amber-cli.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. requirejs.resolve = require.resolve;
  5. require = requirejs;
  6. // This file is used to make additional changes
  7. // when building an app to run in node.js.
  8. // Free to edit. You can break tests (cli test runner uses
  9. // this to build itself - it is a node executable).
  10. define("amber_core/Platform-Browser", ["amber_core/Platform-Node"], {});
  11. define("amber/browser-compatibility", {});
  12. define("jquery", {});
  13. define("config-node", function(){});
  14. /* ====================================================================
  15. |
  16. | Amber Smalltalk
  17. | http://amber-lang.net
  18. |
  19. ======================================================================
  20. ======================================================================
  21. |
  22. | Copyright (c) 2010-2014
  23. | Nicolas Petton <petton.nicolas@gmail.com>
  24. |
  25. | Copyright (c) 2012-2014
  26. | The Amber team https://github.com/amber-smalltalk?tab=members
  27. | Amber contributors https://github.com/amber-smalltalk/amber/graphs/contributors
  28. |
  29. | Amber is released under the MIT license
  30. |
  31. | Permission is hereby granted, free of charge, to any person obtaining
  32. | a copy of this software and associated documentation files (the
  33. | 'Software'), to deal in the Software without restriction, including
  34. | without limitation the rights to use, copy, modify, merge, publish,
  35. | distribute, sublicense, and/or sell copies of the Software, and to
  36. | permit persons to whom the Software is furnished to do so, subject to
  37. | the following conditions:
  38. |
  39. | The above copyright notice and this permission notice shall be
  40. | included in all copies or substantial portions of the Software.
  41. |
  42. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  43. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  44. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  45. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  46. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  47. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  48. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  49. |
  50. ==================================================================== */
  51. //jshint eqnull:true
  52. define("amber/boot", ['require', './browser-compatibility'], function (require) {
  53. /* Reconfigurable micro composition system, https://github.com/amber-smalltalk/brikz */
  54. function Brikz(api, apiKey, initKey) {
  55. var brikz = this, backup = {};
  56. apiKey = apiKey || 'exports';
  57. initKey = initKey || '__init__';
  58. function mixin(src, target, what) {
  59. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  60. if (src == null) {
  61. target[keys[i]] = undefined;
  62. } else {
  63. var value = src[keys[i]];
  64. if (typeof value !== "undefined") {
  65. target[keys[i]] = value;
  66. }
  67. }
  68. }
  69. return target;
  70. }
  71. var d = {value: null, enumerable: false, configurable: true, writable: true};
  72. Object.defineProperties(this, {ensure: d, rebuild: d});
  73. var exclude = mixin(this, {});
  74. this.rebuild = function () {
  75. Object.keys(backup).forEach(function (key) {
  76. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  77. });
  78. var oapi = mixin(api, {}), order = [], chk = {};
  79. brikz.ensure = function (key) {
  80. if (key in exclude) {
  81. return null;
  82. }
  83. var b = brikz[key], bak = backup[key];
  84. mixin(null, api, api);
  85. while (typeof b === "function") {
  86. b = new b(brikz, api, bak);
  87. }
  88. if (b && !chk[key]) {
  89. chk[key] = true;
  90. order.push(b);
  91. }
  92. if (b && !b[apiKey]) {
  93. b[apiKey] = mixin(api, {});
  94. }
  95. brikz[key] = b;
  96. return b;
  97. };
  98. Object.keys(brikz).forEach(function (key) {
  99. brikz.ensure(key);
  100. });
  101. brikz.ensure = null;
  102. mixin(oapi, mixin(null, api, api));
  103. order.forEach(function (brik) {
  104. mixin(brik[apiKey] || {}, api);
  105. });
  106. order.forEach(function (brik) {
  107. if (brik[initKey]) brik[initKey]();
  108. });
  109. backup = mixin(brikz, {});
  110. };
  111. }
  112. /* Brikz end */
  113. function inherits(child, parent) {
  114. child.prototype = Object.create(parent.prototype, {
  115. constructor: {
  116. value: child,
  117. enumerable: false, configurable: true, writable: true
  118. }
  119. });
  120. return child;
  121. }
  122. var globals = {};
  123. globals.SmalltalkSettings = {};
  124. var api = {};
  125. var brikz = new Brikz(api);
  126. function RootBrik(brikz, st) {
  127. /* Smalltalk foundational objects */
  128. /* SmalltalkRoot is the hidden root of the Amber hierarchy.
  129. All objects including `Object` inherit from SmalltalkRoot */
  130. function SmalltalkRoot() {
  131. }
  132. function SmalltalkProtoObject() {
  133. }
  134. inherits(SmalltalkProtoObject, SmalltalkRoot);
  135. function SmalltalkObject() {
  136. }
  137. inherits(SmalltalkObject, SmalltalkProtoObject);
  138. function SmalltalkNil() {
  139. }
  140. inherits(SmalltalkNil, SmalltalkObject);
  141. this.Object = SmalltalkObject;
  142. this.nil = new SmalltalkNil();
  143. // Adds an `isNil` property to the `nil` object. When sending
  144. // nil objects from one environment to another, doing
  145. // `anObject == nil` (in JavaScript) does not always answer
  146. // true as the referenced nil object might come from the other
  147. // environment.
  148. Object.defineProperty(this.nil, 'isNil', {
  149. value: true,
  150. enumerable: false, configurable: false, writable: false
  151. });
  152. // Hidden root class of the system.
  153. this.rootAsClass = {fn: SmalltalkRoot};
  154. this.__init__ = function () {
  155. st.addPackage("Kernel-Objects");
  156. st.wrapClassName("ProtoObject", "Kernel-Objects", SmalltalkProtoObject, undefined, false);
  157. st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, globals.ProtoObject, false);
  158. st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, globals.Object, false);
  159. };
  160. }
  161. function OrganizeBrik(brikz, st) {
  162. brikz.ensure("augments");
  163. var SmalltalkObject = brikz.ensure("root").Object;
  164. function SmalltalkOrganizer() {
  165. }
  166. function SmalltalkPackageOrganizer() {
  167. this.elements = [];
  168. }
  169. function SmalltalkClassOrganizer() {
  170. this.elements = [];
  171. }
  172. inherits(SmalltalkOrganizer, SmalltalkObject);
  173. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  174. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  175. this.__init__ = function () {
  176. st.addPackage("Kernel-Infrastructure");
  177. st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, globals.Object, false);
  178. st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, globals.Organizer, false);
  179. st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, globals.Organizer, false);
  180. };
  181. this.setupClassOrganization = function (klass) {
  182. klass.organization = new SmalltalkClassOrganizer();
  183. klass.organization.theClass = klass;
  184. };
  185. this.setupPackageOrganization = function (pkg) {
  186. pkg.organization = new SmalltalkPackageOrganizer();
  187. };
  188. this.addOrganizationElement = function (owner, element) {
  189. owner.organization.elements.addElement(element);
  190. };
  191. this.removeOrganizationElement = function (owner, element) {
  192. owner.organization.elements.removeElement(element);
  193. };
  194. }
  195. function DNUBrik(brikz, st) {
  196. brikz.ensure("selectorConversion");
  197. brikz.ensure("messageSend");
  198. var manip = brikz.ensure("manipulation");
  199. var rootAsClass = brikz.ensure("root").rootAsClass;
  200. /* Method not implemented handlers */
  201. var methods = [], methodDict = Object.create(null);
  202. this.selectors = [];
  203. this.jsSelectors = [];
  204. this.make = function (stSelector, targetClasses) {
  205. var method = methodDict[stSelector];
  206. if (method) return;
  207. var jsSelector = st.st2js(stSelector);
  208. this.selectors.push(stSelector);
  209. this.jsSelectors.push(jsSelector);
  210. method = {jsSelector: jsSelector, fn: createHandler(stSelector)};
  211. methodDict[stSelector] = method;
  212. methods.push(method);
  213. manip.installMethod(method, rootAsClass);
  214. targetClasses.forEach(function (target) {
  215. manip.installMethod(method, target);
  216. });
  217. return method;
  218. };
  219. /* Dnu handler method */
  220. function createHandler(stSelector) {
  221. return function () {
  222. return brikz.messageSend.messageNotUnderstood(this, stSelector, arguments);
  223. };
  224. }
  225. }
  226. function ClassInitBrik(brikz, st) {
  227. var dnu = brikz.ensure("dnu");
  228. var manip = brikz.ensure("manipulation");
  229. /* Initialize a class in its class hierarchy. Handle both classes and
  230. metaclasses. */
  231. st.init = function (klass) {
  232. initClass(klass);
  233. if (klass.klass && !klass.meta) {
  234. initClass(klass.klass);
  235. }
  236. };
  237. function initClass(klass) {
  238. if (klass.wrapped) {
  239. copySuperclass(klass);
  240. }
  241. }
  242. this.initClass = initClass;
  243. function copySuperclass(klass) {
  244. var superclass = klass.superclass,
  245. localMethods = klass.methods,
  246. localMethodsByJsSelector = {};
  247. Object.keys(localMethods).forEach(function (each) {
  248. var localMethod = localMethods[each];
  249. localMethodsByJsSelector[localMethod.jsSelector] = localMethod;
  250. });
  251. var myproto = klass.fn.prototype,
  252. superproto = superclass.fn.prototype;
  253. dnu.jsSelectors.forEach(function (selector) {
  254. if (!localMethodsByJsSelector[selector]) {
  255. manip.installMethod({
  256. jsSelector: selector,
  257. fn: superproto[selector]
  258. }, klass);
  259. } else if (!myproto[selector]) {
  260. manip.installMethod(localMethodsByJsSelector[selector], klass);
  261. }
  262. });
  263. }
  264. }
  265. function ManipulationBrik(brikz, st) {
  266. this.installMethod = function (method, klass) {
  267. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  268. value: method.fn,
  269. enumerable: false, configurable: true, writable: true
  270. });
  271. };
  272. }
  273. function PackagesBrik(brikz, st) {
  274. var org = brikz.ensure("organize");
  275. var root = brikz.ensure("root");
  276. var nil = root.nil;
  277. var SmalltalkObject = root.Object;
  278. function SmalltalkPackage() {
  279. }
  280. inherits(SmalltalkPackage, SmalltalkObject);
  281. this.__init__ = function () {
  282. st.addPackage("Kernel-Infrastructure");
  283. st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, globals.Object, false);
  284. };
  285. st.packages = {};
  286. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  287. function pkg(spec) {
  288. var that = new SmalltalkPackage();
  289. that.pkgName = spec.pkgName;
  290. org.setupPackageOrganization(that);
  291. that.properties = spec.properties || {};
  292. return that;
  293. }
  294. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  295. If pkgName is null or empty we return nil, which is an allowed package for a class.
  296. If package already exists we still update the properties of it. */
  297. st.addPackage = function (pkgName, properties) {
  298. if (!pkgName) {
  299. return nil;
  300. }
  301. if (!(st.packages[pkgName])) {
  302. st.packages[pkgName] = pkg({
  303. pkgName: pkgName,
  304. properties: properties
  305. });
  306. } else {
  307. if (properties) {
  308. st.packages[pkgName].properties = properties;
  309. }
  310. }
  311. return st.packages[pkgName];
  312. };
  313. }
  314. function ClassesBrik(brikz, st) {
  315. var org = brikz.ensure("organize");
  316. var root = brikz.ensure("root");
  317. var classInit = brikz.ensure("classInit");
  318. var nil = root.nil;
  319. var rootAsClass = root.rootAsClass;
  320. var SmalltalkObject = root.Object;
  321. rootAsClass.klass = {fn: SmalltalkClass};
  322. function SmalltalkBehavior() {
  323. }
  324. function SmalltalkClass() {
  325. }
  326. function SmalltalkMetaclass() {
  327. }
  328. inherits(SmalltalkBehavior, SmalltalkObject);
  329. inherits(SmalltalkClass, SmalltalkBehavior);
  330. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  331. SmalltalkMetaclass.prototype.meta = true;
  332. this.__init__ = function () {
  333. st.addPackage("Kernel-Classes");
  334. st.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, globals.Object, false);
  335. st.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, globals.Behavior, false);
  336. st.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, globals.Behavior, false);
  337. // Manually bootstrap the metaclass hierarchy
  338. globals.ProtoObject.klass.superclass = rootAsClass.klass = globals.Class;
  339. addSubclass(globals.ProtoObject.klass);
  340. };
  341. /* Smalltalk classes */
  342. var classes = [];
  343. var wrappedClasses = [];
  344. /* Smalltalk class creation. A class is an instance of an automatically
  345. created metaclass object. Newly created classes (not their metaclass)
  346. should be added to the smalltalk object, see smalltalk.addClass().
  347. Superclass linking is *not* handled here, see smalltalk.init() */
  348. function klass(spec) {
  349. spec = spec || {};
  350. var setSuperClass = spec.superclass;
  351. if (!spec.superclass) {
  352. spec.superclass = rootAsClass;
  353. }
  354. var meta = metaclass(spec);
  355. var that = meta.instanceClass;
  356. that.superclass = setSuperClass;
  357. that.fn = spec.fn || inherits(function () {
  358. }, spec.superclass.fn);
  359. that.subclasses = [];
  360. setupClass(that, spec);
  361. that.className = spec.className;
  362. that.wrapped = spec.wrapped || false;
  363. meta.className = spec.className + ' class';
  364. meta.superclass = spec.superclass.klass;
  365. return that;
  366. }
  367. function metaclass(spec) {
  368. spec = spec || {};
  369. var that = new SmalltalkMetaclass();
  370. that.fn = inherits(function () {
  371. }, spec.superclass.klass.fn);
  372. that.instanceClass = new that.fn();
  373. setupClass(that);
  374. return that;
  375. }
  376. SmalltalkBehavior.prototype.toString = function () {
  377. return 'Smalltalk ' + this.className;
  378. };
  379. function wireKlass(klass) {
  380. Object.defineProperty(klass.fn.prototype, "klass", {
  381. value: klass,
  382. enumerable: false, configurable: true, writable: true
  383. });
  384. }
  385. function setupClass(klass, spec) {
  386. spec = spec || {};
  387. klass.iVarNames = spec.iVarNames || [];
  388. klass.pkg = spec.pkg;
  389. org.setupClassOrganization(klass);
  390. Object.defineProperty(klass, "methods", {
  391. value: Object.create(null),
  392. enumerable: false, configurable: true, writable: true
  393. });
  394. wireKlass(klass);
  395. }
  396. /* Add a class to the smalltalk object, creating a new one if needed.
  397. A Package is lazily created if it does not exist with given name. */
  398. st.addClass = function (className, superclass, iVarNames, pkgName) {
  399. // While subclassing nil is allowed, it might be an error, so
  400. // warn about it.
  401. if (typeof superclass == 'undefined' || superclass == nil) {
  402. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  403. }
  404. rawAddClass(pkgName, className, superclass, iVarNames, false, null);
  405. };
  406. function rawAddClass(pkgName, className, superclass, iVarNames, wrapped, fn) {
  407. var pkg = st.packages[pkgName];
  408. if (!pkg) {
  409. throw new Error("Missing package " + pkgName);
  410. }
  411. if (!superclass || superclass == nil) {
  412. superclass = null;
  413. }
  414. if (globals[className] && globals[className].superclass == superclass) {
  415. // globals[className].superclass = superclass;
  416. globals[className].iVarNames = iVarNames || [];
  417. if (pkg) globals[className].pkg = pkg;
  418. if (fn) {
  419. fn.prototype = globals[className].fn.prototype;
  420. globals[className].fn = fn;
  421. fn.prototype.constructor = fn;
  422. }
  423. } else {
  424. if (globals[className]) {
  425. st.removeClass(globals[className]);
  426. }
  427. globals[className] = klass({
  428. className: className,
  429. superclass: superclass,
  430. pkg: pkg,
  431. iVarNames: iVarNames,
  432. fn: fn,
  433. wrapped: wrapped
  434. });
  435. addSubclass(globals[className]);
  436. }
  437. classes.addElement(globals[className]);
  438. org.addOrganizationElement(pkg, globals[className]);
  439. }
  440. st.removeClass = function (klass) {
  441. org.removeOrganizationElement(klass.pkg, klass);
  442. classes.removeElement(klass);
  443. removeSubclass(klass);
  444. delete globals[klass.className];
  445. };
  446. function addSubclass(klass) {
  447. if (klass.superclass) {
  448. klass.superclass.subclasses.addElement(klass);
  449. }
  450. }
  451. function removeSubclass(klass) {
  452. if (klass.superclass) {
  453. klass.superclass.subclasses.removeElement(klass);
  454. }
  455. }
  456. /* Create a new class wrapping a JavaScript constructor, and add it to the
  457. global smalltalk object. Package is lazily created if it does not exist with given name. */
  458. st.wrapClassName = function (className, pkgName, fn, superclass, wrapped) {
  459. wrapped = wrapped !== false;
  460. rawAddClass(pkgName, className, superclass, globals[className] && globals[className].iVarNames, wrapped, fn);
  461. if (wrapped) {
  462. wrappedClasses.addElement(globals[className]);
  463. }
  464. };
  465. /* Manually set the constructor of an existing Smalltalk klass, making it a wrapped class. */
  466. st.setClassConstructor = function (klass, constructor) {
  467. wrappedClasses.addElement(klass);
  468. klass.wrapped = true;
  469. klass.fn = constructor;
  470. // The fn property changed. We need to add back the klass property to the prototype
  471. wireKlass(klass);
  472. classInit.initClass(klass);
  473. };
  474. /* Create an alias for an existing class */
  475. st.alias = function (klass, alias) {
  476. globals[alias] = klass;
  477. };
  478. /* Answer all registered Smalltalk classes */
  479. //TODO: remove the function and make smalltalk.classes an array
  480. st.classes = function () {
  481. return classes;
  482. };
  483. st.wrappedClasses = function () {
  484. return wrappedClasses;
  485. };
  486. // Still used, but could go away now that subclasses are stored
  487. // into classes directly.
  488. st.allSubclasses = function (klass) {
  489. return klass._allSubclasses();
  490. };
  491. }
  492. function MethodsBrik(brikz, st) {
  493. var manip = brikz.ensure("manipulation");
  494. var org = brikz.ensure("organize");
  495. var stInit = brikz.ensure("stInit");
  496. var dnu = brikz.ensure("dnu");
  497. var SmalltalkObject = brikz.ensure("root").Object;
  498. brikz.ensure("selectorConversion");
  499. brikz.ensure("classes");
  500. function SmalltalkMethod() {
  501. }
  502. inherits(SmalltalkMethod, SmalltalkObject);
  503. this.__init__ = function () {
  504. st.addPackage("Kernel-Methods");
  505. st.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, globals.Object, false);
  506. };
  507. /* Smalltalk method object. To add a method to a class,
  508. use smalltalk.addMethod() */
  509. st.method = function (spec) {
  510. var that = new SmalltalkMethod();
  511. that.selector = spec.selector;
  512. that.jsSelector = spec.jsSelector;
  513. that.args = spec.args || {};
  514. that.protocol = spec.protocol;
  515. that.source = spec.source;
  516. that.messageSends = spec.messageSends || [];
  517. that.referencedClasses = spec.referencedClasses || [];
  518. that.fn = spec.fn;
  519. return that;
  520. };
  521. function ensureJsSelector(method) {
  522. if (!(method.jsSelector)) {
  523. method.jsSelector = st.st2js(method.selector);
  524. }
  525. }
  526. /* Add/remove a method to/from a class */
  527. st.addMethod = function (method, klass) {
  528. ensureJsSelector(method);
  529. manip.installMethod(method, klass);
  530. klass.methods[method.selector] = method;
  531. method.methodClass = klass;
  532. // During the bootstrap, #addCompiledMethod is not used.
  533. // Therefore we populate the organizer here too
  534. org.addOrganizationElement(klass, method.protocol);
  535. propagateMethodChange(klass, method);
  536. var usedSelectors = method.messageSends,
  537. targetClasses = stInit.initialized() ? st.wrappedClasses() : [];
  538. dnu.make(method.selector, targetClasses);
  539. for (var i = 0; i < usedSelectors.length; i++) {
  540. dnu.make(usedSelectors[i], targetClasses);
  541. }
  542. };
  543. function propagateMethodChange(klass, method) {
  544. // If already initialized (else it will be done later anyway),
  545. // re-initialize all subclasses to ensure the method change
  546. // propagation (for wrapped classes, not using the prototype
  547. // chain).
  548. if (stInit.initialized()) {
  549. st.allSubclasses(klass).forEach(function (subclass) {
  550. initMethodInClass(subclass, method);
  551. });
  552. }
  553. }
  554. function initMethodInClass(klass, method) {
  555. if (klass.wrapped && !klass.methods[method.selector]) {
  556. var jsSelector = method.jsSelector;
  557. manip.installMethod({
  558. jsSelector: jsSelector,
  559. fn: klass.superclass.fn.prototype[jsSelector]
  560. }, klass);
  561. }
  562. }
  563. st.removeMethod = function (method, klass) {
  564. if (klass !== method.methodClass) {
  565. throw new Error(
  566. "Refusing to remove method " +
  567. method.methodClass.className + ">>" + method.selector +
  568. " from different class " +
  569. klass.className);
  570. }
  571. ensureJsSelector(method);
  572. delete klass.fn.prototype[method.jsSelector];
  573. delete klass.methods[method.selector];
  574. initMethodInClass(klass, method);
  575. propagateMethodChange(klass, method);
  576. // Do *not* delete protocols from here.
  577. // This is handled by #removeCompiledMethod
  578. };
  579. /* Answer all method selectors based on dnu handlers */
  580. st.allSelectors = function () {
  581. return dnu.selectors;
  582. };
  583. }
  584. function AugmentsBrik(brikz, st) {
  585. /* Array extensions */
  586. Array.prototype.addElement = function (el) {
  587. if (typeof el === 'undefined') {
  588. return;
  589. }
  590. if (this.indexOf(el) == -1) {
  591. this.push(el);
  592. }
  593. };
  594. Array.prototype.removeElement = function (el) {
  595. var i = this.indexOf(el);
  596. if (i !== -1) {
  597. this.splice(i, 1);
  598. }
  599. };
  600. }
  601. function SmalltalkInitBrik(brikz, st) {
  602. brikz.ensure("classInit");
  603. brikz.ensure("classes");
  604. var initialized = false;
  605. /* Smalltalk initialization. Called on page load */
  606. st.initialize = function () {
  607. if (initialized) {
  608. return;
  609. }
  610. st.classes().forEach(function (klass) {
  611. st.init(klass);
  612. });
  613. runnable();
  614. st.classes().forEach(function (klass) {
  615. klass._initialize();
  616. });
  617. initialized = true;
  618. };
  619. this.initialized = function () {
  620. return initialized;
  621. };
  622. this.__init__ = function () {
  623. st.addPackage("Kernel-Methods");
  624. st.wrapClassName("Number", "Kernel-Objects", Number, globals.Object);
  625. st.wrapClassName("BlockClosure", "Kernel-Methods", Function, globals.Object);
  626. st.wrapClassName("Boolean", "Kernel-Objects", Boolean, globals.Object);
  627. st.wrapClassName("Date", "Kernel-Objects", Date, globals.Object);
  628. st.addPackage("Kernel-Collections");
  629. st.addClass("Collection", globals.Object, null, "Kernel-Collections");
  630. st.addClass("IndexableCollection", globals.Collection, null, "Kernel-Collections");
  631. st.addClass("SequenceableCollection", globals.IndexableCollection, null, "Kernel-Collections");
  632. st.addClass("CharacterArray", globals.SequenceableCollection, null, "Kernel-Collections");
  633. st.wrapClassName("String", "Kernel-Collections", String, globals.CharacterArray);
  634. st.wrapClassName("Array", "Kernel-Collections", Array, globals.SequenceableCollection);
  635. st.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, globals.Object);
  636. st.addPackage("Kernel-Exceptions");
  637. st.wrapClassName("Error", "Kernel-Exceptions", Error, globals.Object);
  638. /* Alias definitions */
  639. st.alias(globals.Array, "OrderedCollection");
  640. st.alias(globals.Date, "Time");
  641. };
  642. }
  643. function PrimitivesBrik(brikz, st) {
  644. /* Unique ID number generator */
  645. var oid = 0;
  646. st.nextId = function () {
  647. oid += 1;
  648. return oid;
  649. };
  650. /* Converts a JavaScript object to valid Smalltalk Object */
  651. st.readJSObject = function (js) {
  652. var readObject = js.constructor === Object;
  653. var readArray = js.constructor === Array;
  654. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  655. for (var i in js) {
  656. if (readObject) {
  657. object._at_put_(i, st.readJSObject(js[i]));
  658. }
  659. if (readArray) {
  660. object[i] = st.readJSObject(js[i]);
  661. }
  662. }
  663. return object;
  664. };
  665. /* Boolean assertion */
  666. st.assert = function (shouldBeBoolean) {
  667. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  668. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  669. shouldBeBoolean = shouldBeBoolean.valueOf();
  670. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  671. }
  672. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  673. };
  674. /* List of all reserved words in JavaScript. They may not be used as variables
  675. in Smalltalk. */
  676. // list of reserved JavaScript keywords as of
  677. // http://es5.github.com/#x7.6.1.1
  678. // and
  679. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  680. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  681. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  682. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  683. 'try', 'typeof', 'var', 'void', 'while', 'with',
  684. // Amber protected words: these should not be compiled as-is when in code
  685. 'arguments',
  686. // ES5: future use: http://es5.github.com/#x7.6.1.2
  687. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  688. // ES5: future use in strict mode
  689. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  690. 'public', 'static', 'yield'];
  691. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  692. }
  693. function RuntimeBrik(brikz, st) {
  694. brikz.ensure("selectorConversion");
  695. var root = brikz.ensure("root");
  696. var nil = root.nil;
  697. var SmalltalkObject = root.Object;
  698. function SmalltalkMethodContext(home, setup) {
  699. this.sendIdx = {};
  700. this.homeContext = home;
  701. this.setup = setup || function () {
  702. };
  703. this.supercall = false;
  704. }
  705. inherits(SmalltalkMethodContext, SmalltalkObject);
  706. this.__init__ = function () {
  707. st.addPackage("Kernel-Methods");
  708. st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, globals.Object, false);
  709. // Fallbacks
  710. SmalltalkMethodContext.prototype.locals = {};
  711. SmalltalkMethodContext.prototype.receiver = null;
  712. SmalltalkMethodContext.prototype.selector = null;
  713. SmalltalkMethodContext.prototype.lookupClass = null;
  714. SmalltalkMethodContext.prototype.fill = function (receiver, selector, locals, lookupClass) {
  715. this.receiver = receiver;
  716. this.selector = selector;
  717. this.locals = locals || {};
  718. this.lookupClass = lookupClass;
  719. if (this.homeContext) {
  720. this.homeContext.evaluatedSelector = selector;
  721. }
  722. };
  723. SmalltalkMethodContext.prototype.fillBlock = function (locals, ctx, index) {
  724. this.locals = locals || {};
  725. this.outerContext = ctx;
  726. this.index = index || 0;
  727. };
  728. SmalltalkMethodContext.prototype.init = function () {
  729. var home = this.homeContext;
  730. if (home) {
  731. home.init();
  732. }
  733. this.setup(this);
  734. };
  735. SmalltalkMethodContext.prototype.method = function () {
  736. var method;
  737. var lookup = this.lookupClass || this.receiver.klass;
  738. while (!method && lookup) {
  739. method = lookup.methods[st.js2st(this.selector)];
  740. lookup = lookup.superclass;
  741. }
  742. return method;
  743. };
  744. };
  745. /* This is the current call context object. While it is publicly available,
  746. Use smalltalk.getThisContext() instead which will answer a safe copy of
  747. the current context */
  748. var thisContext = null;
  749. st.withContext = function (worker, setup) {
  750. if (thisContext) {
  751. return inContext(worker, setup);
  752. } else {
  753. return inContextWithErrorHandling(worker, setup);
  754. }
  755. };
  756. function inContextWithErrorHandling(worker, setup) {
  757. try {
  758. return inContext(worker, setup);
  759. } catch (error) {
  760. handleError(error);
  761. thisContext = null;
  762. // Rethrow the error in any case.
  763. error.amberHandled = true;
  764. throw error;
  765. }
  766. }
  767. function inContext(worker, setup) {
  768. var oldContext = thisContext;
  769. thisContext = new SmalltalkMethodContext(thisContext, setup);
  770. var result = worker(thisContext);
  771. thisContext = oldContext;
  772. return result;
  773. }
  774. /* Wrap a JavaScript exception in a Smalltalk Exception.
  775. In case of a RangeError, stub the stack after 100 contexts to
  776. avoid another RangeError later when the stack is manipulated. */
  777. function wrappedError(error) {
  778. var errorWrapper = globals.JavaScriptException._on_(error);
  779. // Add the error to the context, so it is visible in the stack
  780. try {
  781. errorWrapper._signal();
  782. } catch (ex) {
  783. }
  784. var context = st.getThisContext();
  785. if (isRangeError(error)) {
  786. stubContextStack(context);
  787. }
  788. errorWrapper._context_(context);
  789. return errorWrapper;
  790. }
  791. /* Stub the context stack after 100 contexts */
  792. function stubContextStack(context) {
  793. var currentContext = context;
  794. var contexts = 0;
  795. while (contexts < 100) {
  796. if (currentContext) {
  797. currentContext = currentContext.homeContext;
  798. }
  799. contexts++;
  800. }
  801. if (currentContext) {
  802. currentContext.homeContext = undefined;
  803. }
  804. }
  805. function isRangeError(error) {
  806. return error instanceof RangeError;
  807. }
  808. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  809. (See the Smalltalk class ErrorHandler and its subclasses */
  810. function handleError(error) {
  811. if (!error.smalltalkError) {
  812. error = wrappedError(error);
  813. }
  814. globals.ErrorHandler._handleError_(error);
  815. }
  816. /* Handle thisContext pseudo variable */
  817. st.getThisContext = function () {
  818. if (thisContext) {
  819. thisContext.init();
  820. return thisContext;
  821. } else {
  822. return nil;
  823. }
  824. };
  825. }
  826. function MessageSendBrik(brikz, st) {
  827. brikz.ensure("selectorConversion");
  828. var nil = brikz.ensure("root").nil;
  829. /* Handles unhandled errors during message sends */
  830. // simply send the message and handle #dnu:
  831. st.send = function (receiver, jsSelector, args, klass) {
  832. var method;
  833. if (receiver == null) {
  834. receiver = nil;
  835. }
  836. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  837. if (method) {
  838. return method.apply(receiver, args || []);
  839. } else {
  840. return messageNotUnderstood(receiver, st.js2st(jsSelector), args);
  841. }
  842. };
  843. function invokeDnuMethod(receiver, stSelector, args) {
  844. return receiver._doesNotUnderstand_(
  845. globals.Message._new()
  846. ._selector_(stSelector)
  847. ._arguments_([].slice.call(args))
  848. );
  849. }
  850. /* Handles #dnu: *and* JavaScript method calls.
  851. if the receiver has no klass, we consider it a JS object (outside of the
  852. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  853. function messageNotUnderstood(receiver, stSelector, args) {
  854. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  855. return invokeDnuMethod(receiver, stSelector, args);
  856. }
  857. /* Call a method of a JS object, or answer a property if it exists.
  858. Else try wrapping a JSObjectProxy around the receiver. */
  859. var propertyName = st.st2prop(stSelector);
  860. if (!(propertyName in receiver)) {
  861. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  862. }
  863. return accessJavaScript(receiver, propertyName, args);
  864. }
  865. /* If the object property is a function, then call it, except if it starts with
  866. an uppercase character (we probably want to answer the function itself in this
  867. case and send it #new from Amber).
  868. Converts keyword-based selectors by using the first
  869. keyword only, but keeping all message arguments.
  870. Example:
  871. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  872. function accessJavaScript(receiver, propertyName, args) {
  873. var propertyValue = receiver[propertyName];
  874. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  875. return propertyValue.apply(receiver, args || []);
  876. } else if (args.length > 0) {
  877. receiver[propertyName] = args[0];
  878. return nil;
  879. } else {
  880. return propertyValue;
  881. }
  882. }
  883. st.accessJavaScript = accessJavaScript;
  884. this.messageNotUnderstood = messageNotUnderstood;
  885. }
  886. function SelectorConversionBrik(brikz, st) {
  887. /* Convert a Smalltalk selector into a JS selector */
  888. st.st2js = function (string) {
  889. var selector = '_' + string;
  890. selector = selector.replace(/:/g, '_');
  891. selector = selector.replace(/[\&]/g, '_and');
  892. selector = selector.replace(/[\|]/g, '_or');
  893. selector = selector.replace(/[+]/g, '_plus');
  894. selector = selector.replace(/-/g, '_minus');
  895. selector = selector.replace(/[*]/g, '_star');
  896. selector = selector.replace(/[\/]/g, '_slash');
  897. selector = selector.replace(/[\\]/g, '_backslash');
  898. selector = selector.replace(/[\~]/g, '_tild');
  899. selector = selector.replace(/>/g, '_gt');
  900. selector = selector.replace(/</g, '_lt');
  901. selector = selector.replace(/=/g, '_eq');
  902. selector = selector.replace(/,/g, '_comma');
  903. selector = selector.replace(/[@]/g, '_at');
  904. return selector;
  905. };
  906. /* Convert a string to a valid smalltalk selector.
  907. if you modify the following functions, also change st2js
  908. accordingly */
  909. st.js2st = function (selector) {
  910. if (selector.match(/__/)) {
  911. return binaryJsToSt(selector);
  912. } else {
  913. return keywordJsToSt(selector);
  914. }
  915. };
  916. function keywordJsToSt(selector) {
  917. return selector.replace(/^_/, '').replace(/_/g, ':');
  918. }
  919. function binaryJsToSt(selector) {
  920. return selector
  921. .replace(/^_/, '')
  922. .replace(/_and/g, '&')
  923. .replace(/_or/g, '|')
  924. .replace(/_plus/g, '+')
  925. .replace(/_minus/g, '-')
  926. .replace(/_star/g, '*')
  927. .replace(/_slash/g, '/')
  928. .replace(/_backslash/g, '\\')
  929. .replace(/_tild/g, '~')
  930. .replace(/_gt/g, '>')
  931. .replace(/_lt/g, '<')
  932. .replace(/_eq/g, '=')
  933. .replace(/_comma/g, ',')
  934. .replace(/_at/g, '@');
  935. }
  936. st.st2prop = function (stSelector) {
  937. var colonPosition = stSelector.indexOf(':');
  938. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  939. };
  940. }
  941. /* Adds AMD and requirejs related methods to the smalltalk object */
  942. function AMDBrik(brikz, st) {
  943. this.__init__ = function () {
  944. st.amdRequire = require;
  945. st.defaultTransportType = st.defaultTransportType || "amd";
  946. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  947. };
  948. }
  949. /* Defines asReceiver to be present at load time */
  950. /* (logically it belongs more to PrimitiveBrik) */
  951. function AsReceiverBrik(brikz, st) {
  952. var nil = brikz.ensure("root").nil;
  953. /**
  954. * This function is used all over the compiled amber code.
  955. * It takes any value (JavaScript or Smalltalk)
  956. * and returns a proper Amber Smalltalk receiver.
  957. *
  958. * null or undefined -> nil,
  959. * plain JS object -> wrapped JS object,
  960. * otherwise unchanged
  961. */
  962. this.asReceiver = function (o) {
  963. if (o == null) return nil;
  964. if (typeof o === "object" || typeof o === "function") {
  965. return o.klass != null ? o : globals.JSObjectProxy._on_(o);
  966. }
  967. // IMPORTANT: This optimization (return o if typeof !== "object")
  968. // assumes all primitive types are wrapped by some Smalltalk class
  969. // so they can be returned as-is, without boxing and looking for .klass.
  970. // KEEP THE primitives-are-wrapped INVARIANT!
  971. return o;
  972. };
  973. }
  974. /* Making smalltalk that can load */
  975. brikz.root = RootBrik;
  976. brikz.dnu = DNUBrik;
  977. brikz.organize = OrganizeBrik;
  978. brikz.selectorConversion = SelectorConversionBrik;
  979. brikz.classInit = ClassInitBrik;
  980. brikz.manipulation = ManipulationBrik;
  981. brikz.packages = PackagesBrik;
  982. brikz.classes = ClassesBrik;
  983. brikz.methods = MethodsBrik;
  984. brikz.stInit = SmalltalkInitBrik;
  985. brikz.augments = AugmentsBrik;
  986. brikz.asReceiver = AsReceiverBrik;
  987. brikz.amd = AMDBrik;
  988. brikz.rebuild();
  989. /* Making smalltalk that can run */
  990. function runnable() {
  991. brikz.messageSend = MessageSendBrik;
  992. brikz.runtime = RuntimeBrik;
  993. brikz.primitives = PrimitivesBrik;
  994. brikz.rebuild();
  995. }
  996. return {api: api, nil: brikz.root.nil, globals: globals, asReceiver: brikz.asReceiver.asReceiver};
  997. });
  998. define("amber/helpers", ["amber/boot", "require"], function (boot, require) {
  999. var globals = boot.globals,
  1000. exports = {},
  1001. api = boot.api,
  1002. nil = boot.nil;
  1003. // API
  1004. exports.popupHelios = function () {
  1005. require(['helios/index'], function (helios) {
  1006. helios.popup();
  1007. }, function (err) {
  1008. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1009. });
  1010. };
  1011. Object.defineProperty(exports, "api", {
  1012. value: api,
  1013. enumerable: true, configurable: true, writable: false
  1014. });
  1015. Object.defineProperty(exports, "globals", {
  1016. value: globals,
  1017. enumerable: true, configurable: true, writable: false
  1018. });
  1019. Object.defineProperty(exports, "nil", {
  1020. value: nil,
  1021. enumerable: true, configurable: true, writable: false
  1022. });
  1023. function mixinToSettings(source) {
  1024. var settings = globals.SmalltalkSettings;
  1025. Object.keys(source).forEach(function (key) {
  1026. settings[key] = source[key];
  1027. });
  1028. }
  1029. function settingsInLocalStorage() {
  1030. //jshint evil:true
  1031. var global = new Function('return this')(),
  1032. storage = 'localStorage' in global && global.localStorage;
  1033. if (storage) {
  1034. var fromStorage;
  1035. try {
  1036. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1037. } catch (ex) {
  1038. // pass
  1039. }
  1040. mixinToSettings(fromStorage || {});
  1041. if (typeof window !== "undefined") {
  1042. requirejs(['jquery'], function ($) {
  1043. $(window).on('beforeunload', function () {
  1044. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1045. });
  1046. });
  1047. }
  1048. }
  1049. }
  1050. exports.initialize = function (options) {
  1051. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1052. settingsInLocalStorage();
  1053. mixinToSettings(options || {});
  1054. return api.initialize();
  1055. };
  1056. // Exports
  1057. return exports;
  1058. });
  1059. define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){"use strict";
  1060. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  1061. $core.addPackage('Kernel-Objects');
  1062. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  1063. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1064. $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1065. $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.";
  1066. $core.addMethod(
  1067. $core.method({
  1068. selector: "=",
  1069. protocol: 'comparing',
  1070. fn: function (anObject){
  1071. var self=this;
  1072. return $core.withContext(function($ctx1) {
  1073. var $1;
  1074. $1=self.__eq_eq(anObject);
  1075. return $1;
  1076. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  1077. },
  1078. args: ["anObject"],
  1079. source: "= anObject\x0a\x09^ self == anObject",
  1080. referencedClasses: [],
  1081. messageSends: ["=="]
  1082. }),
  1083. $globals.ProtoObject);
  1084. $core.addMethod(
  1085. $core.method({
  1086. selector: "==",
  1087. protocol: 'comparing',
  1088. fn: function (anObject){
  1089. var self=this;
  1090. return $core.withContext(function($ctx1) {
  1091. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  1092. return self;
  1093. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  1094. },
  1095. args: ["anObject"],
  1096. source: "== anObject\x0a<return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)>",
  1097. referencedClasses: [],
  1098. messageSends: []
  1099. }),
  1100. $globals.ProtoObject);
  1101. $core.addMethod(
  1102. $core.method({
  1103. selector: "asString",
  1104. protocol: 'converting',
  1105. fn: function (){
  1106. var self=this;
  1107. return $core.withContext(function($ctx1) {
  1108. var $1;
  1109. $1=self._printString();
  1110. return $1;
  1111. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  1112. },
  1113. args: [],
  1114. source: "asString\x0a\x09^ self printString",
  1115. referencedClasses: [],
  1116. messageSends: ["printString"]
  1117. }),
  1118. $globals.ProtoObject);
  1119. $core.addMethod(
  1120. $core.method({
  1121. selector: "class",
  1122. protocol: 'accessing',
  1123. fn: function (){
  1124. var self=this;
  1125. return $core.withContext(function($ctx1) {
  1126. return self.klass;
  1127. return self;
  1128. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  1129. },
  1130. args: [],
  1131. source: "class\x0a\x09<return self.klass>",
  1132. referencedClasses: [],
  1133. messageSends: []
  1134. }),
  1135. $globals.ProtoObject);
  1136. $core.addMethod(
  1137. $core.method({
  1138. selector: "doesNotUnderstand:",
  1139. protocol: 'error handling',
  1140. fn: function (aMessage){
  1141. var self=this;
  1142. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1143. return $core.withContext(function($ctx1) {
  1144. var $1,$2;
  1145. $1=$recv($MessageNotUnderstood())._new();
  1146. $recv($1)._receiver_(self);
  1147. $recv($1)._message_(aMessage);
  1148. $2=$recv($1)._signal();
  1149. return self;
  1150. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  1151. },
  1152. args: ["aMessage"],
  1153. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1154. referencedClasses: ["MessageNotUnderstood"],
  1155. messageSends: ["receiver:", "new", "message:", "signal"]
  1156. }),
  1157. $globals.ProtoObject);
  1158. $core.addMethod(
  1159. $core.method({
  1160. selector: "evaluate:on:",
  1161. protocol: 'evaluating',
  1162. fn: function (aString,anEvaluator){
  1163. var self=this;
  1164. return $core.withContext(function($ctx1) {
  1165. var $1;
  1166. $1=$recv(anEvaluator)._evaluate_receiver_(aString,self);
  1167. return $1;
  1168. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  1169. },
  1170. args: ["aString", "anEvaluator"],
  1171. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1172. referencedClasses: [],
  1173. messageSends: ["evaluate:receiver:"]
  1174. }),
  1175. $globals.ProtoObject);
  1176. $core.addMethod(
  1177. $core.method({
  1178. selector: "identityHash",
  1179. protocol: 'accessing',
  1180. fn: function (){
  1181. var self=this;
  1182. return $core.withContext(function($ctx1) {
  1183. var hash=self.identityHash;
  1184. if (hash) return hash;
  1185. hash=$core.nextId();
  1186. Object.defineProperty(self, 'identityHash', {value:hash});
  1187. return hash;
  1188. ;
  1189. return self;
  1190. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  1191. },
  1192. args: [],
  1193. 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>",
  1194. referencedClasses: [],
  1195. messageSends: []
  1196. }),
  1197. $globals.ProtoObject);
  1198. $core.addMethod(
  1199. $core.method({
  1200. selector: "ifNil:",
  1201. protocol: 'testing',
  1202. fn: function (aBlock){
  1203. var self=this;
  1204. return self;
  1205. },
  1206. args: ["aBlock"],
  1207. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1208. referencedClasses: [],
  1209. messageSends: []
  1210. }),
  1211. $globals.ProtoObject);
  1212. $core.addMethod(
  1213. $core.method({
  1214. selector: "ifNil:ifNotNil:",
  1215. protocol: 'testing',
  1216. fn: function (aBlock,anotherBlock){
  1217. var self=this;
  1218. return $core.withContext(function($ctx1) {
  1219. var $1;
  1220. $1=$recv(anotherBlock)._value_(self);
  1221. return $1;
  1222. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1223. },
  1224. args: ["aBlock", "anotherBlock"],
  1225. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1226. referencedClasses: [],
  1227. messageSends: ["value:"]
  1228. }),
  1229. $globals.ProtoObject);
  1230. $core.addMethod(
  1231. $core.method({
  1232. selector: "ifNotNil:",
  1233. protocol: 'testing',
  1234. fn: function (aBlock){
  1235. var self=this;
  1236. return $core.withContext(function($ctx1) {
  1237. var $1;
  1238. $1=$recv(aBlock)._value_(self);
  1239. return $1;
  1240. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  1241. },
  1242. args: ["aBlock"],
  1243. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1244. referencedClasses: [],
  1245. messageSends: ["value:"]
  1246. }),
  1247. $globals.ProtoObject);
  1248. $core.addMethod(
  1249. $core.method({
  1250. selector: "ifNotNil:ifNil:",
  1251. protocol: 'testing',
  1252. fn: function (aBlock,anotherBlock){
  1253. var self=this;
  1254. return $core.withContext(function($ctx1) {
  1255. var $1;
  1256. $1=$recv(aBlock)._value_(self);
  1257. return $1;
  1258. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1259. },
  1260. args: ["aBlock", "anotherBlock"],
  1261. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1262. referencedClasses: [],
  1263. messageSends: ["value:"]
  1264. }),
  1265. $globals.ProtoObject);
  1266. $core.addMethod(
  1267. $core.method({
  1268. selector: "initialize",
  1269. protocol: 'initialization',
  1270. fn: function (){
  1271. var self=this;
  1272. return self;
  1273. },
  1274. args: [],
  1275. source: "initialize",
  1276. referencedClasses: [],
  1277. messageSends: []
  1278. }),
  1279. $globals.ProtoObject);
  1280. $core.addMethod(
  1281. $core.method({
  1282. selector: "inspect",
  1283. protocol: 'inspecting',
  1284. fn: function (){
  1285. var self=this;
  1286. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1287. return $core.withContext(function($ctx1) {
  1288. $recv($Inspector())._inspect_(self);
  1289. return self;
  1290. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  1291. },
  1292. args: [],
  1293. source: "inspect\x0a\x09Inspector inspect: self",
  1294. referencedClasses: ["Inspector"],
  1295. messageSends: ["inspect:"]
  1296. }),
  1297. $globals.ProtoObject);
  1298. $core.addMethod(
  1299. $core.method({
  1300. selector: "inspectOn:",
  1301. protocol: 'inspecting',
  1302. fn: function (anInspector){
  1303. var self=this;
  1304. return self;
  1305. },
  1306. args: ["anInspector"],
  1307. source: "inspectOn: anInspector",
  1308. referencedClasses: [],
  1309. messageSends: []
  1310. }),
  1311. $globals.ProtoObject);
  1312. $core.addMethod(
  1313. $core.method({
  1314. selector: "instVarAt:",
  1315. protocol: 'accessing',
  1316. fn: function (aString){
  1317. var self=this;
  1318. return $core.withContext(function($ctx1) {
  1319. return self['@'+aString] ;
  1320. return self;
  1321. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  1322. },
  1323. args: ["aString"],
  1324. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1325. referencedClasses: [],
  1326. messageSends: []
  1327. }),
  1328. $globals.ProtoObject);
  1329. $core.addMethod(
  1330. $core.method({
  1331. selector: "instVarAt:put:",
  1332. protocol: 'accessing',
  1333. fn: function (aString,anObject){
  1334. var self=this;
  1335. return $core.withContext(function($ctx1) {
  1336. self['@' + aString] = anObject ;
  1337. return self;
  1338. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  1339. },
  1340. args: ["aString", "anObject"],
  1341. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1342. referencedClasses: [],
  1343. messageSends: []
  1344. }),
  1345. $globals.ProtoObject);
  1346. $core.addMethod(
  1347. $core.method({
  1348. selector: "isKindOf:",
  1349. protocol: 'testing',
  1350. fn: function (aClass){
  1351. var self=this;
  1352. return $core.withContext(function($ctx1) {
  1353. var $2,$1;
  1354. $2=self._isMemberOf_(aClass);
  1355. if($core.assert($2)){
  1356. $1=true;
  1357. } else {
  1358. $1=$recv(self._class())._inheritsFrom_(aClass);
  1359. };
  1360. return $1;
  1361. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  1362. },
  1363. args: ["aClass"],
  1364. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1365. referencedClasses: [],
  1366. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1367. }),
  1368. $globals.ProtoObject);
  1369. $core.addMethod(
  1370. $core.method({
  1371. selector: "isNil",
  1372. protocol: 'testing',
  1373. fn: function (){
  1374. var self=this;
  1375. return false;
  1376. },
  1377. args: [],
  1378. source: "isNil\x0a\x09^ false",
  1379. referencedClasses: [],
  1380. messageSends: []
  1381. }),
  1382. $globals.ProtoObject);
  1383. $core.addMethod(
  1384. $core.method({
  1385. selector: "isSameInstanceAs:",
  1386. protocol: 'comparing',
  1387. fn: function (anObject){
  1388. var self=this;
  1389. return $core.withContext(function($ctx1) {
  1390. var $2,$1;
  1391. $2=self._identityHash();
  1392. $ctx1.sendIdx["identityHash"]=1;
  1393. $1=$recv($2).__eq($recv(anObject)._identityHash());
  1394. return $1;
  1395. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  1396. },
  1397. args: ["anObject"],
  1398. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  1399. referencedClasses: [],
  1400. messageSends: ["=", "identityHash"]
  1401. }),
  1402. $globals.ProtoObject);
  1403. $core.addMethod(
  1404. $core.method({
  1405. selector: "notNil",
  1406. protocol: 'testing',
  1407. fn: function (){
  1408. var self=this;
  1409. return $core.withContext(function($ctx1) {
  1410. var $1;
  1411. $1=$recv(self._isNil())._not();
  1412. return $1;
  1413. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  1414. },
  1415. args: [],
  1416. source: "notNil\x0a\x09^ self isNil not",
  1417. referencedClasses: [],
  1418. messageSends: ["not", "isNil"]
  1419. }),
  1420. $globals.ProtoObject);
  1421. $core.addMethod(
  1422. $core.method({
  1423. selector: "perform:",
  1424. protocol: 'message handling',
  1425. fn: function (aString){
  1426. var self=this;
  1427. return $core.withContext(function($ctx1) {
  1428. var $1;
  1429. $1=self._perform_withArguments_(aString,[]);
  1430. return $1;
  1431. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  1432. },
  1433. args: ["aString"],
  1434. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  1435. referencedClasses: [],
  1436. messageSends: ["perform:withArguments:"]
  1437. }),
  1438. $globals.ProtoObject);
  1439. $core.addMethod(
  1440. $core.method({
  1441. selector: "perform:withArguments:",
  1442. protocol: 'message handling',
  1443. fn: function (aString,aCollection){
  1444. var self=this;
  1445. return $core.withContext(function($ctx1) {
  1446. return $core.send(self, aString._asJavaScriptMethodName(), aCollection);
  1447. return self;
  1448. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  1449. },
  1450. args: ["aString", "aCollection"],
  1451. source: "perform: aString withArguments: aCollection\x0a\x09<return $core.send(self, aString._asJavaScriptMethodName(), aCollection)>",
  1452. referencedClasses: [],
  1453. messageSends: []
  1454. }),
  1455. $globals.ProtoObject);
  1456. $core.addMethod(
  1457. $core.method({
  1458. selector: "printOn:",
  1459. protocol: 'printing',
  1460. fn: function (aStream){
  1461. var self=this;
  1462. return $core.withContext(function($ctx1) {
  1463. var $5,$4,$3,$2,$1;
  1464. $5=self._class();
  1465. $ctx1.sendIdx["class"]=1;
  1466. $4=$recv($5)._name();
  1467. $ctx1.sendIdx["name"]=1;
  1468. $3=$recv($4)._first();
  1469. $2=$recv($3)._isVowel();
  1470. if($core.assert($2)){
  1471. $1="an ";
  1472. } else {
  1473. $1="a ";
  1474. };
  1475. $recv(aStream)._nextPutAll_($1);
  1476. $ctx1.sendIdx["nextPutAll:"]=1;
  1477. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  1478. return self;
  1479. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  1480. },
  1481. args: ["aStream"],
  1482. 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",
  1483. referencedClasses: [],
  1484. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  1485. }),
  1486. $globals.ProtoObject);
  1487. $core.addMethod(
  1488. $core.method({
  1489. selector: "printString",
  1490. protocol: 'printing',
  1491. fn: function (){
  1492. var self=this;
  1493. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  1494. return $core.withContext(function($ctx1) {
  1495. var $1;
  1496. $1=$recv($String())._streamContents_((function(str){
  1497. return $core.withContext(function($ctx2) {
  1498. return self._printOn_(str);
  1499. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  1500. }));
  1501. return $1;
  1502. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  1503. },
  1504. args: [],
  1505. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  1506. referencedClasses: ["String"],
  1507. messageSends: ["streamContents:", "printOn:"]
  1508. }),
  1509. $globals.ProtoObject);
  1510. $core.addMethod(
  1511. $core.method({
  1512. selector: "yourself",
  1513. protocol: 'accessing',
  1514. fn: function (){
  1515. var self=this;
  1516. return self;
  1517. },
  1518. args: [],
  1519. source: "yourself\x0a\x09^ self",
  1520. referencedClasses: [],
  1521. messageSends: []
  1522. }),
  1523. $globals.ProtoObject);
  1524. $core.addMethod(
  1525. $core.method({
  1526. selector: "~=",
  1527. protocol: 'comparing',
  1528. fn: function (anObject){
  1529. var self=this;
  1530. return $core.withContext(function($ctx1) {
  1531. var $1;
  1532. $1=$recv(self.__eq(anObject)).__eq(false);
  1533. $ctx1.sendIdx["="]=1;
  1534. return $1;
  1535. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  1536. },
  1537. args: ["anObject"],
  1538. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  1539. referencedClasses: [],
  1540. messageSends: ["="]
  1541. }),
  1542. $globals.ProtoObject);
  1543. $core.addMethod(
  1544. $core.method({
  1545. selector: "~~",
  1546. protocol: 'comparing',
  1547. fn: function (anObject){
  1548. var self=this;
  1549. return $core.withContext(function($ctx1) {
  1550. var $1;
  1551. $1=$recv(self.__eq_eq(anObject)).__eq(false);
  1552. return $1;
  1553. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  1554. },
  1555. args: ["anObject"],
  1556. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  1557. referencedClasses: [],
  1558. messageSends: ["=", "=="]
  1559. }),
  1560. $globals.ProtoObject);
  1561. $core.addMethod(
  1562. $core.method({
  1563. selector: "initialize",
  1564. protocol: 'initialization',
  1565. fn: function (){
  1566. var self=this;
  1567. return self;
  1568. },
  1569. args: [],
  1570. source: "initialize",
  1571. referencedClasses: [],
  1572. messageSends: []
  1573. }),
  1574. $globals.ProtoObject.klass);
  1575. $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
  1576. $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.";
  1577. $core.addMethod(
  1578. $core.method({
  1579. selector: "->",
  1580. protocol: 'converting',
  1581. fn: function (anObject){
  1582. var self=this;
  1583. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  1584. return $core.withContext(function($ctx1) {
  1585. var $1;
  1586. $1=$recv($Association())._key_value_(self,anObject);
  1587. return $1;
  1588. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  1589. },
  1590. args: ["anObject"],
  1591. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  1592. referencedClasses: ["Association"],
  1593. messageSends: ["key:value:"]
  1594. }),
  1595. $globals.Object);
  1596. $core.addMethod(
  1597. $core.method({
  1598. selector: "asJSON",
  1599. protocol: 'converting',
  1600. fn: function (){
  1601. var self=this;
  1602. var variables;
  1603. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1604. return $core.withContext(function($ctx1) {
  1605. var $1;
  1606. variables=$recv($HashedCollection())._new();
  1607. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  1608. return $core.withContext(function($ctx2) {
  1609. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
  1610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1611. }));
  1612. $1=variables;
  1613. return $1;
  1614. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
  1615. },
  1616. args: [],
  1617. 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",
  1618. referencedClasses: ["HashedCollection"],
  1619. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  1620. }),
  1621. $globals.Object);
  1622. $core.addMethod(
  1623. $core.method({
  1624. selector: "asJSONString",
  1625. protocol: 'converting',
  1626. fn: function (){
  1627. var self=this;
  1628. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  1629. return $core.withContext(function($ctx1) {
  1630. var $1;
  1631. $1=$recv($JSON())._stringify_(self._asJSON());
  1632. return $1;
  1633. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  1634. },
  1635. args: [],
  1636. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  1637. referencedClasses: ["JSON"],
  1638. messageSends: ["stringify:", "asJSON"]
  1639. }),
  1640. $globals.Object);
  1641. $core.addMethod(
  1642. $core.method({
  1643. selector: "asJavascript",
  1644. protocol: 'converting',
  1645. fn: function (){
  1646. var self=this;
  1647. return $core.withContext(function($ctx1) {
  1648. var $1;
  1649. $1=self._asString();
  1650. return $1;
  1651. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
  1652. },
  1653. args: [],
  1654. source: "asJavascript\x0a\x09^ self asString",
  1655. referencedClasses: [],
  1656. messageSends: ["asString"]
  1657. }),
  1658. $globals.Object);
  1659. $core.addMethod(
  1660. $core.method({
  1661. selector: "basicAt:",
  1662. protocol: 'accessing',
  1663. fn: function (aString){
  1664. var self=this;
  1665. return $core.withContext(function($ctx1) {
  1666. return self[aString];
  1667. return self;
  1668. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  1669. },
  1670. args: ["aString"],
  1671. source: "basicAt: aString\x0a\x09<return self[aString]>",
  1672. referencedClasses: [],
  1673. messageSends: []
  1674. }),
  1675. $globals.Object);
  1676. $core.addMethod(
  1677. $core.method({
  1678. selector: "basicAt:put:",
  1679. protocol: 'accessing',
  1680. fn: function (aString,anObject){
  1681. var self=this;
  1682. return $core.withContext(function($ctx1) {
  1683. return self[aString] = anObject;
  1684. return self;
  1685. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  1686. },
  1687. args: ["aString", "anObject"],
  1688. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  1689. referencedClasses: [],
  1690. messageSends: []
  1691. }),
  1692. $globals.Object);
  1693. $core.addMethod(
  1694. $core.method({
  1695. selector: "basicDelete:",
  1696. protocol: 'accessing',
  1697. fn: function (aString){
  1698. var self=this;
  1699. return $core.withContext(function($ctx1) {
  1700. delete self[aString]; return aString;
  1701. return self;
  1702. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  1703. },
  1704. args: ["aString"],
  1705. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  1706. referencedClasses: [],
  1707. messageSends: []
  1708. }),
  1709. $globals.Object);
  1710. $core.addMethod(
  1711. $core.method({
  1712. selector: "basicPerform:",
  1713. protocol: 'message handling',
  1714. fn: function (aString){
  1715. var self=this;
  1716. return $core.withContext(function($ctx1) {
  1717. var $1;
  1718. $1=self._basicPerform_withArguments_(aString,[]);
  1719. return $1;
  1720. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  1721. },
  1722. args: ["aString"],
  1723. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  1724. referencedClasses: [],
  1725. messageSends: ["basicPerform:withArguments:"]
  1726. }),
  1727. $globals.Object);
  1728. $core.addMethod(
  1729. $core.method({
  1730. selector: "basicPerform:withArguments:",
  1731. protocol: 'message handling',
  1732. fn: function (aString,aCollection){
  1733. var self=this;
  1734. return $core.withContext(function($ctx1) {
  1735. return self[aString].apply(self, aCollection);;
  1736. return self;
  1737. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  1738. },
  1739. args: ["aString", "aCollection"],
  1740. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  1741. referencedClasses: [],
  1742. messageSends: []
  1743. }),
  1744. $globals.Object);
  1745. $core.addMethod(
  1746. $core.method({
  1747. selector: "browse",
  1748. protocol: 'browsing',
  1749. fn: function (){
  1750. var self=this;
  1751. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  1752. return $core.withContext(function($ctx1) {
  1753. $recv($Finder())._findClass_(self._class());
  1754. return self;
  1755. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  1756. },
  1757. args: [],
  1758. source: "browse\x0a\x09Finder findClass: self class",
  1759. referencedClasses: ["Finder"],
  1760. messageSends: ["findClass:", "class"]
  1761. }),
  1762. $globals.Object);
  1763. $core.addMethod(
  1764. $core.method({
  1765. selector: "copy",
  1766. protocol: 'copying',
  1767. fn: function (){
  1768. var self=this;
  1769. return $core.withContext(function($ctx1) {
  1770. var $1;
  1771. $1=$recv(self._shallowCopy())._postCopy();
  1772. return $1;
  1773. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  1774. },
  1775. args: [],
  1776. source: "copy\x0a\x09^ self shallowCopy postCopy",
  1777. referencedClasses: [],
  1778. messageSends: ["postCopy", "shallowCopy"]
  1779. }),
  1780. $globals.Object);
  1781. $core.addMethod(
  1782. $core.method({
  1783. selector: "deepCopy",
  1784. protocol: 'copying',
  1785. fn: function (){
  1786. var self=this;
  1787. return $core.withContext(function($ctx1) {
  1788. var copy = self.klass._new();
  1789. Object.keys(self).forEach(function (i) {
  1790. if(/^@.+/.test(i)) {
  1791. copy[i] = self[i]._deepCopy();
  1792. }
  1793. });
  1794. return copy;
  1795. ;
  1796. return self;
  1797. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  1798. },
  1799. args: [],
  1800. 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>",
  1801. referencedClasses: [],
  1802. messageSends: []
  1803. }),
  1804. $globals.Object);
  1805. $core.addMethod(
  1806. $core.method({
  1807. selector: "deprecatedAPI",
  1808. protocol: 'error handling',
  1809. fn: function (){
  1810. var self=this;
  1811. return $core.withContext(function($ctx1) {
  1812. var $1,$6,$5,$4,$8,$7,$3,$2;
  1813. $1=console;
  1814. $6=$core.getThisContext()._home();
  1815. $ctx1.sendIdx["home"]=1;
  1816. $5=$recv($6)._asString();
  1817. $ctx1.sendIdx["asString"]=1;
  1818. $4=$recv($5).__comma(" is deprecated! (in ");
  1819. $8=$recv($core.getThisContext()._home())._home();
  1820. $ctx1.sendIdx["home"]=2;
  1821. $7=$recv($8)._asString();
  1822. $3=$recv($4).__comma($7);
  1823. $ctx1.sendIdx[","]=2;
  1824. $2=$recv($3).__comma(")");
  1825. $ctx1.sendIdx[","]=1;
  1826. $recv($1)._warn_($2);
  1827. return self;
  1828. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  1829. },
  1830. args: [],
  1831. 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, ')'.",
  1832. referencedClasses: [],
  1833. messageSends: ["warn:", ",", "asString", "home"]
  1834. }),
  1835. $globals.Object);
  1836. $core.addMethod(
  1837. $core.method({
  1838. selector: "deprecatedAPI:",
  1839. protocol: 'error handling',
  1840. fn: function (aString){
  1841. var self=this;
  1842. return $core.withContext(function($ctx1) {
  1843. var $1,$6,$5,$4,$8,$7,$3,$2;
  1844. $1=console;
  1845. $6=$core.getThisContext()._home();
  1846. $ctx1.sendIdx["home"]=1;
  1847. $5=$recv($6)._asString();
  1848. $ctx1.sendIdx["asString"]=1;
  1849. $4=$recv($5).__comma(" is deprecated! (in ");
  1850. $8=$recv($core.getThisContext()._home())._home();
  1851. $ctx1.sendIdx["home"]=2;
  1852. $7=$recv($8)._asString();
  1853. $3=$recv($4).__comma($7);
  1854. $ctx1.sendIdx[","]=2;
  1855. $2=$recv($3).__comma(")");
  1856. $ctx1.sendIdx[","]=1;
  1857. $recv($1)._warn_($2);
  1858. $ctx1.sendIdx["warn:"]=1;
  1859. $recv(console)._warn_(aString);
  1860. return self;
  1861. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  1862. },
  1863. args: ["aString"],
  1864. 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",
  1865. referencedClasses: [],
  1866. messageSends: ["warn:", ",", "asString", "home"]
  1867. }),
  1868. $globals.Object);
  1869. $core.addMethod(
  1870. $core.method({
  1871. selector: "error:",
  1872. protocol: 'error handling',
  1873. fn: function (aString){
  1874. var self=this;
  1875. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  1876. return $core.withContext(function($ctx1) {
  1877. $recv($Error())._signal_(aString);
  1878. return self;
  1879. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  1880. },
  1881. args: ["aString"],
  1882. source: "error: aString\x0a\x09Error signal: aString",
  1883. referencedClasses: ["Error"],
  1884. messageSends: ["signal:"]
  1885. }),
  1886. $globals.Object);
  1887. $core.addMethod(
  1888. $core.method({
  1889. selector: "halt",
  1890. protocol: 'error handling',
  1891. fn: function (){
  1892. var self=this;
  1893. function $Halt(){return $globals.Halt||(typeof Halt=="undefined"?nil:Halt)}
  1894. return $core.withContext(function($ctx1) {
  1895. $recv($Halt())._signal();
  1896. return self;
  1897. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  1898. },
  1899. args: [],
  1900. source: "halt\x0a\x09Halt signal",
  1901. referencedClasses: ["Halt"],
  1902. messageSends: ["signal"]
  1903. }),
  1904. $globals.Object);
  1905. $core.addMethod(
  1906. $core.method({
  1907. selector: "in:",
  1908. protocol: 'evaluating',
  1909. fn: function (aValuable){
  1910. var self=this;
  1911. return $core.withContext(function($ctx1) {
  1912. var $1;
  1913. $1=$recv(aValuable)._value_(self);
  1914. return $1;
  1915. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  1916. },
  1917. args: ["aValuable"],
  1918. source: "in: aValuable\x0a\x09^ aValuable value: self",
  1919. referencedClasses: [],
  1920. messageSends: ["value:"]
  1921. }),
  1922. $globals.Object);
  1923. $core.addMethod(
  1924. $core.method({
  1925. selector: "isBehavior",
  1926. protocol: 'testing',
  1927. fn: function (){
  1928. var self=this;
  1929. return false;
  1930. },
  1931. args: [],
  1932. source: "isBehavior\x0a\x09^ false",
  1933. referencedClasses: [],
  1934. messageSends: []
  1935. }),
  1936. $globals.Object);
  1937. $core.addMethod(
  1938. $core.method({
  1939. selector: "isBoolean",
  1940. protocol: 'testing',
  1941. fn: function (){
  1942. var self=this;
  1943. return false;
  1944. },
  1945. args: [],
  1946. source: "isBoolean\x0a\x09^ false",
  1947. referencedClasses: [],
  1948. messageSends: []
  1949. }),
  1950. $globals.Object);
  1951. $core.addMethod(
  1952. $core.method({
  1953. selector: "isClass",
  1954. protocol: 'testing',
  1955. fn: function (){
  1956. var self=this;
  1957. return false;
  1958. },
  1959. args: [],
  1960. source: "isClass\x0a\x09^ false",
  1961. referencedClasses: [],
  1962. messageSends: []
  1963. }),
  1964. $globals.Object);
  1965. $core.addMethod(
  1966. $core.method({
  1967. selector: "isCompiledMethod",
  1968. protocol: 'testing',
  1969. fn: function (){
  1970. var self=this;
  1971. return false;
  1972. },
  1973. args: [],
  1974. source: "isCompiledMethod\x0a\x09^ false",
  1975. referencedClasses: [],
  1976. messageSends: []
  1977. }),
  1978. $globals.Object);
  1979. $core.addMethod(
  1980. $core.method({
  1981. selector: "isImmutable",
  1982. protocol: 'testing',
  1983. fn: function (){
  1984. var self=this;
  1985. return false;
  1986. },
  1987. args: [],
  1988. source: "isImmutable\x0a\x09^ false",
  1989. referencedClasses: [],
  1990. messageSends: []
  1991. }),
  1992. $globals.Object);
  1993. $core.addMethod(
  1994. $core.method({
  1995. selector: "isMemberOf:",
  1996. protocol: 'testing',
  1997. fn: function (aClass){
  1998. var self=this;
  1999. return $core.withContext(function($ctx1) {
  2000. var $1;
  2001. $1=$recv(self._class()).__eq(aClass);
  2002. return $1;
  2003. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  2004. },
  2005. args: ["aClass"],
  2006. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2007. referencedClasses: [],
  2008. messageSends: ["=", "class"]
  2009. }),
  2010. $globals.Object);
  2011. $core.addMethod(
  2012. $core.method({
  2013. selector: "isMetaclass",
  2014. protocol: 'testing',
  2015. fn: function (){
  2016. var self=this;
  2017. return false;
  2018. },
  2019. args: [],
  2020. source: "isMetaclass\x0a\x09^ false",
  2021. referencedClasses: [],
  2022. messageSends: []
  2023. }),
  2024. $globals.Object);
  2025. $core.addMethod(
  2026. $core.method({
  2027. selector: "isNumber",
  2028. protocol: 'testing',
  2029. fn: function (){
  2030. var self=this;
  2031. return false;
  2032. },
  2033. args: [],
  2034. source: "isNumber\x0a\x09^ false",
  2035. referencedClasses: [],
  2036. messageSends: []
  2037. }),
  2038. $globals.Object);
  2039. $core.addMethod(
  2040. $core.method({
  2041. selector: "isPackage",
  2042. protocol: 'testing',
  2043. fn: function (){
  2044. var self=this;
  2045. return false;
  2046. },
  2047. args: [],
  2048. source: "isPackage\x0a\x09^ false",
  2049. referencedClasses: [],
  2050. messageSends: []
  2051. }),
  2052. $globals.Object);
  2053. $core.addMethod(
  2054. $core.method({
  2055. selector: "isParseFailure",
  2056. protocol: 'testing',
  2057. fn: function (){
  2058. var self=this;
  2059. return false;
  2060. },
  2061. args: [],
  2062. source: "isParseFailure\x0a\x09^ false",
  2063. referencedClasses: [],
  2064. messageSends: []
  2065. }),
  2066. $globals.Object);
  2067. $core.addMethod(
  2068. $core.method({
  2069. selector: "isString",
  2070. protocol: 'testing',
  2071. fn: function (){
  2072. var self=this;
  2073. return false;
  2074. },
  2075. args: [],
  2076. source: "isString\x0a\x09^ false",
  2077. referencedClasses: [],
  2078. messageSends: []
  2079. }),
  2080. $globals.Object);
  2081. $core.addMethod(
  2082. $core.method({
  2083. selector: "isSymbol",
  2084. protocol: 'testing',
  2085. fn: function (){
  2086. var self=this;
  2087. return false;
  2088. },
  2089. args: [],
  2090. source: "isSymbol\x0a\x09^ false",
  2091. referencedClasses: [],
  2092. messageSends: []
  2093. }),
  2094. $globals.Object);
  2095. $core.addMethod(
  2096. $core.method({
  2097. selector: "postCopy",
  2098. protocol: 'copying',
  2099. fn: function (){
  2100. var self=this;
  2101. return self;
  2102. },
  2103. args: [],
  2104. source: "postCopy",
  2105. referencedClasses: [],
  2106. messageSends: []
  2107. }),
  2108. $globals.Object);
  2109. $core.addMethod(
  2110. $core.method({
  2111. selector: "putOn:",
  2112. protocol: 'streaming',
  2113. fn: function (aStream){
  2114. var self=this;
  2115. return $core.withContext(function($ctx1) {
  2116. $recv(aStream)._nextPut_(self);
  2117. return self;
  2118. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  2119. },
  2120. args: ["aStream"],
  2121. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2122. referencedClasses: [],
  2123. messageSends: ["nextPut:"]
  2124. }),
  2125. $globals.Object);
  2126. $core.addMethod(
  2127. $core.method({
  2128. selector: "respondsTo:",
  2129. protocol: 'testing',
  2130. fn: function (aSelector){
  2131. var self=this;
  2132. return $core.withContext(function($ctx1) {
  2133. var $1;
  2134. $1=$recv(self._class())._canUnderstand_(aSelector);
  2135. return $1;
  2136. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  2137. },
  2138. args: ["aSelector"],
  2139. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2140. referencedClasses: [],
  2141. messageSends: ["canUnderstand:", "class"]
  2142. }),
  2143. $globals.Object);
  2144. $core.addMethod(
  2145. $core.method({
  2146. selector: "shallowCopy",
  2147. protocol: 'copying',
  2148. fn: function (){
  2149. var self=this;
  2150. return $core.withContext(function($ctx1) {
  2151. var copy = self.klass._new();
  2152. Object.keys(self).forEach(function(i) {
  2153. if(/^@.+/.test(i)) {
  2154. copy[i] = self[i];
  2155. }
  2156. });
  2157. return copy;
  2158. ;
  2159. return self;
  2160. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  2161. },
  2162. args: [],
  2163. 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>",
  2164. referencedClasses: [],
  2165. messageSends: []
  2166. }),
  2167. $globals.Object);
  2168. $core.addMethod(
  2169. $core.method({
  2170. selector: "shouldNotImplement",
  2171. protocol: 'error handling',
  2172. fn: function (){
  2173. var self=this;
  2174. return $core.withContext(function($ctx1) {
  2175. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  2176. return self;
  2177. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  2178. },
  2179. args: [],
  2180. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2181. referencedClasses: [],
  2182. messageSends: ["error:", ",", "name", "class"]
  2183. }),
  2184. $globals.Object);
  2185. $core.addMethod(
  2186. $core.method({
  2187. selector: "size",
  2188. protocol: 'accessing',
  2189. fn: function (){
  2190. var self=this;
  2191. return $core.withContext(function($ctx1) {
  2192. self._error_("Object not indexable");
  2193. return self;
  2194. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  2195. },
  2196. args: [],
  2197. source: "size\x0a\x09self error: 'Object not indexable'",
  2198. referencedClasses: [],
  2199. messageSends: ["error:"]
  2200. }),
  2201. $globals.Object);
  2202. $core.addMethod(
  2203. $core.method({
  2204. selector: "subclassResponsibility",
  2205. protocol: 'error handling',
  2206. fn: function (){
  2207. var self=this;
  2208. return $core.withContext(function($ctx1) {
  2209. self._error_("This method is a responsibility of a subclass");
  2210. return self;
  2211. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  2212. },
  2213. args: [],
  2214. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2215. referencedClasses: [],
  2216. messageSends: ["error:"]
  2217. }),
  2218. $globals.Object);
  2219. $core.addMethod(
  2220. $core.method({
  2221. selector: "throw:",
  2222. protocol: 'error handling',
  2223. fn: function (anObject){
  2224. var self=this;
  2225. return $core.withContext(function($ctx1) {
  2226. throw anObject ;
  2227. return self;
  2228. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)});
  2229. },
  2230. args: ["anObject"],
  2231. source: "throw: anObject\x0a\x09< throw anObject >",
  2232. referencedClasses: [],
  2233. messageSends: []
  2234. }),
  2235. $globals.Object);
  2236. $core.addMethod(
  2237. $core.method({
  2238. selector: "value",
  2239. protocol: 'evaluating',
  2240. fn: function (){
  2241. var self=this;
  2242. return $core.withContext(function($ctx1) {
  2243. return self.valueOf();
  2244. return self;
  2245. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  2246. },
  2247. args: [],
  2248. source: "value\x0a\x09<return self.valueOf()>",
  2249. referencedClasses: [],
  2250. messageSends: []
  2251. }),
  2252. $globals.Object);
  2253. $core.addMethod(
  2254. $core.method({
  2255. selector: "accessorProtocolWith:",
  2256. protocol: 'helios',
  2257. fn: function (aGenerator){
  2258. var self=this;
  2259. return $core.withContext(function($ctx1) {
  2260. $recv(aGenerator)._accessorProtocolForObject();
  2261. return self;
  2262. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2263. },
  2264. args: ["aGenerator"],
  2265. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2266. referencedClasses: [],
  2267. messageSends: ["accessorProtocolForObject"]
  2268. }),
  2269. $globals.Object.klass);
  2270. $core.addMethod(
  2271. $core.method({
  2272. selector: "accessorsSourceCodesWith:",
  2273. protocol: 'helios',
  2274. fn: function (aGenerator){
  2275. var self=this;
  2276. return $core.withContext(function($ctx1) {
  2277. $recv(aGenerator)._accessorsForObject();
  2278. return self;
  2279. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2280. },
  2281. args: ["aGenerator"],
  2282. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2283. referencedClasses: [],
  2284. messageSends: ["accessorsForObject"]
  2285. }),
  2286. $globals.Object.klass);
  2287. $core.addMethod(
  2288. $core.method({
  2289. selector: "initialize",
  2290. protocol: 'initialization',
  2291. fn: function (){
  2292. var self=this;
  2293. return self;
  2294. },
  2295. args: [],
  2296. source: "initialize\x0a\x09\x22no op\x22",
  2297. referencedClasses: [],
  2298. messageSends: []
  2299. }),
  2300. $globals.Object.klass);
  2301. $core.addMethod(
  2302. $core.method({
  2303. selector: "initializeProtocolWith:",
  2304. protocol: 'helios',
  2305. fn: function (aGenerator){
  2306. var self=this;
  2307. return $core.withContext(function($ctx1) {
  2308. $recv(aGenerator)._initializeProtocolForObject();
  2309. return self;
  2310. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2311. },
  2312. args: ["aGenerator"],
  2313. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2314. referencedClasses: [],
  2315. messageSends: ["initializeProtocolForObject"]
  2316. }),
  2317. $globals.Object.klass);
  2318. $core.addMethod(
  2319. $core.method({
  2320. selector: "initializeSourceCodesWith:",
  2321. protocol: 'helios',
  2322. fn: function (aGenerator){
  2323. var self=this;
  2324. return $core.withContext(function($ctx1) {
  2325. $recv(aGenerator)._initializeForObject();
  2326. return self;
  2327. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2328. },
  2329. args: ["aGenerator"],
  2330. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2331. referencedClasses: [],
  2332. messageSends: ["initializeForObject"]
  2333. }),
  2334. $globals.Object.klass);
  2335. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  2336. $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: [ ... ]";
  2337. $core.addMethod(
  2338. $core.method({
  2339. selector: "&",
  2340. protocol: 'controlling',
  2341. fn: function (aBoolean){
  2342. var self=this;
  2343. return $core.withContext(function($ctx1) {
  2344. if(self == true) {
  2345. return aBoolean;
  2346. } else {
  2347. return false;
  2348. }
  2349. ;
  2350. return self;
  2351. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  2352. },
  2353. args: ["aBoolean"],
  2354. 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>",
  2355. referencedClasses: [],
  2356. messageSends: []
  2357. }),
  2358. $globals.Boolean);
  2359. $core.addMethod(
  2360. $core.method({
  2361. selector: "==",
  2362. protocol: 'comparing',
  2363. fn: function (aBoolean){
  2364. var self=this;
  2365. return $core.withContext(function($ctx1) {
  2366. return aBoolean != null && self.valueOf() === (typeof aBoolean === "boolean" ? aBoolean : aBoolean.valueOf());
  2367. return self;
  2368. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  2369. },
  2370. args: ["aBoolean"],
  2371. source: "== aBoolean\x0a<return aBoolean != null && self.valueOf() === (typeof aBoolean === \x22boolean\x22 ? aBoolean : aBoolean.valueOf())>",
  2372. referencedClasses: [],
  2373. messageSends: []
  2374. }),
  2375. $globals.Boolean);
  2376. $core.addMethod(
  2377. $core.method({
  2378. selector: "and:",
  2379. protocol: 'controlling',
  2380. fn: function (aBlock){
  2381. var self=this;
  2382. return $core.withContext(function($ctx1) {
  2383. var $2,$1;
  2384. $2=self.__eq(true);
  2385. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  2386. return false;
  2387. }));
  2388. return $1;
  2389. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  2390. },
  2391. args: ["aBlock"],
  2392. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  2393. referencedClasses: [],
  2394. messageSends: ["ifTrue:ifFalse:", "="]
  2395. }),
  2396. $globals.Boolean);
  2397. $core.addMethod(
  2398. $core.method({
  2399. selector: "asBit",
  2400. protocol: 'converting',
  2401. fn: function (){
  2402. var self=this;
  2403. return $core.withContext(function($ctx1) {
  2404. var $1;
  2405. if($core.assert(self)){
  2406. $1=(1);
  2407. } else {
  2408. $1=(0);
  2409. };
  2410. return $1;
  2411. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  2412. },
  2413. args: [],
  2414. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  2415. referencedClasses: [],
  2416. messageSends: ["ifTrue:ifFalse:"]
  2417. }),
  2418. $globals.Boolean);
  2419. $core.addMethod(
  2420. $core.method({
  2421. selector: "asJSON",
  2422. protocol: 'converting',
  2423. fn: function (){
  2424. var self=this;
  2425. return self;
  2426. },
  2427. args: [],
  2428. source: "asJSON\x0a\x09^ self",
  2429. referencedClasses: [],
  2430. messageSends: []
  2431. }),
  2432. $globals.Boolean);
  2433. $core.addMethod(
  2434. $core.method({
  2435. selector: "asString",
  2436. protocol: 'converting',
  2437. fn: function (){
  2438. var self=this;
  2439. return $core.withContext(function($ctx1) {
  2440. return self.toString() ;
  2441. return self;
  2442. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  2443. },
  2444. args: [],
  2445. source: "asString\x0a\x09< return self.toString() >",
  2446. referencedClasses: [],
  2447. messageSends: []
  2448. }),
  2449. $globals.Boolean);
  2450. $core.addMethod(
  2451. $core.method({
  2452. selector: "deepCopy",
  2453. protocol: 'copying',
  2454. fn: function (){
  2455. var self=this;
  2456. return self;
  2457. },
  2458. args: [],
  2459. source: "deepCopy\x0a\x09^ self",
  2460. referencedClasses: [],
  2461. messageSends: []
  2462. }),
  2463. $globals.Boolean);
  2464. $core.addMethod(
  2465. $core.method({
  2466. selector: "ifFalse:",
  2467. protocol: 'controlling',
  2468. fn: function (aBlock){
  2469. var self=this;
  2470. return $core.withContext(function($ctx1) {
  2471. var $1;
  2472. $1=self._ifTrue_ifFalse_((function(){
  2473. }),aBlock);
  2474. return $1;
  2475. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  2476. },
  2477. args: ["aBlock"],
  2478. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  2479. referencedClasses: [],
  2480. messageSends: ["ifTrue:ifFalse:"]
  2481. }),
  2482. $globals.Boolean);
  2483. $core.addMethod(
  2484. $core.method({
  2485. selector: "ifFalse:ifTrue:",
  2486. protocol: 'controlling',
  2487. fn: function (aBlock,anotherBlock){
  2488. var self=this;
  2489. return $core.withContext(function($ctx1) {
  2490. var $1;
  2491. $1=self._ifTrue_ifFalse_(anotherBlock,aBlock);
  2492. return $1;
  2493. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2494. },
  2495. args: ["aBlock", "anotherBlock"],
  2496. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  2497. referencedClasses: [],
  2498. messageSends: ["ifTrue:ifFalse:"]
  2499. }),
  2500. $globals.Boolean);
  2501. $core.addMethod(
  2502. $core.method({
  2503. selector: "ifTrue:",
  2504. protocol: 'controlling',
  2505. fn: function (aBlock){
  2506. var self=this;
  2507. return $core.withContext(function($ctx1) {
  2508. var $1;
  2509. $1=self._ifTrue_ifFalse_(aBlock,(function(){
  2510. }));
  2511. return $1;
  2512. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  2513. },
  2514. args: ["aBlock"],
  2515. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  2516. referencedClasses: [],
  2517. messageSends: ["ifTrue:ifFalse:"]
  2518. }),
  2519. $globals.Boolean);
  2520. $core.addMethod(
  2521. $core.method({
  2522. selector: "ifTrue:ifFalse:",
  2523. protocol: 'controlling',
  2524. fn: function (aBlock,anotherBlock){
  2525. var self=this;
  2526. return $core.withContext(function($ctx1) {
  2527. if(self == true) {
  2528. return aBlock._value();
  2529. } else {
  2530. return anotherBlock._value();
  2531. }
  2532. ;
  2533. return self;
  2534. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2535. },
  2536. args: ["aBlock", "anotherBlock"],
  2537. 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>",
  2538. referencedClasses: [],
  2539. messageSends: []
  2540. }),
  2541. $globals.Boolean);
  2542. $core.addMethod(
  2543. $core.method({
  2544. selector: "isBoolean",
  2545. protocol: 'testing',
  2546. fn: function (){
  2547. var self=this;
  2548. return true;
  2549. },
  2550. args: [],
  2551. source: "isBoolean\x0a\x09^ true",
  2552. referencedClasses: [],
  2553. messageSends: []
  2554. }),
  2555. $globals.Boolean);
  2556. $core.addMethod(
  2557. $core.method({
  2558. selector: "isImmutable",
  2559. protocol: 'testing',
  2560. fn: function (){
  2561. var self=this;
  2562. return true;
  2563. },
  2564. args: [],
  2565. source: "isImmutable\x0a\x09^ true",
  2566. referencedClasses: [],
  2567. messageSends: []
  2568. }),
  2569. $globals.Boolean);
  2570. $core.addMethod(
  2571. $core.method({
  2572. selector: "not",
  2573. protocol: 'controlling',
  2574. fn: function (){
  2575. var self=this;
  2576. return $core.withContext(function($ctx1) {
  2577. var $1;
  2578. $1=self.__eq(false);
  2579. return $1;
  2580. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  2581. },
  2582. args: [],
  2583. source: "not\x0a\x09^ self = false",
  2584. referencedClasses: [],
  2585. messageSends: ["="]
  2586. }),
  2587. $globals.Boolean);
  2588. $core.addMethod(
  2589. $core.method({
  2590. selector: "or:",
  2591. protocol: 'controlling',
  2592. fn: function (aBlock){
  2593. var self=this;
  2594. return $core.withContext(function($ctx1) {
  2595. var $2,$1;
  2596. $2=self.__eq(true);
  2597. $1=$recv($2)._ifTrue_ifFalse_((function(){
  2598. return true;
  2599. }),aBlock);
  2600. return $1;
  2601. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  2602. },
  2603. args: ["aBlock"],
  2604. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  2605. referencedClasses: [],
  2606. messageSends: ["ifTrue:ifFalse:", "="]
  2607. }),
  2608. $globals.Boolean);
  2609. $core.addMethod(
  2610. $core.method({
  2611. selector: "printOn:",
  2612. protocol: 'printing',
  2613. fn: function (aStream){
  2614. var self=this;
  2615. return $core.withContext(function($ctx1) {
  2616. $recv(aStream)._nextPutAll_(self._asString());
  2617. return self;
  2618. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  2619. },
  2620. args: ["aStream"],
  2621. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2622. referencedClasses: [],
  2623. messageSends: ["nextPutAll:", "asString"]
  2624. }),
  2625. $globals.Boolean);
  2626. $core.addMethod(
  2627. $core.method({
  2628. selector: "shallowCopy",
  2629. protocol: 'copying',
  2630. fn: function (){
  2631. var self=this;
  2632. return self;
  2633. },
  2634. args: [],
  2635. source: "shallowCopy\x0a\x09^ self",
  2636. referencedClasses: [],
  2637. messageSends: []
  2638. }),
  2639. $globals.Boolean);
  2640. $core.addMethod(
  2641. $core.method({
  2642. selector: "|",
  2643. protocol: 'controlling',
  2644. fn: function (aBoolean){
  2645. var self=this;
  2646. return $core.withContext(function($ctx1) {
  2647. if(self == true) {
  2648. return true;
  2649. } else {
  2650. return aBoolean;
  2651. }
  2652. ;
  2653. return self;
  2654. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  2655. },
  2656. args: ["aBoolean"],
  2657. 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>",
  2658. referencedClasses: [],
  2659. messageSends: []
  2660. }),
  2661. $globals.Boolean);
  2662. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  2663. $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.).";
  2664. $core.addMethod(
  2665. $core.method({
  2666. selector: "+",
  2667. protocol: 'arithmetic',
  2668. fn: function (aDate){
  2669. var self=this;
  2670. return $core.withContext(function($ctx1) {
  2671. return self + aDate;
  2672. return self;
  2673. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  2674. },
  2675. args: ["aDate"],
  2676. source: "+ aDate\x0a\x09<return self + aDate>",
  2677. referencedClasses: [],
  2678. messageSends: []
  2679. }),
  2680. $globals.Date);
  2681. $core.addMethod(
  2682. $core.method({
  2683. selector: "-",
  2684. protocol: 'arithmetic',
  2685. fn: function (aDate){
  2686. var self=this;
  2687. return $core.withContext(function($ctx1) {
  2688. return self - aDate;
  2689. return self;
  2690. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  2691. },
  2692. args: ["aDate"],
  2693. source: "- aDate\x0a\x09<return self - aDate>",
  2694. referencedClasses: [],
  2695. messageSends: []
  2696. }),
  2697. $globals.Date);
  2698. $core.addMethod(
  2699. $core.method({
  2700. selector: "<",
  2701. protocol: 'comparing',
  2702. fn: function (aDate){
  2703. var self=this;
  2704. return $core.withContext(function($ctx1) {
  2705. return self < aDate;
  2706. return self;
  2707. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  2708. },
  2709. args: ["aDate"],
  2710. source: "< aDate\x0a\x09<return self < aDate>",
  2711. referencedClasses: [],
  2712. messageSends: []
  2713. }),
  2714. $globals.Date);
  2715. $core.addMethod(
  2716. $core.method({
  2717. selector: "<=",
  2718. protocol: 'comparing',
  2719. fn: function (aDate){
  2720. var self=this;
  2721. return $core.withContext(function($ctx1) {
  2722. return self <= aDate;
  2723. return self;
  2724. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  2725. },
  2726. args: ["aDate"],
  2727. source: "<= aDate\x0a\x09<return self <= aDate>",
  2728. referencedClasses: [],
  2729. messageSends: []
  2730. }),
  2731. $globals.Date);
  2732. $core.addMethod(
  2733. $core.method({
  2734. selector: "=",
  2735. protocol: 'comparing',
  2736. fn: function (aDate){
  2737. var self=this;
  2738. return $core.withContext(function($ctx1) {
  2739. var $3,$2,$4,$1;
  2740. $3=$recv(aDate)._class();
  2741. $ctx1.sendIdx["class"]=1;
  2742. $2=$recv($3).__eq_eq(self._class());
  2743. $ctx1.sendIdx["=="]=1;
  2744. $1=$recv($2)._and_((function(){
  2745. return $core.withContext(function($ctx2) {
  2746. $4=self._asMilliseconds();
  2747. $ctx2.sendIdx["asMilliseconds"]=1;
  2748. return $recv($4).__eq_eq($recv(aDate)._asMilliseconds());
  2749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2750. }));
  2751. return $1;
  2752. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  2753. },
  2754. args: ["aDate"],
  2755. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  2756. referencedClasses: [],
  2757. messageSends: ["and:", "==", "class", "asMilliseconds"]
  2758. }),
  2759. $globals.Date);
  2760. $core.addMethod(
  2761. $core.method({
  2762. selector: ">",
  2763. protocol: 'comparing',
  2764. fn: function (aDate){
  2765. var self=this;
  2766. return $core.withContext(function($ctx1) {
  2767. return self > aDate;
  2768. return self;
  2769. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  2770. },
  2771. args: ["aDate"],
  2772. source: "> aDate\x0a\x09<return self >> aDate>",
  2773. referencedClasses: [],
  2774. messageSends: []
  2775. }),
  2776. $globals.Date);
  2777. $core.addMethod(
  2778. $core.method({
  2779. selector: ">=",
  2780. protocol: 'comparing',
  2781. fn: function (aDate){
  2782. var self=this;
  2783. return $core.withContext(function($ctx1) {
  2784. return self >= aDate;
  2785. return self;
  2786. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  2787. },
  2788. args: ["aDate"],
  2789. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2790. referencedClasses: [],
  2791. messageSends: []
  2792. }),
  2793. $globals.Date);
  2794. $core.addMethod(
  2795. $core.method({
  2796. selector: "asDateString",
  2797. protocol: 'converting',
  2798. fn: function (){
  2799. var self=this;
  2800. return $core.withContext(function($ctx1) {
  2801. return self.toDateString();
  2802. return self;
  2803. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  2804. },
  2805. args: [],
  2806. source: "asDateString\x0a\x09<return self.toDateString()>",
  2807. referencedClasses: [],
  2808. messageSends: []
  2809. }),
  2810. $globals.Date);
  2811. $core.addMethod(
  2812. $core.method({
  2813. selector: "asLocaleString",
  2814. protocol: 'converting',
  2815. fn: function (){
  2816. var self=this;
  2817. return $core.withContext(function($ctx1) {
  2818. return self.toLocaleString();
  2819. return self;
  2820. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  2821. },
  2822. args: [],
  2823. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2824. referencedClasses: [],
  2825. messageSends: []
  2826. }),
  2827. $globals.Date);
  2828. $core.addMethod(
  2829. $core.method({
  2830. selector: "asMilliseconds",
  2831. protocol: 'converting',
  2832. fn: function (){
  2833. var self=this;
  2834. return $core.withContext(function($ctx1) {
  2835. var $1;
  2836. $1=self._time();
  2837. return $1;
  2838. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  2839. },
  2840. args: [],
  2841. source: "asMilliseconds\x0a\x09^ self time",
  2842. referencedClasses: [],
  2843. messageSends: ["time"]
  2844. }),
  2845. $globals.Date);
  2846. $core.addMethod(
  2847. $core.method({
  2848. selector: "asNumber",
  2849. protocol: 'converting',
  2850. fn: function (){
  2851. var self=this;
  2852. return $core.withContext(function($ctx1) {
  2853. var $1;
  2854. $1=self._asMilliseconds();
  2855. return $1;
  2856. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  2857. },
  2858. args: [],
  2859. source: "asNumber\x0a\x09^ self asMilliseconds",
  2860. referencedClasses: [],
  2861. messageSends: ["asMilliseconds"]
  2862. }),
  2863. $globals.Date);
  2864. $core.addMethod(
  2865. $core.method({
  2866. selector: "asString",
  2867. protocol: 'converting',
  2868. fn: function (){
  2869. var self=this;
  2870. return $core.withContext(function($ctx1) {
  2871. return self.toString();
  2872. return self;
  2873. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  2874. },
  2875. args: [],
  2876. source: "asString\x0a\x09<return self.toString()>",
  2877. referencedClasses: [],
  2878. messageSends: []
  2879. }),
  2880. $globals.Date);
  2881. $core.addMethod(
  2882. $core.method({
  2883. selector: "asTimeString",
  2884. protocol: 'converting',
  2885. fn: function (){
  2886. var self=this;
  2887. return $core.withContext(function($ctx1) {
  2888. return self.toTimeString();
  2889. return self;
  2890. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  2891. },
  2892. args: [],
  2893. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2894. referencedClasses: [],
  2895. messageSends: []
  2896. }),
  2897. $globals.Date);
  2898. $core.addMethod(
  2899. $core.method({
  2900. selector: "day",
  2901. protocol: 'accessing',
  2902. fn: function (){
  2903. var self=this;
  2904. return $core.withContext(function($ctx1) {
  2905. var $1;
  2906. $1=self._dayOfWeek();
  2907. return $1;
  2908. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  2909. },
  2910. args: [],
  2911. source: "day\x0a\x09^ self dayOfWeek",
  2912. referencedClasses: [],
  2913. messageSends: ["dayOfWeek"]
  2914. }),
  2915. $globals.Date);
  2916. $core.addMethod(
  2917. $core.method({
  2918. selector: "day:",
  2919. protocol: 'accessing',
  2920. fn: function (aNumber){
  2921. var self=this;
  2922. return $core.withContext(function($ctx1) {
  2923. self._dayOfWeek_(aNumber);
  2924. return self;
  2925. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  2926. },
  2927. args: ["aNumber"],
  2928. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2929. referencedClasses: [],
  2930. messageSends: ["dayOfWeek:"]
  2931. }),
  2932. $globals.Date);
  2933. $core.addMethod(
  2934. $core.method({
  2935. selector: "dayOfMonth",
  2936. protocol: 'accessing',
  2937. fn: function (){
  2938. var self=this;
  2939. return $core.withContext(function($ctx1) {
  2940. return self.getDate();
  2941. return self;
  2942. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  2943. },
  2944. args: [],
  2945. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2946. referencedClasses: [],
  2947. messageSends: []
  2948. }),
  2949. $globals.Date);
  2950. $core.addMethod(
  2951. $core.method({
  2952. selector: "dayOfMonth:",
  2953. protocol: 'accessing',
  2954. fn: function (aNumber){
  2955. var self=this;
  2956. return $core.withContext(function($ctx1) {
  2957. self.setDate(aNumber);
  2958. return self;
  2959. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  2960. },
  2961. args: ["aNumber"],
  2962. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2963. referencedClasses: [],
  2964. messageSends: []
  2965. }),
  2966. $globals.Date);
  2967. $core.addMethod(
  2968. $core.method({
  2969. selector: "dayOfWeek",
  2970. protocol: 'accessing',
  2971. fn: function (){
  2972. var self=this;
  2973. return $core.withContext(function($ctx1) {
  2974. return self.getDay() + 1;
  2975. return self;
  2976. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  2977. },
  2978. args: [],
  2979. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2980. referencedClasses: [],
  2981. messageSends: []
  2982. }),
  2983. $globals.Date);
  2984. $core.addMethod(
  2985. $core.method({
  2986. selector: "dayOfWeek:",
  2987. protocol: 'accessing',
  2988. fn: function (aNumber){
  2989. var self=this;
  2990. return $core.withContext(function($ctx1) {
  2991. return self.setDay(aNumber - 1);
  2992. return self;
  2993. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  2994. },
  2995. args: ["aNumber"],
  2996. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2997. referencedClasses: [],
  2998. messageSends: []
  2999. }),
  3000. $globals.Date);
  3001. $core.addMethod(
  3002. $core.method({
  3003. selector: "hours",
  3004. protocol: 'accessing',
  3005. fn: function (){
  3006. var self=this;
  3007. return $core.withContext(function($ctx1) {
  3008. return self.getHours();
  3009. return self;
  3010. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3011. },
  3012. args: [],
  3013. source: "hours\x0a\x09<return self.getHours()>",
  3014. referencedClasses: [],
  3015. messageSends: []
  3016. }),
  3017. $globals.Date);
  3018. $core.addMethod(
  3019. $core.method({
  3020. selector: "hours:",
  3021. protocol: 'accessing',
  3022. fn: function (aNumber){
  3023. var self=this;
  3024. return $core.withContext(function($ctx1) {
  3025. self.setHours(aNumber);
  3026. return self;
  3027. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3028. },
  3029. args: ["aNumber"],
  3030. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  3031. referencedClasses: [],
  3032. messageSends: []
  3033. }),
  3034. $globals.Date);
  3035. $core.addMethod(
  3036. $core.method({
  3037. selector: "milliseconds",
  3038. protocol: 'accessing',
  3039. fn: function (){
  3040. var self=this;
  3041. return $core.withContext(function($ctx1) {
  3042. return self.getMilliseconds();
  3043. return self;
  3044. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3045. },
  3046. args: [],
  3047. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  3048. referencedClasses: [],
  3049. messageSends: []
  3050. }),
  3051. $globals.Date);
  3052. $core.addMethod(
  3053. $core.method({
  3054. selector: "milliseconds:",
  3055. protocol: 'accessing',
  3056. fn: function (aNumber){
  3057. var self=this;
  3058. return $core.withContext(function($ctx1) {
  3059. self.setMilliseconds(aNumber);
  3060. return self;
  3061. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3062. },
  3063. args: ["aNumber"],
  3064. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3065. referencedClasses: [],
  3066. messageSends: []
  3067. }),
  3068. $globals.Date);
  3069. $core.addMethod(
  3070. $core.method({
  3071. selector: "minutes",
  3072. protocol: 'accessing',
  3073. fn: function (){
  3074. var self=this;
  3075. return $core.withContext(function($ctx1) {
  3076. return self.getMinutes();
  3077. return self;
  3078. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3079. },
  3080. args: [],
  3081. source: "minutes\x0a\x09<return self.getMinutes()>",
  3082. referencedClasses: [],
  3083. messageSends: []
  3084. }),
  3085. $globals.Date);
  3086. $core.addMethod(
  3087. $core.method({
  3088. selector: "minutes:",
  3089. protocol: 'accessing',
  3090. fn: function (aNumber){
  3091. var self=this;
  3092. return $core.withContext(function($ctx1) {
  3093. self.setMinutes(aNumber);
  3094. return self;
  3095. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3096. },
  3097. args: ["aNumber"],
  3098. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3099. referencedClasses: [],
  3100. messageSends: []
  3101. }),
  3102. $globals.Date);
  3103. $core.addMethod(
  3104. $core.method({
  3105. selector: "month",
  3106. protocol: 'accessing',
  3107. fn: function (){
  3108. var self=this;
  3109. return $core.withContext(function($ctx1) {
  3110. return self.getMonth() + 1;
  3111. return self;
  3112. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3113. },
  3114. args: [],
  3115. source: "month\x0a\x09<return self.getMonth() + 1>",
  3116. referencedClasses: [],
  3117. messageSends: []
  3118. }),
  3119. $globals.Date);
  3120. $core.addMethod(
  3121. $core.method({
  3122. selector: "month:",
  3123. protocol: 'accessing',
  3124. fn: function (aNumber){
  3125. var self=this;
  3126. return $core.withContext(function($ctx1) {
  3127. self.setMonth(aNumber - 1);
  3128. return self;
  3129. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3130. },
  3131. args: ["aNumber"],
  3132. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3133. referencedClasses: [],
  3134. messageSends: []
  3135. }),
  3136. $globals.Date);
  3137. $core.addMethod(
  3138. $core.method({
  3139. selector: "printOn:",
  3140. protocol: 'printing',
  3141. fn: function (aStream){
  3142. var self=this;
  3143. return $core.withContext(function($ctx1) {
  3144. $recv(aStream)._nextPutAll_(self._asString());
  3145. return self;
  3146. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3147. },
  3148. args: ["aStream"],
  3149. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3150. referencedClasses: [],
  3151. messageSends: ["nextPutAll:", "asString"]
  3152. }),
  3153. $globals.Date);
  3154. $core.addMethod(
  3155. $core.method({
  3156. selector: "seconds",
  3157. protocol: 'accessing',
  3158. fn: function (){
  3159. var self=this;
  3160. return $core.withContext(function($ctx1) {
  3161. return self.getSeconds();
  3162. return self;
  3163. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3164. },
  3165. args: [],
  3166. source: "seconds\x0a\x09<return self.getSeconds()>",
  3167. referencedClasses: [],
  3168. messageSends: []
  3169. }),
  3170. $globals.Date);
  3171. $core.addMethod(
  3172. $core.method({
  3173. selector: "seconds:",
  3174. protocol: 'accessing',
  3175. fn: function (aNumber){
  3176. var self=this;
  3177. return $core.withContext(function($ctx1) {
  3178. self.setSeconds(aNumber);
  3179. return self;
  3180. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3181. },
  3182. args: ["aNumber"],
  3183. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3184. referencedClasses: [],
  3185. messageSends: []
  3186. }),
  3187. $globals.Date);
  3188. $core.addMethod(
  3189. $core.method({
  3190. selector: "time",
  3191. protocol: 'accessing',
  3192. fn: function (){
  3193. var self=this;
  3194. return $core.withContext(function($ctx1) {
  3195. return self.getTime();
  3196. return self;
  3197. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3198. },
  3199. args: [],
  3200. source: "time\x0a\x09<return self.getTime()>",
  3201. referencedClasses: [],
  3202. messageSends: []
  3203. }),
  3204. $globals.Date);
  3205. $core.addMethod(
  3206. $core.method({
  3207. selector: "time:",
  3208. protocol: 'accessing',
  3209. fn: function (aNumber){
  3210. var self=this;
  3211. return $core.withContext(function($ctx1) {
  3212. self.setTime(aNumber);
  3213. return self;
  3214. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3215. },
  3216. args: ["aNumber"],
  3217. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3218. referencedClasses: [],
  3219. messageSends: []
  3220. }),
  3221. $globals.Date);
  3222. $core.addMethod(
  3223. $core.method({
  3224. selector: "year",
  3225. protocol: 'accessing',
  3226. fn: function (){
  3227. var self=this;
  3228. return $core.withContext(function($ctx1) {
  3229. return self.getFullYear();
  3230. return self;
  3231. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3232. },
  3233. args: [],
  3234. source: "year\x0a\x09<return self.getFullYear()>",
  3235. referencedClasses: [],
  3236. messageSends: []
  3237. }),
  3238. $globals.Date);
  3239. $core.addMethod(
  3240. $core.method({
  3241. selector: "year:",
  3242. protocol: 'accessing',
  3243. fn: function (aNumber){
  3244. var self=this;
  3245. return $core.withContext(function($ctx1) {
  3246. self.setFullYear(aNumber);
  3247. return self;
  3248. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  3249. },
  3250. args: ["aNumber"],
  3251. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3252. referencedClasses: [],
  3253. messageSends: []
  3254. }),
  3255. $globals.Date);
  3256. $core.addMethod(
  3257. $core.method({
  3258. selector: "classTag",
  3259. protocol: 'accessing',
  3260. fn: function (){
  3261. var self=this;
  3262. return "magnitude";
  3263. },
  3264. args: [],
  3265. 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'",
  3266. referencedClasses: [],
  3267. messageSends: []
  3268. }),
  3269. $globals.Date.klass);
  3270. $core.addMethod(
  3271. $core.method({
  3272. selector: "fromMilliseconds:",
  3273. protocol: 'instance creation',
  3274. fn: function (aNumber){
  3275. var self=this;
  3276. return $core.withContext(function($ctx1) {
  3277. var $1;
  3278. $1=self._new_(aNumber);
  3279. return $1;
  3280. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  3281. },
  3282. args: ["aNumber"],
  3283. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3284. referencedClasses: [],
  3285. messageSends: ["new:"]
  3286. }),
  3287. $globals.Date.klass);
  3288. $core.addMethod(
  3289. $core.method({
  3290. selector: "fromSeconds:",
  3291. protocol: 'instance creation',
  3292. fn: function (aNumber){
  3293. var self=this;
  3294. return $core.withContext(function($ctx1) {
  3295. var $1;
  3296. $1=self._fromMilliseconds_($recv(aNumber).__star((1000)));
  3297. return $1;
  3298. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  3299. },
  3300. args: ["aNumber"],
  3301. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3302. referencedClasses: [],
  3303. messageSends: ["fromMilliseconds:", "*"]
  3304. }),
  3305. $globals.Date.klass);
  3306. $core.addMethod(
  3307. $core.method({
  3308. selector: "fromString:",
  3309. protocol: 'instance creation',
  3310. fn: function (aString){
  3311. var self=this;
  3312. return $core.withContext(function($ctx1) {
  3313. var $1;
  3314. $1=self._new_(aString);
  3315. return $1;
  3316. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  3317. },
  3318. args: ["aString"],
  3319. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3320. referencedClasses: [],
  3321. messageSends: ["new:"]
  3322. }),
  3323. $globals.Date.klass);
  3324. $core.addMethod(
  3325. $core.method({
  3326. selector: "millisecondsToRun:",
  3327. protocol: 'instance creation',
  3328. fn: function (aBlock){
  3329. var self=this;
  3330. var t;
  3331. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  3332. return $core.withContext(function($ctx1) {
  3333. var $1;
  3334. t=$recv($Date())._now();
  3335. $ctx1.sendIdx["now"]=1;
  3336. $recv(aBlock)._value();
  3337. $1=$recv($recv($Date())._now()).__minus(t);
  3338. return $1;
  3339. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  3340. },
  3341. args: ["aBlock"],
  3342. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3343. referencedClasses: ["Date"],
  3344. messageSends: ["now", "value", "-"]
  3345. }),
  3346. $globals.Date.klass);
  3347. $core.addMethod(
  3348. $core.method({
  3349. selector: "new:",
  3350. protocol: 'instance creation',
  3351. fn: function (anObject){
  3352. var self=this;
  3353. return $core.withContext(function($ctx1) {
  3354. return new Date(anObject);
  3355. return self;
  3356. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  3357. },
  3358. args: ["anObject"],
  3359. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3360. referencedClasses: [],
  3361. messageSends: []
  3362. }),
  3363. $globals.Date.klass);
  3364. $core.addMethod(
  3365. $core.method({
  3366. selector: "now",
  3367. protocol: 'instance creation',
  3368. fn: function (){
  3369. var self=this;
  3370. return $core.withContext(function($ctx1) {
  3371. var $1;
  3372. $1=self._today();
  3373. return $1;
  3374. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  3375. },
  3376. args: [],
  3377. source: "now\x0a\x09^ self today",
  3378. referencedClasses: [],
  3379. messageSends: ["today"]
  3380. }),
  3381. $globals.Date.klass);
  3382. $core.addMethod(
  3383. $core.method({
  3384. selector: "today",
  3385. protocol: 'instance creation',
  3386. fn: function (){
  3387. var self=this;
  3388. return $core.withContext(function($ctx1) {
  3389. var $1;
  3390. $1=self._new();
  3391. return $1;
  3392. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  3393. },
  3394. args: [],
  3395. source: "today\x0a\x09^ self new",
  3396. referencedClasses: [],
  3397. messageSends: ["new"]
  3398. }),
  3399. $globals.Date.klass);
  3400. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  3401. $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 ].";
  3402. $core.addMethod(
  3403. $core.method({
  3404. selector: "&",
  3405. protocol: 'converting',
  3406. fn: function (aNumber){
  3407. var self=this;
  3408. return $core.withContext(function($ctx1) {
  3409. return self & aNumber;
  3410. return self;
  3411. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  3412. },
  3413. args: ["aNumber"],
  3414. source: "& aNumber\x0a\x09<return self & aNumber>",
  3415. referencedClasses: [],
  3416. messageSends: []
  3417. }),
  3418. $globals.Number);
  3419. $core.addMethod(
  3420. $core.method({
  3421. selector: "*",
  3422. protocol: 'arithmetic',
  3423. fn: function (aNumber){
  3424. var self=this;
  3425. return $core.withContext(function($ctx1) {
  3426. return self * aNumber;
  3427. return self;
  3428. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  3429. },
  3430. args: ["aNumber"],
  3431. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3432. referencedClasses: [],
  3433. messageSends: []
  3434. }),
  3435. $globals.Number);
  3436. $core.addMethod(
  3437. $core.method({
  3438. selector: "**",
  3439. protocol: 'mathematical functions',
  3440. fn: function (exponent){
  3441. var self=this;
  3442. return $core.withContext(function($ctx1) {
  3443. var $1;
  3444. $1=self._raisedTo_(exponent);
  3445. return $1;
  3446. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  3447. },
  3448. args: ["exponent"],
  3449. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  3450. referencedClasses: [],
  3451. messageSends: ["raisedTo:"]
  3452. }),
  3453. $globals.Number);
  3454. $core.addMethod(
  3455. $core.method({
  3456. selector: "+",
  3457. protocol: 'arithmetic',
  3458. fn: function (aNumber){
  3459. var self=this;
  3460. return $core.withContext(function($ctx1) {
  3461. return self + aNumber;
  3462. return self;
  3463. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  3464. },
  3465. args: ["aNumber"],
  3466. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3467. referencedClasses: [],
  3468. messageSends: []
  3469. }),
  3470. $globals.Number);
  3471. $core.addMethod(
  3472. $core.method({
  3473. selector: "-",
  3474. protocol: 'arithmetic',
  3475. fn: function (aNumber){
  3476. var self=this;
  3477. return $core.withContext(function($ctx1) {
  3478. return self - aNumber;
  3479. return self;
  3480. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  3481. },
  3482. args: ["aNumber"],
  3483. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3484. referencedClasses: [],
  3485. messageSends: []
  3486. }),
  3487. $globals.Number);
  3488. $core.addMethod(
  3489. $core.method({
  3490. selector: "/",
  3491. protocol: 'arithmetic',
  3492. fn: function (aNumber){
  3493. var self=this;
  3494. return $core.withContext(function($ctx1) {
  3495. return self / aNumber;
  3496. return self;
  3497. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  3498. },
  3499. args: ["aNumber"],
  3500. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3501. referencedClasses: [],
  3502. messageSends: []
  3503. }),
  3504. $globals.Number);
  3505. $core.addMethod(
  3506. $core.method({
  3507. selector: "//",
  3508. protocol: 'arithmetic',
  3509. fn: function (aNumber){
  3510. var self=this;
  3511. return $core.withContext(function($ctx1) {
  3512. var $1;
  3513. $1=$recv(self.__slash(aNumber))._floor();
  3514. return $1;
  3515. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  3516. },
  3517. args: ["aNumber"],
  3518. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  3519. referencedClasses: [],
  3520. messageSends: ["floor", "/"]
  3521. }),
  3522. $globals.Number);
  3523. $core.addMethod(
  3524. $core.method({
  3525. selector: "<",
  3526. protocol: 'comparing',
  3527. fn: function (aNumber){
  3528. var self=this;
  3529. return $core.withContext(function($ctx1) {
  3530. return self < aNumber;
  3531. return self;
  3532. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  3533. },
  3534. args: ["aNumber"],
  3535. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3536. referencedClasses: [],
  3537. messageSends: []
  3538. }),
  3539. $globals.Number);
  3540. $core.addMethod(
  3541. $core.method({
  3542. selector: "<=",
  3543. protocol: 'comparing',
  3544. fn: function (aNumber){
  3545. var self=this;
  3546. return $core.withContext(function($ctx1) {
  3547. return self <= aNumber;
  3548. return self;
  3549. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  3550. },
  3551. args: ["aNumber"],
  3552. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3553. referencedClasses: [],
  3554. messageSends: []
  3555. }),
  3556. $globals.Number);
  3557. $core.addMethod(
  3558. $core.method({
  3559. selector: "==",
  3560. protocol: 'comparing',
  3561. fn: function (aNumber){
  3562. var self=this;
  3563. return $core.withContext(function($ctx1) {
  3564. return aNumber != null && Number(self) === (typeof aNumber === "number" ? aNumber : aNumber.valueOf());
  3565. return self;
  3566. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  3567. },
  3568. args: ["aNumber"],
  3569. source: "== aNumber\x0a<return aNumber != null && Number(self) === (typeof aNumber === \x22number\x22 ? aNumber : aNumber.valueOf())>",
  3570. referencedClasses: [],
  3571. messageSends: []
  3572. }),
  3573. $globals.Number);
  3574. $core.addMethod(
  3575. $core.method({
  3576. selector: ">",
  3577. protocol: 'comparing',
  3578. fn: function (aNumber){
  3579. var self=this;
  3580. return $core.withContext(function($ctx1) {
  3581. return self > aNumber;
  3582. return self;
  3583. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  3584. },
  3585. args: ["aNumber"],
  3586. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3587. referencedClasses: [],
  3588. messageSends: []
  3589. }),
  3590. $globals.Number);
  3591. $core.addMethod(
  3592. $core.method({
  3593. selector: ">=",
  3594. protocol: 'comparing',
  3595. fn: function (aNumber){
  3596. var self=this;
  3597. return $core.withContext(function($ctx1) {
  3598. return self >= aNumber;
  3599. return self;
  3600. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  3601. },
  3602. args: ["aNumber"],
  3603. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3604. referencedClasses: [],
  3605. messageSends: []
  3606. }),
  3607. $globals.Number);
  3608. $core.addMethod(
  3609. $core.method({
  3610. selector: "@",
  3611. protocol: 'converting',
  3612. fn: function (aNumber){
  3613. var self=this;
  3614. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3615. return $core.withContext(function($ctx1) {
  3616. var $1;
  3617. $1=$recv($Point())._x_y_(self,aNumber);
  3618. return $1;
  3619. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  3620. },
  3621. args: ["aNumber"],
  3622. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  3623. referencedClasses: ["Point"],
  3624. messageSends: ["x:y:"]
  3625. }),
  3626. $globals.Number);
  3627. $core.addMethod(
  3628. $core.method({
  3629. selector: "\x5c\x5c",
  3630. protocol: 'arithmetic',
  3631. fn: function (aNumber){
  3632. var self=this;
  3633. return $core.withContext(function($ctx1) {
  3634. return self % aNumber;
  3635. return self;
  3636. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  3637. },
  3638. args: ["aNumber"],
  3639. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3640. referencedClasses: [],
  3641. messageSends: []
  3642. }),
  3643. $globals.Number);
  3644. $core.addMethod(
  3645. $core.method({
  3646. selector: "abs",
  3647. protocol: 'arithmetic',
  3648. fn: function (){
  3649. var self=this;
  3650. return $core.withContext(function($ctx1) {
  3651. return Math.abs(self);;
  3652. return self;
  3653. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  3654. },
  3655. args: [],
  3656. source: "abs\x0a\x09<return Math.abs(self);>",
  3657. referencedClasses: [],
  3658. messageSends: []
  3659. }),
  3660. $globals.Number);
  3661. $core.addMethod(
  3662. $core.method({
  3663. selector: "arcCos",
  3664. protocol: 'mathematical functions',
  3665. fn: function (){
  3666. var self=this;
  3667. return $core.withContext(function($ctx1) {
  3668. return Math.acos(self);;
  3669. return self;
  3670. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  3671. },
  3672. args: [],
  3673. source: "arcCos\x0a\x09<return Math.acos(self);>",
  3674. referencedClasses: [],
  3675. messageSends: []
  3676. }),
  3677. $globals.Number);
  3678. $core.addMethod(
  3679. $core.method({
  3680. selector: "arcSin",
  3681. protocol: 'mathematical functions',
  3682. fn: function (){
  3683. var self=this;
  3684. return $core.withContext(function($ctx1) {
  3685. return Math.asin(self);;
  3686. return self;
  3687. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  3688. },
  3689. args: [],
  3690. source: "arcSin\x0a\x09<return Math.asin(self);>",
  3691. referencedClasses: [],
  3692. messageSends: []
  3693. }),
  3694. $globals.Number);
  3695. $core.addMethod(
  3696. $core.method({
  3697. selector: "arcTan",
  3698. protocol: 'mathematical functions',
  3699. fn: function (){
  3700. var self=this;
  3701. return $core.withContext(function($ctx1) {
  3702. return Math.atan(self);;
  3703. return self;
  3704. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  3705. },
  3706. args: [],
  3707. source: "arcTan\x0a\x09<return Math.atan(self);>",
  3708. referencedClasses: [],
  3709. messageSends: []
  3710. }),
  3711. $globals.Number);
  3712. $core.addMethod(
  3713. $core.method({
  3714. selector: "asJSON",
  3715. protocol: 'converting',
  3716. fn: function (){
  3717. var self=this;
  3718. return self;
  3719. },
  3720. args: [],
  3721. source: "asJSON\x0a\x09^ self",
  3722. referencedClasses: [],
  3723. messageSends: []
  3724. }),
  3725. $globals.Number);
  3726. $core.addMethod(
  3727. $core.method({
  3728. selector: "asJavascript",
  3729. protocol: 'converting',
  3730. fn: function (){
  3731. var self=this;
  3732. return $core.withContext(function($ctx1) {
  3733. var $1;
  3734. $1=$recv("(".__comma(self._printString())).__comma(")");
  3735. $ctx1.sendIdx[","]=1;
  3736. return $1;
  3737. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  3738. },
  3739. args: [],
  3740. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  3741. referencedClasses: [],
  3742. messageSends: [",", "printString"]
  3743. }),
  3744. $globals.Number);
  3745. $core.addMethod(
  3746. $core.method({
  3747. selector: "asNumber",
  3748. protocol: 'converting',
  3749. fn: function (){
  3750. var self=this;
  3751. return self;
  3752. },
  3753. args: [],
  3754. source: "asNumber\x0a\x09^ self",
  3755. referencedClasses: [],
  3756. messageSends: []
  3757. }),
  3758. $globals.Number);
  3759. $core.addMethod(
  3760. $core.method({
  3761. selector: "asPoint",
  3762. protocol: 'converting',
  3763. fn: function (){
  3764. var self=this;
  3765. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3766. return $core.withContext(function($ctx1) {
  3767. var $1;
  3768. $1=$recv($Point())._x_y_(self,self);
  3769. return $1;
  3770. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  3771. },
  3772. args: [],
  3773. source: "asPoint\x0a\x09^ Point x: self y: self",
  3774. referencedClasses: ["Point"],
  3775. messageSends: ["x:y:"]
  3776. }),
  3777. $globals.Number);
  3778. $core.addMethod(
  3779. $core.method({
  3780. selector: "asString",
  3781. protocol: 'converting',
  3782. fn: function (){
  3783. var self=this;
  3784. return $core.withContext(function($ctx1) {
  3785. return String(self) ;
  3786. return self;
  3787. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  3788. },
  3789. args: [],
  3790. source: "asString\x0a\x09< return String(self) >",
  3791. referencedClasses: [],
  3792. messageSends: []
  3793. }),
  3794. $globals.Number);
  3795. $core.addMethod(
  3796. $core.method({
  3797. selector: "atRandom",
  3798. protocol: 'converting',
  3799. fn: function (){
  3800. var self=this;
  3801. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  3802. return $core.withContext(function($ctx1) {
  3803. var $1;
  3804. $1=$recv($recv($recv($recv($recv($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  3805. return $1;
  3806. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  3807. },
  3808. args: [],
  3809. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  3810. referencedClasses: ["Random"],
  3811. messageSends: ["+", "truncated", "*", "next", "new"]
  3812. }),
  3813. $globals.Number);
  3814. $core.addMethod(
  3815. $core.method({
  3816. selector: "ceiling",
  3817. protocol: 'converting',
  3818. fn: function (){
  3819. var self=this;
  3820. return $core.withContext(function($ctx1) {
  3821. return Math.ceil(self);;
  3822. return self;
  3823. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  3824. },
  3825. args: [],
  3826. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  3827. referencedClasses: [],
  3828. messageSends: []
  3829. }),
  3830. $globals.Number);
  3831. $core.addMethod(
  3832. $core.method({
  3833. selector: "copy",
  3834. protocol: 'copying',
  3835. fn: function (){
  3836. var self=this;
  3837. return self;
  3838. },
  3839. args: [],
  3840. source: "copy\x0a\x09^ self",
  3841. referencedClasses: [],
  3842. messageSends: []
  3843. }),
  3844. $globals.Number);
  3845. $core.addMethod(
  3846. $core.method({
  3847. selector: "cos",
  3848. protocol: 'mathematical functions',
  3849. fn: function (){
  3850. var self=this;
  3851. return $core.withContext(function($ctx1) {
  3852. return Math.cos(self);;
  3853. return self;
  3854. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  3855. },
  3856. args: [],
  3857. source: "cos\x0a\x09<return Math.cos(self);>",
  3858. referencedClasses: [],
  3859. messageSends: []
  3860. }),
  3861. $globals.Number);
  3862. $core.addMethod(
  3863. $core.method({
  3864. selector: "deepCopy",
  3865. protocol: 'copying',
  3866. fn: function (){
  3867. var self=this;
  3868. return $core.withContext(function($ctx1) {
  3869. var $1;
  3870. $1=self._copy();
  3871. return $1;
  3872. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  3873. },
  3874. args: [],
  3875. source: "deepCopy\x0a\x09^ self copy",
  3876. referencedClasses: [],
  3877. messageSends: ["copy"]
  3878. }),
  3879. $globals.Number);
  3880. $core.addMethod(
  3881. $core.method({
  3882. selector: "even",
  3883. protocol: 'testing',
  3884. fn: function (){
  3885. var self=this;
  3886. return $core.withContext(function($ctx1) {
  3887. var $1;
  3888. $1=(0).__eq(self.__backslash_backslash((2)));
  3889. return $1;
  3890. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  3891. },
  3892. args: [],
  3893. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3894. referencedClasses: [],
  3895. messageSends: ["=", "\x5c\x5c"]
  3896. }),
  3897. $globals.Number);
  3898. $core.addMethod(
  3899. $core.method({
  3900. selector: "floor",
  3901. protocol: 'converting',
  3902. fn: function (){
  3903. var self=this;
  3904. return $core.withContext(function($ctx1) {
  3905. return Math.floor(self);;
  3906. return self;
  3907. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  3908. },
  3909. args: [],
  3910. source: "floor\x0a\x09<return Math.floor(self);>",
  3911. referencedClasses: [],
  3912. messageSends: []
  3913. }),
  3914. $globals.Number);
  3915. $core.addMethod(
  3916. $core.method({
  3917. selector: "isImmutable",
  3918. protocol: 'testing',
  3919. fn: function (){
  3920. var self=this;
  3921. return true;
  3922. },
  3923. args: [],
  3924. source: "isImmutable\x0a\x09^ true",
  3925. referencedClasses: [],
  3926. messageSends: []
  3927. }),
  3928. $globals.Number);
  3929. $core.addMethod(
  3930. $core.method({
  3931. selector: "isNumber",
  3932. protocol: 'testing',
  3933. fn: function (){
  3934. var self=this;
  3935. return true;
  3936. },
  3937. args: [],
  3938. source: "isNumber\x0a\x09^ true",
  3939. referencedClasses: [],
  3940. messageSends: []
  3941. }),
  3942. $globals.Number);
  3943. $core.addMethod(
  3944. $core.method({
  3945. selector: "isZero",
  3946. protocol: 'testing',
  3947. fn: function (){
  3948. var self=this;
  3949. return $core.withContext(function($ctx1) {
  3950. var $1;
  3951. $1=self.__eq((0));
  3952. return $1;
  3953. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  3954. },
  3955. args: [],
  3956. source: "isZero\x0a\x09^ self = 0",
  3957. referencedClasses: [],
  3958. messageSends: ["="]
  3959. }),
  3960. $globals.Number);
  3961. $core.addMethod(
  3962. $core.method({
  3963. selector: "ln",
  3964. protocol: 'mathematical functions',
  3965. fn: function (){
  3966. var self=this;
  3967. return $core.withContext(function($ctx1) {
  3968. return Math.log(self);;
  3969. return self;
  3970. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  3971. },
  3972. args: [],
  3973. source: "ln\x0a\x09<return Math.log(self);>",
  3974. referencedClasses: [],
  3975. messageSends: []
  3976. }),
  3977. $globals.Number);
  3978. $core.addMethod(
  3979. $core.method({
  3980. selector: "log",
  3981. protocol: 'mathematical functions',
  3982. fn: function (){
  3983. var self=this;
  3984. return $core.withContext(function($ctx1) {
  3985. return Math.log(self) / Math.LN10;;
  3986. return self;
  3987. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  3988. },
  3989. args: [],
  3990. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  3991. referencedClasses: [],
  3992. messageSends: []
  3993. }),
  3994. $globals.Number);
  3995. $core.addMethod(
  3996. $core.method({
  3997. selector: "log:",
  3998. protocol: 'mathematical functions',
  3999. fn: function (aNumber){
  4000. var self=this;
  4001. return $core.withContext(function($ctx1) {
  4002. return Math.log(self) / Math.log(aNumber);;
  4003. return self;
  4004. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4005. },
  4006. args: ["aNumber"],
  4007. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  4008. referencedClasses: [],
  4009. messageSends: []
  4010. }),
  4011. $globals.Number);
  4012. $core.addMethod(
  4013. $core.method({
  4014. selector: "max:",
  4015. protocol: 'arithmetic',
  4016. fn: function (aNumber){
  4017. var self=this;
  4018. return $core.withContext(function($ctx1) {
  4019. return Math.max(self, aNumber);;
  4020. return self;
  4021. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4022. },
  4023. args: ["aNumber"],
  4024. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  4025. referencedClasses: [],
  4026. messageSends: []
  4027. }),
  4028. $globals.Number);
  4029. $core.addMethod(
  4030. $core.method({
  4031. selector: "min:",
  4032. protocol: 'arithmetic',
  4033. fn: function (aNumber){
  4034. var self=this;
  4035. return $core.withContext(function($ctx1) {
  4036. return Math.min(self, aNumber);;
  4037. return self;
  4038. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4039. },
  4040. args: ["aNumber"],
  4041. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  4042. referencedClasses: [],
  4043. messageSends: []
  4044. }),
  4045. $globals.Number);
  4046. $core.addMethod(
  4047. $core.method({
  4048. selector: "negated",
  4049. protocol: 'arithmetic',
  4050. fn: function (){
  4051. var self=this;
  4052. return $core.withContext(function($ctx1) {
  4053. var $1;
  4054. $1=(0).__minus(self);
  4055. return $1;
  4056. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4057. },
  4058. args: [],
  4059. source: "negated\x0a\x09^ 0 - self",
  4060. referencedClasses: [],
  4061. messageSends: ["-"]
  4062. }),
  4063. $globals.Number);
  4064. $core.addMethod(
  4065. $core.method({
  4066. selector: "negative",
  4067. protocol: 'testing',
  4068. fn: function (){
  4069. var self=this;
  4070. return $core.withContext(function($ctx1) {
  4071. var $1;
  4072. $1=self.__lt((0));
  4073. return $1;
  4074. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4075. },
  4076. args: [],
  4077. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4078. referencedClasses: [],
  4079. messageSends: ["<"]
  4080. }),
  4081. $globals.Number);
  4082. $core.addMethod(
  4083. $core.method({
  4084. selector: "odd",
  4085. protocol: 'testing',
  4086. fn: function (){
  4087. var self=this;
  4088. return $core.withContext(function($ctx1) {
  4089. var $1;
  4090. $1=$recv(self._even())._not();
  4091. return $1;
  4092. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4093. },
  4094. args: [],
  4095. source: "odd\x0a\x09^ self even not",
  4096. referencedClasses: [],
  4097. messageSends: ["not", "even"]
  4098. }),
  4099. $globals.Number);
  4100. $core.addMethod(
  4101. $core.method({
  4102. selector: "positive",
  4103. protocol: 'testing',
  4104. fn: function (){
  4105. var self=this;
  4106. return $core.withContext(function($ctx1) {
  4107. var $1;
  4108. $1=self.__gt_eq((0));
  4109. return $1;
  4110. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4111. },
  4112. args: [],
  4113. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4114. referencedClasses: [],
  4115. messageSends: [">="]
  4116. }),
  4117. $globals.Number);
  4118. $core.addMethod(
  4119. $core.method({
  4120. selector: "printOn:",
  4121. protocol: 'printing',
  4122. fn: function (aStream){
  4123. var self=this;
  4124. return $core.withContext(function($ctx1) {
  4125. $recv(aStream)._nextPutAll_(self._asString());
  4126. return self;
  4127. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4128. },
  4129. args: ["aStream"],
  4130. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4131. referencedClasses: [],
  4132. messageSends: ["nextPutAll:", "asString"]
  4133. }),
  4134. $globals.Number);
  4135. $core.addMethod(
  4136. $core.method({
  4137. selector: "printShowingDecimalPlaces:",
  4138. protocol: 'printing',
  4139. fn: function (placesDesired){
  4140. var self=this;
  4141. return $core.withContext(function($ctx1) {
  4142. return self.toFixed(placesDesired);
  4143. return self;
  4144. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4145. },
  4146. args: ["placesDesired"],
  4147. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4148. referencedClasses: [],
  4149. messageSends: []
  4150. }),
  4151. $globals.Number);
  4152. $core.addMethod(
  4153. $core.method({
  4154. selector: "raisedTo:",
  4155. protocol: 'mathematical functions',
  4156. fn: function (exponent){
  4157. var self=this;
  4158. return $core.withContext(function($ctx1) {
  4159. return Math.pow(self, exponent);;
  4160. return self;
  4161. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4162. },
  4163. args: ["exponent"],
  4164. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4165. referencedClasses: [],
  4166. messageSends: []
  4167. }),
  4168. $globals.Number);
  4169. $core.addMethod(
  4170. $core.method({
  4171. selector: "rounded",
  4172. protocol: 'converting',
  4173. fn: function (){
  4174. var self=this;
  4175. return $core.withContext(function($ctx1) {
  4176. return Math.round(self);;
  4177. return self;
  4178. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4179. },
  4180. args: [],
  4181. source: "rounded\x0a\x09<return Math.round(self);>",
  4182. referencedClasses: [],
  4183. messageSends: []
  4184. }),
  4185. $globals.Number);
  4186. $core.addMethod(
  4187. $core.method({
  4188. selector: "sign",
  4189. protocol: 'mathematical functions',
  4190. fn: function (){
  4191. var self=this;
  4192. return $core.withContext(function($ctx1) {
  4193. var $1,$2;
  4194. $1=self._isZero();
  4195. if($core.assert($1)){
  4196. return (0);
  4197. };
  4198. $2=self._positive();
  4199. if($core.assert($2)){
  4200. return (1);
  4201. } else {
  4202. return (-1);
  4203. };
  4204. return self;
  4205. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4206. },
  4207. args: [],
  4208. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4209. referencedClasses: [],
  4210. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4211. }),
  4212. $globals.Number);
  4213. $core.addMethod(
  4214. $core.method({
  4215. selector: "sin",
  4216. protocol: 'mathematical functions',
  4217. fn: function (){
  4218. var self=this;
  4219. return $core.withContext(function($ctx1) {
  4220. return Math.sin(self);;
  4221. return self;
  4222. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4223. },
  4224. args: [],
  4225. source: "sin\x0a\x09<return Math.sin(self);>",
  4226. referencedClasses: [],
  4227. messageSends: []
  4228. }),
  4229. $globals.Number);
  4230. $core.addMethod(
  4231. $core.method({
  4232. selector: "sqrt",
  4233. protocol: 'mathematical functions',
  4234. fn: function (){
  4235. var self=this;
  4236. return $core.withContext(function($ctx1) {
  4237. return Math.sqrt(self);
  4238. return self;
  4239. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4240. },
  4241. args: [],
  4242. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4243. referencedClasses: [],
  4244. messageSends: []
  4245. }),
  4246. $globals.Number);
  4247. $core.addMethod(
  4248. $core.method({
  4249. selector: "squared",
  4250. protocol: 'mathematical functions',
  4251. fn: function (){
  4252. var self=this;
  4253. return $core.withContext(function($ctx1) {
  4254. var $1;
  4255. $1=self.__star(self);
  4256. return $1;
  4257. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4258. },
  4259. args: [],
  4260. source: "squared\x0a\x09^ self * self",
  4261. referencedClasses: [],
  4262. messageSends: ["*"]
  4263. }),
  4264. $globals.Number);
  4265. $core.addMethod(
  4266. $core.method({
  4267. selector: "tan",
  4268. protocol: 'mathematical functions',
  4269. fn: function (){
  4270. var self=this;
  4271. return $core.withContext(function($ctx1) {
  4272. return Math.tan(self);;
  4273. return self;
  4274. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4275. },
  4276. args: [],
  4277. source: "tan\x0a\x09<return Math.tan(self);>",
  4278. referencedClasses: [],
  4279. messageSends: []
  4280. }),
  4281. $globals.Number);
  4282. $core.addMethod(
  4283. $core.method({
  4284. selector: "timesRepeat:",
  4285. protocol: 'enumerating',
  4286. fn: function (aBlock){
  4287. var self=this;
  4288. var count;
  4289. return $core.withContext(function($ctx1) {
  4290. count=(1);
  4291. $recv((function(){
  4292. return $core.withContext(function($ctx2) {
  4293. return $recv(count).__gt(self);
  4294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4295. }))._whileFalse_((function(){
  4296. return $core.withContext(function($ctx2) {
  4297. $recv(aBlock)._value();
  4298. count=$recv(count).__plus((1));
  4299. return count;
  4300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4301. }));
  4302. return self;
  4303. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  4304. },
  4305. args: ["aBlock"],
  4306. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4307. referencedClasses: [],
  4308. messageSends: ["whileFalse:", ">", "value", "+"]
  4309. }),
  4310. $globals.Number);
  4311. $core.addMethod(
  4312. $core.method({
  4313. selector: "to:",
  4314. protocol: 'converting',
  4315. fn: function (aNumber){
  4316. var self=this;
  4317. var array,first,last,count;
  4318. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4319. return $core.withContext(function($ctx1) {
  4320. var $1;
  4321. first=self._truncated();
  4322. $ctx1.sendIdx["truncated"]=1;
  4323. last=$recv($recv(aNumber)._truncated()).__plus((1));
  4324. $ctx1.sendIdx["+"]=1;
  4325. count=(1);
  4326. array=$recv($Array())._new();
  4327. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  4328. return $core.withContext(function($ctx2) {
  4329. $recv(array)._at_put_(count,first);
  4330. count=$recv(count).__plus((1));
  4331. $ctx2.sendIdx["+"]=2;
  4332. count;
  4333. first=$recv(first).__plus((1));
  4334. return first;
  4335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4336. }));
  4337. $1=array;
  4338. return $1;
  4339. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  4340. },
  4341. args: ["aNumber"],
  4342. 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",
  4343. referencedClasses: ["Array"],
  4344. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  4345. }),
  4346. $globals.Number);
  4347. $core.addMethod(
  4348. $core.method({
  4349. selector: "to:by:",
  4350. protocol: 'converting',
  4351. fn: function (stop,step){
  4352. var self=this;
  4353. var array,value,pos;
  4354. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4355. return $core.withContext(function($ctx1) {
  4356. var $1,$2,$3;
  4357. value=self;
  4358. array=$recv($Array())._new();
  4359. pos=(1);
  4360. $1=$recv(step).__eq((0));
  4361. if($core.assert($1)){
  4362. self._error_("step must be non-zero");
  4363. };
  4364. $2=$recv(step).__lt((0));
  4365. if($core.assert($2)){
  4366. $recv((function(){
  4367. return $core.withContext(function($ctx2) {
  4368. return $recv(value).__gt_eq(stop);
  4369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4370. }))._whileTrue_((function(){
  4371. return $core.withContext(function($ctx2) {
  4372. $recv(array)._at_put_(pos,value);
  4373. $ctx2.sendIdx["at:put:"]=1;
  4374. pos=$recv(pos).__plus((1));
  4375. $ctx2.sendIdx["+"]=1;
  4376. pos;
  4377. value=$recv(value).__plus(step);
  4378. $ctx2.sendIdx["+"]=2;
  4379. return value;
  4380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4381. }));
  4382. $ctx1.sendIdx["whileTrue:"]=1;
  4383. } else {
  4384. $recv((function(){
  4385. return $core.withContext(function($ctx2) {
  4386. return $recv(value).__lt_eq(stop);
  4387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4388. }))._whileTrue_((function(){
  4389. return $core.withContext(function($ctx2) {
  4390. $recv(array)._at_put_(pos,value);
  4391. pos=$recv(pos).__plus((1));
  4392. $ctx2.sendIdx["+"]=3;
  4393. pos;
  4394. value=$recv(value).__plus(step);
  4395. return value;
  4396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4397. }));
  4398. };
  4399. $3=array;
  4400. return $3;
  4401. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  4402. },
  4403. args: ["stop", "step"],
  4404. 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",
  4405. referencedClasses: ["Array"],
  4406. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  4407. }),
  4408. $globals.Number);
  4409. $core.addMethod(
  4410. $core.method({
  4411. selector: "to:by:do:",
  4412. protocol: 'enumerating',
  4413. fn: function (stop,step,aBlock){
  4414. var self=this;
  4415. var value;
  4416. return $core.withContext(function($ctx1) {
  4417. var $1,$2;
  4418. value=self;
  4419. $1=$recv(step).__eq((0));
  4420. if($core.assert($1)){
  4421. self._error_("step must be non-zero");
  4422. };
  4423. $2=$recv(step).__lt((0));
  4424. if($core.assert($2)){
  4425. $recv((function(){
  4426. return $core.withContext(function($ctx2) {
  4427. return $recv(value).__gt_eq(stop);
  4428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4429. }))._whileTrue_((function(){
  4430. return $core.withContext(function($ctx2) {
  4431. $recv(aBlock)._value_(value);
  4432. $ctx2.sendIdx["value:"]=1;
  4433. value=$recv(value).__plus(step);
  4434. $ctx2.sendIdx["+"]=1;
  4435. return value;
  4436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4437. }));
  4438. $ctx1.sendIdx["whileTrue:"]=1;
  4439. } else {
  4440. $recv((function(){
  4441. return $core.withContext(function($ctx2) {
  4442. return $recv(value).__lt_eq(stop);
  4443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4444. }))._whileTrue_((function(){
  4445. return $core.withContext(function($ctx2) {
  4446. $recv(aBlock)._value_(value);
  4447. value=$recv(value).__plus(step);
  4448. return value;
  4449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4450. }));
  4451. };
  4452. return self;
  4453. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  4454. },
  4455. args: ["stop", "step", "aBlock"],
  4456. 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 ]]",
  4457. referencedClasses: [],
  4458. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  4459. }),
  4460. $globals.Number);
  4461. $core.addMethod(
  4462. $core.method({
  4463. selector: "to:do:",
  4464. protocol: 'enumerating',
  4465. fn: function (stop,aBlock){
  4466. var self=this;
  4467. var nextValue;
  4468. return $core.withContext(function($ctx1) {
  4469. nextValue=self;
  4470. $recv((function(){
  4471. return $core.withContext(function($ctx2) {
  4472. return $recv(nextValue).__lt_eq(stop);
  4473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4474. }))._whileTrue_((function(){
  4475. return $core.withContext(function($ctx2) {
  4476. $recv(aBlock)._value_(nextValue);
  4477. nextValue=$recv(nextValue).__plus((1));
  4478. return nextValue;
  4479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4480. }));
  4481. return self;
  4482. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  4483. },
  4484. args: ["stop", "aBlock"],
  4485. 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 ]",
  4486. referencedClasses: [],
  4487. messageSends: ["whileTrue:", "<=", "value:", "+"]
  4488. }),
  4489. $globals.Number);
  4490. $core.addMethod(
  4491. $core.method({
  4492. selector: "truncated",
  4493. protocol: 'converting',
  4494. fn: function (){
  4495. var self=this;
  4496. return $core.withContext(function($ctx1) {
  4497. if(self >= 0) {
  4498. return Math.floor(self);
  4499. } else {
  4500. return Math.floor(self * (-1)) * (-1);
  4501. };
  4502. ;
  4503. return self;
  4504. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  4505. },
  4506. args: [],
  4507. 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>",
  4508. referencedClasses: [],
  4509. messageSends: []
  4510. }),
  4511. $globals.Number);
  4512. $core.addMethod(
  4513. $core.method({
  4514. selector: "|",
  4515. protocol: 'converting',
  4516. fn: function (aNumber){
  4517. var self=this;
  4518. return $core.withContext(function($ctx1) {
  4519. return self | aNumber;
  4520. return self;
  4521. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  4522. },
  4523. args: ["aNumber"],
  4524. source: "| aNumber\x0a\x09<return self | aNumber>",
  4525. referencedClasses: [],
  4526. messageSends: []
  4527. }),
  4528. $globals.Number);
  4529. $core.addMethod(
  4530. $core.method({
  4531. selector: "classTag",
  4532. protocol: 'accessing',
  4533. fn: function (){
  4534. var self=this;
  4535. return "magnitude";
  4536. },
  4537. args: [],
  4538. 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'",
  4539. referencedClasses: [],
  4540. messageSends: []
  4541. }),
  4542. $globals.Number.klass);
  4543. $core.addMethod(
  4544. $core.method({
  4545. selector: "e",
  4546. protocol: 'instance creation',
  4547. fn: function (){
  4548. var self=this;
  4549. return $core.withContext(function($ctx1) {
  4550. return Math.E;;
  4551. return self;
  4552. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  4553. },
  4554. args: [],
  4555. source: "e\x0a\x09<return Math.E;>",
  4556. referencedClasses: [],
  4557. messageSends: []
  4558. }),
  4559. $globals.Number.klass);
  4560. $core.addMethod(
  4561. $core.method({
  4562. selector: "pi",
  4563. protocol: 'instance creation',
  4564. fn: function (){
  4565. var self=this;
  4566. return $core.withContext(function($ctx1) {
  4567. return Math.PI;
  4568. return self;
  4569. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  4570. },
  4571. args: [],
  4572. source: "pi\x0a\x09<return Math.PI>",
  4573. referencedClasses: [],
  4574. messageSends: []
  4575. }),
  4576. $globals.Number.klass);
  4577. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  4578. $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";
  4579. $core.addMethod(
  4580. $core.method({
  4581. selector: "*",
  4582. protocol: 'arithmetic',
  4583. fn: function (aPoint){
  4584. var self=this;
  4585. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4586. return $core.withContext(function($ctx1) {
  4587. var $3,$5,$4,$2,$7,$6,$1;
  4588. $3=self._x();
  4589. $ctx1.sendIdx["x"]=1;
  4590. $5=$recv(aPoint)._asPoint();
  4591. $ctx1.sendIdx["asPoint"]=1;
  4592. $4=$recv($5)._x();
  4593. $2=$recv($3).__star($4);
  4594. $ctx1.sendIdx["*"]=1;
  4595. $7=self._y();
  4596. $ctx1.sendIdx["y"]=1;
  4597. $6=$recv($7).__star($recv($recv(aPoint)._asPoint())._y());
  4598. $1=$recv($Point())._x_y_($2,$6);
  4599. return $1;
  4600. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  4601. },
  4602. args: ["aPoint"],
  4603. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4604. referencedClasses: ["Point"],
  4605. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  4606. }),
  4607. $globals.Point);
  4608. $core.addMethod(
  4609. $core.method({
  4610. selector: "+",
  4611. protocol: 'arithmetic',
  4612. fn: function (aPoint){
  4613. var self=this;
  4614. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4615. return $core.withContext(function($ctx1) {
  4616. var $3,$5,$4,$2,$7,$6,$1;
  4617. $3=self._x();
  4618. $ctx1.sendIdx["x"]=1;
  4619. $5=$recv(aPoint)._asPoint();
  4620. $ctx1.sendIdx["asPoint"]=1;
  4621. $4=$recv($5)._x();
  4622. $2=$recv($3).__plus($4);
  4623. $ctx1.sendIdx["+"]=1;
  4624. $7=self._y();
  4625. $ctx1.sendIdx["y"]=1;
  4626. $6=$recv($7).__plus($recv($recv(aPoint)._asPoint())._y());
  4627. $1=$recv($Point())._x_y_($2,$6);
  4628. return $1;
  4629. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  4630. },
  4631. args: ["aPoint"],
  4632. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4633. referencedClasses: ["Point"],
  4634. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  4635. }),
  4636. $globals.Point);
  4637. $core.addMethod(
  4638. $core.method({
  4639. selector: "-",
  4640. protocol: 'arithmetic',
  4641. fn: function (aPoint){
  4642. var self=this;
  4643. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4644. return $core.withContext(function($ctx1) {
  4645. var $3,$5,$4,$2,$7,$6,$1;
  4646. $3=self._x();
  4647. $ctx1.sendIdx["x"]=1;
  4648. $5=$recv(aPoint)._asPoint();
  4649. $ctx1.sendIdx["asPoint"]=1;
  4650. $4=$recv($5)._x();
  4651. $2=$recv($3).__minus($4);
  4652. $ctx1.sendIdx["-"]=1;
  4653. $7=self._y();
  4654. $ctx1.sendIdx["y"]=1;
  4655. $6=$recv($7).__minus($recv($recv(aPoint)._asPoint())._y());
  4656. $1=$recv($Point())._x_y_($2,$6);
  4657. return $1;
  4658. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  4659. },
  4660. args: ["aPoint"],
  4661. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4662. referencedClasses: ["Point"],
  4663. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  4664. }),
  4665. $globals.Point);
  4666. $core.addMethod(
  4667. $core.method({
  4668. selector: "/",
  4669. protocol: 'arithmetic',
  4670. fn: function (aPoint){
  4671. var self=this;
  4672. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4673. return $core.withContext(function($ctx1) {
  4674. var $3,$5,$4,$2,$7,$6,$1;
  4675. $3=self._x();
  4676. $ctx1.sendIdx["x"]=1;
  4677. $5=$recv(aPoint)._asPoint();
  4678. $ctx1.sendIdx["asPoint"]=1;
  4679. $4=$recv($5)._x();
  4680. $2=$recv($3).__slash($4);
  4681. $ctx1.sendIdx["/"]=1;
  4682. $7=self._y();
  4683. $ctx1.sendIdx["y"]=1;
  4684. $6=$recv($7).__slash($recv($recv(aPoint)._asPoint())._y());
  4685. $1=$recv($Point())._x_y_($2,$6);
  4686. return $1;
  4687. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  4688. },
  4689. args: ["aPoint"],
  4690. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4691. referencedClasses: ["Point"],
  4692. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  4693. }),
  4694. $globals.Point);
  4695. $core.addMethod(
  4696. $core.method({
  4697. selector: "<",
  4698. protocol: 'comparing',
  4699. fn: function (aPoint){
  4700. var self=this;
  4701. return $core.withContext(function($ctx1) {
  4702. var $3,$2,$4,$1;
  4703. $3=self._x();
  4704. $ctx1.sendIdx["x"]=1;
  4705. $2=$recv($3).__lt($recv(aPoint)._x());
  4706. $ctx1.sendIdx["<"]=1;
  4707. $1=$recv($2)._and_((function(){
  4708. return $core.withContext(function($ctx2) {
  4709. $4=self._y();
  4710. $ctx2.sendIdx["y"]=1;
  4711. return $recv($4).__lt($recv(aPoint)._y());
  4712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4713. }));
  4714. return $1;
  4715. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  4716. },
  4717. args: ["aPoint"],
  4718. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  4719. referencedClasses: [],
  4720. messageSends: ["and:", "<", "x", "y"]
  4721. }),
  4722. $globals.Point);
  4723. $core.addMethod(
  4724. $core.method({
  4725. selector: "<=",
  4726. protocol: 'comparing',
  4727. fn: function (aPoint){
  4728. var self=this;
  4729. return $core.withContext(function($ctx1) {
  4730. var $3,$2,$4,$1;
  4731. $3=self._x();
  4732. $ctx1.sendIdx["x"]=1;
  4733. $2=$recv($3).__lt_eq($recv(aPoint)._x());
  4734. $ctx1.sendIdx["<="]=1;
  4735. $1=$recv($2)._and_((function(){
  4736. return $core.withContext(function($ctx2) {
  4737. $4=self._y();
  4738. $ctx2.sendIdx["y"]=1;
  4739. return $recv($4).__lt_eq($recv(aPoint)._y());
  4740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4741. }));
  4742. return $1;
  4743. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  4744. },
  4745. args: ["aPoint"],
  4746. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  4747. referencedClasses: [],
  4748. messageSends: ["and:", "<=", "x", "y"]
  4749. }),
  4750. $globals.Point);
  4751. $core.addMethod(
  4752. $core.method({
  4753. selector: "=",
  4754. protocol: 'comparing',
  4755. fn: function (aPoint){
  4756. var self=this;
  4757. return $core.withContext(function($ctx1) {
  4758. var $3,$2,$5,$4,$7,$6,$1;
  4759. $3=$recv(aPoint)._class();
  4760. $ctx1.sendIdx["class"]=1;
  4761. $2=$recv($3).__eq(self._class());
  4762. $ctx1.sendIdx["="]=1;
  4763. $1=$recv($2)._and_((function(){
  4764. return $core.withContext(function($ctx2) {
  4765. $5=$recv(aPoint)._x();
  4766. $ctx2.sendIdx["x"]=1;
  4767. $4=$recv($5).__eq(self._x());
  4768. $ctx2.sendIdx["="]=2;
  4769. $7=$recv(aPoint)._y();
  4770. $ctx2.sendIdx["y"]=1;
  4771. $6=$recv($7).__eq(self._y());
  4772. return $recv($4).__and($6);
  4773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4774. }));
  4775. return $1;
  4776. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  4777. },
  4778. args: ["aPoint"],
  4779. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  4780. referencedClasses: [],
  4781. messageSends: ["and:", "=", "class", "&", "x", "y"]
  4782. }),
  4783. $globals.Point);
  4784. $core.addMethod(
  4785. $core.method({
  4786. selector: ">",
  4787. protocol: 'comparing',
  4788. fn: function (aPoint){
  4789. var self=this;
  4790. return $core.withContext(function($ctx1) {
  4791. var $3,$2,$4,$1;
  4792. $3=self._x();
  4793. $ctx1.sendIdx["x"]=1;
  4794. $2=$recv($3).__gt($recv(aPoint)._x());
  4795. $ctx1.sendIdx[">"]=1;
  4796. $1=$recv($2)._and_((function(){
  4797. return $core.withContext(function($ctx2) {
  4798. $4=self._y();
  4799. $ctx2.sendIdx["y"]=1;
  4800. return $recv($4).__gt($recv(aPoint)._y());
  4801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4802. }));
  4803. return $1;
  4804. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  4805. },
  4806. args: ["aPoint"],
  4807. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  4808. referencedClasses: [],
  4809. messageSends: ["and:", ">", "x", "y"]
  4810. }),
  4811. $globals.Point);
  4812. $core.addMethod(
  4813. $core.method({
  4814. selector: ">=",
  4815. protocol: 'comparing',
  4816. fn: function (aPoint){
  4817. var self=this;
  4818. return $core.withContext(function($ctx1) {
  4819. var $3,$2,$4,$1;
  4820. $3=self._x();
  4821. $ctx1.sendIdx["x"]=1;
  4822. $2=$recv($3).__gt_eq($recv(aPoint)._x());
  4823. $ctx1.sendIdx[">="]=1;
  4824. $1=$recv($2)._and_((function(){
  4825. return $core.withContext(function($ctx2) {
  4826. $4=self._y();
  4827. $ctx2.sendIdx["y"]=1;
  4828. return $recv($4).__gt_eq($recv(aPoint)._y());
  4829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4830. }));
  4831. return $1;
  4832. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  4833. },
  4834. args: ["aPoint"],
  4835. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  4836. referencedClasses: [],
  4837. messageSends: ["and:", ">=", "x", "y"]
  4838. }),
  4839. $globals.Point);
  4840. $core.addMethod(
  4841. $core.method({
  4842. selector: "asPoint",
  4843. protocol: 'converting',
  4844. fn: function (){
  4845. var self=this;
  4846. return self;
  4847. },
  4848. args: [],
  4849. source: "asPoint\x0a\x09^ self",
  4850. referencedClasses: [],
  4851. messageSends: []
  4852. }),
  4853. $globals.Point);
  4854. $core.addMethod(
  4855. $core.method({
  4856. selector: "dist:",
  4857. protocol: 'transforming',
  4858. fn: function (aPoint){
  4859. var self=this;
  4860. var dx,dy;
  4861. return $core.withContext(function($ctx1) {
  4862. var $3,$2,$1;
  4863. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  4864. $ctx1.sendIdx["-"]=1;
  4865. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  4866. $3=$recv(dx).__star(dx);
  4867. $ctx1.sendIdx["*"]=1;
  4868. $2=$recv($3).__plus($recv(dy).__star(dy));
  4869. $1=$recv($2)._sqrt();
  4870. return $1;
  4871. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  4872. },
  4873. args: ["aPoint"],
  4874. 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",
  4875. referencedClasses: [],
  4876. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  4877. }),
  4878. $globals.Point);
  4879. $core.addMethod(
  4880. $core.method({
  4881. selector: "printOn:",
  4882. protocol: 'printing',
  4883. fn: function (aStream){
  4884. var self=this;
  4885. return $core.withContext(function($ctx1) {
  4886. var $1;
  4887. $recv(self["@x"])._printOn_(aStream);
  4888. $ctx1.sendIdx["printOn:"]=1;
  4889. $recv(aStream)._nextPutAll_("@");
  4890. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  4891. return $core.withContext(function($ctx2) {
  4892. return $recv(self["@y"])._negative();
  4893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4894. }));
  4895. if($core.assert($1)){
  4896. $recv(aStream)._space();
  4897. };
  4898. $recv(self["@y"])._printOn_(aStream);
  4899. return self;
  4900. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  4901. },
  4902. args: ["aStream"],
  4903. 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",
  4904. referencedClasses: [],
  4905. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  4906. }),
  4907. $globals.Point);
  4908. $core.addMethod(
  4909. $core.method({
  4910. selector: "translateBy:",
  4911. protocol: 'transforming',
  4912. fn: function (delta){
  4913. var self=this;
  4914. return $core.withContext(function($ctx1) {
  4915. var $2,$1;
  4916. $2=$recv($recv(delta)._x()).__plus(self["@x"]);
  4917. $ctx1.sendIdx["+"]=1;
  4918. $1=$recv($2).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  4919. return $1;
  4920. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  4921. },
  4922. args: ["delta"],
  4923. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  4924. referencedClasses: [],
  4925. messageSends: ["@", "+", "x", "y"]
  4926. }),
  4927. $globals.Point);
  4928. $core.addMethod(
  4929. $core.method({
  4930. selector: "x",
  4931. protocol: 'accessing',
  4932. fn: function (){
  4933. var self=this;
  4934. var $1;
  4935. $1=self["@x"];
  4936. return $1;
  4937. },
  4938. args: [],
  4939. source: "x\x0a\x09^ x",
  4940. referencedClasses: [],
  4941. messageSends: []
  4942. }),
  4943. $globals.Point);
  4944. $core.addMethod(
  4945. $core.method({
  4946. selector: "x:",
  4947. protocol: 'accessing',
  4948. fn: function (aNumber){
  4949. var self=this;
  4950. self["@x"]=aNumber;
  4951. return self;
  4952. },
  4953. args: ["aNumber"],
  4954. source: "x: aNumber\x0a\x09x := aNumber",
  4955. referencedClasses: [],
  4956. messageSends: []
  4957. }),
  4958. $globals.Point);
  4959. $core.addMethod(
  4960. $core.method({
  4961. selector: "y",
  4962. protocol: 'accessing',
  4963. fn: function (){
  4964. var self=this;
  4965. var $1;
  4966. $1=self["@y"];
  4967. return $1;
  4968. },
  4969. args: [],
  4970. source: "y\x0a\x09^ y",
  4971. referencedClasses: [],
  4972. messageSends: []
  4973. }),
  4974. $globals.Point);
  4975. $core.addMethod(
  4976. $core.method({
  4977. selector: "y:",
  4978. protocol: 'accessing',
  4979. fn: function (aNumber){
  4980. var self=this;
  4981. self["@y"]=aNumber;
  4982. return self;
  4983. },
  4984. args: ["aNumber"],
  4985. source: "y: aNumber\x0a\x09y := aNumber",
  4986. referencedClasses: [],
  4987. messageSends: []
  4988. }),
  4989. $globals.Point);
  4990. $core.addMethod(
  4991. $core.method({
  4992. selector: "classTag",
  4993. protocol: 'accessing',
  4994. fn: function (){
  4995. var self=this;
  4996. return "magnitude";
  4997. },
  4998. args: [],
  4999. 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'",
  5000. referencedClasses: [],
  5001. messageSends: []
  5002. }),
  5003. $globals.Point.klass);
  5004. $core.addMethod(
  5005. $core.method({
  5006. selector: "x:y:",
  5007. protocol: 'instance creation',
  5008. fn: function (aNumber,anotherNumber){
  5009. var self=this;
  5010. return $core.withContext(function($ctx1) {
  5011. var $2,$3,$1;
  5012. $2=self._new();
  5013. $recv($2)._x_(aNumber);
  5014. $recv($2)._y_(anotherNumber);
  5015. $3=$recv($2)._yourself();
  5016. $1=$3;
  5017. return $1;
  5018. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5019. },
  5020. args: ["aNumber", "anotherNumber"],
  5021. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5022. referencedClasses: [],
  5023. messageSends: ["x:", "new", "y:", "yourself"]
  5024. }),
  5025. $globals.Point.klass);
  5026. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  5027. $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'`.";
  5028. $core.addMethod(
  5029. $core.method({
  5030. selector: "next",
  5031. protocol: 'accessing',
  5032. fn: function (){
  5033. var self=this;
  5034. return $core.withContext(function($ctx1) {
  5035. return Math.random();
  5036. return self;
  5037. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5038. },
  5039. args: [],
  5040. source: "next\x0a\x09<return Math.random()>",
  5041. referencedClasses: [],
  5042. messageSends: []
  5043. }),
  5044. $globals.Random);
  5045. $core.addMethod(
  5046. $core.method({
  5047. selector: "next:",
  5048. protocol: 'accessing',
  5049. fn: function (anInteger){
  5050. var self=this;
  5051. return $core.withContext(function($ctx1) {
  5052. var $1;
  5053. $1=$recv((1)._to_(anInteger))._collect_((function(each){
  5054. return $core.withContext(function($ctx2) {
  5055. return self._next();
  5056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5057. }));
  5058. return $1;
  5059. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5060. },
  5061. args: ["anInteger"],
  5062. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5063. referencedClasses: [],
  5064. messageSends: ["collect:", "to:", "next"]
  5065. }),
  5066. $globals.Random);
  5067. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  5068. $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`.";
  5069. $core.addMethod(
  5070. $core.method({
  5071. selector: "asJSON",
  5072. protocol: 'converting',
  5073. fn: function (){
  5074. var self=this;
  5075. var $1;
  5076. $1=null;
  5077. return $1;
  5078. },
  5079. args: [],
  5080. source: "asJSON\x0a\x09^ null",
  5081. referencedClasses: [],
  5082. messageSends: []
  5083. }),
  5084. $globals.UndefinedObject);
  5085. $core.addMethod(
  5086. $core.method({
  5087. selector: "deepCopy",
  5088. protocol: 'copying',
  5089. fn: function (){
  5090. var self=this;
  5091. return self;
  5092. },
  5093. args: [],
  5094. source: "deepCopy\x0a\x09^ self",
  5095. referencedClasses: [],
  5096. messageSends: []
  5097. }),
  5098. $globals.UndefinedObject);
  5099. $core.addMethod(
  5100. $core.method({
  5101. selector: "ifNil:",
  5102. protocol: 'testing',
  5103. fn: function (aBlock){
  5104. var self=this;
  5105. return $core.withContext(function($ctx1) {
  5106. var $1;
  5107. $1=self._ifNil_ifNotNil_(aBlock,(function(){
  5108. }));
  5109. return $1;
  5110. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5111. },
  5112. args: ["aBlock"],
  5113. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5114. referencedClasses: [],
  5115. messageSends: ["ifNil:ifNotNil:"]
  5116. }),
  5117. $globals.UndefinedObject);
  5118. $core.addMethod(
  5119. $core.method({
  5120. selector: "ifNil:ifNotNil:",
  5121. protocol: 'testing',
  5122. fn: function (aBlock,anotherBlock){
  5123. var self=this;
  5124. return $core.withContext(function($ctx1) {
  5125. var $1;
  5126. $1=$recv(aBlock)._value();
  5127. return $1;
  5128. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5129. },
  5130. args: ["aBlock", "anotherBlock"],
  5131. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5132. referencedClasses: [],
  5133. messageSends: ["value"]
  5134. }),
  5135. $globals.UndefinedObject);
  5136. $core.addMethod(
  5137. $core.method({
  5138. selector: "ifNotNil:",
  5139. protocol: 'testing',
  5140. fn: function (aBlock){
  5141. var self=this;
  5142. return self;
  5143. },
  5144. args: ["aBlock"],
  5145. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5146. referencedClasses: [],
  5147. messageSends: []
  5148. }),
  5149. $globals.UndefinedObject);
  5150. $core.addMethod(
  5151. $core.method({
  5152. selector: "ifNotNil:ifNil:",
  5153. protocol: 'testing',
  5154. fn: function (aBlock,anotherBlock){
  5155. var self=this;
  5156. return $core.withContext(function($ctx1) {
  5157. var $1;
  5158. $1=$recv(anotherBlock)._value();
  5159. return $1;
  5160. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5161. },
  5162. args: ["aBlock", "anotherBlock"],
  5163. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5164. referencedClasses: [],
  5165. messageSends: ["value"]
  5166. }),
  5167. $globals.UndefinedObject);
  5168. $core.addMethod(
  5169. $core.method({
  5170. selector: "isImmutable",
  5171. protocol: 'testing',
  5172. fn: function (){
  5173. var self=this;
  5174. return true;
  5175. },
  5176. args: [],
  5177. source: "isImmutable\x0a\x09^ true",
  5178. referencedClasses: [],
  5179. messageSends: []
  5180. }),
  5181. $globals.UndefinedObject);
  5182. $core.addMethod(
  5183. $core.method({
  5184. selector: "isNil",
  5185. protocol: 'testing',
  5186. fn: function (){
  5187. var self=this;
  5188. return true;
  5189. },
  5190. args: [],
  5191. source: "isNil\x0a\x09^ true",
  5192. referencedClasses: [],
  5193. messageSends: []
  5194. }),
  5195. $globals.UndefinedObject);
  5196. $core.addMethod(
  5197. $core.method({
  5198. selector: "notNil",
  5199. protocol: 'testing',
  5200. fn: function (){
  5201. var self=this;
  5202. return false;
  5203. },
  5204. args: [],
  5205. source: "notNil\x0a\x09^ false",
  5206. referencedClasses: [],
  5207. messageSends: []
  5208. }),
  5209. $globals.UndefinedObject);
  5210. $core.addMethod(
  5211. $core.method({
  5212. selector: "printOn:",
  5213. protocol: 'printing',
  5214. fn: function (aStream){
  5215. var self=this;
  5216. return $core.withContext(function($ctx1) {
  5217. $recv(aStream)._nextPutAll_("nil");
  5218. return self;
  5219. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5220. },
  5221. args: ["aStream"],
  5222. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5223. referencedClasses: [],
  5224. messageSends: ["nextPutAll:"]
  5225. }),
  5226. $globals.UndefinedObject);
  5227. $core.addMethod(
  5228. $core.method({
  5229. selector: "shallowCopy",
  5230. protocol: 'copying',
  5231. fn: function (){
  5232. var self=this;
  5233. return self;
  5234. },
  5235. args: [],
  5236. source: "shallowCopy\x0a\x09^ self",
  5237. referencedClasses: [],
  5238. messageSends: []
  5239. }),
  5240. $globals.UndefinedObject);
  5241. $core.addMethod(
  5242. $core.method({
  5243. selector: "subclass:instanceVariableNames:",
  5244. protocol: 'class creation',
  5245. fn: function (aString,anotherString){
  5246. var self=this;
  5247. return $core.withContext(function($ctx1) {
  5248. var $1;
  5249. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5250. return $1;
  5251. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5252. },
  5253. args: ["aString", "anotherString"],
  5254. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5255. referencedClasses: [],
  5256. messageSends: ["subclass:instanceVariableNames:package:"]
  5257. }),
  5258. $globals.UndefinedObject);
  5259. $core.addMethod(
  5260. $core.method({
  5261. selector: "subclass:instanceVariableNames:category:",
  5262. protocol: 'class creation',
  5263. fn: function (aString,aString2,aString3){
  5264. var self=this;
  5265. return $core.withContext(function($ctx1) {
  5266. var $1;
  5267. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5268. return $1;
  5269. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5270. },
  5271. args: ["aString", "aString2", "aString3"],
  5272. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5273. referencedClasses: [],
  5274. messageSends: ["subclass:instanceVariableNames:package:"]
  5275. }),
  5276. $globals.UndefinedObject);
  5277. $core.addMethod(
  5278. $core.method({
  5279. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5280. protocol: 'class creation',
  5281. fn: function (aString,aString2,classVars,pools,aString3){
  5282. var self=this;
  5283. return $core.withContext(function($ctx1) {
  5284. var $1;
  5285. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5286. return $1;
  5287. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5288. },
  5289. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5290. 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",
  5291. referencedClasses: [],
  5292. messageSends: ["subclass:instanceVariableNames:package:"]
  5293. }),
  5294. $globals.UndefinedObject);
  5295. $core.addMethod(
  5296. $core.method({
  5297. selector: "subclass:instanceVariableNames:package:",
  5298. protocol: 'class creation',
  5299. fn: function (aString,aString2,aString3){
  5300. var self=this;
  5301. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5302. return $core.withContext(function($ctx1) {
  5303. var $1;
  5304. $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5305. return $1;
  5306. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5307. },
  5308. args: ["aString", "aString2", "aString3"],
  5309. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5310. referencedClasses: ["ClassBuilder"],
  5311. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5312. }),
  5313. $globals.UndefinedObject);
  5314. $core.addMethod(
  5315. $core.method({
  5316. selector: "new",
  5317. protocol: 'instance creation',
  5318. fn: function (){
  5319. var self=this;
  5320. return $core.withContext(function($ctx1) {
  5321. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5322. return self;
  5323. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5324. },
  5325. args: [],
  5326. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5327. referencedClasses: [],
  5328. messageSends: ["error:"]
  5329. }),
  5330. $globals.UndefinedObject.klass);
  5331. });
  5332. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  5333. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  5334. $core.addPackage('Kernel-Classes');
  5335. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  5336. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5337. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  5338. $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.";
  5339. $core.addMethod(
  5340. $core.method({
  5341. selector: ">>",
  5342. protocol: 'accessing',
  5343. fn: function (aString){
  5344. var self=this;
  5345. return $core.withContext(function($ctx1) {
  5346. var $1;
  5347. $1=self._methodAt_(aString);
  5348. return $1;
  5349. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  5350. },
  5351. args: ["aString"],
  5352. source: ">> aString\x0a\x09^ self methodAt: aString",
  5353. referencedClasses: [],
  5354. messageSends: ["methodAt:"]
  5355. }),
  5356. $globals.Behavior);
  5357. $core.addMethod(
  5358. $core.method({
  5359. selector: "addCompiledMethod:",
  5360. protocol: 'compiling',
  5361. fn: function (aMethod){
  5362. var self=this;
  5363. var oldMethod,announcement;
  5364. function $MethodAdded(){return $globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  5365. function $MethodModified(){return $globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  5366. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5367. return $core.withContext(function($ctx1) {
  5368. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  5369. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  5370. return nil;
  5371. }));
  5372. $2=self._protocols();
  5373. $3=$recv(aMethod)._protocol();
  5374. $ctx1.sendIdx["protocol"]=1;
  5375. $1=$recv($2)._includes_($3);
  5376. if(!$core.assert($1)){
  5377. $4=self._organization();
  5378. $5=$recv(aMethod)._protocol();
  5379. $ctx1.sendIdx["protocol"]=2;
  5380. $recv($4)._addElement_($5);
  5381. };
  5382. self._basicAddCompiledMethod_(aMethod);
  5383. $6=oldMethod;
  5384. if(($receiver = $6) == null || $receiver.isNil){
  5385. $6;
  5386. } else {
  5387. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  5388. };
  5389. $7=oldMethod;
  5390. if(($receiver = $7) == null || $receiver.isNil){
  5391. $8=$recv($MethodAdded())._new();
  5392. $ctx1.sendIdx["new"]=1;
  5393. $recv($8)._method_(aMethod);
  5394. $ctx1.sendIdx["method:"]=1;
  5395. $9=$recv($8)._yourself();
  5396. $ctx1.sendIdx["yourself"]=1;
  5397. announcement=$9;
  5398. } else {
  5399. $10=$recv($MethodModified())._new();
  5400. $recv($10)._oldMethod_(oldMethod);
  5401. $recv($10)._method_(aMethod);
  5402. $11=$recv($10)._yourself();
  5403. announcement=$11;
  5404. };
  5405. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  5406. return self;
  5407. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  5408. },
  5409. args: ["aMethod"],
  5410. 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",
  5411. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  5412. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  5413. }),
  5414. $globals.Behavior);
  5415. $core.addMethod(
  5416. $core.method({
  5417. selector: "allInstanceVariableNames",
  5418. protocol: 'accessing',
  5419. fn: function (){
  5420. var self=this;
  5421. var result;
  5422. return $core.withContext(function($ctx1) {
  5423. var $1,$2,$receiver;
  5424. result=$recv(self._instanceVariableNames())._copy();
  5425. $1=self._superclass();
  5426. $ctx1.sendIdx["superclass"]=1;
  5427. if(($receiver = $1) == null || $receiver.isNil){
  5428. $1;
  5429. } else {
  5430. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  5431. };
  5432. $2=result;
  5433. return $2;
  5434. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  5435. },
  5436. args: [],
  5437. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5438. referencedClasses: [],
  5439. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  5440. }),
  5441. $globals.Behavior);
  5442. $core.addMethod(
  5443. $core.method({
  5444. selector: "allSelectors",
  5445. protocol: 'accessing',
  5446. fn: function (){
  5447. var self=this;
  5448. return $core.withContext(function($ctx1) {
  5449. var $2,$3,$4,$1;
  5450. $2=self._allSuperclasses();
  5451. $3=self._selectors();
  5452. $ctx1.sendIdx["selectors"]=1;
  5453. $1=$recv($2)._inject_into_($3,(function(acc,each){
  5454. return $core.withContext(function($ctx2) {
  5455. $recv(acc)._addAll_($recv(each)._selectors());
  5456. $4=$recv(acc)._yourself();
  5457. return $4;
  5458. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5459. }));
  5460. return $1;
  5461. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  5462. },
  5463. args: [],
  5464. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5465. referencedClasses: [],
  5466. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  5467. }),
  5468. $globals.Behavior);
  5469. $core.addMethod(
  5470. $core.method({
  5471. selector: "allSubclasses",
  5472. protocol: 'accessing',
  5473. fn: function (){
  5474. var self=this;
  5475. var subclasses,index;
  5476. return $core.withContext(function($ctx1) {
  5477. var $1;
  5478. subclasses=self._subclasses();
  5479. $ctx1.sendIdx["subclasses"]=1;
  5480. index=(1);
  5481. $recv((function(){
  5482. return $core.withContext(function($ctx2) {
  5483. return $recv(index).__gt($recv(subclasses)._size());
  5484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5485. }))._whileFalse_((function(){
  5486. return $core.withContext(function($ctx2) {
  5487. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  5488. index=$recv(index).__plus((1));
  5489. return index;
  5490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5491. }));
  5492. $1=subclasses;
  5493. return $1;
  5494. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},$globals.Behavior)});
  5495. },
  5496. args: [],
  5497. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09| subclasses index |\x0a\x09\x0a\x09subclasses := self subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09^ subclasses",
  5498. referencedClasses: [],
  5499. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"]
  5500. }),
  5501. $globals.Behavior);
  5502. $core.addMethod(
  5503. $core.method({
  5504. selector: "allSubclassesDo:",
  5505. protocol: 'enumerating',
  5506. fn: function (aBlock){
  5507. var self=this;
  5508. return $core.withContext(function($ctx1) {
  5509. $recv(self._allSubclasses())._do_((function(each){
  5510. return $core.withContext(function($ctx2) {
  5511. return $recv(aBlock)._value_(each);
  5512. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5513. }));
  5514. return self;
  5515. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  5516. },
  5517. args: ["aBlock"],
  5518. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self allSubclasses do: [ :each |\x0a \x09aBlock value: each ]",
  5519. referencedClasses: [],
  5520. messageSends: ["do:", "allSubclasses", "value:"]
  5521. }),
  5522. $globals.Behavior);
  5523. $core.addMethod(
  5524. $core.method({
  5525. selector: "allSuperclasses",
  5526. protocol: 'accessing',
  5527. fn: function (){
  5528. var self=this;
  5529. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5530. return $core.withContext(function($ctx1) {
  5531. var $1,$2,$5,$4,$6,$3,$receiver;
  5532. $1=self._superclass();
  5533. $ctx1.sendIdx["superclass"]=1;
  5534. if(($receiver = $1) == null || $receiver.isNil){
  5535. $2=[];
  5536. return $2;
  5537. } else {
  5538. $1;
  5539. };
  5540. $5=self._superclass();
  5541. $ctx1.sendIdx["superclass"]=2;
  5542. $4=$recv($OrderedCollection())._with_($5);
  5543. $recv($4)._addAll_($recv(self._superclass())._allSuperclasses());
  5544. $6=$recv($4)._yourself();
  5545. $3=$6;
  5546. return $3;
  5547. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  5548. },
  5549. args: [],
  5550. 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",
  5551. referencedClasses: ["OrderedCollection"],
  5552. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  5553. }),
  5554. $globals.Behavior);
  5555. $core.addMethod(
  5556. $core.method({
  5557. selector: "basicAddCompiledMethod:",
  5558. protocol: 'private',
  5559. fn: function (aMethod){
  5560. var self=this;
  5561. return $core.withContext(function($ctx1) {
  5562. $core.addMethod(aMethod, self);
  5563. return self;
  5564. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5565. },
  5566. args: ["aMethod"],
  5567. source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>",
  5568. referencedClasses: [],
  5569. messageSends: []
  5570. }),
  5571. $globals.Behavior);
  5572. $core.addMethod(
  5573. $core.method({
  5574. selector: "basicNew",
  5575. protocol: 'instance creation',
  5576. fn: function (){
  5577. var self=this;
  5578. return $core.withContext(function($ctx1) {
  5579. return new self.fn();
  5580. return self;
  5581. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  5582. },
  5583. args: [],
  5584. source: "basicNew\x0a\x09<return new self.fn()>",
  5585. referencedClasses: [],
  5586. messageSends: []
  5587. }),
  5588. $globals.Behavior);
  5589. $core.addMethod(
  5590. $core.method({
  5591. selector: "basicRemoveCompiledMethod:",
  5592. protocol: 'private',
  5593. fn: function (aMethod){
  5594. var self=this;
  5595. return $core.withContext(function($ctx1) {
  5596. $core.removeMethod(aMethod,self);
  5597. return self;
  5598. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5599. },
  5600. args: ["aMethod"],
  5601. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>",
  5602. referencedClasses: [],
  5603. messageSends: []
  5604. }),
  5605. $globals.Behavior);
  5606. $core.addMethod(
  5607. $core.method({
  5608. selector: "canUnderstand:",
  5609. protocol: 'testing',
  5610. fn: function (aSelector){
  5611. var self=this;
  5612. return $core.withContext(function($ctx1) {
  5613. var $3,$2,$1;
  5614. $1=$recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  5615. return $core.withContext(function($ctx2) {
  5616. $3=self._superclass();
  5617. $ctx2.sendIdx["superclass"]=1;
  5618. $2=$recv($3)._notNil();
  5619. return $recv($2)._and_((function(){
  5620. return $core.withContext(function($ctx3) {
  5621. return $recv(self._superclass())._canUnderstand_(aSelector);
  5622. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  5623. }));
  5624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5625. }));
  5626. return $1;
  5627. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  5628. },
  5629. args: ["aSelector"],
  5630. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  5631. referencedClasses: [],
  5632. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  5633. }),
  5634. $globals.Behavior);
  5635. $core.addMethod(
  5636. $core.method({
  5637. selector: "comment",
  5638. protocol: 'accessing',
  5639. fn: function (){
  5640. var self=this;
  5641. return $core.withContext(function($ctx1) {
  5642. var $2,$1,$receiver;
  5643. $2=self._basicAt_("comment");
  5644. if(($receiver = $2) == null || $receiver.isNil){
  5645. $1="";
  5646. } else {
  5647. $1=$2;
  5648. };
  5649. return $1;
  5650. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  5651. },
  5652. args: [],
  5653. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  5654. referencedClasses: [],
  5655. messageSends: ["ifNil:", "basicAt:"]
  5656. }),
  5657. $globals.Behavior);
  5658. $core.addMethod(
  5659. $core.method({
  5660. selector: "comment:",
  5661. protocol: 'accessing',
  5662. fn: function (aString){
  5663. var self=this;
  5664. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5665. function $ClassCommentChanged(){return $globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  5666. return $core.withContext(function($ctx1) {
  5667. var $1,$2;
  5668. self._basicAt_put_("comment",aString);
  5669. $1=$recv($ClassCommentChanged())._new();
  5670. $recv($1)._theClass_(self);
  5671. $2=$recv($1)._yourself();
  5672. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  5673. return self;
  5674. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  5675. },
  5676. args: ["aString"],
  5677. 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)",
  5678. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  5679. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  5680. }),
  5681. $globals.Behavior);
  5682. $core.addMethod(
  5683. $core.method({
  5684. selector: "compile:protocol:",
  5685. protocol: 'compiling',
  5686. fn: function (aString,anotherString){
  5687. var self=this;
  5688. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5689. return $core.withContext(function($ctx1) {
  5690. var $1;
  5691. $1=$recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
  5692. return $1;
  5693. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  5694. },
  5695. args: ["aString", "anotherString"],
  5696. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  5697. referencedClasses: ["Compiler"],
  5698. messageSends: ["install:forClass:protocol:", "new"]
  5699. }),
  5700. $globals.Behavior);
  5701. $core.addMethod(
  5702. $core.method({
  5703. selector: "definition",
  5704. protocol: 'accessing',
  5705. fn: function (){
  5706. var self=this;
  5707. return "";
  5708. },
  5709. args: [],
  5710. source: "definition\x0a\x09^ ''",
  5711. referencedClasses: [],
  5712. messageSends: []
  5713. }),
  5714. $globals.Behavior);
  5715. $core.addMethod(
  5716. $core.method({
  5717. selector: "includesBehavior:",
  5718. protocol: 'testing',
  5719. fn: function (aClass){
  5720. var self=this;
  5721. return $core.withContext(function($ctx1) {
  5722. var $1;
  5723. $1=$recv(self.__eq_eq(aClass))._or_((function(){
  5724. return $core.withContext(function($ctx2) {
  5725. return self._inheritsFrom_(aClass);
  5726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5727. }));
  5728. return $1;
  5729. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  5730. },
  5731. args: ["aClass"],
  5732. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  5733. referencedClasses: [],
  5734. messageSends: ["or:", "==", "inheritsFrom:"]
  5735. }),
  5736. $globals.Behavior);
  5737. $core.addMethod(
  5738. $core.method({
  5739. selector: "includesSelector:",
  5740. protocol: 'testing',
  5741. fn: function (aString){
  5742. var self=this;
  5743. return $core.withContext(function($ctx1) {
  5744. var $1;
  5745. $1=$recv(self._methodDictionary())._includesKey_(aString);
  5746. return $1;
  5747. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  5748. },
  5749. args: ["aString"],
  5750. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  5751. referencedClasses: [],
  5752. messageSends: ["includesKey:", "methodDictionary"]
  5753. }),
  5754. $globals.Behavior);
  5755. $core.addMethod(
  5756. $core.method({
  5757. selector: "inheritsFrom:",
  5758. protocol: 'testing',
  5759. fn: function (aClass){
  5760. var self=this;
  5761. return $core.withContext(function($ctx1) {
  5762. var $1,$4,$3,$2,$receiver;
  5763. $1=self._superclass();
  5764. $ctx1.sendIdx["superclass"]=1;
  5765. if(($receiver = $1) == null || $receiver.isNil){
  5766. return false;
  5767. } else {
  5768. $1;
  5769. };
  5770. $4=self._superclass();
  5771. $ctx1.sendIdx["superclass"]=2;
  5772. $3=$recv(aClass).__eq_eq($4);
  5773. $2=$recv($3)._or_((function(){
  5774. return $core.withContext(function($ctx2) {
  5775. return $recv(self._superclass())._inheritsFrom_(aClass);
  5776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5777. }));
  5778. return $2;
  5779. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  5780. },
  5781. args: ["aClass"],
  5782. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  5783. referencedClasses: [],
  5784. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  5785. }),
  5786. $globals.Behavior);
  5787. $core.addMethod(
  5788. $core.method({
  5789. selector: "instanceVariableNames",
  5790. protocol: 'accessing',
  5791. fn: function (){
  5792. var self=this;
  5793. return $core.withContext(function($ctx1) {
  5794. return self.iVarNames;
  5795. return self;
  5796. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  5797. },
  5798. args: [],
  5799. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5800. referencedClasses: [],
  5801. messageSends: []
  5802. }),
  5803. $globals.Behavior);
  5804. $core.addMethod(
  5805. $core.method({
  5806. selector: "isBehavior",
  5807. protocol: 'testing',
  5808. fn: function (){
  5809. var self=this;
  5810. return true;
  5811. },
  5812. args: [],
  5813. source: "isBehavior\x0a\x09^ true",
  5814. referencedClasses: [],
  5815. messageSends: []
  5816. }),
  5817. $globals.Behavior);
  5818. $core.addMethod(
  5819. $core.method({
  5820. selector: "javascriptConstructor",
  5821. protocol: 'accessing',
  5822. fn: function (){
  5823. var self=this;
  5824. return $core.withContext(function($ctx1) {
  5825. return self.fn;
  5826. return self;
  5827. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  5828. },
  5829. args: [],
  5830. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  5831. referencedClasses: [],
  5832. messageSends: []
  5833. }),
  5834. $globals.Behavior);
  5835. $core.addMethod(
  5836. $core.method({
  5837. selector: "javascriptConstructor:",
  5838. protocol: 'accessing',
  5839. fn: function (aJavaScriptFunction){
  5840. var self=this;
  5841. return $core.withContext(function($ctx1) {
  5842. $core.setClassConstructor(self, aJavaScriptFunction);;
  5843. return self;
  5844. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  5845. },
  5846. args: ["aJavaScriptFunction"],
  5847. 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);>",
  5848. referencedClasses: [],
  5849. messageSends: []
  5850. }),
  5851. $globals.Behavior);
  5852. $core.addMethod(
  5853. $core.method({
  5854. selector: "lookupSelector:",
  5855. protocol: 'accessing',
  5856. fn: function (selector){
  5857. var self=this;
  5858. var lookupClass;
  5859. return $core.withContext(function($ctx1) {
  5860. var $1,$2;
  5861. var $early={};
  5862. try {
  5863. lookupClass=self;
  5864. $recv((function(){
  5865. return $core.withContext(function($ctx2) {
  5866. return $recv(lookupClass).__eq(nil);
  5867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5868. }))._whileFalse_((function(){
  5869. return $core.withContext(function($ctx2) {
  5870. $1=$recv(lookupClass)._includesSelector_(selector);
  5871. if($core.assert($1)){
  5872. $2=$recv(lookupClass)._methodAt_(selector);
  5873. throw $early=[$2];
  5874. };
  5875. lookupClass=$recv(lookupClass)._superclass();
  5876. return lookupClass;
  5877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5878. }));
  5879. return nil;
  5880. }
  5881. catch(e) {if(e===$early)return e[0]; throw e}
  5882. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  5883. },
  5884. args: ["selector"],
  5885. 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",
  5886. referencedClasses: [],
  5887. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  5888. }),
  5889. $globals.Behavior);
  5890. $core.addMethod(
  5891. $core.method({
  5892. selector: "methodAt:",
  5893. protocol: 'accessing',
  5894. fn: function (aString){
  5895. var self=this;
  5896. return $core.withContext(function($ctx1) {
  5897. var $1;
  5898. $1=$recv(self._methodDictionary())._at_(aString);
  5899. return $1;
  5900. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  5901. },
  5902. args: ["aString"],
  5903. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  5904. referencedClasses: [],
  5905. messageSends: ["at:", "methodDictionary"]
  5906. }),
  5907. $globals.Behavior);
  5908. $core.addMethod(
  5909. $core.method({
  5910. selector: "methodDictionary",
  5911. protocol: 'accessing',
  5912. fn: function (){
  5913. var self=this;
  5914. return $core.withContext(function($ctx1) {
  5915. var dict = $globals.HashedCollection._new();
  5916. var methods = self.methods;
  5917. Object.keys(methods).forEach(function(i) {
  5918. if(methods[i].selector) {
  5919. dict._at_put_(methods[i].selector, methods[i]);
  5920. }
  5921. });
  5922. return dict;
  5923. return self;
  5924. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  5925. },
  5926. args: [],
  5927. 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>",
  5928. referencedClasses: [],
  5929. messageSends: []
  5930. }),
  5931. $globals.Behavior);
  5932. $core.addMethod(
  5933. $core.method({
  5934. selector: "methodTemplate",
  5935. protocol: 'accessing',
  5936. fn: function (){
  5937. var self=this;
  5938. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  5939. return $core.withContext(function($ctx1) {
  5940. var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
  5941. $1=$recv($String())._streamContents_((function(stream){
  5942. return $core.withContext(function($ctx2) {
  5943. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  5944. $ctx2.sendIdx["nextPutAll:"]=1;
  5945. $3=$recv($String())._lf();
  5946. $ctx2.sendIdx["lf"]=1;
  5947. $4=$recv($String())._tab();
  5948. $ctx2.sendIdx["tab"]=1;
  5949. $2=$recv($3).__comma($4);
  5950. $ctx2.sendIdx[","]=1;
  5951. $recv(stream)._nextPutAll_($2);
  5952. $ctx2.sendIdx["nextPutAll:"]=2;
  5953. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  5954. $ctx2.sendIdx["nextPutAll:"]=3;
  5955. $7=$recv($String())._lf();
  5956. $ctx2.sendIdx["lf"]=2;
  5957. $8=$recv($String())._lf();
  5958. $ctx2.sendIdx["lf"]=3;
  5959. $6=$recv($7).__comma($8);
  5960. $ctx2.sendIdx[","]=3;
  5961. $9=$recv($String())._tab();
  5962. $ctx2.sendIdx["tab"]=2;
  5963. $5=$recv($6).__comma($9);
  5964. $ctx2.sendIdx[","]=2;
  5965. $recv(stream)._nextPutAll_($5);
  5966. $ctx2.sendIdx["nextPutAll:"]=4;
  5967. $recv(stream)._nextPutAll_("| temporary variable names |");
  5968. $ctx2.sendIdx["nextPutAll:"]=5;
  5969. $recv(stream)._nextPutAll_($recv($recv($String())._lf()).__comma($recv($String())._tab()));
  5970. $ctx2.sendIdx["nextPutAll:"]=6;
  5971. $10=$recv(stream)._nextPutAll_("statements");
  5972. return $10;
  5973. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5974. }));
  5975. return $1;
  5976. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  5977. },
  5978. args: [],
  5979. 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' ]",
  5980. referencedClasses: ["String"],
  5981. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  5982. }),
  5983. $globals.Behavior);
  5984. $core.addMethod(
  5985. $core.method({
  5986. selector: "methods",
  5987. protocol: 'accessing',
  5988. fn: function (){
  5989. var self=this;
  5990. return $core.withContext(function($ctx1) {
  5991. var $1;
  5992. $1=$recv(self._methodDictionary())._values();
  5993. return $1;
  5994. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  5995. },
  5996. args: [],
  5997. source: "methods\x0a\x09^ self methodDictionary values",
  5998. referencedClasses: [],
  5999. messageSends: ["values", "methodDictionary"]
  6000. }),
  6001. $globals.Behavior);
  6002. $core.addMethod(
  6003. $core.method({
  6004. selector: "methodsInProtocol:",
  6005. protocol: 'accessing',
  6006. fn: function (aString){
  6007. var self=this;
  6008. return $core.withContext(function($ctx1) {
  6009. var $1;
  6010. $1=$recv(self._methods())._select_((function(each){
  6011. return $core.withContext(function($ctx2) {
  6012. return $recv($recv(each)._protocol()).__eq(aString);
  6013. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6014. }));
  6015. return $1;
  6016. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  6017. },
  6018. args: ["aString"],
  6019. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  6020. referencedClasses: [],
  6021. messageSends: ["select:", "methods", "=", "protocol"]
  6022. }),
  6023. $globals.Behavior);
  6024. $core.addMethod(
  6025. $core.method({
  6026. selector: "name",
  6027. protocol: 'accessing',
  6028. fn: function (){
  6029. var self=this;
  6030. return $core.withContext(function($ctx1) {
  6031. return self.className || nil;
  6032. return self;
  6033. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  6034. },
  6035. args: [],
  6036. source: "name\x0a\x09<return self.className || nil>",
  6037. referencedClasses: [],
  6038. messageSends: []
  6039. }),
  6040. $globals.Behavior);
  6041. $core.addMethod(
  6042. $core.method({
  6043. selector: "new",
  6044. protocol: 'instance creation',
  6045. fn: function (){
  6046. var self=this;
  6047. return $core.withContext(function($ctx1) {
  6048. var $1;
  6049. $1=$recv(self._basicNew())._initialize();
  6050. return $1;
  6051. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  6052. },
  6053. args: [],
  6054. source: "new\x0a\x09^ self basicNew initialize",
  6055. referencedClasses: [],
  6056. messageSends: ["initialize", "basicNew"]
  6057. }),
  6058. $globals.Behavior);
  6059. $core.addMethod(
  6060. $core.method({
  6061. selector: "organization",
  6062. protocol: 'accessing',
  6063. fn: function (){
  6064. var self=this;
  6065. return $core.withContext(function($ctx1) {
  6066. var $1;
  6067. $1=self._basicAt_("organization");
  6068. return $1;
  6069. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  6070. },
  6071. args: [],
  6072. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6073. referencedClasses: [],
  6074. messageSends: ["basicAt:"]
  6075. }),
  6076. $globals.Behavior);
  6077. $core.addMethod(
  6078. $core.method({
  6079. selector: "ownMethods",
  6080. protocol: 'accessing',
  6081. fn: function (){
  6082. var self=this;
  6083. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  6084. return $core.withContext(function($ctx1) {
  6085. var $2,$1;
  6086. $1=$recv($recv(self._ownProtocols())._inject_into_($recv($OrderedCollection())._new(),(function(acc,each){
  6087. return $core.withContext(function($ctx2) {
  6088. return $recv(acc).__comma(self._methodsInProtocol_(each));
  6089. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6090. })))._sorted_((function(a,b){
  6091. return $core.withContext(function($ctx2) {
  6092. $2=$recv(a)._selector();
  6093. $ctx2.sendIdx["selector"]=1;
  6094. return $recv($2).__lt_eq($recv(b)._selector());
  6095. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  6096. }));
  6097. return $1;
  6098. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  6099. },
  6100. args: [],
  6101. 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 ]",
  6102. referencedClasses: ["OrderedCollection"],
  6103. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  6104. }),
  6105. $globals.Behavior);
  6106. $core.addMethod(
  6107. $core.method({
  6108. selector: "ownProtocols",
  6109. protocol: 'accessing',
  6110. fn: function (){
  6111. var self=this;
  6112. return $core.withContext(function($ctx1) {
  6113. var $1;
  6114. $1=$recv(self._protocols())._reject_((function(each){
  6115. return $core.withContext(function($ctx2) {
  6116. return $recv(each)._match_("^\x5c*");
  6117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6118. }));
  6119. return $1;
  6120. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  6121. },
  6122. args: [],
  6123. 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*' ]",
  6124. referencedClasses: [],
  6125. messageSends: ["reject:", "protocols", "match:"]
  6126. }),
  6127. $globals.Behavior);
  6128. $core.addMethod(
  6129. $core.method({
  6130. selector: "packageOfProtocol:",
  6131. protocol: 'accessing',
  6132. fn: function (aString){
  6133. var self=this;
  6134. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  6135. return $core.withContext(function($ctx1) {
  6136. var $1,$2,$3;
  6137. $1=$recv(aString)._beginsWith_("*");
  6138. if(!$core.assert($1)){
  6139. $2=self._package();
  6140. return $2;
  6141. };
  6142. $3=$recv($Package())._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  6143. return nil;
  6144. }));
  6145. return $3;
  6146. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  6147. },
  6148. args: ["aString"],
  6149. 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 ]",
  6150. referencedClasses: ["Package"],
  6151. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  6152. }),
  6153. $globals.Behavior);
  6154. $core.addMethod(
  6155. $core.method({
  6156. selector: "protocols",
  6157. protocol: 'accessing',
  6158. fn: function (){
  6159. var self=this;
  6160. return $core.withContext(function($ctx1) {
  6161. var $1;
  6162. $1=$recv($recv(self._organization())._elements())._sorted();
  6163. return $1;
  6164. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6165. },
  6166. args: [],
  6167. source: "protocols\x0a\x09^ self organization elements sorted",
  6168. referencedClasses: [],
  6169. messageSends: ["sorted", "elements", "organization"]
  6170. }),
  6171. $globals.Behavior);
  6172. $core.addMethod(
  6173. $core.method({
  6174. selector: "protocolsDo:",
  6175. protocol: 'enumerating',
  6176. fn: function (aBlock){
  6177. var self=this;
  6178. var methodsByProtocol;
  6179. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  6180. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6181. return $core.withContext(function($ctx1) {
  6182. methodsByProtocol=$recv($HashedCollection())._new();
  6183. $ctx1.sendIdx["new"]=1;
  6184. $recv(self._methodDictionary())._valuesDo_((function(m){
  6185. return $core.withContext(function($ctx2) {
  6186. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6187. return $core.withContext(function($ctx3) {
  6188. return $recv($Array())._new();
  6189. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6190. })))._add_(m);
  6191. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6192. }));
  6193. $recv(self._protocols())._do_((function(protocol){
  6194. return $core.withContext(function($ctx2) {
  6195. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6196. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6197. }));
  6198. return self;
  6199. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6200. },
  6201. args: ["aBlock"],
  6202. 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) ]",
  6203. referencedClasses: ["HashedCollection", "Array"],
  6204. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6205. }),
  6206. $globals.Behavior);
  6207. $core.addMethod(
  6208. $core.method({
  6209. selector: "prototype",
  6210. protocol: 'accessing',
  6211. fn: function (){
  6212. var self=this;
  6213. return $core.withContext(function($ctx1) {
  6214. return self.fn.prototype;
  6215. return self;
  6216. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6217. },
  6218. args: [],
  6219. source: "prototype\x0a\x09<return self.fn.prototype>",
  6220. referencedClasses: [],
  6221. messageSends: []
  6222. }),
  6223. $globals.Behavior);
  6224. $core.addMethod(
  6225. $core.method({
  6226. selector: "recompile",
  6227. protocol: 'compiling',
  6228. fn: function (){
  6229. var self=this;
  6230. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6231. return $core.withContext(function($ctx1) {
  6232. var $1;
  6233. $1=$recv($recv($Compiler())._new())._recompile_(self);
  6234. return $1;
  6235. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6236. },
  6237. args: [],
  6238. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6239. referencedClasses: ["Compiler"],
  6240. messageSends: ["recompile:", "new"]
  6241. }),
  6242. $globals.Behavior);
  6243. $core.addMethod(
  6244. $core.method({
  6245. selector: "removeCompiledMethod:",
  6246. protocol: 'compiling',
  6247. fn: function (aMethod){
  6248. var self=this;
  6249. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6250. function $MethodRemoved(){return $globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  6251. return $core.withContext(function($ctx1) {
  6252. var $1,$2;
  6253. self._basicRemoveCompiledMethod_(aMethod);
  6254. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6255. $1=$recv($MethodRemoved())._new();
  6256. $recv($1)._method_(aMethod);
  6257. $2=$recv($1)._yourself();
  6258. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  6259. return self;
  6260. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6261. },
  6262. args: ["aMethod"],
  6263. 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)",
  6264. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6265. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6266. }),
  6267. $globals.Behavior);
  6268. $core.addMethod(
  6269. $core.method({
  6270. selector: "removeProtocolIfEmpty:",
  6271. protocol: 'accessing',
  6272. fn: function (aString){
  6273. var self=this;
  6274. return $core.withContext(function($ctx1) {
  6275. $recv(self._methods())._detect_ifNone_((function(each){
  6276. return $core.withContext(function($ctx2) {
  6277. return $recv($recv(each)._protocol()).__eq(aString);
  6278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6279. }),(function(){
  6280. return $core.withContext(function($ctx2) {
  6281. return $recv(self._organization())._removeElement_(aString);
  6282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6283. }));
  6284. return self;
  6285. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6286. },
  6287. args: ["aString"],
  6288. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6289. referencedClasses: [],
  6290. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6291. }),
  6292. $globals.Behavior);
  6293. $core.addMethod(
  6294. $core.method({
  6295. selector: "selectors",
  6296. protocol: 'accessing',
  6297. fn: function (){
  6298. var self=this;
  6299. return $core.withContext(function($ctx1) {
  6300. var $1;
  6301. $1=$recv(self._methodDictionary())._keys();
  6302. return $1;
  6303. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6304. },
  6305. args: [],
  6306. source: "selectors\x0a\x09^ self methodDictionary keys",
  6307. referencedClasses: [],
  6308. messageSends: ["keys", "methodDictionary"]
  6309. }),
  6310. $globals.Behavior);
  6311. $core.addMethod(
  6312. $core.method({
  6313. selector: "subclasses",
  6314. protocol: 'accessing',
  6315. fn: function (){
  6316. var self=this;
  6317. return $core.withContext(function($ctx1) {
  6318. self._subclassResponsibility();
  6319. return self;
  6320. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6321. },
  6322. args: [],
  6323. source: "subclasses\x0a\x09self subclassResponsibility",
  6324. referencedClasses: [],
  6325. messageSends: ["subclassResponsibility"]
  6326. }),
  6327. $globals.Behavior);
  6328. $core.addMethod(
  6329. $core.method({
  6330. selector: "superclass",
  6331. protocol: 'accessing',
  6332. fn: function (){
  6333. var self=this;
  6334. return $core.withContext(function($ctx1) {
  6335. return self.superclass || nil;
  6336. return self;
  6337. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6338. },
  6339. args: [],
  6340. source: "superclass\x0a\x09<return self.superclass || nil>",
  6341. referencedClasses: [],
  6342. messageSends: []
  6343. }),
  6344. $globals.Behavior);
  6345. $core.addMethod(
  6346. $core.method({
  6347. selector: "theMetaClass",
  6348. protocol: 'accessing',
  6349. fn: function (){
  6350. var self=this;
  6351. return $core.withContext(function($ctx1) {
  6352. self._subclassResponsibility();
  6353. return self;
  6354. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  6355. },
  6356. args: [],
  6357. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6358. referencedClasses: [],
  6359. messageSends: ["subclassResponsibility"]
  6360. }),
  6361. $globals.Behavior);
  6362. $core.addMethod(
  6363. $core.method({
  6364. selector: "theNonMetaClass",
  6365. protocol: 'accessing',
  6366. fn: function (){
  6367. var self=this;
  6368. return $core.withContext(function($ctx1) {
  6369. self._subclassResponsibility();
  6370. return self;
  6371. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6372. },
  6373. args: [],
  6374. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6375. referencedClasses: [],
  6376. messageSends: ["subclassResponsibility"]
  6377. }),
  6378. $globals.Behavior);
  6379. $core.addMethod(
  6380. $core.method({
  6381. selector: "withAllSubclasses",
  6382. protocol: 'accessing',
  6383. fn: function (){
  6384. var self=this;
  6385. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6386. return $core.withContext(function($ctx1) {
  6387. var $2,$3,$1;
  6388. $2=$recv($Array())._with_(self);
  6389. $recv($2)._addAll_(self._allSubclasses());
  6390. $3=$recv($2)._yourself();
  6391. $1=$3;
  6392. return $1;
  6393. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  6394. },
  6395. args: [],
  6396. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6397. referencedClasses: ["Array"],
  6398. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  6399. }),
  6400. $globals.Behavior);
  6401. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  6402. $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.";
  6403. $core.addMethod(
  6404. $core.method({
  6405. selector: "asJavascript",
  6406. protocol: 'converting',
  6407. fn: function (){
  6408. var self=this;
  6409. return $core.withContext(function($ctx1) {
  6410. var $1;
  6411. $1="$globals.".__comma(self._name());
  6412. return $1;
  6413. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  6414. },
  6415. args: [],
  6416. source: "asJavascript\x0a\x09^ '$globals.', self name",
  6417. referencedClasses: [],
  6418. messageSends: [",", "name"]
  6419. }),
  6420. $globals.Class);
  6421. $core.addMethod(
  6422. $core.method({
  6423. selector: "browse",
  6424. protocol: 'browsing',
  6425. fn: function (){
  6426. var self=this;
  6427. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  6428. return $core.withContext(function($ctx1) {
  6429. $recv($Finder())._findClass_(self);
  6430. return self;
  6431. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  6432. },
  6433. args: [],
  6434. source: "browse\x0a\x09Finder findClass: self",
  6435. referencedClasses: ["Finder"],
  6436. messageSends: ["findClass:"]
  6437. }),
  6438. $globals.Class);
  6439. $core.addMethod(
  6440. $core.method({
  6441. selector: "category",
  6442. protocol: 'accessing',
  6443. fn: function (){
  6444. var self=this;
  6445. return $core.withContext(function($ctx1) {
  6446. var $2,$1,$receiver;
  6447. $2=self._package();
  6448. $ctx1.sendIdx["package"]=1;
  6449. if(($receiver = $2) == null || $receiver.isNil){
  6450. $1="Unclassified";
  6451. } else {
  6452. $1=$recv(self._package())._name();
  6453. };
  6454. return $1;
  6455. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  6456. },
  6457. args: [],
  6458. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6459. referencedClasses: [],
  6460. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  6461. }),
  6462. $globals.Class);
  6463. $core.addMethod(
  6464. $core.method({
  6465. selector: "classTag",
  6466. protocol: 'accessing',
  6467. fn: function (){
  6468. var self=this;
  6469. return "class";
  6470. },
  6471. args: [],
  6472. 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'",
  6473. referencedClasses: [],
  6474. messageSends: []
  6475. }),
  6476. $globals.Class);
  6477. $core.addMethod(
  6478. $core.method({
  6479. selector: "definition",
  6480. protocol: 'accessing',
  6481. fn: function (){
  6482. var self=this;
  6483. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6484. return $core.withContext(function($ctx1) {
  6485. var $3,$4,$2,$5,$6,$7,$1;
  6486. $1=$recv($String())._streamContents_((function(stream){
  6487. return $core.withContext(function($ctx2) {
  6488. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  6489. $ctx2.sendIdx["nextPutAll:"]=1;
  6490. $recv(stream)._nextPutAll_(" subclass: #");
  6491. $ctx2.sendIdx["nextPutAll:"]=2;
  6492. $recv(stream)._nextPutAll_(self._name());
  6493. $ctx2.sendIdx["nextPutAll:"]=3;
  6494. $3=$recv($String())._lf();
  6495. $ctx2.sendIdx["lf"]=1;
  6496. $4=$recv($String())._tab();
  6497. $ctx2.sendIdx["tab"]=1;
  6498. $2=$recv($3).__comma($4);
  6499. $ctx2.sendIdx[","]=1;
  6500. $recv(stream)._nextPutAll_($2);
  6501. $ctx2.sendIdx["nextPutAll:"]=4;
  6502. $5=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  6503. $ctx2.sendIdx["nextPutAll:"]=5;
  6504. $5;
  6505. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6506. return $core.withContext(function($ctx3) {
  6507. return $recv(stream)._nextPutAll_(each);
  6508. $ctx3.sendIdx["nextPutAll:"]=6;
  6509. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6510. }),(function(){
  6511. return $core.withContext(function($ctx3) {
  6512. return $recv(stream)._nextPutAll_(" ");
  6513. $ctx3.sendIdx["nextPutAll:"]=7;
  6514. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6515. }));
  6516. $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  6517. $ctx2.sendIdx[","]=2;
  6518. $recv(stream)._nextPutAll_($6);
  6519. $ctx2.sendIdx["nextPutAll:"]=8;
  6520. $recv(stream)._nextPutAll_("package: '");
  6521. $ctx2.sendIdx["nextPutAll:"]=9;
  6522. $recv(stream)._nextPutAll_(self._category());
  6523. $ctx2.sendIdx["nextPutAll:"]=10;
  6524. $7=$recv(stream)._nextPutAll_("'");
  6525. return $7;
  6526. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6527. }));
  6528. return $1;
  6529. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  6530. },
  6531. args: [],
  6532. 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: '''' ]",
  6533. referencedClasses: ["String"],
  6534. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  6535. }),
  6536. $globals.Class);
  6537. $core.addMethod(
  6538. $core.method({
  6539. selector: "isClass",
  6540. protocol: 'testing',
  6541. fn: function (){
  6542. var self=this;
  6543. return true;
  6544. },
  6545. args: [],
  6546. source: "isClass\x0a\x09^ true",
  6547. referencedClasses: [],
  6548. messageSends: []
  6549. }),
  6550. $globals.Class);
  6551. $core.addMethod(
  6552. $core.method({
  6553. selector: "package",
  6554. protocol: 'accessing',
  6555. fn: function (){
  6556. var self=this;
  6557. return $core.withContext(function($ctx1) {
  6558. var $1;
  6559. $1=self._basicAt_("pkg");
  6560. return $1;
  6561. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  6562. },
  6563. args: [],
  6564. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6565. referencedClasses: [],
  6566. messageSends: ["basicAt:"]
  6567. }),
  6568. $globals.Class);
  6569. $core.addMethod(
  6570. $core.method({
  6571. selector: "package:",
  6572. protocol: 'accessing',
  6573. fn: function (aPackage){
  6574. var self=this;
  6575. var oldPackage;
  6576. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6577. function $ClassMoved(){return $globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  6578. return $core.withContext(function($ctx1) {
  6579. var $2,$1,$3,$4,$5;
  6580. $2=self._package();
  6581. $ctx1.sendIdx["package"]=1;
  6582. $1=$recv($2).__eq(aPackage);
  6583. if($core.assert($1)){
  6584. return self;
  6585. };
  6586. oldPackage=self._package();
  6587. self._basicAt_put_("pkg",aPackage);
  6588. $3=$recv(oldPackage)._organization();
  6589. $ctx1.sendIdx["organization"]=1;
  6590. $recv($3)._removeElement_(self);
  6591. $recv($recv(aPackage)._organization())._addElement_(self);
  6592. $4=$recv($ClassMoved())._new();
  6593. $recv($4)._theClass_(self);
  6594. $recv($4)._oldPackage_(oldPackage);
  6595. $5=$recv($4)._yourself();
  6596. $recv($recv($SystemAnnouncer())._current())._announce_($5);
  6597. return self;
  6598. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  6599. },
  6600. args: ["aPackage"],
  6601. 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)",
  6602. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  6603. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  6604. }),
  6605. $globals.Class);
  6606. $core.addMethod(
  6607. $core.method({
  6608. selector: "printOn:",
  6609. protocol: 'printing',
  6610. fn: function (aStream){
  6611. var self=this;
  6612. return $core.withContext(function($ctx1) {
  6613. $recv(aStream)._nextPutAll_(self._name());
  6614. return self;
  6615. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  6616. },
  6617. args: ["aStream"],
  6618. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  6619. referencedClasses: [],
  6620. messageSends: ["nextPutAll:", "name"]
  6621. }),
  6622. $globals.Class);
  6623. $core.addMethod(
  6624. $core.method({
  6625. selector: "rename:",
  6626. protocol: 'accessing',
  6627. fn: function (aString){
  6628. var self=this;
  6629. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6630. return $core.withContext(function($ctx1) {
  6631. $recv($recv($ClassBuilder())._new())._renameClass_to_(self,aString);
  6632. return self;
  6633. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  6634. },
  6635. args: ["aString"],
  6636. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  6637. referencedClasses: ["ClassBuilder"],
  6638. messageSends: ["renameClass:to:", "new"]
  6639. }),
  6640. $globals.Class);
  6641. $core.addMethod(
  6642. $core.method({
  6643. selector: "subclass:instanceVariableNames:",
  6644. protocol: 'class creation',
  6645. fn: function (aString,anotherString){
  6646. var self=this;
  6647. return $core.withContext(function($ctx1) {
  6648. var $1;
  6649. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6650. return $1;
  6651. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  6652. },
  6653. args: ["aString", "anotherString"],
  6654. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  6655. referencedClasses: [],
  6656. messageSends: ["subclass:instanceVariableNames:package:"]
  6657. }),
  6658. $globals.Class);
  6659. $core.addMethod(
  6660. $core.method({
  6661. selector: "subclass:instanceVariableNames:category:",
  6662. protocol: 'class creation',
  6663. fn: function (aString,aString2,aString3){
  6664. var self=this;
  6665. return $core.withContext(function($ctx1) {
  6666. var $1;
  6667. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6668. return $1;
  6669. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6670. },
  6671. args: ["aString", "aString2", "aString3"],
  6672. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  6673. referencedClasses: [],
  6674. messageSends: ["subclass:instanceVariableNames:package:"]
  6675. }),
  6676. $globals.Class);
  6677. $core.addMethod(
  6678. $core.method({
  6679. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  6680. protocol: 'class creation',
  6681. fn: function (aString,aString2,classVars,pools,aString3){
  6682. var self=this;
  6683. return $core.withContext(function($ctx1) {
  6684. var $1;
  6685. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6686. return $1;
  6687. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  6688. },
  6689. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  6690. 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",
  6691. referencedClasses: [],
  6692. messageSends: ["subclass:instanceVariableNames:package:"]
  6693. }),
  6694. $globals.Class);
  6695. $core.addMethod(
  6696. $core.method({
  6697. selector: "subclass:instanceVariableNames:package:",
  6698. protocol: 'class creation',
  6699. fn: function (aString,aString2,aString3){
  6700. var self=this;
  6701. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6702. return $core.withContext(function($ctx1) {
  6703. var $1;
  6704. $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  6705. return $1;
  6706. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6707. },
  6708. args: ["aString", "aString2", "aString3"],
  6709. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6710. referencedClasses: ["ClassBuilder"],
  6711. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  6712. }),
  6713. $globals.Class);
  6714. $core.addMethod(
  6715. $core.method({
  6716. selector: "subclasses",
  6717. protocol: 'accessing',
  6718. fn: function (){
  6719. var self=this;
  6720. return $core.withContext(function($ctx1) {
  6721. return self.subclasses._copy();
  6722. return self;
  6723. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  6724. },
  6725. args: [],
  6726. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  6727. referencedClasses: [],
  6728. messageSends: []
  6729. }),
  6730. $globals.Class);
  6731. $core.addMethod(
  6732. $core.method({
  6733. selector: "theMetaClass",
  6734. protocol: 'accessing',
  6735. fn: function (){
  6736. var self=this;
  6737. return $core.withContext(function($ctx1) {
  6738. var $1;
  6739. $1=self._class();
  6740. return $1;
  6741. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  6742. },
  6743. args: [],
  6744. source: "theMetaClass\x0a\x09^ self class",
  6745. referencedClasses: [],
  6746. messageSends: ["class"]
  6747. }),
  6748. $globals.Class);
  6749. $core.addMethod(
  6750. $core.method({
  6751. selector: "theNonMetaClass",
  6752. protocol: 'accessing',
  6753. fn: function (){
  6754. var self=this;
  6755. return self;
  6756. },
  6757. args: [],
  6758. source: "theNonMetaClass\x0a\x09^ self",
  6759. referencedClasses: [],
  6760. messageSends: []
  6761. }),
  6762. $globals.Class);
  6763. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  6764. $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.";
  6765. $core.addMethod(
  6766. $core.method({
  6767. selector: "asJavascript",
  6768. protocol: 'converting',
  6769. fn: function (){
  6770. var self=this;
  6771. return $core.withContext(function($ctx1) {
  6772. var $1;
  6773. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  6774. $ctx1.sendIdx[","]=1;
  6775. return $1;
  6776. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  6777. },
  6778. args: [],
  6779. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  6780. referencedClasses: [],
  6781. messageSends: [",", "name", "instanceClass"]
  6782. }),
  6783. $globals.Metaclass);
  6784. $core.addMethod(
  6785. $core.method({
  6786. selector: "definition",
  6787. protocol: 'accessing',
  6788. fn: function (){
  6789. var self=this;
  6790. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6791. return $core.withContext(function($ctx1) {
  6792. var $2,$1;
  6793. $1=$recv($String())._streamContents_((function(stream){
  6794. return $core.withContext(function($ctx2) {
  6795. $recv(stream)._nextPutAll_(self._asString());
  6796. $ctx2.sendIdx["nextPutAll:"]=1;
  6797. $2=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  6798. $ctx2.sendIdx["nextPutAll:"]=2;
  6799. $2;
  6800. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6801. return $core.withContext(function($ctx3) {
  6802. return $recv(stream)._nextPutAll_(each);
  6803. $ctx3.sendIdx["nextPutAll:"]=3;
  6804. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6805. }),(function(){
  6806. return $core.withContext(function($ctx3) {
  6807. return $recv(stream)._nextPutAll_(" ");
  6808. $ctx3.sendIdx["nextPutAll:"]=4;
  6809. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6810. }));
  6811. return $recv(stream)._nextPutAll_("'");
  6812. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6813. }));
  6814. return $1;
  6815. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  6816. },
  6817. args: [],
  6818. 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: '''' ]",
  6819. referencedClasses: ["String"],
  6820. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  6821. }),
  6822. $globals.Metaclass);
  6823. $core.addMethod(
  6824. $core.method({
  6825. selector: "instanceClass",
  6826. protocol: 'accessing',
  6827. fn: function (){
  6828. var self=this;
  6829. return $core.withContext(function($ctx1) {
  6830. return self.instanceClass;
  6831. return self;
  6832. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  6833. },
  6834. args: [],
  6835. source: "instanceClass\x0a\x09<return self.instanceClass>",
  6836. referencedClasses: [],
  6837. messageSends: []
  6838. }),
  6839. $globals.Metaclass);
  6840. $core.addMethod(
  6841. $core.method({
  6842. selector: "instanceVariableNames:",
  6843. protocol: 'accessing',
  6844. fn: function (aCollection){
  6845. var self=this;
  6846. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6847. return $core.withContext(function($ctx1) {
  6848. $recv($recv($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  6849. return self;
  6850. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  6851. },
  6852. args: ["aCollection"],
  6853. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  6854. referencedClasses: ["ClassBuilder"],
  6855. messageSends: ["class:instanceVariableNames:", "new"]
  6856. }),
  6857. $globals.Metaclass);
  6858. $core.addMethod(
  6859. $core.method({
  6860. selector: "isMetaclass",
  6861. protocol: 'testing',
  6862. fn: function (){
  6863. var self=this;
  6864. return true;
  6865. },
  6866. args: [],
  6867. source: "isMetaclass\x0a\x09^ true",
  6868. referencedClasses: [],
  6869. messageSends: []
  6870. }),
  6871. $globals.Metaclass);
  6872. $core.addMethod(
  6873. $core.method({
  6874. selector: "package",
  6875. protocol: 'accessing',
  6876. fn: function (){
  6877. var self=this;
  6878. return $core.withContext(function($ctx1) {
  6879. var $1;
  6880. $1=$recv(self._instanceClass())._package();
  6881. return $1;
  6882. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  6883. },
  6884. args: [],
  6885. source: "package\x0a\x09^ self instanceClass package",
  6886. referencedClasses: [],
  6887. messageSends: ["package", "instanceClass"]
  6888. }),
  6889. $globals.Metaclass);
  6890. $core.addMethod(
  6891. $core.method({
  6892. selector: "printOn:",
  6893. protocol: 'printing',
  6894. fn: function (aStream){
  6895. var self=this;
  6896. return $core.withContext(function($ctx1) {
  6897. var $1;
  6898. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  6899. $ctx1.sendIdx["nextPutAll:"]=1;
  6900. $1=$recv(aStream)._nextPutAll_(" class");
  6901. return self;
  6902. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  6903. },
  6904. args: ["aStream"],
  6905. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  6906. referencedClasses: [],
  6907. messageSends: ["nextPutAll:", "name", "instanceClass"]
  6908. }),
  6909. $globals.Metaclass);
  6910. $core.addMethod(
  6911. $core.method({
  6912. selector: "subclasses",
  6913. protocol: 'accessing',
  6914. fn: function (){
  6915. var self=this;
  6916. return $core.withContext(function($ctx1) {
  6917. var $1;
  6918. $1=$recv($recv($recv(self._instanceClass())._subclasses())._select_((function(each){
  6919. return $core.withContext(function($ctx2) {
  6920. return $recv($recv(each)._isMetaclass())._not();
  6921. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6922. })))._collect_((function(each){
  6923. return $core.withContext(function($ctx2) {
  6924. return $recv(each)._theMetaClass();
  6925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  6926. }));
  6927. return $1;
  6928. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  6929. },
  6930. args: [],
  6931. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  6932. referencedClasses: [],
  6933. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"]
  6934. }),
  6935. $globals.Metaclass);
  6936. $core.addMethod(
  6937. $core.method({
  6938. selector: "theMetaClass",
  6939. protocol: 'accessing',
  6940. fn: function (){
  6941. var self=this;
  6942. return self;
  6943. },
  6944. args: [],
  6945. source: "theMetaClass\x0a\x09^ self",
  6946. referencedClasses: [],
  6947. messageSends: []
  6948. }),
  6949. $globals.Metaclass);
  6950. $core.addMethod(
  6951. $core.method({
  6952. selector: "theNonMetaClass",
  6953. protocol: 'accessing',
  6954. fn: function (){
  6955. var self=this;
  6956. return $core.withContext(function($ctx1) {
  6957. var $1;
  6958. $1=self._instanceClass();
  6959. return $1;
  6960. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  6961. },
  6962. args: [],
  6963. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  6964. referencedClasses: [],
  6965. messageSends: ["instanceClass"]
  6966. }),
  6967. $globals.Metaclass);
  6968. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  6969. $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:`.";
  6970. $core.addMethod(
  6971. $core.method({
  6972. selector: "addSubclassOf:named:instanceVariableNames:package:",
  6973. protocol: 'class definition',
  6974. fn: function (aClass,className,aCollection,packageName){
  6975. var self=this;
  6976. var theClass,thePackage;
  6977. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6978. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  6979. return $core.withContext(function($ctx1) {
  6980. var $1,$2,$3,$4,$receiver;
  6981. theClass=$recv($recv($Smalltalk())._globals())._at_(className);
  6982. thePackage=$recv($Package())._named_(packageName);
  6983. $1=theClass;
  6984. if(($receiver = $1) == null || $receiver.isNil){
  6985. $1;
  6986. } else {
  6987. $recv(theClass)._package_(thePackage);
  6988. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  6989. if(!$core.assert($2)){
  6990. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  6991. return $3;
  6992. };
  6993. };
  6994. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  6995. return $4;
  6996. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  6997. },
  6998. args: ["aClass", "className", "aCollection", "packageName"],
  6999. 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",
  7000. referencedClasses: ["Smalltalk", "Package"],
  7001. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  7002. }),
  7003. $globals.ClassBuilder);
  7004. $core.addMethod(
  7005. $core.method({
  7006. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7007. protocol: 'private',
  7008. fn: function (aClass,aString,aCollection,packageName){
  7009. var self=this;
  7010. return $core.withContext(function($ctx1) {
  7011. $core.addClass(aString, aClass, aCollection, packageName);
  7012. return $globals[aString]
  7013. ;
  7014. return self;
  7015. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  7016. },
  7017. args: ["aClass", "aString", "aCollection", "packageName"],
  7018. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09$core.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return $globals[aString]\x0a\x09>",
  7019. referencedClasses: [],
  7020. messageSends: []
  7021. }),
  7022. $globals.ClassBuilder);
  7023. $core.addMethod(
  7024. $core.method({
  7025. selector: "basicClass:instanceVariableNames:",
  7026. protocol: 'private',
  7027. fn: function (aClass,aString){
  7028. var self=this;
  7029. return $core.withContext(function($ctx1) {
  7030. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7031. return self;
  7032. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7033. },
  7034. args: ["aClass", "aString"],
  7035. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7036. referencedClasses: [],
  7037. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  7038. }),
  7039. $globals.ClassBuilder);
  7040. $core.addMethod(
  7041. $core.method({
  7042. selector: "basicClass:instanceVariables:",
  7043. protocol: 'private',
  7044. fn: function (aClass,aCollection){
  7045. var self=this;
  7046. return $core.withContext(function($ctx1) {
  7047. var $1;
  7048. $1=$recv(aClass)._isMetaclass();
  7049. if(!$core.assert($1)){
  7050. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  7051. };
  7052. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  7053. return self;
  7054. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  7055. },
  7056. args: ["aClass", "aCollection"],
  7057. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7058. referencedClasses: [],
  7059. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  7060. }),
  7061. $globals.ClassBuilder);
  7062. $core.addMethod(
  7063. $core.method({
  7064. selector: "basicRemoveClass:",
  7065. protocol: 'private',
  7066. fn: function (aClass){
  7067. var self=this;
  7068. return $core.withContext(function($ctx1) {
  7069. $core.removeClass(aClass);
  7070. return self;
  7071. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  7072. },
  7073. args: ["aClass"],
  7074. source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>",
  7075. referencedClasses: [],
  7076. messageSends: []
  7077. }),
  7078. $globals.ClassBuilder);
  7079. $core.addMethod(
  7080. $core.method({
  7081. selector: "basicRenameClass:to:",
  7082. protocol: 'private',
  7083. fn: function (aClass,aString){
  7084. var self=this;
  7085. return $core.withContext(function($ctx1) {
  7086. $globals[aString] = aClass;
  7087. delete $globals[aClass.className];
  7088. aClass.className = aString;
  7089. ;
  7090. return self;
  7091. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7092. },
  7093. args: ["aClass", "aString"],
  7094. 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>",
  7095. referencedClasses: [],
  7096. messageSends: []
  7097. }),
  7098. $globals.ClassBuilder);
  7099. $core.addMethod(
  7100. $core.method({
  7101. selector: "basicSwapClassNames:with:",
  7102. protocol: 'private',
  7103. fn: function (aClass,anotherClass){
  7104. var self=this;
  7105. return $core.withContext(function($ctx1) {
  7106. var tmp = aClass.className;
  7107. aClass.className = anotherClass.className;
  7108. anotherClass.className = tmp;
  7109. ;
  7110. return self;
  7111. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7112. },
  7113. args: ["aClass", "anotherClass"],
  7114. 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>",
  7115. referencedClasses: [],
  7116. messageSends: []
  7117. }),
  7118. $globals.ClassBuilder);
  7119. $core.addMethod(
  7120. $core.method({
  7121. selector: "class:instanceVariableNames:",
  7122. protocol: 'class definition',
  7123. fn: function (aClass,ivarNames){
  7124. var self=this;
  7125. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7126. function $ClassDefinitionChanged(){return $globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  7127. return $core.withContext(function($ctx1) {
  7128. var $1,$2;
  7129. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7130. self._setupClass_(aClass);
  7131. $1=$recv($ClassDefinitionChanged())._new();
  7132. $recv($1)._theClass_(aClass);
  7133. $2=$recv($1)._yourself();
  7134. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7135. return self;
  7136. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  7137. },
  7138. args: ["aClass", "ivarNames"],
  7139. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7140. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  7141. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7142. }),
  7143. $globals.ClassBuilder);
  7144. $core.addMethod(
  7145. $core.method({
  7146. selector: "copyClass:named:",
  7147. protocol: 'copying',
  7148. fn: function (aClass,className){
  7149. var self=this;
  7150. var newClass;
  7151. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7152. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7153. return $core.withContext(function($ctx1) {
  7154. var $1,$2,$3;
  7155. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7156. self._copyClass_to_(aClass,newClass);
  7157. $1=$recv($ClassAdded())._new();
  7158. $recv($1)._theClass_(newClass);
  7159. $2=$recv($1)._yourself();
  7160. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7161. $3=newClass;
  7162. return $3;
  7163. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  7164. },
  7165. args: ["aClass", "className"],
  7166. 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",
  7167. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7168. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  7169. }),
  7170. $globals.ClassBuilder);
  7171. $core.addMethod(
  7172. $core.method({
  7173. selector: "copyClass:to:",
  7174. protocol: 'copying',
  7175. fn: function (aClass,anotherClass){
  7176. var self=this;
  7177. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7178. return $core.withContext(function($ctx1) {
  7179. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  7180. $recv(anotherClass)._comment_($recv(aClass)._comment());
  7181. $1=$recv(aClass)._methodDictionary();
  7182. $ctx1.sendIdx["methodDictionary"]=1;
  7183. $recv($1)._valuesDo_((function(each){
  7184. return $core.withContext(function($ctx2) {
  7185. $2=$recv($Compiler())._new();
  7186. $ctx2.sendIdx["new"]=1;
  7187. $3=$recv(each)._source();
  7188. $ctx2.sendIdx["source"]=1;
  7189. $4=$recv(each)._protocol();
  7190. $ctx2.sendIdx["protocol"]=1;
  7191. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7192. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7193. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7194. }));
  7195. $ctx1.sendIdx["valuesDo:"]=1;
  7196. $5=$recv(anotherClass)._class();
  7197. $ctx1.sendIdx["class"]=1;
  7198. $7=$recv(aClass)._class();
  7199. $ctx1.sendIdx["class"]=2;
  7200. $6=$recv($7)._instanceVariableNames();
  7201. self._basicClass_instanceVariables_($5,$6);
  7202. $9=$recv(aClass)._class();
  7203. $ctx1.sendIdx["class"]=3;
  7204. $8=$recv($9)._methodDictionary();
  7205. $recv($8)._valuesDo_((function(each){
  7206. return $core.withContext(function($ctx2) {
  7207. return $recv($recv($Compiler())._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7208. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7209. }));
  7210. self._setupClass_(anotherClass);
  7211. return self;
  7212. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7213. },
  7214. args: ["aClass", "anotherClass"],
  7215. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ].\x0a\x0a\x09self setupClass: anotherClass",
  7216. referencedClasses: ["Compiler"],
  7217. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"]
  7218. }),
  7219. $globals.ClassBuilder);
  7220. $core.addMethod(
  7221. $core.method({
  7222. selector: "installMethod:forClass:protocol:",
  7223. protocol: 'method definition',
  7224. fn: function (aCompiledMethod,aBehavior,aString){
  7225. var self=this;
  7226. return $core.withContext(function($ctx1) {
  7227. $recv(aCompiledMethod)._protocol_(aString);
  7228. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7229. return aCompiledMethod;
  7230. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7231. },
  7232. args: ["aCompiledMethod", "aBehavior", "aString"],
  7233. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7234. referencedClasses: [],
  7235. messageSends: ["protocol:", "addCompiledMethod:"]
  7236. }),
  7237. $globals.ClassBuilder);
  7238. $core.addMethod(
  7239. $core.method({
  7240. selector: "instanceVariableNamesFor:",
  7241. protocol: 'accessing',
  7242. fn: function (aString){
  7243. var self=this;
  7244. return $core.withContext(function($ctx1) {
  7245. var $1;
  7246. $1=$recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7247. return $core.withContext(function($ctx2) {
  7248. return $recv(each)._isEmpty();
  7249. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7250. }));
  7251. return $1;
  7252. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7253. },
  7254. args: ["aString"],
  7255. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7256. referencedClasses: [],
  7257. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7258. }),
  7259. $globals.ClassBuilder);
  7260. $core.addMethod(
  7261. $core.method({
  7262. selector: "migrateClass:superclass:",
  7263. protocol: 'class migration',
  7264. fn: function (aClass,anotherClass){
  7265. var self=this;
  7266. return $core.withContext(function($ctx1) {
  7267. var $2,$1;
  7268. $2=$recv(aClass)._name();
  7269. $ctx1.sendIdx["name"]=1;
  7270. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7271. return $1;
  7272. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7273. },
  7274. args: ["aClass", "anotherClass"],
  7275. 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",
  7276. referencedClasses: [],
  7277. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7278. }),
  7279. $globals.ClassBuilder);
  7280. $core.addMethod(
  7281. $core.method({
  7282. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7283. protocol: 'class migration',
  7284. fn: function (className,aClass,aCollection,packageName){
  7285. var self=this;
  7286. var oldClass,newClass,tmp;
  7287. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7288. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  7289. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7290. function $ClassMigrated(){return $globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  7291. return $core.withContext(function($ctx1) {
  7292. var $1,$2,$3,$4,$5;
  7293. tmp="new*".__comma(className);
  7294. oldClass=$recv($recv($Smalltalk())._globals())._at_(className);
  7295. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7296. self._basicSwapClassNames_with_(oldClass,newClass);
  7297. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7298. $recv((function(){
  7299. return $core.withContext(function($ctx2) {
  7300. return self._copyClass_to_(oldClass,newClass);
  7301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7302. }))._on_do_($Error(),(function(exception){
  7303. return $core.withContext(function($ctx2) {
  7304. self._basicSwapClassNames_with_(oldClass,newClass);
  7305. $1=self._basicRemoveClass_(newClass);
  7306. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7307. $1;
  7308. return $recv(exception)._resignal();
  7309. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7310. }));
  7311. self._rawRenameClass_to_(oldClass,tmp);
  7312. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7313. $2=self._rawRenameClass_to_(newClass,className);
  7314. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7315. return $core.withContext(function($ctx2) {
  7316. return self._migrateClass_superclass_(each,newClass);
  7317. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7318. }));
  7319. self._basicRemoveClass_(oldClass);
  7320. $3=$recv($ClassMigrated())._new();
  7321. $recv($3)._theClass_(newClass);
  7322. $recv($3)._oldClass_(oldClass);
  7323. $4=$recv($3)._yourself();
  7324. $recv($recv($SystemAnnouncer())._current())._announce_($4);
  7325. $5=newClass;
  7326. return $5;
  7327. }, 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)});
  7328. },
  7329. args: ["className", "aClass", "aCollection", "packageName"],
  7330. 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",
  7331. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7332. 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"]
  7333. }),
  7334. $globals.ClassBuilder);
  7335. $core.addMethod(
  7336. $core.method({
  7337. selector: "rawRenameClass:to:",
  7338. protocol: 'private',
  7339. fn: function (aClass,aString){
  7340. var self=this;
  7341. return $core.withContext(function($ctx1) {
  7342. $globals[aString] = aClass;
  7343. ;
  7344. return self;
  7345. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7346. },
  7347. args: ["aClass", "aString"],
  7348. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>",
  7349. referencedClasses: [],
  7350. messageSends: []
  7351. }),
  7352. $globals.ClassBuilder);
  7353. $core.addMethod(
  7354. $core.method({
  7355. selector: "renameClass:to:",
  7356. protocol: 'class migration',
  7357. fn: function (aClass,className){
  7358. var self=this;
  7359. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7360. function $ClassRenamed(){return $globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  7361. return $core.withContext(function($ctx1) {
  7362. var $1,$2;
  7363. self._basicRenameClass_to_(aClass,className);
  7364. $recv(aClass)._recompile();
  7365. $1=$recv($ClassRenamed())._new();
  7366. $recv($1)._theClass_(aClass);
  7367. $2=$recv($1)._yourself();
  7368. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7369. return self;
  7370. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7371. },
  7372. args: ["aClass", "className"],
  7373. 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)",
  7374. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7375. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7376. }),
  7377. $globals.ClassBuilder);
  7378. $core.addMethod(
  7379. $core.method({
  7380. selector: "setupClass:",
  7381. protocol: 'public',
  7382. fn: function (aClass){
  7383. var self=this;
  7384. return $core.withContext(function($ctx1) {
  7385. $core.init(aClass);;
  7386. return self;
  7387. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7388. },
  7389. args: ["aClass"],
  7390. source: "setupClass: aClass\x0a\x09<$core.init(aClass);>",
  7391. referencedClasses: [],
  7392. messageSends: []
  7393. }),
  7394. $globals.ClassBuilder);
  7395. $core.addMethod(
  7396. $core.method({
  7397. selector: "superclass:subclass:",
  7398. protocol: 'class definition',
  7399. fn: function (aClass,className){
  7400. var self=this;
  7401. return $core.withContext(function($ctx1) {
  7402. var $1;
  7403. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7404. return $1;
  7405. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7406. },
  7407. args: ["aClass", "className"],
  7408. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7409. referencedClasses: [],
  7410. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7411. }),
  7412. $globals.ClassBuilder);
  7413. $core.addMethod(
  7414. $core.method({
  7415. selector: "superclass:subclass:instanceVariableNames:package:",
  7416. protocol: 'class definition',
  7417. fn: function (aClass,className,ivarNames,packageName){
  7418. var self=this;
  7419. var newClass;
  7420. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7421. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7422. return $core.withContext(function($ctx1) {
  7423. var $1,$2,$3,$4,$5,$receiver;
  7424. $1=self._instanceVariableNamesFor_(ivarNames);
  7425. if(($receiver = packageName) == null || $receiver.isNil){
  7426. $2="unclassified";
  7427. } else {
  7428. $2=packageName;
  7429. };
  7430. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7431. self._setupClass_(newClass);
  7432. $3=$recv($ClassAdded())._new();
  7433. $recv($3)._theClass_(newClass);
  7434. $4=$recv($3)._yourself();
  7435. $recv($recv($SystemAnnouncer())._current())._announce_($4);
  7436. $5=newClass;
  7437. return $5;
  7438. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7439. },
  7440. args: ["aClass", "className", "ivarNames", "packageName"],
  7441. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09self setupClass: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7442. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7443. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7444. }),
  7445. $globals.ClassBuilder);
  7446. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7447. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";
  7448. $core.addMethod(
  7449. $core.method({
  7450. selector: "getNodesFrom:",
  7451. protocol: 'accessing',
  7452. fn: function (aCollection){
  7453. var self=this;
  7454. var children,others;
  7455. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  7456. return $core.withContext(function($ctx1) {
  7457. var $1;
  7458. children=[];
  7459. others=[];
  7460. $recv(aCollection)._do_((function(each){
  7461. return $core.withContext(function($ctx2) {
  7462. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  7463. if($core.assert($1)){
  7464. return $recv(children)._add_(each);
  7465. $ctx2.sendIdx["add:"]=1;
  7466. } else {
  7467. return $recv(others)._add_(each);
  7468. };
  7469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7470. }));
  7471. self["@nodes"]=$recv(children)._collect_((function(each){
  7472. return $core.withContext(function($ctx2) {
  7473. return $recv($ClassSorterNode())._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  7474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  7475. }));
  7476. return self;
  7477. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  7478. },
  7479. args: ["aCollection"],
  7480. 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 ]",
  7481. referencedClasses: ["ClassSorterNode"],
  7482. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  7483. }),
  7484. $globals.ClassSorterNode);
  7485. $core.addMethod(
  7486. $core.method({
  7487. selector: "level",
  7488. protocol: 'accessing',
  7489. fn: function (){
  7490. var self=this;
  7491. var $1;
  7492. $1=self["@level"];
  7493. return $1;
  7494. },
  7495. args: [],
  7496. source: "level\x0a\x09^ level",
  7497. referencedClasses: [],
  7498. messageSends: []
  7499. }),
  7500. $globals.ClassSorterNode);
  7501. $core.addMethod(
  7502. $core.method({
  7503. selector: "level:",
  7504. protocol: 'accessing',
  7505. fn: function (anInteger){
  7506. var self=this;
  7507. self["@level"]=anInteger;
  7508. return self;
  7509. },
  7510. args: ["anInteger"],
  7511. source: "level: anInteger\x0a\x09level := anInteger",
  7512. referencedClasses: [],
  7513. messageSends: []
  7514. }),
  7515. $globals.ClassSorterNode);
  7516. $core.addMethod(
  7517. $core.method({
  7518. selector: "nodes",
  7519. protocol: 'accessing',
  7520. fn: function (){
  7521. var self=this;
  7522. var $1;
  7523. $1=self["@nodes"];
  7524. return $1;
  7525. },
  7526. args: [],
  7527. source: "nodes\x0a\x09^ nodes",
  7528. referencedClasses: [],
  7529. messageSends: []
  7530. }),
  7531. $globals.ClassSorterNode);
  7532. $core.addMethod(
  7533. $core.method({
  7534. selector: "theClass",
  7535. protocol: 'accessing',
  7536. fn: function (){
  7537. var self=this;
  7538. var $1;
  7539. $1=self["@theClass"];
  7540. return $1;
  7541. },
  7542. args: [],
  7543. source: "theClass\x0a\x09^ theClass",
  7544. referencedClasses: [],
  7545. messageSends: []
  7546. }),
  7547. $globals.ClassSorterNode);
  7548. $core.addMethod(
  7549. $core.method({
  7550. selector: "theClass:",
  7551. protocol: 'accessing',
  7552. fn: function (aClass){
  7553. var self=this;
  7554. self["@theClass"]=aClass;
  7555. return self;
  7556. },
  7557. args: ["aClass"],
  7558. source: "theClass: aClass\x0a\x09theClass := aClass",
  7559. referencedClasses: [],
  7560. messageSends: []
  7561. }),
  7562. $globals.ClassSorterNode);
  7563. $core.addMethod(
  7564. $core.method({
  7565. selector: "traverseClassesWith:",
  7566. protocol: 'visiting',
  7567. fn: function (aCollection){
  7568. var self=this;
  7569. return $core.withContext(function($ctx1) {
  7570. var $1,$3,$2;
  7571. $1=self._theClass();
  7572. $ctx1.sendIdx["theClass"]=1;
  7573. $recv(aCollection)._add_($1);
  7574. $recv($recv(self._nodes())._sorted_((function(a,b){
  7575. return $core.withContext(function($ctx2) {
  7576. $3=$recv(a)._theClass();
  7577. $ctx2.sendIdx["theClass"]=2;
  7578. $2=$recv($3)._name();
  7579. $ctx2.sendIdx["name"]=1;
  7580. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  7581. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  7582. })))._do_((function(aNode){
  7583. return $core.withContext(function($ctx2) {
  7584. return $recv(aNode)._traverseClassesWith_(aCollection);
  7585. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  7586. }));
  7587. return self;
  7588. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  7589. },
  7590. args: ["aCollection"],
  7591. 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 ].",
  7592. referencedClasses: [],
  7593. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  7594. }),
  7595. $globals.ClassSorterNode);
  7596. $core.addMethod(
  7597. $core.method({
  7598. selector: "on:classes:level:",
  7599. protocol: 'instance creation',
  7600. fn: function (aClass,aCollection,anInteger){
  7601. var self=this;
  7602. return $core.withContext(function($ctx1) {
  7603. var $2,$3,$1;
  7604. $2=self._new();
  7605. $recv($2)._theClass_(aClass);
  7606. $recv($2)._level_(anInteger);
  7607. $recv($2)._getNodesFrom_(aCollection);
  7608. $3=$recv($2)._yourself();
  7609. $1=$3;
  7610. return $1;
  7611. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  7612. },
  7613. args: ["aClass", "aCollection", "anInteger"],
  7614. 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",
  7615. referencedClasses: [],
  7616. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  7617. }),
  7618. $globals.ClassSorterNode.klass);
  7619. });
  7620. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7621. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  7622. $core.addPackage('Kernel-Methods');
  7623. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  7624. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7625. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  7626. $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 | ... ] `";
  7627. $core.addMethod(
  7628. $core.method({
  7629. selector: "applyTo:arguments:",
  7630. protocol: 'evaluating',
  7631. fn: function (anObject,aCollection){
  7632. var self=this;
  7633. return $core.withContext(function($ctx1) {
  7634. return self.apply(anObject, aCollection);
  7635. return self;
  7636. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  7637. },
  7638. args: ["anObject", "aCollection"],
  7639. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7640. referencedClasses: [],
  7641. messageSends: []
  7642. }),
  7643. $globals.BlockClosure);
  7644. $core.addMethod(
  7645. $core.method({
  7646. selector: "asCompiledMethod:",
  7647. protocol: 'converting',
  7648. fn: function (aString){
  7649. var self=this;
  7650. return $core.withContext(function($ctx1) {
  7651. return $core.method({selector:aString, fn:self});;
  7652. return self;
  7653. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  7654. },
  7655. args: ["aString"],
  7656. source: "asCompiledMethod: aString\x0a\x09<return $core.method({selector:aString, fn:self});>",
  7657. referencedClasses: [],
  7658. messageSends: []
  7659. }),
  7660. $globals.BlockClosure);
  7661. $core.addMethod(
  7662. $core.method({
  7663. selector: "compiledSource",
  7664. protocol: 'accessing',
  7665. fn: function (){
  7666. var self=this;
  7667. return $core.withContext(function($ctx1) {
  7668. return self.toString();
  7669. return self;
  7670. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  7671. },
  7672. args: [],
  7673. source: "compiledSource\x0a\x09<return self.toString()>",
  7674. referencedClasses: [],
  7675. messageSends: []
  7676. }),
  7677. $globals.BlockClosure);
  7678. $core.addMethod(
  7679. $core.method({
  7680. selector: "currySelf",
  7681. protocol: 'converting',
  7682. fn: function (){
  7683. var self=this;
  7684. return $core.withContext(function($ctx1) {
  7685. return function () {
  7686. var args = [ this ];
  7687. args.push.apply(args, arguments);
  7688. return self.apply(null, args);
  7689. }
  7690. ;
  7691. return self;
  7692. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  7693. },
  7694. args: [],
  7695. 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>",
  7696. referencedClasses: [],
  7697. messageSends: []
  7698. }),
  7699. $globals.BlockClosure);
  7700. $core.addMethod(
  7701. $core.method({
  7702. selector: "ensure:",
  7703. protocol: 'evaluating',
  7704. fn: function (aBlock){
  7705. var self=this;
  7706. return $core.withContext(function($ctx1) {
  7707. try{return self._value()}finally{aBlock._value()};
  7708. return self;
  7709. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  7710. },
  7711. args: ["aBlock"],
  7712. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  7713. referencedClasses: [],
  7714. messageSends: []
  7715. }),
  7716. $globals.BlockClosure);
  7717. $core.addMethod(
  7718. $core.method({
  7719. selector: "fork",
  7720. protocol: 'timeout/interval',
  7721. fn: function (){
  7722. var self=this;
  7723. function $ForkPool(){return $globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  7724. return $core.withContext(function($ctx1) {
  7725. $recv($recv($ForkPool())._default())._fork_(self);
  7726. return self;
  7727. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  7728. },
  7729. args: [],
  7730. source: "fork\x0a\x09ForkPool default fork: self",
  7731. referencedClasses: ["ForkPool"],
  7732. messageSends: ["fork:", "default"]
  7733. }),
  7734. $globals.BlockClosure);
  7735. $core.addMethod(
  7736. $core.method({
  7737. selector: "new",
  7738. protocol: 'evaluating',
  7739. fn: function (){
  7740. var self=this;
  7741. return $core.withContext(function($ctx1) {
  7742. return new self();
  7743. return self;
  7744. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  7745. },
  7746. args: [],
  7747. 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()>",
  7748. referencedClasses: [],
  7749. messageSends: []
  7750. }),
  7751. $globals.BlockClosure);
  7752. $core.addMethod(
  7753. $core.method({
  7754. selector: "newValue:",
  7755. protocol: 'evaluating',
  7756. fn: function (anObject){
  7757. var self=this;
  7758. return $core.withContext(function($ctx1) {
  7759. var $1;
  7760. $1=self._newWithValues_([anObject]);
  7761. return $1;
  7762. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  7763. },
  7764. args: ["anObject"],
  7765. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  7766. referencedClasses: [],
  7767. messageSends: ["newWithValues:"]
  7768. }),
  7769. $globals.BlockClosure);
  7770. $core.addMethod(
  7771. $core.method({
  7772. selector: "newValue:value:",
  7773. protocol: 'evaluating',
  7774. fn: function (anObject,anObject2){
  7775. var self=this;
  7776. return $core.withContext(function($ctx1) {
  7777. var $1;
  7778. $1=self._newWithValues_([anObject,anObject2]);
  7779. return $1;
  7780. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  7781. },
  7782. args: ["anObject", "anObject2"],
  7783. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  7784. referencedClasses: [],
  7785. messageSends: ["newWithValues:"]
  7786. }),
  7787. $globals.BlockClosure);
  7788. $core.addMethod(
  7789. $core.method({
  7790. selector: "newValue:value:value:",
  7791. protocol: 'evaluating',
  7792. fn: function (anObject,anObject2,anObject3){
  7793. var self=this;
  7794. return $core.withContext(function($ctx1) {
  7795. var $1;
  7796. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  7797. return $1;
  7798. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  7799. },
  7800. args: ["anObject", "anObject2", "anObject3"],
  7801. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  7802. referencedClasses: [],
  7803. messageSends: ["newWithValues:"]
  7804. }),
  7805. $globals.BlockClosure);
  7806. $core.addMethod(
  7807. $core.method({
  7808. selector: "newWithValues:",
  7809. protocol: 'evaluating',
  7810. fn: function (aCollection){
  7811. var self=this;
  7812. return $core.withContext(function($ctx1) {
  7813. var object = Object.create(self.prototype);
  7814. var result = self.apply(object, aCollection);
  7815. return typeof result === "object" ? result : object;
  7816. ;
  7817. return self;
  7818. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  7819. },
  7820. args: ["aCollection"],
  7821. 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>",
  7822. referencedClasses: [],
  7823. messageSends: []
  7824. }),
  7825. $globals.BlockClosure);
  7826. $core.addMethod(
  7827. $core.method({
  7828. selector: "numArgs",
  7829. protocol: 'accessing',
  7830. fn: function (){
  7831. var self=this;
  7832. return $core.withContext(function($ctx1) {
  7833. return self.length;
  7834. return self;
  7835. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  7836. },
  7837. args: [],
  7838. source: "numArgs\x0a\x09<return self.length>",
  7839. referencedClasses: [],
  7840. messageSends: []
  7841. }),
  7842. $globals.BlockClosure);
  7843. $core.addMethod(
  7844. $core.method({
  7845. selector: "on:do:",
  7846. protocol: 'error handling',
  7847. fn: function (anErrorClass,aBlock){
  7848. var self=this;
  7849. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7850. return $core.withContext(function($ctx1) {
  7851. var $2,$1;
  7852. $1=self._tryCatch_((function(error){
  7853. var smalltalkError;
  7854. return $core.withContext(function($ctx2) {
  7855. smalltalkError=$recv($Smalltalk())._asSmalltalkException_(error);
  7856. smalltalkError;
  7857. $2=$recv(smalltalkError)._isKindOf_(anErrorClass);
  7858. if($core.assert($2)){
  7859. return $recv(aBlock)._value_(smalltalkError);
  7860. } else {
  7861. return $recv(smalltalkError)._resignal();
  7862. };
  7863. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  7864. }));
  7865. return $1;
  7866. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  7867. },
  7868. args: ["anErrorClass", "aBlock"],
  7869. 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 ] ]",
  7870. referencedClasses: ["Smalltalk"],
  7871. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  7872. }),
  7873. $globals.BlockClosure);
  7874. $core.addMethod(
  7875. $core.method({
  7876. selector: "receiver",
  7877. protocol: 'accessing',
  7878. fn: function (){
  7879. var self=this;
  7880. return nil;
  7881. },
  7882. args: [],
  7883. source: "receiver\x0a\x09^ nil",
  7884. referencedClasses: [],
  7885. messageSends: []
  7886. }),
  7887. $globals.BlockClosure);
  7888. $core.addMethod(
  7889. $core.method({
  7890. selector: "timeToRun",
  7891. protocol: 'evaluating',
  7892. fn: function (){
  7893. var self=this;
  7894. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  7895. return $core.withContext(function($ctx1) {
  7896. var $1;
  7897. $1=$recv($Date())._millisecondsToRun_(self);
  7898. return $1;
  7899. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  7900. },
  7901. args: [],
  7902. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  7903. referencedClasses: ["Date"],
  7904. messageSends: ["millisecondsToRun:"]
  7905. }),
  7906. $globals.BlockClosure);
  7907. $core.addMethod(
  7908. $core.method({
  7909. selector: "tryCatch:",
  7910. protocol: 'error handling',
  7911. fn: function (aBlock){
  7912. var self=this;
  7913. return $core.withContext(function($ctx1) {
  7914. try {
  7915. return self._value();
  7916. } catch(error) {
  7917. // pass non-local returns undetected
  7918. if (Array.isArray(error) && error.length === 1) throw error;
  7919. return aBlock._value_(error);
  7920. }
  7921. ;
  7922. return self;
  7923. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  7924. },
  7925. args: ["aBlock"],
  7926. 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>",
  7927. referencedClasses: [],
  7928. messageSends: []
  7929. }),
  7930. $globals.BlockClosure);
  7931. $core.addMethod(
  7932. $core.method({
  7933. selector: "value",
  7934. protocol: 'evaluating',
  7935. fn: function (){
  7936. var self=this;
  7937. return $core.withContext(function($ctx1) {
  7938. return self();;
  7939. return self;
  7940. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  7941. },
  7942. args: [],
  7943. source: "value\x0a\x09<return self();>",
  7944. referencedClasses: [],
  7945. messageSends: []
  7946. }),
  7947. $globals.BlockClosure);
  7948. $core.addMethod(
  7949. $core.method({
  7950. selector: "value:",
  7951. protocol: 'evaluating',
  7952. fn: function (anArg){
  7953. var self=this;
  7954. return $core.withContext(function($ctx1) {
  7955. return self(anArg);;
  7956. return self;
  7957. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  7958. },
  7959. args: ["anArg"],
  7960. source: "value: anArg\x0a\x09<return self(anArg);>",
  7961. referencedClasses: [],
  7962. messageSends: []
  7963. }),
  7964. $globals.BlockClosure);
  7965. $core.addMethod(
  7966. $core.method({
  7967. selector: "value:value:",
  7968. protocol: 'evaluating',
  7969. fn: function (firstArg,secondArg){
  7970. var self=this;
  7971. return $core.withContext(function($ctx1) {
  7972. return self(firstArg, secondArg);;
  7973. return self;
  7974. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  7975. },
  7976. args: ["firstArg", "secondArg"],
  7977. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  7978. referencedClasses: [],
  7979. messageSends: []
  7980. }),
  7981. $globals.BlockClosure);
  7982. $core.addMethod(
  7983. $core.method({
  7984. selector: "value:value:value:",
  7985. protocol: 'evaluating',
  7986. fn: function (firstArg,secondArg,thirdArg){
  7987. var self=this;
  7988. return $core.withContext(function($ctx1) {
  7989. return self(firstArg, secondArg, thirdArg);;
  7990. return self;
  7991. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  7992. },
  7993. args: ["firstArg", "secondArg", "thirdArg"],
  7994. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  7995. referencedClasses: [],
  7996. messageSends: []
  7997. }),
  7998. $globals.BlockClosure);
  7999. $core.addMethod(
  8000. $core.method({
  8001. selector: "valueWithInterval:",
  8002. protocol: 'timeout/interval',
  8003. fn: function (aNumber){
  8004. var self=this;
  8005. return $core.withContext(function($ctx1) {
  8006. var interval = setInterval(self, aNumber);
  8007. return $globals.Timeout._on_(interval);
  8008. ;
  8009. return self;
  8010. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  8011. },
  8012. args: ["aNumber"],
  8013. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>",
  8014. referencedClasses: [],
  8015. messageSends: []
  8016. }),
  8017. $globals.BlockClosure);
  8018. $core.addMethod(
  8019. $core.method({
  8020. selector: "valueWithPossibleArguments:",
  8021. protocol: 'evaluating',
  8022. fn: function (aCollection){
  8023. var self=this;
  8024. return $core.withContext(function($ctx1) {
  8025. return self.apply(null, aCollection);;
  8026. return self;
  8027. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  8028. },
  8029. args: ["aCollection"],
  8030. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  8031. referencedClasses: [],
  8032. messageSends: []
  8033. }),
  8034. $globals.BlockClosure);
  8035. $core.addMethod(
  8036. $core.method({
  8037. selector: "valueWithTimeout:",
  8038. protocol: 'timeout/interval',
  8039. fn: function (aNumber){
  8040. var self=this;
  8041. return $core.withContext(function($ctx1) {
  8042. var timeout = setTimeout(self, aNumber);
  8043. return $globals.Timeout._on_(timeout);
  8044. ;
  8045. return self;
  8046. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  8047. },
  8048. args: ["aNumber"],
  8049. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>",
  8050. referencedClasses: [],
  8051. messageSends: []
  8052. }),
  8053. $globals.BlockClosure);
  8054. $core.addMethod(
  8055. $core.method({
  8056. selector: "whileFalse",
  8057. protocol: 'controlling',
  8058. fn: function (){
  8059. var self=this;
  8060. return $core.withContext(function($ctx1) {
  8061. self._whileFalse_((function(){
  8062. }));
  8063. return self;
  8064. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  8065. },
  8066. args: [],
  8067. source: "whileFalse\x0a\x09self whileFalse: []",
  8068. referencedClasses: [],
  8069. messageSends: ["whileFalse:"]
  8070. }),
  8071. $globals.BlockClosure);
  8072. $core.addMethod(
  8073. $core.method({
  8074. selector: "whileFalse:",
  8075. protocol: 'controlling',
  8076. fn: function (aBlock){
  8077. var self=this;
  8078. return $core.withContext(function($ctx1) {
  8079. while(!$core.assert(self._value())) {aBlock._value()};
  8080. return self;
  8081. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  8082. },
  8083. args: ["aBlock"],
  8084. source: "whileFalse: aBlock\x0a\x09<while(!$core.assert(self._value())) {aBlock._value()}>",
  8085. referencedClasses: [],
  8086. messageSends: []
  8087. }),
  8088. $globals.BlockClosure);
  8089. $core.addMethod(
  8090. $core.method({
  8091. selector: "whileTrue",
  8092. protocol: 'controlling',
  8093. fn: function (){
  8094. var self=this;
  8095. return $core.withContext(function($ctx1) {
  8096. self._whileTrue_((function(){
  8097. }));
  8098. return self;
  8099. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  8100. },
  8101. args: [],
  8102. source: "whileTrue\x0a\x09self whileTrue: []",
  8103. referencedClasses: [],
  8104. messageSends: ["whileTrue:"]
  8105. }),
  8106. $globals.BlockClosure);
  8107. $core.addMethod(
  8108. $core.method({
  8109. selector: "whileTrue:",
  8110. protocol: 'controlling',
  8111. fn: function (aBlock){
  8112. var self=this;
  8113. return $core.withContext(function($ctx1) {
  8114. while($core.assert(self._value())) {aBlock._value()};
  8115. return self;
  8116. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  8117. },
  8118. args: ["aBlock"],
  8119. source: "whileTrue: aBlock\x0a\x09<while($core.assert(self._value())) {aBlock._value()}>",
  8120. referencedClasses: [],
  8121. messageSends: []
  8122. }),
  8123. $globals.BlockClosure);
  8124. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  8125. $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";
  8126. $core.addMethod(
  8127. $core.method({
  8128. selector: "arguments",
  8129. protocol: 'accessing',
  8130. fn: function (){
  8131. var self=this;
  8132. return $core.withContext(function($ctx1) {
  8133. return self.args || [];
  8134. return self;
  8135. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  8136. },
  8137. args: [],
  8138. source: "arguments\x0a\x09<return self.args || []>",
  8139. referencedClasses: [],
  8140. messageSends: []
  8141. }),
  8142. $globals.CompiledMethod);
  8143. $core.addMethod(
  8144. $core.method({
  8145. selector: "browse",
  8146. protocol: 'browsing',
  8147. fn: function (){
  8148. var self=this;
  8149. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  8150. return $core.withContext(function($ctx1) {
  8151. $recv($Finder())._findMethod_(self);
  8152. return self;
  8153. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  8154. },
  8155. args: [],
  8156. source: "browse\x0a\x09Finder findMethod: self",
  8157. referencedClasses: ["Finder"],
  8158. messageSends: ["findMethod:"]
  8159. }),
  8160. $globals.CompiledMethod);
  8161. $core.addMethod(
  8162. $core.method({
  8163. selector: "category",
  8164. protocol: 'accessing',
  8165. fn: function (){
  8166. var self=this;
  8167. return $core.withContext(function($ctx1) {
  8168. var $1;
  8169. $1=self._protocol();
  8170. return $1;
  8171. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  8172. },
  8173. args: [],
  8174. source: "category\x0a\x09^ self protocol",
  8175. referencedClasses: [],
  8176. messageSends: ["protocol"]
  8177. }),
  8178. $globals.CompiledMethod);
  8179. $core.addMethod(
  8180. $core.method({
  8181. selector: "defaultProtocol",
  8182. protocol: 'defaults',
  8183. fn: function (){
  8184. var self=this;
  8185. return "as yet unclassified";
  8186. },
  8187. args: [],
  8188. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  8189. referencedClasses: [],
  8190. messageSends: []
  8191. }),
  8192. $globals.CompiledMethod);
  8193. $core.addMethod(
  8194. $core.method({
  8195. selector: "fn",
  8196. protocol: 'accessing',
  8197. fn: function (){
  8198. var self=this;
  8199. return $core.withContext(function($ctx1) {
  8200. var $1;
  8201. $1=self._basicAt_("fn");
  8202. return $1;
  8203. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  8204. },
  8205. args: [],
  8206. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8207. referencedClasses: [],
  8208. messageSends: ["basicAt:"]
  8209. }),
  8210. $globals.CompiledMethod);
  8211. $core.addMethod(
  8212. $core.method({
  8213. selector: "fn:",
  8214. protocol: 'accessing',
  8215. fn: function (aBlock){
  8216. var self=this;
  8217. return $core.withContext(function($ctx1) {
  8218. self._basicAt_put_("fn",aBlock);
  8219. return self;
  8220. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8221. },
  8222. args: ["aBlock"],
  8223. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8224. referencedClasses: [],
  8225. messageSends: ["basicAt:put:"]
  8226. }),
  8227. $globals.CompiledMethod);
  8228. $core.addMethod(
  8229. $core.method({
  8230. selector: "isCompiledMethod",
  8231. protocol: 'testing',
  8232. fn: function (){
  8233. var self=this;
  8234. return true;
  8235. },
  8236. args: [],
  8237. source: "isCompiledMethod\x0a\x09^ true",
  8238. referencedClasses: [],
  8239. messageSends: []
  8240. }),
  8241. $globals.CompiledMethod);
  8242. $core.addMethod(
  8243. $core.method({
  8244. selector: "isOverridden",
  8245. protocol: 'testing',
  8246. fn: function (){
  8247. var self=this;
  8248. var selector;
  8249. return $core.withContext(function($ctx1) {
  8250. var $1;
  8251. var $early={};
  8252. try {
  8253. selector=self._selector();
  8254. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8255. return $core.withContext(function($ctx2) {
  8256. $1=$recv(each)._includesSelector_(selector);
  8257. if($core.assert($1)){
  8258. throw $early=[true];
  8259. };
  8260. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8261. }));
  8262. return false;
  8263. }
  8264. catch(e) {if(e===$early)return e[0]; throw e}
  8265. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8266. },
  8267. args: [],
  8268. 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",
  8269. referencedClasses: [],
  8270. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8271. }),
  8272. $globals.CompiledMethod);
  8273. $core.addMethod(
  8274. $core.method({
  8275. selector: "isOverride",
  8276. protocol: 'testing',
  8277. fn: function (){
  8278. var self=this;
  8279. var superclass;
  8280. return $core.withContext(function($ctx1) {
  8281. var $1,$2,$3,$receiver;
  8282. $1=self._methodClass();
  8283. $ctx1.sendIdx["methodClass"]=1;
  8284. superclass=$recv($1)._superclass();
  8285. $ctx1.sendIdx["superclass"]=1;
  8286. $2=superclass;
  8287. if(($receiver = $2) == null || $receiver.isNil){
  8288. return false;
  8289. } else {
  8290. $2;
  8291. };
  8292. $3=$recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8293. return $3;
  8294. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8295. },
  8296. args: [],
  8297. 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",
  8298. referencedClasses: [],
  8299. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8300. }),
  8301. $globals.CompiledMethod);
  8302. $core.addMethod(
  8303. $core.method({
  8304. selector: "messageSends",
  8305. protocol: 'accessing',
  8306. fn: function (){
  8307. var self=this;
  8308. return $core.withContext(function($ctx1) {
  8309. var $1;
  8310. $1=self._basicAt_("messageSends");
  8311. return $1;
  8312. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8313. },
  8314. args: [],
  8315. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8316. referencedClasses: [],
  8317. messageSends: ["basicAt:"]
  8318. }),
  8319. $globals.CompiledMethod);
  8320. $core.addMethod(
  8321. $core.method({
  8322. selector: "methodClass",
  8323. protocol: 'accessing',
  8324. fn: function (){
  8325. var self=this;
  8326. return $core.withContext(function($ctx1) {
  8327. var $1;
  8328. $1=self._basicAt_("methodClass");
  8329. return $1;
  8330. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8331. },
  8332. args: [],
  8333. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8334. referencedClasses: [],
  8335. messageSends: ["basicAt:"]
  8336. }),
  8337. $globals.CompiledMethod);
  8338. $core.addMethod(
  8339. $core.method({
  8340. selector: "package",
  8341. protocol: 'accessing',
  8342. fn: function (){
  8343. var self=this;
  8344. return $core.withContext(function($ctx1) {
  8345. var $2,$1,$receiver;
  8346. $2=self._methodClass();
  8347. if(($receiver = $2) == null || $receiver.isNil){
  8348. $1=$2;
  8349. } else {
  8350. var class_;
  8351. class_=$receiver;
  8352. $1=$recv(class_)._packageOfProtocol_(self._protocol());
  8353. };
  8354. return $1;
  8355. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8356. },
  8357. args: [],
  8358. 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 ]",
  8359. referencedClasses: [],
  8360. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8361. }),
  8362. $globals.CompiledMethod);
  8363. $core.addMethod(
  8364. $core.method({
  8365. selector: "protocol",
  8366. protocol: 'accessing',
  8367. fn: function (){
  8368. var self=this;
  8369. return $core.withContext(function($ctx1) {
  8370. var $2,$1,$receiver;
  8371. $2=self._basicAt_("protocol");
  8372. if(($receiver = $2) == null || $receiver.isNil){
  8373. $1=self._defaultProtocol();
  8374. } else {
  8375. $1=$2;
  8376. };
  8377. return $1;
  8378. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8379. },
  8380. args: [],
  8381. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8382. referencedClasses: [],
  8383. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8384. }),
  8385. $globals.CompiledMethod);
  8386. $core.addMethod(
  8387. $core.method({
  8388. selector: "protocol:",
  8389. protocol: 'accessing',
  8390. fn: function (aString){
  8391. var self=this;
  8392. var oldProtocol;
  8393. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8394. function $MethodMoved(){return $globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  8395. return $core.withContext(function($ctx1) {
  8396. var $1,$2,$3,$receiver;
  8397. oldProtocol=self._protocol();
  8398. self._basicAt_put_("protocol",aString);
  8399. $1=$recv($MethodMoved())._new();
  8400. $recv($1)._method_(self);
  8401. $recv($1)._oldProtocol_(oldProtocol);
  8402. $2=$recv($1)._yourself();
  8403. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  8404. $3=self._methodClass();
  8405. if(($receiver = $3) == null || $receiver.isNil){
  8406. $3;
  8407. } else {
  8408. var methodClass;
  8409. methodClass=$receiver;
  8410. $recv($recv(methodClass)._organization())._addElement_(aString);
  8411. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8412. };
  8413. return self;
  8414. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8415. },
  8416. args: ["aString"],
  8417. 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 ]",
  8418. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8419. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8420. }),
  8421. $globals.CompiledMethod);
  8422. $core.addMethod(
  8423. $core.method({
  8424. selector: "referencedClasses",
  8425. protocol: 'accessing',
  8426. fn: function (){
  8427. var self=this;
  8428. return $core.withContext(function($ctx1) {
  8429. var $1;
  8430. $1=self._basicAt_("referencedClasses");
  8431. return $1;
  8432. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8433. },
  8434. args: [],
  8435. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8436. referencedClasses: [],
  8437. messageSends: ["basicAt:"]
  8438. }),
  8439. $globals.CompiledMethod);
  8440. $core.addMethod(
  8441. $core.method({
  8442. selector: "selector",
  8443. protocol: 'accessing',
  8444. fn: function (){
  8445. var self=this;
  8446. return $core.withContext(function($ctx1) {
  8447. var $1;
  8448. $1=self._basicAt_("selector");
  8449. return $1;
  8450. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8451. },
  8452. args: [],
  8453. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8454. referencedClasses: [],
  8455. messageSends: ["basicAt:"]
  8456. }),
  8457. $globals.CompiledMethod);
  8458. $core.addMethod(
  8459. $core.method({
  8460. selector: "selector:",
  8461. protocol: 'accessing',
  8462. fn: function (aString){
  8463. var self=this;
  8464. return $core.withContext(function($ctx1) {
  8465. self._basicAt_put_("selector",aString);
  8466. return self;
  8467. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8468. },
  8469. args: ["aString"],
  8470. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8471. referencedClasses: [],
  8472. messageSends: ["basicAt:put:"]
  8473. }),
  8474. $globals.CompiledMethod);
  8475. $core.addMethod(
  8476. $core.method({
  8477. selector: "sendTo:arguments:",
  8478. protocol: 'evaluating',
  8479. fn: function (anObject,aCollection){
  8480. var self=this;
  8481. return $core.withContext(function($ctx1) {
  8482. var $1;
  8483. $1=$recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  8484. return $1;
  8485. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  8486. },
  8487. args: ["anObject", "aCollection"],
  8488. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8489. referencedClasses: [],
  8490. messageSends: ["applyTo:arguments:", "fn"]
  8491. }),
  8492. $globals.CompiledMethod);
  8493. $core.addMethod(
  8494. $core.method({
  8495. selector: "source",
  8496. protocol: 'accessing',
  8497. fn: function (){
  8498. var self=this;
  8499. return $core.withContext(function($ctx1) {
  8500. var $2,$1,$receiver;
  8501. $2=self._basicAt_("source");
  8502. if(($receiver = $2) == null || $receiver.isNil){
  8503. $1="";
  8504. } else {
  8505. $1=$2;
  8506. };
  8507. return $1;
  8508. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  8509. },
  8510. args: [],
  8511. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8512. referencedClasses: [],
  8513. messageSends: ["ifNil:", "basicAt:"]
  8514. }),
  8515. $globals.CompiledMethod);
  8516. $core.addMethod(
  8517. $core.method({
  8518. selector: "source:",
  8519. protocol: 'accessing',
  8520. fn: function (aString){
  8521. var self=this;
  8522. return $core.withContext(function($ctx1) {
  8523. self._basicAt_put_("source",aString);
  8524. return self;
  8525. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  8526. },
  8527. args: ["aString"],
  8528. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8529. referencedClasses: [],
  8530. messageSends: ["basicAt:put:"]
  8531. }),
  8532. $globals.CompiledMethod);
  8533. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8534. $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`";
  8535. $core.addMethod(
  8536. $core.method({
  8537. selector: "addWorker",
  8538. protocol: 'private',
  8539. fn: function (){
  8540. var self=this;
  8541. return $core.withContext(function($ctx1) {
  8542. $recv(self["@worker"])._valueWithTimeout_((0));
  8543. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  8544. return self;
  8545. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  8546. },
  8547. args: [],
  8548. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8549. referencedClasses: [],
  8550. messageSends: ["valueWithTimeout:", "+"]
  8551. }),
  8552. $globals.ForkPool);
  8553. $core.addMethod(
  8554. $core.method({
  8555. selector: "defaultMaxPoolSize",
  8556. protocol: 'defaults',
  8557. fn: function (){
  8558. var self=this;
  8559. return $core.withContext(function($ctx1) {
  8560. var $1;
  8561. $1=$recv(self._class())._defaultMaxPoolSize();
  8562. return $1;
  8563. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  8564. },
  8565. args: [],
  8566. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8567. referencedClasses: [],
  8568. messageSends: ["defaultMaxPoolSize", "class"]
  8569. }),
  8570. $globals.ForkPool);
  8571. $core.addMethod(
  8572. $core.method({
  8573. selector: "fork:",
  8574. protocol: 'actions',
  8575. fn: function (aBlock){
  8576. var self=this;
  8577. return $core.withContext(function($ctx1) {
  8578. var $1;
  8579. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  8580. if($core.assert($1)){
  8581. self._addWorker();
  8582. };
  8583. $recv(self["@queue"])._nextPut_(aBlock);
  8584. return self;
  8585. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  8586. },
  8587. args: ["aBlock"],
  8588. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8589. referencedClasses: [],
  8590. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  8591. }),
  8592. $globals.ForkPool);
  8593. $core.addMethod(
  8594. $core.method({
  8595. selector: "initialize",
  8596. protocol: 'initialization',
  8597. fn: function (){
  8598. var self=this;
  8599. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8600. return $core.withContext(function($ctx1) {
  8601. (
  8602. $ctx1.supercall = true,
  8603. $globals.ForkPool.superclass.fn.prototype._initialize.apply($recv(self), []));
  8604. $ctx1.supercall = false;
  8605. self["@poolSize"]=(0);
  8606. self["@queue"]=$recv($Queue())._new();
  8607. self["@worker"]=self._makeWorker();
  8608. return self;
  8609. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  8610. },
  8611. args: [],
  8612. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8613. referencedClasses: ["Queue"],
  8614. messageSends: ["initialize", "new", "makeWorker"]
  8615. }),
  8616. $globals.ForkPool);
  8617. $core.addMethod(
  8618. $core.method({
  8619. selector: "makeWorker",
  8620. protocol: 'initialization',
  8621. fn: function (){
  8622. var self=this;
  8623. var sentinel;
  8624. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  8625. return $core.withContext(function($ctx1) {
  8626. var $2,$1;
  8627. sentinel=$recv($Object())._new();
  8628. $1=(function(){
  8629. var block;
  8630. return $core.withContext(function($ctx2) {
  8631. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  8632. self["@poolSize"];
  8633. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  8634. return sentinel;
  8635. }));
  8636. block;
  8637. $2=$recv(block).__eq_eq(sentinel);
  8638. if(!$core.assert($2)){
  8639. return $recv((function(){
  8640. return $core.withContext(function($ctx3) {
  8641. return $recv(block)._value();
  8642. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  8643. }))._ensure_((function(){
  8644. return $core.withContext(function($ctx3) {
  8645. return self._addWorker();
  8646. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  8647. }));
  8648. };
  8649. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  8650. });
  8651. return $1;
  8652. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  8653. },
  8654. args: [],
  8655. 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 ] ]]",
  8656. referencedClasses: ["Object"],
  8657. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  8658. }),
  8659. $globals.ForkPool);
  8660. $core.addMethod(
  8661. $core.method({
  8662. selector: "maxPoolSize",
  8663. protocol: 'accessing',
  8664. fn: function (){
  8665. var self=this;
  8666. return $core.withContext(function($ctx1) {
  8667. var $2,$1,$receiver;
  8668. $2=self["@maxPoolSize"];
  8669. if(($receiver = $2) == null || $receiver.isNil){
  8670. $1=self._defaultMaxPoolSize();
  8671. } else {
  8672. $1=$2;
  8673. };
  8674. return $1;
  8675. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  8676. },
  8677. args: [],
  8678. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8679. referencedClasses: [],
  8680. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  8681. }),
  8682. $globals.ForkPool);
  8683. $core.addMethod(
  8684. $core.method({
  8685. selector: "maxPoolSize:",
  8686. protocol: 'accessing',
  8687. fn: function (anInteger){
  8688. var self=this;
  8689. self["@maxPoolSize"]=anInteger;
  8690. return self;
  8691. },
  8692. args: ["anInteger"],
  8693. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8694. referencedClasses: [],
  8695. messageSends: []
  8696. }),
  8697. $globals.ForkPool);
  8698. $globals.ForkPool.klass.iVarNames = ['default'];
  8699. $core.addMethod(
  8700. $core.method({
  8701. selector: "default",
  8702. protocol: 'accessing',
  8703. fn: function (){
  8704. var self=this;
  8705. return $core.withContext(function($ctx1) {
  8706. var $2,$1,$receiver;
  8707. $2=self["@default"];
  8708. if(($receiver = $2) == null || $receiver.isNil){
  8709. self["@default"]=self._new();
  8710. $1=self["@default"];
  8711. } else {
  8712. $1=$2;
  8713. };
  8714. return $1;
  8715. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  8716. },
  8717. args: [],
  8718. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  8719. referencedClasses: [],
  8720. messageSends: ["ifNil:", "new"]
  8721. }),
  8722. $globals.ForkPool.klass);
  8723. $core.addMethod(
  8724. $core.method({
  8725. selector: "defaultMaxPoolSize",
  8726. protocol: 'accessing',
  8727. fn: function (){
  8728. var self=this;
  8729. return (100);
  8730. },
  8731. args: [],
  8732. source: "defaultMaxPoolSize\x0a\x09^ 100",
  8733. referencedClasses: [],
  8734. messageSends: []
  8735. }),
  8736. $globals.ForkPool.klass);
  8737. $core.addMethod(
  8738. $core.method({
  8739. selector: "resetDefault",
  8740. protocol: 'accessing',
  8741. fn: function (){
  8742. var self=this;
  8743. self["@default"]=nil;
  8744. return self;
  8745. },
  8746. args: [],
  8747. source: "resetDefault\x0a\x09default := nil",
  8748. referencedClasses: [],
  8749. messageSends: []
  8750. }),
  8751. $globals.ForkPool.klass);
  8752. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  8753. $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.";
  8754. $core.addMethod(
  8755. $core.method({
  8756. selector: "arguments",
  8757. protocol: 'accessing',
  8758. fn: function (){
  8759. var self=this;
  8760. var $1;
  8761. $1=self["@arguments"];
  8762. return $1;
  8763. },
  8764. args: [],
  8765. source: "arguments\x0a\x09^ arguments",
  8766. referencedClasses: [],
  8767. messageSends: []
  8768. }),
  8769. $globals.Message);
  8770. $core.addMethod(
  8771. $core.method({
  8772. selector: "arguments:",
  8773. protocol: 'accessing',
  8774. fn: function (anArray){
  8775. var self=this;
  8776. self["@arguments"]=anArray;
  8777. return self;
  8778. },
  8779. args: ["anArray"],
  8780. source: "arguments: anArray\x0a\x09arguments := anArray",
  8781. referencedClasses: [],
  8782. messageSends: []
  8783. }),
  8784. $globals.Message);
  8785. $core.addMethod(
  8786. $core.method({
  8787. selector: "printOn:",
  8788. protocol: 'printing',
  8789. fn: function (aStream){
  8790. var self=this;
  8791. return $core.withContext(function($ctx1) {
  8792. var $1;
  8793. (
  8794. $ctx1.supercall = true,
  8795. $globals.Message.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  8796. $ctx1.supercall = false;
  8797. $recv(aStream)._nextPutAll_("(");
  8798. $ctx1.sendIdx["nextPutAll:"]=1;
  8799. $recv(aStream)._nextPutAll_(self._selector());
  8800. $ctx1.sendIdx["nextPutAll:"]=2;
  8801. $1=$recv(aStream)._nextPutAll_(")");
  8802. return self;
  8803. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  8804. },
  8805. args: ["aStream"],
  8806. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8807. referencedClasses: [],
  8808. messageSends: ["printOn:", "nextPutAll:", "selector"]
  8809. }),
  8810. $globals.Message);
  8811. $core.addMethod(
  8812. $core.method({
  8813. selector: "selector",
  8814. protocol: 'accessing',
  8815. fn: function (){
  8816. var self=this;
  8817. var $1;
  8818. $1=self["@selector"];
  8819. return $1;
  8820. },
  8821. args: [],
  8822. source: "selector\x0a\x09^ selector",
  8823. referencedClasses: [],
  8824. messageSends: []
  8825. }),
  8826. $globals.Message);
  8827. $core.addMethod(
  8828. $core.method({
  8829. selector: "selector:",
  8830. protocol: 'accessing',
  8831. fn: function (aString){
  8832. var self=this;
  8833. self["@selector"]=aString;
  8834. return self;
  8835. },
  8836. args: ["aString"],
  8837. source: "selector: aString\x0a\x09selector := aString",
  8838. referencedClasses: [],
  8839. messageSends: []
  8840. }),
  8841. $globals.Message);
  8842. $core.addMethod(
  8843. $core.method({
  8844. selector: "sendTo:",
  8845. protocol: 'actions',
  8846. fn: function (anObject){
  8847. var self=this;
  8848. return $core.withContext(function($ctx1) {
  8849. var $1;
  8850. $1=$recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  8851. return $1;
  8852. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  8853. },
  8854. args: ["anObject"],
  8855. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  8856. referencedClasses: [],
  8857. messageSends: ["perform:withArguments:", "selector", "arguments"]
  8858. }),
  8859. $globals.Message);
  8860. $core.addMethod(
  8861. $core.method({
  8862. selector: "selector:arguments:",
  8863. protocol: 'instance creation',
  8864. fn: function (aString,anArray){
  8865. var self=this;
  8866. return $core.withContext(function($ctx1) {
  8867. var $2,$3,$1;
  8868. $2=self._new();
  8869. $recv($2)._selector_(aString);
  8870. $recv($2)._arguments_(anArray);
  8871. $3=$recv($2)._yourself();
  8872. $1=$3;
  8873. return $1;
  8874. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  8875. },
  8876. args: ["aString", "anArray"],
  8877. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  8878. referencedClasses: [],
  8879. messageSends: ["selector:", "new", "arguments:", "yourself"]
  8880. }),
  8881. $globals.Message.klass);
  8882. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  8883. $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.";
  8884. $core.addMethod(
  8885. $core.method({
  8886. selector: "arguments",
  8887. protocol: 'accessing',
  8888. fn: function (){
  8889. var self=this;
  8890. return $core.withContext(function($ctx1) {
  8891. var $1;
  8892. $1=$recv(self["@message"])._arguments();
  8893. return $1;
  8894. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  8895. },
  8896. args: [],
  8897. source: "arguments\x0a\x09^ message arguments",
  8898. referencedClasses: [],
  8899. messageSends: ["arguments"]
  8900. }),
  8901. $globals.MessageSend);
  8902. $core.addMethod(
  8903. $core.method({
  8904. selector: "arguments:",
  8905. protocol: 'accessing',
  8906. fn: function (aCollection){
  8907. var self=this;
  8908. return $core.withContext(function($ctx1) {
  8909. $recv(self["@message"])._arguments_(aCollection);
  8910. return self;
  8911. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  8912. },
  8913. args: ["aCollection"],
  8914. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  8915. referencedClasses: [],
  8916. messageSends: ["arguments:"]
  8917. }),
  8918. $globals.MessageSend);
  8919. $core.addMethod(
  8920. $core.method({
  8921. selector: "initialize",
  8922. protocol: 'initialization',
  8923. fn: function (){
  8924. var self=this;
  8925. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  8926. return $core.withContext(function($ctx1) {
  8927. (
  8928. $ctx1.supercall = true,
  8929. $globals.MessageSend.superclass.fn.prototype._initialize.apply($recv(self), []));
  8930. $ctx1.supercall = false;
  8931. self["@message"]=$recv($Message())._new();
  8932. return self;
  8933. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  8934. },
  8935. args: [],
  8936. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  8937. referencedClasses: ["Message"],
  8938. messageSends: ["initialize", "new"]
  8939. }),
  8940. $globals.MessageSend);
  8941. $core.addMethod(
  8942. $core.method({
  8943. selector: "printOn:",
  8944. protocol: 'printing',
  8945. fn: function (aStream){
  8946. var self=this;
  8947. return $core.withContext(function($ctx1) {
  8948. var $1;
  8949. (
  8950. $ctx1.supercall = true,
  8951. $globals.MessageSend.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  8952. $ctx1.supercall = false;
  8953. $recv(aStream)._nextPutAll_("(");
  8954. $ctx1.sendIdx["nextPutAll:"]=1;
  8955. $recv(aStream)._nextPutAll_(self._receiver());
  8956. $ctx1.sendIdx["nextPutAll:"]=2;
  8957. $recv(aStream)._nextPutAll_(" >> ");
  8958. $ctx1.sendIdx["nextPutAll:"]=3;
  8959. $recv(aStream)._nextPutAll_(self._selector());
  8960. $ctx1.sendIdx["nextPutAll:"]=4;
  8961. $1=$recv(aStream)._nextPutAll_(")");
  8962. return self;
  8963. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  8964. },
  8965. args: ["aStream"],
  8966. 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: ')'",
  8967. referencedClasses: [],
  8968. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  8969. }),
  8970. $globals.MessageSend);
  8971. $core.addMethod(
  8972. $core.method({
  8973. selector: "receiver",
  8974. protocol: 'accessing',
  8975. fn: function (){
  8976. var self=this;
  8977. var $1;
  8978. $1=self["@receiver"];
  8979. return $1;
  8980. },
  8981. args: [],
  8982. source: "receiver\x0a\x09^ receiver",
  8983. referencedClasses: [],
  8984. messageSends: []
  8985. }),
  8986. $globals.MessageSend);
  8987. $core.addMethod(
  8988. $core.method({
  8989. selector: "receiver:",
  8990. protocol: 'accessing',
  8991. fn: function (anObject){
  8992. var self=this;
  8993. self["@receiver"]=anObject;
  8994. return self;
  8995. },
  8996. args: ["anObject"],
  8997. source: "receiver: anObject\x0a\x09receiver := anObject",
  8998. referencedClasses: [],
  8999. messageSends: []
  9000. }),
  9001. $globals.MessageSend);
  9002. $core.addMethod(
  9003. $core.method({
  9004. selector: "selector",
  9005. protocol: 'accessing',
  9006. fn: function (){
  9007. var self=this;
  9008. return $core.withContext(function($ctx1) {
  9009. var $1;
  9010. $1=$recv(self["@message"])._selector();
  9011. return $1;
  9012. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  9013. },
  9014. args: [],
  9015. source: "selector\x0a\x09^ message selector",
  9016. referencedClasses: [],
  9017. messageSends: ["selector"]
  9018. }),
  9019. $globals.MessageSend);
  9020. $core.addMethod(
  9021. $core.method({
  9022. selector: "selector:",
  9023. protocol: 'accessing',
  9024. fn: function (aString){
  9025. var self=this;
  9026. return $core.withContext(function($ctx1) {
  9027. $recv(self["@message"])._selector_(aString);
  9028. return self;
  9029. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  9030. },
  9031. args: ["aString"],
  9032. source: "selector: aString\x0a\x09message selector: aString",
  9033. referencedClasses: [],
  9034. messageSends: ["selector:"]
  9035. }),
  9036. $globals.MessageSend);
  9037. $core.addMethod(
  9038. $core.method({
  9039. selector: "value",
  9040. protocol: 'evaluating',
  9041. fn: function (){
  9042. var self=this;
  9043. return $core.withContext(function($ctx1) {
  9044. var $1;
  9045. $1=$recv(self["@message"])._sendTo_(self._receiver());
  9046. return $1;
  9047. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  9048. },
  9049. args: [],
  9050. source: "value\x0a\x09^ message sendTo: self receiver",
  9051. referencedClasses: [],
  9052. messageSends: ["sendTo:", "receiver"]
  9053. }),
  9054. $globals.MessageSend);
  9055. $core.addMethod(
  9056. $core.method({
  9057. selector: "value:",
  9058. protocol: 'evaluating',
  9059. fn: function (anObject){
  9060. var self=this;
  9061. return $core.withContext(function($ctx1) {
  9062. var $2,$3,$1;
  9063. $2=self["@message"];
  9064. $recv($2)._arguments_([anObject]);
  9065. $3=$recv($2)._sendTo_(self._receiver());
  9066. $1=$3;
  9067. return $1;
  9068. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  9069. },
  9070. args: ["anObject"],
  9071. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9072. referencedClasses: [],
  9073. messageSends: ["arguments:", "sendTo:", "receiver"]
  9074. }),
  9075. $globals.MessageSend);
  9076. $core.addMethod(
  9077. $core.method({
  9078. selector: "value:value:",
  9079. protocol: 'evaluating',
  9080. fn: function (firstArgument,secondArgument){
  9081. var self=this;
  9082. return $core.withContext(function($ctx1) {
  9083. var $2,$3,$1;
  9084. $2=self["@message"];
  9085. $recv($2)._arguments_([firstArgument,secondArgument]);
  9086. $3=$recv($2)._sendTo_(self._receiver());
  9087. $1=$3;
  9088. return $1;
  9089. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  9090. },
  9091. args: ["firstArgument", "secondArgument"],
  9092. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9093. referencedClasses: [],
  9094. messageSends: ["arguments:", "sendTo:", "receiver"]
  9095. }),
  9096. $globals.MessageSend);
  9097. $core.addMethod(
  9098. $core.method({
  9099. selector: "value:value:value:",
  9100. protocol: 'evaluating',
  9101. fn: function (firstArgument,secondArgument,thirdArgument){
  9102. var self=this;
  9103. return $core.withContext(function($ctx1) {
  9104. var $2,$3,$1;
  9105. $2=self["@message"];
  9106. $recv($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9107. $3=$recv($2)._sendTo_(self._receiver());
  9108. $1=$3;
  9109. return $1;
  9110. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  9111. },
  9112. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9113. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9114. referencedClasses: [],
  9115. messageSends: ["arguments:", "sendTo:", "receiver"]
  9116. }),
  9117. $globals.MessageSend);
  9118. $core.addMethod(
  9119. $core.method({
  9120. selector: "valueWithPossibleArguments:",
  9121. protocol: 'evaluating',
  9122. fn: function (aCollection){
  9123. var self=this;
  9124. return $core.withContext(function($ctx1) {
  9125. var $1;
  9126. self._arguments_(aCollection);
  9127. $1=self._value();
  9128. return $1;
  9129. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  9130. },
  9131. args: ["aCollection"],
  9132. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9133. referencedClasses: [],
  9134. messageSends: ["arguments:", "value"]
  9135. }),
  9136. $globals.MessageSend);
  9137. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  9138. $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`.";
  9139. $core.addMethod(
  9140. $core.method({
  9141. selector: "asString",
  9142. protocol: 'converting',
  9143. fn: function (){
  9144. var self=this;
  9145. return $core.withContext(function($ctx1) {
  9146. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  9147. $2=self._isBlockContext();
  9148. if($core.assert($2)){
  9149. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  9150. $ctx1.sendIdx[","]=2;
  9151. $1=$recv($3).__comma(")");
  9152. $ctx1.sendIdx[","]=1;
  9153. } else {
  9154. var methodClass;
  9155. methodClass=$recv(self._method())._methodClass();
  9156. methodClass;
  9157. $5=methodClass;
  9158. $7=self._receiver();
  9159. $ctx1.sendIdx["receiver"]=1;
  9160. $6=$recv($7)._class();
  9161. $ctx1.sendIdx["class"]=1;
  9162. $4=$recv($5).__eq($6);
  9163. if($core.assert($4)){
  9164. $11=self._receiver();
  9165. $ctx1.sendIdx["receiver"]=2;
  9166. $10=$recv($11)._class();
  9167. $ctx1.sendIdx["class"]=2;
  9168. $9=$recv($10)._name();
  9169. $ctx1.sendIdx["name"]=1;
  9170. $8=$recv($9).__comma(" >> ");
  9171. $ctx1.sendIdx[","]=4;
  9172. $12=self._selector();
  9173. $ctx1.sendIdx["selector"]=1;
  9174. $1=$recv($8).__comma($12);
  9175. $ctx1.sendIdx[","]=3;
  9176. } else {
  9177. $16=$recv($recv(self._receiver())._class())._name();
  9178. $ctx1.sendIdx["name"]=2;
  9179. $15=$recv($16).__comma("(");
  9180. $14=$recv($15).__comma($recv(methodClass)._name());
  9181. $ctx1.sendIdx[","]=7;
  9182. $13=$recv($14).__comma(") >> ");
  9183. $ctx1.sendIdx[","]=6;
  9184. $1=$recv($13).__comma(self._selector());
  9185. $ctx1.sendIdx[","]=5;
  9186. };
  9187. };
  9188. return $1;
  9189. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  9190. },
  9191. args: [],
  9192. 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 ] ]",
  9193. referencedClasses: [],
  9194. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  9195. }),
  9196. $globals.MethodContext);
  9197. $core.addMethod(
  9198. $core.method({
  9199. selector: "basicReceiver",
  9200. protocol: 'accessing',
  9201. fn: function (){
  9202. var self=this;
  9203. return $core.withContext(function($ctx1) {
  9204. return self.receiver;
  9205. return self;
  9206. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  9207. },
  9208. args: [],
  9209. source: "basicReceiver\x0a\x09<return self.receiver>",
  9210. referencedClasses: [],
  9211. messageSends: []
  9212. }),
  9213. $globals.MethodContext);
  9214. $core.addMethod(
  9215. $core.method({
  9216. selector: "evaluatedSelector",
  9217. protocol: 'accessing',
  9218. fn: function (){
  9219. var self=this;
  9220. return $core.withContext(function($ctx1) {
  9221. return self.evaluatedSelector;
  9222. return self;
  9223. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  9224. },
  9225. args: [],
  9226. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  9227. referencedClasses: [],
  9228. messageSends: []
  9229. }),
  9230. $globals.MethodContext);
  9231. $core.addMethod(
  9232. $core.method({
  9233. selector: "findContextSuchThat:",
  9234. protocol: 'accessing',
  9235. fn: function (testBlock){
  9236. var self=this;
  9237. var context;
  9238. return $core.withContext(function($ctx1) {
  9239. var $1,$2;
  9240. var $early={};
  9241. try {
  9242. context=self;
  9243. $recv((function(){
  9244. return $core.withContext(function($ctx2) {
  9245. return $recv(context)._isNil();
  9246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9247. }))._whileFalse_((function(){
  9248. return $core.withContext(function($ctx2) {
  9249. $1=$recv(testBlock)._value_(context);
  9250. if($core.assert($1)){
  9251. $2=context;
  9252. throw $early=[$2];
  9253. };
  9254. context=$recv(context)._outerContext();
  9255. return context;
  9256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9257. }));
  9258. return nil;
  9259. }
  9260. catch(e) {if(e===$early)return e[0]; throw e}
  9261. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9262. },
  9263. args: ["testBlock"],
  9264. 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",
  9265. referencedClasses: [],
  9266. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9267. }),
  9268. $globals.MethodContext);
  9269. $core.addMethod(
  9270. $core.method({
  9271. selector: "home",
  9272. protocol: 'accessing',
  9273. fn: function (){
  9274. var self=this;
  9275. return $core.withContext(function($ctx1) {
  9276. return self.homeContext;
  9277. return self;
  9278. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9279. },
  9280. args: [],
  9281. source: "home\x0a\x09<return self.homeContext>",
  9282. referencedClasses: [],
  9283. messageSends: []
  9284. }),
  9285. $globals.MethodContext);
  9286. $core.addMethod(
  9287. $core.method({
  9288. selector: "index",
  9289. protocol: 'accessing',
  9290. fn: function (){
  9291. var self=this;
  9292. return $core.withContext(function($ctx1) {
  9293. return self.index || 0;
  9294. return self;
  9295. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9296. },
  9297. args: [],
  9298. source: "index\x0a\x09<return self.index || 0>",
  9299. referencedClasses: [],
  9300. messageSends: []
  9301. }),
  9302. $globals.MethodContext);
  9303. $core.addMethod(
  9304. $core.method({
  9305. selector: "isBlockContext",
  9306. protocol: 'testing',
  9307. fn: function (){
  9308. var self=this;
  9309. return $core.withContext(function($ctx1) {
  9310. var $1;
  9311. $1=$recv(self._selector())._isNil();
  9312. return $1;
  9313. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9314. },
  9315. args: [],
  9316. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9317. referencedClasses: [],
  9318. messageSends: ["isNil", "selector"]
  9319. }),
  9320. $globals.MethodContext);
  9321. $core.addMethod(
  9322. $core.method({
  9323. selector: "locals",
  9324. protocol: 'accessing',
  9325. fn: function (){
  9326. var self=this;
  9327. return $core.withContext(function($ctx1) {
  9328. return self.locals || {};
  9329. return self;
  9330. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9331. },
  9332. args: [],
  9333. source: "locals\x0a\x09<return self.locals || {}>",
  9334. referencedClasses: [],
  9335. messageSends: []
  9336. }),
  9337. $globals.MethodContext);
  9338. $core.addMethod(
  9339. $core.method({
  9340. selector: "method",
  9341. protocol: 'accessing',
  9342. fn: function (){
  9343. var self=this;
  9344. var method,lookupClass,receiverClass,supercall;
  9345. return $core.withContext(function($ctx1) {
  9346. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$receiver;
  9347. $1=self._methodContext();
  9348. $ctx1.sendIdx["methodContext"]=1;
  9349. if(($receiver = $1) == null || $receiver.isNil){
  9350. return nil;
  9351. } else {
  9352. $1;
  9353. };
  9354. $3=self._methodContext();
  9355. $ctx1.sendIdx["methodContext"]=2;
  9356. $2=$recv($3)._receiver();
  9357. receiverClass=$recv($2)._class();
  9358. $4=receiverClass;
  9359. $6=self._methodContext();
  9360. $ctx1.sendIdx["methodContext"]=3;
  9361. $5=$recv($6)._selector();
  9362. $ctx1.sendIdx["selector"]=1;
  9363. method=$recv($4)._lookupSelector_($5);
  9364. $ctx1.sendIdx["lookupSelector:"]=1;
  9365. $7=self._outerContext();
  9366. if(($receiver = $7) == null || $receiver.isNil){
  9367. supercall=false;
  9368. } else {
  9369. var outer;
  9370. outer=$receiver;
  9371. supercall=$recv(outer)._supercall();
  9372. };
  9373. $9=supercall;
  9374. if($core.assert($9)){
  9375. $8=$recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9376. } else {
  9377. $8=method;
  9378. };
  9379. return $8;
  9380. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9381. },
  9382. args: [],
  9383. 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 ]",
  9384. referencedClasses: [],
  9385. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9386. }),
  9387. $globals.MethodContext);
  9388. $core.addMethod(
  9389. $core.method({
  9390. selector: "methodContext",
  9391. protocol: 'accessing',
  9392. fn: function (){
  9393. var self=this;
  9394. return $core.withContext(function($ctx1) {
  9395. var $1,$3,$2,$receiver;
  9396. $1=self._isBlockContext();
  9397. if(!$core.assert($1)){
  9398. return self;
  9399. };
  9400. $3=self._outerContext();
  9401. if(($receiver = $3) == null || $receiver.isNil){
  9402. $2=$3;
  9403. } else {
  9404. var outer;
  9405. outer=$receiver;
  9406. $2=$recv(outer)._methodContext();
  9407. };
  9408. return $2;
  9409. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9410. },
  9411. args: [],
  9412. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9413. referencedClasses: [],
  9414. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9415. }),
  9416. $globals.MethodContext);
  9417. $core.addMethod(
  9418. $core.method({
  9419. selector: "outerContext",
  9420. protocol: 'accessing',
  9421. fn: function (){
  9422. var self=this;
  9423. return $core.withContext(function($ctx1) {
  9424. return self.outerContext || self.homeContext;
  9425. return self;
  9426. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9427. },
  9428. args: [],
  9429. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9430. referencedClasses: [],
  9431. messageSends: []
  9432. }),
  9433. $globals.MethodContext);
  9434. $core.addMethod(
  9435. $core.method({
  9436. selector: "printOn:",
  9437. protocol: 'printing',
  9438. fn: function (aStream){
  9439. var self=this;
  9440. return $core.withContext(function($ctx1) {
  9441. var $1;
  9442. (
  9443. $ctx1.supercall = true,
  9444. $globals.MethodContext.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  9445. $ctx1.supercall = false;
  9446. $recv(aStream)._nextPutAll_("(");
  9447. $ctx1.sendIdx["nextPutAll:"]=1;
  9448. $recv(aStream)._nextPutAll_(self._asString());
  9449. $ctx1.sendIdx["nextPutAll:"]=2;
  9450. $1=$recv(aStream)._nextPutAll_(")");
  9451. return self;
  9452. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9453. },
  9454. args: ["aStream"],
  9455. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9456. referencedClasses: [],
  9457. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9458. }),
  9459. $globals.MethodContext);
  9460. $core.addMethod(
  9461. $core.method({
  9462. selector: "receiver",
  9463. protocol: 'accessing',
  9464. fn: function (){
  9465. var self=this;
  9466. return $core.withContext(function($ctx1) {
  9467. var $3,$2,$1;
  9468. $2=$recv(self._isBlockContext())._and_((function(){
  9469. return $core.withContext(function($ctx2) {
  9470. $3=self._outerContext();
  9471. $ctx2.sendIdx["outerContext"]=1;
  9472. return $recv($3)._notNil();
  9473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9474. }));
  9475. if($core.assert($2)){
  9476. $1=$recv(self._outerContext())._receiver();
  9477. } else {
  9478. $1=self._basicReceiver();
  9479. };
  9480. return $1;
  9481. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9482. },
  9483. args: [],
  9484. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9485. referencedClasses: [],
  9486. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9487. }),
  9488. $globals.MethodContext);
  9489. $core.addMethod(
  9490. $core.method({
  9491. selector: "selector",
  9492. protocol: 'accessing',
  9493. fn: function (){
  9494. var self=this;
  9495. return $core.withContext(function($ctx1) {
  9496. if(self.selector) {
  9497. return $core.js2st(self.selector);
  9498. } else {
  9499. return nil;
  9500. }
  9501. ;
  9502. return self;
  9503. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9504. },
  9505. args: [],
  9506. 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>",
  9507. referencedClasses: [],
  9508. messageSends: []
  9509. }),
  9510. $globals.MethodContext);
  9511. $core.addMethod(
  9512. $core.method({
  9513. selector: "sendIndexAt:",
  9514. protocol: 'accessing',
  9515. fn: function (aSelector){
  9516. var self=this;
  9517. return $core.withContext(function($ctx1) {
  9518. return self.sendIdx[aSelector] || 0;
  9519. return self;
  9520. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9521. },
  9522. args: ["aSelector"],
  9523. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  9524. referencedClasses: [],
  9525. messageSends: []
  9526. }),
  9527. $globals.MethodContext);
  9528. $core.addMethod(
  9529. $core.method({
  9530. selector: "sendIndexes",
  9531. protocol: 'accessing',
  9532. fn: function (){
  9533. var self=this;
  9534. return $core.withContext(function($ctx1) {
  9535. return self.sendIdx;
  9536. return self;
  9537. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  9538. },
  9539. args: [],
  9540. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  9541. referencedClasses: [],
  9542. messageSends: []
  9543. }),
  9544. $globals.MethodContext);
  9545. $core.addMethod(
  9546. $core.method({
  9547. selector: "supercall",
  9548. protocol: 'accessing',
  9549. fn: function (){
  9550. var self=this;
  9551. return $core.withContext(function($ctx1) {
  9552. return self.supercall == true;
  9553. return self;
  9554. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  9555. },
  9556. args: [],
  9557. source: "supercall\x0a\x09<return self.supercall == true>",
  9558. referencedClasses: [],
  9559. messageSends: []
  9560. }),
  9561. $globals.MethodContext);
  9562. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  9563. $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' ]";
  9564. $core.addMethod(
  9565. $core.method({
  9566. selector: "constructor:",
  9567. protocol: 'instance creation',
  9568. fn: function (aString){
  9569. var self=this;
  9570. return $core.withContext(function($ctx1) {
  9571. self._deprecatedAPI_("Use constructorNamed:");
  9572. var nativeFunc=eval(aString);
  9573. return new nativeFunc();
  9574. ;
  9575. return self;
  9576. }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},$globals.NativeFunction.klass)});
  9577. },
  9578. args: ["aString"],
  9579. 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>",
  9580. referencedClasses: [],
  9581. messageSends: []
  9582. }),
  9583. $globals.NativeFunction.klass);
  9584. $core.addMethod(
  9585. $core.method({
  9586. selector: "constructor:value:",
  9587. protocol: 'instance creation',
  9588. fn: function (aString,anObject){
  9589. var self=this;
  9590. return $core.withContext(function($ctx1) {
  9591. self._deprecatedAPI_("Use constructorNamed:value:");
  9592. var nativeFunc=eval(aString);
  9593. return new nativeFunc(anObject);
  9594. ;
  9595. return self;
  9596. }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9597. },
  9598. args: ["aString", "anObject"],
  9599. 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>",
  9600. referencedClasses: [],
  9601. messageSends: []
  9602. }),
  9603. $globals.NativeFunction.klass);
  9604. $core.addMethod(
  9605. $core.method({
  9606. selector: "constructor:value:value:",
  9607. protocol: 'instance creation',
  9608. fn: function (aString,anObject,anObject2){
  9609. var self=this;
  9610. return $core.withContext(function($ctx1) {
  9611. self._deprecatedAPI_("Use constructorNamed:value:value:");
  9612. var nativeFunc=eval(aString);
  9613. return new nativeFunc(anObject,anObject2);
  9614. ;
  9615. return self;
  9616. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9617. },
  9618. args: ["aString", "anObject", "anObject2"],
  9619. 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>",
  9620. referencedClasses: [],
  9621. messageSends: []
  9622. }),
  9623. $globals.NativeFunction.klass);
  9624. $core.addMethod(
  9625. $core.method({
  9626. selector: "constructor:value:value:value:",
  9627. protocol: 'instance creation',
  9628. fn: function (aString,anObject,anObject2,anObject3){
  9629. var self=this;
  9630. return $core.withContext(function($ctx1) {
  9631. self._deprecatedAPI_("Use constructorNamed:value:value:value");
  9632. var nativeFunc=eval(aString);
  9633. return new nativeFunc(anObject,anObject2, anObject3);
  9634. ;
  9635. return self;
  9636. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9637. },
  9638. args: ["aString", "anObject", "anObject2", "anObject3"],
  9639. 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>",
  9640. referencedClasses: [],
  9641. messageSends: []
  9642. }),
  9643. $globals.NativeFunction.klass);
  9644. $core.addMethod(
  9645. $core.method({
  9646. selector: "constructorNamed:",
  9647. protocol: 'instance creation',
  9648. fn: function (aString){
  9649. var self=this;
  9650. return $core.withContext(function($ctx1) {
  9651. var nativeFunc=(new Function('return this'))()[aString];
  9652. return new nativeFunc();
  9653. ;
  9654. return self;
  9655. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9656. },
  9657. args: ["aString"],
  9658. source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9659. referencedClasses: [],
  9660. messageSends: []
  9661. }),
  9662. $globals.NativeFunction.klass);
  9663. $core.addMethod(
  9664. $core.method({
  9665. selector: "constructorNamed:value:",
  9666. protocol: 'instance creation',
  9667. fn: function (aString,anObject){
  9668. var self=this;
  9669. return $core.withContext(function($ctx1) {
  9670. var nativeFunc=(new Function('return this'))()[aString];
  9671. return new nativeFunc(anObject);
  9672. ;
  9673. return self;
  9674. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9675. },
  9676. args: ["aString", "anObject"],
  9677. source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9678. referencedClasses: [],
  9679. messageSends: []
  9680. }),
  9681. $globals.NativeFunction.klass);
  9682. $core.addMethod(
  9683. $core.method({
  9684. selector: "constructorNamed:value:value:",
  9685. protocol: 'instance creation',
  9686. fn: function (aString,anObject,anObject2){
  9687. var self=this;
  9688. return $core.withContext(function($ctx1) {
  9689. var nativeFunc=(new Function('return this'))()[aString];
  9690. return new nativeFunc(anObject,anObject2);
  9691. ;
  9692. return self;
  9693. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9694. },
  9695. args: ["aString", "anObject", "anObject2"],
  9696. 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>",
  9697. referencedClasses: [],
  9698. messageSends: []
  9699. }),
  9700. $globals.NativeFunction.klass);
  9701. $core.addMethod(
  9702. $core.method({
  9703. selector: "constructorNamed:value:value:value:",
  9704. protocol: 'instance creation',
  9705. fn: function (aString,anObject,anObject2,anObject3){
  9706. var self=this;
  9707. return $core.withContext(function($ctx1) {
  9708. var nativeFunc=(new Function('return this'))()[aString];
  9709. return new nativeFunc(anObject,anObject2, anObject3);
  9710. ;
  9711. return self;
  9712. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9713. },
  9714. args: ["aString", "anObject", "anObject2", "anObject3"],
  9715. 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>",
  9716. referencedClasses: [],
  9717. messageSends: []
  9718. }),
  9719. $globals.NativeFunction.klass);
  9720. $core.addMethod(
  9721. $core.method({
  9722. selector: "constructorOf:",
  9723. protocol: 'instance creation',
  9724. fn: function (nativeFunc){
  9725. var self=this;
  9726. return $core.withContext(function($ctx1) {
  9727. return new nativeFunc();
  9728. ;
  9729. return self;
  9730. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9731. },
  9732. args: ["nativeFunc"],
  9733. source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9734. referencedClasses: [],
  9735. messageSends: []
  9736. }),
  9737. $globals.NativeFunction.klass);
  9738. $core.addMethod(
  9739. $core.method({
  9740. selector: "constructorOf:value:",
  9741. protocol: 'instance creation',
  9742. fn: function (nativeFunc,anObject){
  9743. var self=this;
  9744. return $core.withContext(function($ctx1) {
  9745. return new nativeFunc(anObject);
  9746. ;
  9747. return self;
  9748. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9749. },
  9750. args: ["nativeFunc", "anObject"],
  9751. source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9752. referencedClasses: [],
  9753. messageSends: []
  9754. }),
  9755. $globals.NativeFunction.klass);
  9756. $core.addMethod(
  9757. $core.method({
  9758. selector: "constructorOf:value:value:",
  9759. protocol: 'instance creation',
  9760. fn: function (nativeFunc,anObject,anObject2){
  9761. var self=this;
  9762. return $core.withContext(function($ctx1) {
  9763. return new nativeFunc(anObject,anObject2);
  9764. ;
  9765. return self;
  9766. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9767. },
  9768. args: ["nativeFunc", "anObject", "anObject2"],
  9769. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9770. referencedClasses: [],
  9771. messageSends: []
  9772. }),
  9773. $globals.NativeFunction.klass);
  9774. $core.addMethod(
  9775. $core.method({
  9776. selector: "constructorOf:value:value:value:",
  9777. protocol: 'instance creation',
  9778. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9779. var self=this;
  9780. return $core.withContext(function($ctx1) {
  9781. return new nativeFunc(anObject,anObject2, anObject3);
  9782. ;
  9783. return self;
  9784. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9785. },
  9786. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9787. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9788. referencedClasses: [],
  9789. messageSends: []
  9790. }),
  9791. $globals.NativeFunction.klass);
  9792. $core.addMethod(
  9793. $core.method({
  9794. selector: "exists:",
  9795. protocol: 'testing',
  9796. fn: function (aString){
  9797. var self=this;
  9798. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  9799. return $core.withContext(function($ctx1) {
  9800. var $1;
  9801. $1=$recv($Smalltalk())._existsJsGlobal_(aString);
  9802. return $1;
  9803. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  9804. },
  9805. args: ["aString"],
  9806. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  9807. referencedClasses: ["Smalltalk"],
  9808. messageSends: ["existsJsGlobal:"]
  9809. }),
  9810. $globals.NativeFunction.klass);
  9811. $core.addMethod(
  9812. $core.method({
  9813. selector: "functionNamed:",
  9814. protocol: 'function calling',
  9815. fn: function (aString){
  9816. var self=this;
  9817. return $core.withContext(function($ctx1) {
  9818. var nativeFunc=(new Function('return this'))()[aString];
  9819. return nativeFunc();
  9820. ;
  9821. return self;
  9822. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9823. },
  9824. args: ["aString"],
  9825. source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9826. referencedClasses: [],
  9827. messageSends: []
  9828. }),
  9829. $globals.NativeFunction.klass);
  9830. $core.addMethod(
  9831. $core.method({
  9832. selector: "functionNamed:value:",
  9833. protocol: 'function calling',
  9834. fn: function (aString,anObject){
  9835. var self=this;
  9836. return $core.withContext(function($ctx1) {
  9837. var nativeFunc=(new Function('return this'))()[aString];
  9838. return nativeFunc(anObject);
  9839. ;
  9840. return self;
  9841. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9842. },
  9843. args: ["aString", "anObject"],
  9844. source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9845. referencedClasses: [],
  9846. messageSends: []
  9847. }),
  9848. $globals.NativeFunction.klass);
  9849. $core.addMethod(
  9850. $core.method({
  9851. selector: "functionNamed:value:value:",
  9852. protocol: 'function calling',
  9853. fn: function (aString,anObject,anObject2){
  9854. var self=this;
  9855. return $core.withContext(function($ctx1) {
  9856. var nativeFunc=(new Function('return this'))()[aString];
  9857. return nativeFunc(anObject,anObject2);
  9858. ;
  9859. return self;
  9860. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9861. },
  9862. args: ["aString", "anObject", "anObject2"],
  9863. 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>",
  9864. referencedClasses: [],
  9865. messageSends: []
  9866. }),
  9867. $globals.NativeFunction.klass);
  9868. $core.addMethod(
  9869. $core.method({
  9870. selector: "functionNamed:value:value:value:",
  9871. protocol: 'function calling',
  9872. fn: function (aString,anObject,anObject2,anObject3){
  9873. var self=this;
  9874. return $core.withContext(function($ctx1) {
  9875. var nativeFunc=(new Function('return this'))()[aString];
  9876. return nativeFunc(anObject,anObject2, anObject3);
  9877. ;
  9878. return self;
  9879. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9880. },
  9881. args: ["aString", "anObject", "anObject2", "anObject3"],
  9882. 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>",
  9883. referencedClasses: [],
  9884. messageSends: []
  9885. }),
  9886. $globals.NativeFunction.klass);
  9887. $core.addMethod(
  9888. $core.method({
  9889. selector: "functionNamed:valueWithArgs:",
  9890. protocol: 'function calling',
  9891. fn: function (aString,args){
  9892. var self=this;
  9893. return $core.withContext(function($ctx1) {
  9894. var nativeFunc=(new Function('return this'))()[aString];
  9895. return Function.prototype.apply.call(nativeFunc, null, args);
  9896. ;
  9897. return self;
  9898. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  9899. },
  9900. args: ["aString", "args"],
  9901. 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>",
  9902. referencedClasses: [],
  9903. messageSends: []
  9904. }),
  9905. $globals.NativeFunction.klass);
  9906. $core.addMethod(
  9907. $core.method({
  9908. selector: "functionOf:",
  9909. protocol: 'function calling',
  9910. fn: function (nativeFunc){
  9911. var self=this;
  9912. return $core.withContext(function($ctx1) {
  9913. return nativeFunc();
  9914. ;
  9915. return self;
  9916. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9917. },
  9918. args: ["nativeFunc"],
  9919. source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9920. referencedClasses: [],
  9921. messageSends: []
  9922. }),
  9923. $globals.NativeFunction.klass);
  9924. $core.addMethod(
  9925. $core.method({
  9926. selector: "functionOf:value:",
  9927. protocol: 'function calling',
  9928. fn: function (nativeFunc,anObject){
  9929. var self=this;
  9930. return $core.withContext(function($ctx1) {
  9931. return nativeFunc(anObject);
  9932. ;
  9933. return self;
  9934. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9935. },
  9936. args: ["nativeFunc", "anObject"],
  9937. source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9938. referencedClasses: [],
  9939. messageSends: []
  9940. }),
  9941. $globals.NativeFunction.klass);
  9942. $core.addMethod(
  9943. $core.method({
  9944. selector: "functionOf:value:value:",
  9945. protocol: 'function calling',
  9946. fn: function (nativeFunc,anObject,anObject2){
  9947. var self=this;
  9948. return $core.withContext(function($ctx1) {
  9949. return nativeFunc(anObject,anObject2);
  9950. ;
  9951. return self;
  9952. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9953. },
  9954. args: ["nativeFunc", "anObject", "anObject2"],
  9955. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  9956. referencedClasses: [],
  9957. messageSends: []
  9958. }),
  9959. $globals.NativeFunction.klass);
  9960. $core.addMethod(
  9961. $core.method({
  9962. selector: "functionOf:value:value:value:",
  9963. protocol: 'function calling',
  9964. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9965. var self=this;
  9966. return $core.withContext(function($ctx1) {
  9967. return nativeFunc(anObject,anObject2, anObject3);
  9968. ;
  9969. return self;
  9970. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9971. },
  9972. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9973. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9974. referencedClasses: [],
  9975. messageSends: []
  9976. }),
  9977. $globals.NativeFunction.klass);
  9978. $core.addMethod(
  9979. $core.method({
  9980. selector: "functionOf:valueWithArgs:",
  9981. protocol: 'function calling',
  9982. fn: function (nativeFunc,args){
  9983. var self=this;
  9984. return $core.withContext(function($ctx1) {
  9985. return Function.prototype.apply.call(nativeFunc, null, args);
  9986. ;
  9987. return self;
  9988. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  9989. },
  9990. args: ["nativeFunc", "args"],
  9991. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  9992. referencedClasses: [],
  9993. messageSends: []
  9994. }),
  9995. $globals.NativeFunction.klass);
  9996. $core.addMethod(
  9997. $core.method({
  9998. selector: "methodOf:this:",
  9999. protocol: 'method calling',
  10000. fn: function (nativeFunc,thisObject){
  10001. var self=this;
  10002. return $core.withContext(function($ctx1) {
  10003. return Function.prototype.call.call(nativeFunc, thisObject);
  10004. ;
  10005. return self;
  10006. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  10007. },
  10008. args: ["nativeFunc", "thisObject"],
  10009. source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>",
  10010. referencedClasses: [],
  10011. messageSends: []
  10012. }),
  10013. $globals.NativeFunction.klass);
  10014. $core.addMethod(
  10015. $core.method({
  10016. selector: "methodOf:this:value:",
  10017. protocol: 'method calling',
  10018. fn: function (nativeFunc,thisObject,anObject){
  10019. var self=this;
  10020. return $core.withContext(function($ctx1) {
  10021. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  10022. ;
  10023. return self;
  10024. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  10025. },
  10026. args: ["nativeFunc", "thisObject", "anObject"],
  10027. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>",
  10028. referencedClasses: [],
  10029. messageSends: []
  10030. }),
  10031. $globals.NativeFunction.klass);
  10032. $core.addMethod(
  10033. $core.method({
  10034. selector: "methodOf:this:value:value:",
  10035. protocol: 'method calling',
  10036. fn: function (nativeFunc,thisObject,anObject,anObject2){
  10037. var self=this;
  10038. return $core.withContext(function($ctx1) {
  10039. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  10040. ;
  10041. return self;
  10042. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10043. },
  10044. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  10045. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>",
  10046. referencedClasses: [],
  10047. messageSends: []
  10048. }),
  10049. $globals.NativeFunction.klass);
  10050. $core.addMethod(
  10051. $core.method({
  10052. selector: "methodOf:this:value:value:value:",
  10053. protocol: 'method calling',
  10054. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  10055. var self=this;
  10056. return $core.withContext(function($ctx1) {
  10057. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  10058. ;
  10059. return self;
  10060. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10061. },
  10062. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  10063. 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>",
  10064. referencedClasses: [],
  10065. messageSends: []
  10066. }),
  10067. $globals.NativeFunction.klass);
  10068. $core.addMethod(
  10069. $core.method({
  10070. selector: "methodOf:this:valueWithArgs:",
  10071. protocol: 'method calling',
  10072. fn: function (nativeFunc,thisObject,args){
  10073. var self=this;
  10074. return $core.withContext(function($ctx1) {
  10075. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  10076. ;
  10077. return self;
  10078. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  10079. },
  10080. args: ["nativeFunc", "thisObject", "args"],
  10081. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>",
  10082. referencedClasses: [],
  10083. messageSends: []
  10084. }),
  10085. $globals.NativeFunction.klass);
  10086. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  10087. $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.";
  10088. $core.addMethod(
  10089. $core.method({
  10090. selector: "clearInterval",
  10091. protocol: 'timeout/interval',
  10092. fn: function (){
  10093. var self=this;
  10094. return $core.withContext(function($ctx1) {
  10095. var interval = self["@rawTimeout"];
  10096. clearInterval(interval);
  10097. ;
  10098. return self;
  10099. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  10100. },
  10101. args: [],
  10102. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  10103. referencedClasses: [],
  10104. messageSends: []
  10105. }),
  10106. $globals.Timeout);
  10107. $core.addMethod(
  10108. $core.method({
  10109. selector: "clearTimeout",
  10110. protocol: 'timeout/interval',
  10111. fn: function (){
  10112. var self=this;
  10113. return $core.withContext(function($ctx1) {
  10114. var timeout = self["@rawTimeout"];
  10115. clearTimeout(timeout);
  10116. ;
  10117. return self;
  10118. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  10119. },
  10120. args: [],
  10121. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  10122. referencedClasses: [],
  10123. messageSends: []
  10124. }),
  10125. $globals.Timeout);
  10126. $core.addMethod(
  10127. $core.method({
  10128. selector: "rawTimeout:",
  10129. protocol: 'accessing',
  10130. fn: function (anObject){
  10131. var self=this;
  10132. self["@rawTimeout"]=anObject;
  10133. return self;
  10134. },
  10135. args: ["anObject"],
  10136. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  10137. referencedClasses: [],
  10138. messageSends: []
  10139. }),
  10140. $globals.Timeout);
  10141. $core.addMethod(
  10142. $core.method({
  10143. selector: "on:",
  10144. protocol: 'instance creation',
  10145. fn: function (anObject){
  10146. var self=this;
  10147. return $core.withContext(function($ctx1) {
  10148. var $2,$3,$1;
  10149. $2=self._new();
  10150. $recv($2)._rawTimeout_(anObject);
  10151. $3=$recv($2)._yourself();
  10152. $1=$3;
  10153. return $1;
  10154. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  10155. },
  10156. args: ["anObject"],
  10157. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  10158. referencedClasses: [],
  10159. messageSends: ["rawTimeout:", "new", "yourself"]
  10160. }),
  10161. $globals.Timeout.klass);
  10162. });
  10163. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  10164. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  10165. $core.addPackage('Kernel-Collections');
  10166. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  10167. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10168. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  10169. $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:`";
  10170. $core.addMethod(
  10171. $core.method({
  10172. selector: "=",
  10173. protocol: 'comparing',
  10174. fn: function (anAssociation){
  10175. var self=this;
  10176. return $core.withContext(function($ctx1) {
  10177. var $3,$2,$5,$4,$6,$1;
  10178. $3=self._class();
  10179. $ctx1.sendIdx["class"]=1;
  10180. $2=$recv($3).__eq($recv(anAssociation)._class());
  10181. $ctx1.sendIdx["="]=1;
  10182. $1=$recv($2)._and_((function(){
  10183. return $core.withContext(function($ctx2) {
  10184. $5=self._key();
  10185. $ctx2.sendIdx["key"]=1;
  10186. $4=$recv($5).__eq($recv(anAssociation)._key());
  10187. $ctx2.sendIdx["="]=2;
  10188. return $recv($4)._and_((function(){
  10189. return $core.withContext(function($ctx3) {
  10190. $6=self._value();
  10191. $ctx3.sendIdx["value"]=1;
  10192. return $recv($6).__eq($recv(anAssociation)._value());
  10193. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10194. }));
  10195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10196. }));
  10197. $ctx1.sendIdx["and:"]=1;
  10198. return $1;
  10199. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  10200. },
  10201. args: ["anAssociation"],
  10202. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  10203. referencedClasses: [],
  10204. messageSends: ["and:", "=", "class", "key", "value"]
  10205. }),
  10206. $globals.Association);
  10207. $core.addMethod(
  10208. $core.method({
  10209. selector: "key",
  10210. protocol: 'accessing',
  10211. fn: function (){
  10212. var self=this;
  10213. var $1;
  10214. $1=self["@key"];
  10215. return $1;
  10216. },
  10217. args: [],
  10218. source: "key\x0a\x09^ key",
  10219. referencedClasses: [],
  10220. messageSends: []
  10221. }),
  10222. $globals.Association);
  10223. $core.addMethod(
  10224. $core.method({
  10225. selector: "key:",
  10226. protocol: 'accessing',
  10227. fn: function (aKey){
  10228. var self=this;
  10229. self["@key"]=aKey;
  10230. return self;
  10231. },
  10232. args: ["aKey"],
  10233. source: "key: aKey\x0a\x09key := aKey",
  10234. referencedClasses: [],
  10235. messageSends: []
  10236. }),
  10237. $globals.Association);
  10238. $core.addMethod(
  10239. $core.method({
  10240. selector: "printOn:",
  10241. protocol: 'printing',
  10242. fn: function (aStream){
  10243. var self=this;
  10244. return $core.withContext(function($ctx1) {
  10245. $recv(self._key())._printOn_(aStream);
  10246. $ctx1.sendIdx["printOn:"]=1;
  10247. $recv(aStream)._nextPutAll_(" -> ");
  10248. $recv(self._value())._printOn_(aStream);
  10249. return self;
  10250. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  10251. },
  10252. args: ["aStream"],
  10253. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10254. referencedClasses: [],
  10255. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  10256. }),
  10257. $globals.Association);
  10258. $core.addMethod(
  10259. $core.method({
  10260. selector: "value",
  10261. protocol: 'accessing',
  10262. fn: function (){
  10263. var self=this;
  10264. var $1;
  10265. $1=self["@value"];
  10266. return $1;
  10267. },
  10268. args: [],
  10269. source: "value\x0a\x09^ value",
  10270. referencedClasses: [],
  10271. messageSends: []
  10272. }),
  10273. $globals.Association);
  10274. $core.addMethod(
  10275. $core.method({
  10276. selector: "value:",
  10277. protocol: 'accessing',
  10278. fn: function (aValue){
  10279. var self=this;
  10280. self["@value"]=aValue;
  10281. return self;
  10282. },
  10283. args: ["aValue"],
  10284. source: "value: aValue\x0a\x09value := aValue",
  10285. referencedClasses: [],
  10286. messageSends: []
  10287. }),
  10288. $globals.Association);
  10289. $core.addMethod(
  10290. $core.method({
  10291. selector: "key:value:",
  10292. protocol: 'instance creation',
  10293. fn: function (aKey,aValue){
  10294. var self=this;
  10295. return $core.withContext(function($ctx1) {
  10296. var $2,$3,$1;
  10297. $2=self._new();
  10298. $recv($2)._key_(aKey);
  10299. $recv($2)._value_(aValue);
  10300. $3=$recv($2)._yourself();
  10301. $1=$3;
  10302. return $1;
  10303. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10304. },
  10305. args: ["aKey", "aValue"],
  10306. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10307. referencedClasses: [],
  10308. messageSends: ["key:", "new", "value:", "yourself"]
  10309. }),
  10310. $globals.Association.klass);
  10311. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10312. $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`.";
  10313. $core.addMethod(
  10314. $core.method({
  10315. selector: "bucketOfElement:",
  10316. protocol: 'accessing',
  10317. fn: function (anObject){
  10318. var self=this;
  10319. return $core.withContext(function($ctx1) {
  10320. var hash = self['@hashBlock'](anObject);
  10321. if (!hash) return null;
  10322. var buckets = self['@buckets'],
  10323. bucket = buckets[hash];
  10324. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10325. return bucket;
  10326. ;
  10327. return self;
  10328. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10329. },
  10330. args: ["anObject"],
  10331. 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>",
  10332. referencedClasses: [],
  10333. messageSends: []
  10334. }),
  10335. $globals.BucketStore);
  10336. $core.addMethod(
  10337. $core.method({
  10338. selector: "do:",
  10339. protocol: 'enumerating',
  10340. fn: function (aBlock){
  10341. var self=this;
  10342. return $core.withContext(function($ctx1) {
  10343. var buckets = self['@buckets'];
  10344. var keys = Object.keys(buckets);
  10345. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10346. ;
  10347. return self;
  10348. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10349. },
  10350. args: ["aBlock"],
  10351. 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>",
  10352. referencedClasses: [],
  10353. messageSends: []
  10354. }),
  10355. $globals.BucketStore);
  10356. $core.addMethod(
  10357. $core.method({
  10358. selector: "hashBlock:",
  10359. protocol: 'accessing',
  10360. fn: function (aBlock){
  10361. var self=this;
  10362. self["@hashBlock"]=aBlock;
  10363. return self;
  10364. },
  10365. args: ["aBlock"],
  10366. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10367. referencedClasses: [],
  10368. messageSends: []
  10369. }),
  10370. $globals.BucketStore);
  10371. $core.addMethod(
  10372. $core.method({
  10373. selector: "initialize",
  10374. protocol: 'initialization',
  10375. fn: function (){
  10376. var self=this;
  10377. return $core.withContext(function($ctx1) {
  10378. (
  10379. $ctx1.supercall = true,
  10380. $globals.BucketStore.superclass.fn.prototype._initialize.apply($recv(self), []));
  10381. $ctx1.supercall = false;
  10382. self._removeAll();
  10383. return self;
  10384. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10385. },
  10386. args: [],
  10387. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10388. referencedClasses: [],
  10389. messageSends: ["initialize", "removeAll"]
  10390. }),
  10391. $globals.BucketStore);
  10392. $core.addMethod(
  10393. $core.method({
  10394. selector: "newBucket",
  10395. protocol: 'private',
  10396. fn: function (){
  10397. var self=this;
  10398. return $core.withContext(function($ctx1) {
  10399. self._subclassResponsibility();
  10400. return self;
  10401. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10402. },
  10403. args: [],
  10404. source: "newBucket\x0a\x09self subclassResponsibility",
  10405. referencedClasses: [],
  10406. messageSends: ["subclassResponsibility"]
  10407. }),
  10408. $globals.BucketStore);
  10409. $core.addMethod(
  10410. $core.method({
  10411. selector: "removeAll",
  10412. protocol: 'adding/removing',
  10413. fn: function (){
  10414. var self=this;
  10415. return $core.withContext(function($ctx1) {
  10416. self['@buckets'] = Object.create(null);;
  10417. return self;
  10418. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10419. },
  10420. args: [],
  10421. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  10422. referencedClasses: [],
  10423. messageSends: []
  10424. }),
  10425. $globals.BucketStore);
  10426. $core.addMethod(
  10427. $core.method({
  10428. selector: "hashBlock:",
  10429. protocol: 'instance creation',
  10430. fn: function (aBlock){
  10431. var self=this;
  10432. return $core.withContext(function($ctx1) {
  10433. var $2,$3,$1;
  10434. $2=self._new();
  10435. $recv($2)._hashBlock_(aBlock);
  10436. $3=$recv($2)._yourself();
  10437. $1=$3;
  10438. return $1;
  10439. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10440. },
  10441. args: ["aBlock"],
  10442. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10443. referencedClasses: [],
  10444. messageSends: ["hashBlock:", "new", "yourself"]
  10445. }),
  10446. $globals.BucketStore.klass);
  10447. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10448. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10449. $core.addMethod(
  10450. $core.method({
  10451. selector: "newBucket",
  10452. protocol: 'private',
  10453. fn: function (){
  10454. var self=this;
  10455. var $1;
  10456. $1=[];
  10457. return $1;
  10458. },
  10459. args: [],
  10460. source: "newBucket\x0a\x09^ #()",
  10461. referencedClasses: [],
  10462. messageSends: []
  10463. }),
  10464. $globals.ArrayBucketStore);
  10465. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10466. $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.";
  10467. $core.addMethod(
  10468. $core.method({
  10469. selector: ",",
  10470. protocol: 'copying',
  10471. fn: function (aCollection){
  10472. var self=this;
  10473. return $core.withContext(function($ctx1) {
  10474. var $2,$3,$1;
  10475. $2=self._copy();
  10476. $recv($2)._addAll_(aCollection);
  10477. $3=$recv($2)._yourself();
  10478. $1=$3;
  10479. return $1;
  10480. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10481. },
  10482. args: ["aCollection"],
  10483. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10484. referencedClasses: [],
  10485. messageSends: ["addAll:", "copy", "yourself"]
  10486. }),
  10487. $globals.Collection);
  10488. $core.addMethod(
  10489. $core.method({
  10490. selector: "add:",
  10491. protocol: 'adding/removing',
  10492. fn: function (anObject){
  10493. var self=this;
  10494. return $core.withContext(function($ctx1) {
  10495. self._subclassResponsibility();
  10496. return self;
  10497. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10498. },
  10499. args: ["anObject"],
  10500. source: "add: anObject\x0a\x09self subclassResponsibility",
  10501. referencedClasses: [],
  10502. messageSends: ["subclassResponsibility"]
  10503. }),
  10504. $globals.Collection);
  10505. $core.addMethod(
  10506. $core.method({
  10507. selector: "addAll:",
  10508. protocol: 'adding/removing',
  10509. fn: function (aCollection){
  10510. var self=this;
  10511. return $core.withContext(function($ctx1) {
  10512. $recv(aCollection)._do_((function(each){
  10513. return $core.withContext(function($ctx2) {
  10514. return self._add_(each);
  10515. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10516. }));
  10517. return aCollection;
  10518. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10519. },
  10520. args: ["aCollection"],
  10521. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10522. referencedClasses: [],
  10523. messageSends: ["do:", "add:"]
  10524. }),
  10525. $globals.Collection);
  10526. $core.addMethod(
  10527. $core.method({
  10528. selector: "allSatisfy:",
  10529. protocol: 'enumerating',
  10530. fn: function (aBlock){
  10531. var self=this;
  10532. return $core.withContext(function($ctx1) {
  10533. var $1;
  10534. var $early={};
  10535. try {
  10536. self._do_((function(each){
  10537. return $core.withContext(function($ctx2) {
  10538. $1=$recv(aBlock)._value_(each);
  10539. if(!$core.assert($1)){
  10540. throw $early=[false];
  10541. };
  10542. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10543. }));
  10544. return true;
  10545. }
  10546. catch(e) {if(e===$early)return e[0]; throw e}
  10547. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10548. },
  10549. args: ["aBlock"],
  10550. 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",
  10551. referencedClasses: [],
  10552. messageSends: ["do:", "ifFalse:", "value:"]
  10553. }),
  10554. $globals.Collection);
  10555. $core.addMethod(
  10556. $core.method({
  10557. selector: "anyOne",
  10558. protocol: 'adding/removing',
  10559. fn: function (){
  10560. var self=this;
  10561. return $core.withContext(function($ctx1) {
  10562. var $early={};
  10563. try {
  10564. self._ifEmpty_((function(){
  10565. return $core.withContext(function($ctx2) {
  10566. return self._error_("Collection is empty");
  10567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10568. }));
  10569. self._do_((function(each){
  10570. throw $early=[each];
  10571. }));
  10572. return self;
  10573. }
  10574. catch(e) {if(e===$early)return e[0]; throw e}
  10575. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  10576. },
  10577. args: [],
  10578. 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 ]",
  10579. referencedClasses: [],
  10580. messageSends: ["ifEmpty:", "error:", "do:"]
  10581. }),
  10582. $globals.Collection);
  10583. $core.addMethod(
  10584. $core.method({
  10585. selector: "anySatisfy:",
  10586. protocol: 'enumerating',
  10587. fn: function (aBlock){
  10588. var self=this;
  10589. return $core.withContext(function($ctx1) {
  10590. var $1;
  10591. var $early={};
  10592. try {
  10593. self._do_((function(each){
  10594. return $core.withContext(function($ctx2) {
  10595. $1=$recv(aBlock)._value_(each);
  10596. if($core.assert($1)){
  10597. throw $early=[true];
  10598. };
  10599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10600. }));
  10601. return false;
  10602. }
  10603. catch(e) {if(e===$early)return e[0]; throw e}
  10604. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  10605. },
  10606. args: ["aBlock"],
  10607. 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",
  10608. referencedClasses: [],
  10609. messageSends: ["do:", "ifTrue:", "value:"]
  10610. }),
  10611. $globals.Collection);
  10612. $core.addMethod(
  10613. $core.method({
  10614. selector: "asArray",
  10615. protocol: 'converting',
  10616. fn: function (){
  10617. var self=this;
  10618. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  10619. return $core.withContext(function($ctx1) {
  10620. var $1;
  10621. $1=$recv($Array())._withAll_(self);
  10622. return $1;
  10623. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  10624. },
  10625. args: [],
  10626. source: "asArray\x0a\x09^ Array withAll: self",
  10627. referencedClasses: ["Array"],
  10628. messageSends: ["withAll:"]
  10629. }),
  10630. $globals.Collection);
  10631. $core.addMethod(
  10632. $core.method({
  10633. selector: "asJSON",
  10634. protocol: 'converting',
  10635. fn: function (){
  10636. var self=this;
  10637. return $core.withContext(function($ctx1) {
  10638. var $1;
  10639. $1=$recv(self._asArray())._collect_((function(each){
  10640. return $core.withContext(function($ctx2) {
  10641. return $recv(each)._asJSON();
  10642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10643. }));
  10644. return $1;
  10645. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  10646. },
  10647. args: [],
  10648. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  10649. referencedClasses: [],
  10650. messageSends: ["collect:", "asArray", "asJSON"]
  10651. }),
  10652. $globals.Collection);
  10653. $core.addMethod(
  10654. $core.method({
  10655. selector: "asOrderedCollection",
  10656. protocol: 'converting',
  10657. fn: function (){
  10658. var self=this;
  10659. return $core.withContext(function($ctx1) {
  10660. var $1;
  10661. $1=self._asArray();
  10662. return $1;
  10663. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  10664. },
  10665. args: [],
  10666. source: "asOrderedCollection\x0a\x09^ self asArray",
  10667. referencedClasses: [],
  10668. messageSends: ["asArray"]
  10669. }),
  10670. $globals.Collection);
  10671. $core.addMethod(
  10672. $core.method({
  10673. selector: "asSet",
  10674. protocol: 'converting',
  10675. fn: function (){
  10676. var self=this;
  10677. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  10678. return $core.withContext(function($ctx1) {
  10679. var $1;
  10680. $1=$recv($Set())._withAll_(self);
  10681. return $1;
  10682. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  10683. },
  10684. args: [],
  10685. source: "asSet\x0a\x09^ Set withAll: self",
  10686. referencedClasses: ["Set"],
  10687. messageSends: ["withAll:"]
  10688. }),
  10689. $globals.Collection);
  10690. $core.addMethod(
  10691. $core.method({
  10692. selector: "collect:",
  10693. protocol: 'enumerating',
  10694. fn: function (aBlock){
  10695. var self=this;
  10696. var stream;
  10697. return $core.withContext(function($ctx1) {
  10698. var $1;
  10699. stream=$recv($recv(self._class())._new())._writeStream();
  10700. self._do_((function(each){
  10701. return $core.withContext(function($ctx2) {
  10702. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  10703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10704. }));
  10705. $1=$recv(stream)._contents();
  10706. return $1;
  10707. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10708. },
  10709. args: ["aBlock"],
  10710. 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",
  10711. referencedClasses: [],
  10712. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  10713. }),
  10714. $globals.Collection);
  10715. $core.addMethod(
  10716. $core.method({
  10717. selector: "copyWith:",
  10718. protocol: 'copying',
  10719. fn: function (anObject){
  10720. var self=this;
  10721. return $core.withContext(function($ctx1) {
  10722. var $2,$3,$1;
  10723. $2=self._copy();
  10724. $recv($2)._add_(anObject);
  10725. $3=$recv($2)._yourself();
  10726. $1=$3;
  10727. return $1;
  10728. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  10729. },
  10730. args: ["anObject"],
  10731. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10732. referencedClasses: [],
  10733. messageSends: ["add:", "copy", "yourself"]
  10734. }),
  10735. $globals.Collection);
  10736. $core.addMethod(
  10737. $core.method({
  10738. selector: "copyWithAll:",
  10739. protocol: 'copying',
  10740. fn: function (aCollection){
  10741. var self=this;
  10742. return $core.withContext(function($ctx1) {
  10743. var $2,$3,$1;
  10744. $2=self._copy();
  10745. $recv($2)._addAll_(aCollection);
  10746. $3=$recv($2)._yourself();
  10747. $1=$3;
  10748. return $1;
  10749. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  10750. },
  10751. args: ["aCollection"],
  10752. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10753. referencedClasses: [],
  10754. messageSends: ["addAll:", "copy", "yourself"]
  10755. }),
  10756. $globals.Collection);
  10757. $core.addMethod(
  10758. $core.method({
  10759. selector: "copyWithoutAll:",
  10760. protocol: 'copying',
  10761. fn: function (aCollection){
  10762. var self=this;
  10763. return $core.withContext(function($ctx1) {
  10764. var $1;
  10765. $1=self._reject_((function(each){
  10766. return $core.withContext(function($ctx2) {
  10767. return $recv(aCollection)._includes_(each);
  10768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10769. }));
  10770. return $1;
  10771. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  10772. },
  10773. args: ["aCollection"],
  10774. 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 ]",
  10775. referencedClasses: [],
  10776. messageSends: ["reject:", "includes:"]
  10777. }),
  10778. $globals.Collection);
  10779. $core.addMethod(
  10780. $core.method({
  10781. selector: "detect:",
  10782. protocol: 'enumerating',
  10783. fn: function (aBlock){
  10784. var self=this;
  10785. return $core.withContext(function($ctx1) {
  10786. var $1;
  10787. $1=self._detect_ifNone_(aBlock,(function(){
  10788. return $core.withContext(function($ctx2) {
  10789. return self._errorNotFound();
  10790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10791. }));
  10792. return $1;
  10793. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  10794. },
  10795. args: ["aBlock"],
  10796. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  10797. referencedClasses: [],
  10798. messageSends: ["detect:ifNone:", "errorNotFound"]
  10799. }),
  10800. $globals.Collection);
  10801. $core.addMethod(
  10802. $core.method({
  10803. selector: "detect:ifNone:",
  10804. protocol: 'enumerating',
  10805. fn: function (aBlock,anotherBlock){
  10806. var self=this;
  10807. return $core.withContext(function($ctx1) {
  10808. self._subclassResponsibility();
  10809. return self;
  10810. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10811. },
  10812. args: ["aBlock", "anotherBlock"],
  10813. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10814. referencedClasses: [],
  10815. messageSends: ["subclassResponsibility"]
  10816. }),
  10817. $globals.Collection);
  10818. $core.addMethod(
  10819. $core.method({
  10820. selector: "do:",
  10821. protocol: 'enumerating',
  10822. fn: function (aBlock){
  10823. var self=this;
  10824. return $core.withContext(function($ctx1) {
  10825. self._subclassResponsibility();
  10826. return self;
  10827. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  10828. },
  10829. args: ["aBlock"],
  10830. source: "do: aBlock\x0a\x09self subclassResponsibility",
  10831. referencedClasses: [],
  10832. messageSends: ["subclassResponsibility"]
  10833. }),
  10834. $globals.Collection);
  10835. $core.addMethod(
  10836. $core.method({
  10837. selector: "do:separatedBy:",
  10838. protocol: 'enumerating',
  10839. fn: function (aBlock,anotherBlock){
  10840. var self=this;
  10841. var actionBeforeElement;
  10842. return $core.withContext(function($ctx1) {
  10843. actionBeforeElement=(function(){
  10844. actionBeforeElement=anotherBlock;
  10845. return actionBeforeElement;
  10846. });
  10847. self._do_((function(each){
  10848. return $core.withContext(function($ctx2) {
  10849. $recv(actionBeforeElement)._value();
  10850. return $recv(aBlock)._value_(each);
  10851. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  10852. }));
  10853. return self;
  10854. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  10855. },
  10856. args: ["aBlock", "anotherBlock"],
  10857. 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 ]",
  10858. referencedClasses: [],
  10859. messageSends: ["do:", "value", "value:"]
  10860. }),
  10861. $globals.Collection);
  10862. $core.addMethod(
  10863. $core.method({
  10864. selector: "errorNotFound",
  10865. protocol: 'error handling',
  10866. fn: function (){
  10867. var self=this;
  10868. return $core.withContext(function($ctx1) {
  10869. self._error_("Object is not in the collection");
  10870. return self;
  10871. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  10872. },
  10873. args: [],
  10874. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  10875. referencedClasses: [],
  10876. messageSends: ["error:"]
  10877. }),
  10878. $globals.Collection);
  10879. $core.addMethod(
  10880. $core.method({
  10881. selector: "ifEmpty:",
  10882. protocol: 'testing',
  10883. fn: function (aBlock){
  10884. var self=this;
  10885. return $core.withContext(function($ctx1) {
  10886. var $2,$1;
  10887. $2=self._isEmpty();
  10888. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  10889. return self;
  10890. }));
  10891. return $1;
  10892. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  10893. },
  10894. args: ["aBlock"],
  10895. 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 ]",
  10896. referencedClasses: [],
  10897. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  10898. }),
  10899. $globals.Collection);
  10900. $core.addMethod(
  10901. $core.method({
  10902. selector: "ifEmpty:ifNotEmpty:",
  10903. protocol: 'testing',
  10904. fn: function (aBlock,anotherBlock){
  10905. var self=this;
  10906. return $core.withContext(function($ctx1) {
  10907. var $2,$1;
  10908. $2=self._isEmpty();
  10909. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  10910. return $core.withContext(function($ctx2) {
  10911. return $recv(anotherBlock)._value_(self);
  10912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10913. }));
  10914. return $1;
  10915. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10916. },
  10917. args: ["aBlock", "anotherBlock"],
  10918. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  10919. referencedClasses: [],
  10920. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  10921. }),
  10922. $globals.Collection);
  10923. $core.addMethod(
  10924. $core.method({
  10925. selector: "ifNotEmpty:",
  10926. protocol: 'testing',
  10927. fn: function (aBlock){
  10928. var self=this;
  10929. return $core.withContext(function($ctx1) {
  10930. var $2,$1;
  10931. $2=self._notEmpty();
  10932. if($core.assert($2)){
  10933. $1=$recv(aBlock)._value_(self);
  10934. } else {
  10935. $1=self;
  10936. };
  10937. return $1;
  10938. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  10939. },
  10940. args: ["aBlock"],
  10941. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  10942. referencedClasses: [],
  10943. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10944. }),
  10945. $globals.Collection);
  10946. $core.addMethod(
  10947. $core.method({
  10948. selector: "ifNotEmpty:ifEmpty:",
  10949. protocol: 'testing',
  10950. fn: function (aBlock,anotherBlock){
  10951. var self=this;
  10952. return $core.withContext(function($ctx1) {
  10953. var $2,$1;
  10954. $2=self._notEmpty();
  10955. $1=$recv($2)._ifTrue_ifFalse_((function(){
  10956. return $core.withContext(function($ctx2) {
  10957. return $recv(aBlock)._value_(self);
  10958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10959. }),anotherBlock);
  10960. return $1;
  10961. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10962. },
  10963. args: ["aBlock", "anotherBlock"],
  10964. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  10965. referencedClasses: [],
  10966. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10967. }),
  10968. $globals.Collection);
  10969. $core.addMethod(
  10970. $core.method({
  10971. selector: "includes:",
  10972. protocol: 'testing',
  10973. fn: function (anObject){
  10974. var self=this;
  10975. return $core.withContext(function($ctx1) {
  10976. var $1;
  10977. $1=self._anySatisfy_((function(each){
  10978. return $core.withContext(function($ctx2) {
  10979. return $recv(each).__eq(anObject);
  10980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10981. }));
  10982. return $1;
  10983. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  10984. },
  10985. args: ["anObject"],
  10986. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  10987. referencedClasses: [],
  10988. messageSends: ["anySatisfy:", "="]
  10989. }),
  10990. $globals.Collection);
  10991. $core.addMethod(
  10992. $core.method({
  10993. selector: "inject:into:",
  10994. protocol: 'enumerating',
  10995. fn: function (anObject,aBlock){
  10996. var self=this;
  10997. var result;
  10998. return $core.withContext(function($ctx1) {
  10999. var $1;
  11000. result=anObject;
  11001. self._do_((function(each){
  11002. return $core.withContext(function($ctx2) {
  11003. result=$recv(aBlock)._value_value_(result,each);
  11004. return result;
  11005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11006. }));
  11007. $1=result;
  11008. return $1;
  11009. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  11010. },
  11011. args: ["anObject", "aBlock"],
  11012. 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",
  11013. referencedClasses: [],
  11014. messageSends: ["do:", "value:value:"]
  11015. }),
  11016. $globals.Collection);
  11017. $core.addMethod(
  11018. $core.method({
  11019. selector: "intersection:",
  11020. protocol: 'enumerating',
  11021. fn: function (aCollection){
  11022. var self=this;
  11023. var set,outputSet;
  11024. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  11025. return $core.withContext(function($ctx1) {
  11026. var $2,$1,$3;
  11027. set=self._asSet();
  11028. outputSet=$recv($Set())._new();
  11029. $recv(aCollection)._do_((function(each){
  11030. return $core.withContext(function($ctx2) {
  11031. $2=$recv(set)._includes_(each);
  11032. $ctx2.sendIdx["includes:"]=1;
  11033. $1=$recv($2)._and_((function(){
  11034. return $core.withContext(function($ctx3) {
  11035. return $recv($recv(outputSet)._includes_(each))._not();
  11036. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  11037. }));
  11038. if($core.assert($1)){
  11039. return $recv(outputSet)._add_(each);
  11040. };
  11041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11042. }));
  11043. $3=$recv(self._class())._withAll_($recv(outputSet)._asArray());
  11044. return $3;
  11045. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  11046. },
  11047. args: ["aCollection"],
  11048. 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",
  11049. referencedClasses: ["Set"],
  11050. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  11051. }),
  11052. $globals.Collection);
  11053. $core.addMethod(
  11054. $core.method({
  11055. selector: "isEmpty",
  11056. protocol: 'testing',
  11057. fn: function (){
  11058. var self=this;
  11059. return $core.withContext(function($ctx1) {
  11060. var $1;
  11061. $1=$recv(self._size()).__eq((0));
  11062. return $1;
  11063. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  11064. },
  11065. args: [],
  11066. source: "isEmpty\x0a\x09^ self size = 0",
  11067. referencedClasses: [],
  11068. messageSends: ["=", "size"]
  11069. }),
  11070. $globals.Collection);
  11071. $core.addMethod(
  11072. $core.method({
  11073. selector: "noneSatisfy:",
  11074. protocol: 'enumerating',
  11075. fn: function (aBlock){
  11076. var self=this;
  11077. return $core.withContext(function($ctx1) {
  11078. var $1;
  11079. var $early={};
  11080. try {
  11081. self._do_((function(item){
  11082. return $core.withContext(function($ctx2) {
  11083. $1=$recv(aBlock)._value_(item);
  11084. if($core.assert($1)){
  11085. throw $early=[false];
  11086. };
  11087. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  11088. }));
  11089. return true;
  11090. }
  11091. catch(e) {if(e===$early)return e[0]; throw e}
  11092. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11093. },
  11094. args: ["aBlock"],
  11095. 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",
  11096. referencedClasses: [],
  11097. messageSends: ["do:", "ifTrue:", "value:"]
  11098. }),
  11099. $globals.Collection);
  11100. $core.addMethod(
  11101. $core.method({
  11102. selector: "notEmpty",
  11103. protocol: 'testing',
  11104. fn: function (){
  11105. var self=this;
  11106. return $core.withContext(function($ctx1) {
  11107. var $1;
  11108. $1=$recv(self._isEmpty())._not();
  11109. return $1;
  11110. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  11111. },
  11112. args: [],
  11113. source: "notEmpty\x0a\x09^ self isEmpty not",
  11114. referencedClasses: [],
  11115. messageSends: ["not", "isEmpty"]
  11116. }),
  11117. $globals.Collection);
  11118. $core.addMethod(
  11119. $core.method({
  11120. selector: "occurrencesOf:",
  11121. protocol: 'accessing',
  11122. fn: function (anObject){
  11123. var self=this;
  11124. var tally;
  11125. return $core.withContext(function($ctx1) {
  11126. var $1,$2;
  11127. tally=(0);
  11128. self._do_((function(each){
  11129. return $core.withContext(function($ctx2) {
  11130. $1=$recv(anObject).__eq(each);
  11131. if($core.assert($1)){
  11132. tally=$recv(tally).__plus((1));
  11133. return tally;
  11134. };
  11135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11136. }));
  11137. $2=tally;
  11138. return $2;
  11139. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  11140. },
  11141. args: ["anObject"],
  11142. 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",
  11143. referencedClasses: [],
  11144. messageSends: ["do:", "ifTrue:", "=", "+"]
  11145. }),
  11146. $globals.Collection);
  11147. $core.addMethod(
  11148. $core.method({
  11149. selector: "putOn:",
  11150. protocol: 'streaming',
  11151. fn: function (aStream){
  11152. var self=this;
  11153. return $core.withContext(function($ctx1) {
  11154. self._do_((function(each){
  11155. return $core.withContext(function($ctx2) {
  11156. return $recv(each)._putOn_(aStream);
  11157. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11158. }));
  11159. return self;
  11160. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  11161. },
  11162. args: ["aStream"],
  11163. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  11164. referencedClasses: [],
  11165. messageSends: ["do:", "putOn:"]
  11166. }),
  11167. $globals.Collection);
  11168. $core.addMethod(
  11169. $core.method({
  11170. selector: "reject:",
  11171. protocol: 'enumerating',
  11172. fn: function (aBlock){
  11173. var self=this;
  11174. return $core.withContext(function($ctx1) {
  11175. var $1;
  11176. $1=self._select_((function(each){
  11177. return $core.withContext(function($ctx2) {
  11178. return $recv($recv(aBlock)._value_(each)).__eq(false);
  11179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11180. }));
  11181. return $1;
  11182. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  11183. },
  11184. args: ["aBlock"],
  11185. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  11186. referencedClasses: [],
  11187. messageSends: ["select:", "=", "value:"]
  11188. }),
  11189. $globals.Collection);
  11190. $core.addMethod(
  11191. $core.method({
  11192. selector: "remove:",
  11193. protocol: 'adding/removing',
  11194. fn: function (anObject){
  11195. var self=this;
  11196. return $core.withContext(function($ctx1) {
  11197. var $1;
  11198. $1=self._remove_ifAbsent_(anObject,(function(){
  11199. return $core.withContext(function($ctx2) {
  11200. return self._errorNotFound();
  11201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11202. }));
  11203. return $1;
  11204. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  11205. },
  11206. args: ["anObject"],
  11207. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  11208. referencedClasses: [],
  11209. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  11210. }),
  11211. $globals.Collection);
  11212. $core.addMethod(
  11213. $core.method({
  11214. selector: "remove:ifAbsent:",
  11215. protocol: 'adding/removing',
  11216. fn: function (anObject,aBlock){
  11217. var self=this;
  11218. return $core.withContext(function($ctx1) {
  11219. self._subclassResponsibility();
  11220. return self;
  11221. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  11222. },
  11223. args: ["anObject", "aBlock"],
  11224. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11225. referencedClasses: [],
  11226. messageSends: ["subclassResponsibility"]
  11227. }),
  11228. $globals.Collection);
  11229. $core.addMethod(
  11230. $core.method({
  11231. selector: "removeAll",
  11232. protocol: 'adding/removing',
  11233. fn: function (){
  11234. var self=this;
  11235. return $core.withContext(function($ctx1) {
  11236. self._subclassResponsibility();
  11237. return self;
  11238. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  11239. },
  11240. args: [],
  11241. source: "removeAll\x0a\x09self subclassResponsibility",
  11242. referencedClasses: [],
  11243. messageSends: ["subclassResponsibility"]
  11244. }),
  11245. $globals.Collection);
  11246. $core.addMethod(
  11247. $core.method({
  11248. selector: "select:",
  11249. protocol: 'enumerating',
  11250. fn: function (aBlock){
  11251. var self=this;
  11252. var stream;
  11253. return $core.withContext(function($ctx1) {
  11254. var $1,$2;
  11255. stream=$recv($recv(self._class())._new())._writeStream();
  11256. self._do_((function(each){
  11257. return $core.withContext(function($ctx2) {
  11258. $1=$recv(aBlock)._value_(each);
  11259. if($core.assert($1)){
  11260. return $recv(stream)._nextPut_(each);
  11261. };
  11262. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11263. }));
  11264. $2=$recv(stream)._contents();
  11265. return $2;
  11266. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11267. },
  11268. args: ["aBlock"],
  11269. 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",
  11270. referencedClasses: [],
  11271. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11272. }),
  11273. $globals.Collection);
  11274. $core.addMethod(
  11275. $core.method({
  11276. selector: "select:thenCollect:",
  11277. protocol: 'enumerating',
  11278. fn: function (selectBlock,collectBlock){
  11279. var self=this;
  11280. var stream;
  11281. return $core.withContext(function($ctx1) {
  11282. var $1,$2;
  11283. stream=$recv($recv(self._class())._new())._writeStream();
  11284. self._do_((function(each){
  11285. return $core.withContext(function($ctx2) {
  11286. $1=$recv(selectBlock)._value_(each);
  11287. $ctx2.sendIdx["value:"]=1;
  11288. if($core.assert($1)){
  11289. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  11290. };
  11291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11292. }));
  11293. $2=$recv(stream)._contents();
  11294. return $2;
  11295. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  11296. },
  11297. args: ["selectBlock", "collectBlock"],
  11298. 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",
  11299. referencedClasses: [],
  11300. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11301. }),
  11302. $globals.Collection);
  11303. $core.addMethod(
  11304. $core.method({
  11305. selector: "size",
  11306. protocol: 'accessing',
  11307. fn: function (){
  11308. var self=this;
  11309. return $core.withContext(function($ctx1) {
  11310. self._subclassResponsibility();
  11311. return self;
  11312. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11313. },
  11314. args: [],
  11315. source: "size\x0a\x09self subclassResponsibility",
  11316. referencedClasses: [],
  11317. messageSends: ["subclassResponsibility"]
  11318. }),
  11319. $globals.Collection);
  11320. $core.addMethod(
  11321. $core.method({
  11322. selector: "classTag",
  11323. protocol: 'accessing',
  11324. fn: function (){
  11325. var self=this;
  11326. return "collection";
  11327. },
  11328. args: [],
  11329. 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'",
  11330. referencedClasses: [],
  11331. messageSends: []
  11332. }),
  11333. $globals.Collection.klass);
  11334. $core.addMethod(
  11335. $core.method({
  11336. selector: "new:",
  11337. protocol: 'instance creation',
  11338. fn: function (anInteger){
  11339. var self=this;
  11340. return $core.withContext(function($ctx1) {
  11341. var $1;
  11342. $1=self._new();
  11343. return $1;
  11344. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11345. },
  11346. args: ["anInteger"],
  11347. source: "new: anInteger\x0a\x09^ self new",
  11348. referencedClasses: [],
  11349. messageSends: ["new"]
  11350. }),
  11351. $globals.Collection.klass);
  11352. $core.addMethod(
  11353. $core.method({
  11354. selector: "with:",
  11355. protocol: 'instance creation',
  11356. fn: function (anObject){
  11357. var self=this;
  11358. return $core.withContext(function($ctx1) {
  11359. var $2,$3,$1;
  11360. $2=self._new();
  11361. $recv($2)._add_(anObject);
  11362. $3=$recv($2)._yourself();
  11363. $1=$3;
  11364. return $1;
  11365. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11366. },
  11367. args: ["anObject"],
  11368. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11369. referencedClasses: [],
  11370. messageSends: ["add:", "new", "yourself"]
  11371. }),
  11372. $globals.Collection.klass);
  11373. $core.addMethod(
  11374. $core.method({
  11375. selector: "with:with:",
  11376. protocol: 'instance creation',
  11377. fn: function (anObject,anotherObject){
  11378. var self=this;
  11379. return $core.withContext(function($ctx1) {
  11380. var $2,$3,$1;
  11381. $2=self._new();
  11382. $recv($2)._add_(anObject);
  11383. $ctx1.sendIdx["add:"]=1;
  11384. $recv($2)._add_(anotherObject);
  11385. $3=$recv($2)._yourself();
  11386. $1=$3;
  11387. return $1;
  11388. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11389. },
  11390. args: ["anObject", "anotherObject"],
  11391. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11392. referencedClasses: [],
  11393. messageSends: ["add:", "new", "yourself"]
  11394. }),
  11395. $globals.Collection.klass);
  11396. $core.addMethod(
  11397. $core.method({
  11398. selector: "with:with:with:",
  11399. protocol: 'instance creation',
  11400. fn: function (firstObject,secondObject,thirdObject){
  11401. var self=this;
  11402. return $core.withContext(function($ctx1) {
  11403. var $2,$3,$1;
  11404. $2=self._new();
  11405. $recv($2)._add_(firstObject);
  11406. $ctx1.sendIdx["add:"]=1;
  11407. $recv($2)._add_(secondObject);
  11408. $ctx1.sendIdx["add:"]=2;
  11409. $recv($2)._add_(thirdObject);
  11410. $3=$recv($2)._yourself();
  11411. $1=$3;
  11412. return $1;
  11413. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11414. },
  11415. args: ["firstObject", "secondObject", "thirdObject"],
  11416. 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",
  11417. referencedClasses: [],
  11418. messageSends: ["add:", "new", "yourself"]
  11419. }),
  11420. $globals.Collection.klass);
  11421. $core.addMethod(
  11422. $core.method({
  11423. selector: "withAll:",
  11424. protocol: 'instance creation',
  11425. fn: function (aCollection){
  11426. var self=this;
  11427. return $core.withContext(function($ctx1) {
  11428. var $2,$3,$1;
  11429. $2=self._new();
  11430. $recv($2)._addAll_(aCollection);
  11431. $3=$recv($2)._yourself();
  11432. $1=$3;
  11433. return $1;
  11434. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11435. },
  11436. args: ["aCollection"],
  11437. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11438. referencedClasses: [],
  11439. messageSends: ["addAll:", "new", "yourself"]
  11440. }),
  11441. $globals.Collection.klass);
  11442. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11443. $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.";
  11444. $core.addMethod(
  11445. $core.method({
  11446. selector: "at:",
  11447. protocol: 'accessing',
  11448. fn: function (anIndex){
  11449. var self=this;
  11450. return $core.withContext(function($ctx1) {
  11451. var $1;
  11452. $1=self._at_ifAbsent_(anIndex,(function(){
  11453. return $core.withContext(function($ctx2) {
  11454. return self._errorNotFound();
  11455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11456. }));
  11457. return $1;
  11458. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11459. },
  11460. args: ["anIndex"],
  11461. 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 ]",
  11462. referencedClasses: [],
  11463. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11464. }),
  11465. $globals.IndexableCollection);
  11466. $core.addMethod(
  11467. $core.method({
  11468. selector: "at:ifAbsent:",
  11469. protocol: 'accessing',
  11470. fn: function (anIndex,aBlock){
  11471. var self=this;
  11472. return $core.withContext(function($ctx1) {
  11473. self._subclassResponsibility();
  11474. return self;
  11475. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11476. },
  11477. args: ["anIndex", "aBlock"],
  11478. 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",
  11479. referencedClasses: [],
  11480. messageSends: ["subclassResponsibility"]
  11481. }),
  11482. $globals.IndexableCollection);
  11483. $core.addMethod(
  11484. $core.method({
  11485. selector: "at:ifAbsentPut:",
  11486. protocol: 'accessing',
  11487. fn: function (aKey,aBlock){
  11488. var self=this;
  11489. return $core.withContext(function($ctx1) {
  11490. var $1;
  11491. $1=self._at_ifAbsent_(aKey,(function(){
  11492. return $core.withContext(function($ctx2) {
  11493. return self._at_put_(aKey,$recv(aBlock)._value());
  11494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11495. }));
  11496. return $1;
  11497. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11498. },
  11499. args: ["aKey", "aBlock"],
  11500. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11501. referencedClasses: [],
  11502. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11503. }),
  11504. $globals.IndexableCollection);
  11505. $core.addMethod(
  11506. $core.method({
  11507. selector: "at:ifPresent:",
  11508. protocol: 'accessing',
  11509. fn: function (anIndex,aBlock){
  11510. var self=this;
  11511. return $core.withContext(function($ctx1) {
  11512. var $1;
  11513. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11514. return nil;
  11515. }));
  11516. return $1;
  11517. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11518. },
  11519. args: ["anIndex", "aBlock"],
  11520. 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 ]",
  11521. referencedClasses: [],
  11522. messageSends: ["at:ifPresent:ifAbsent:"]
  11523. }),
  11524. $globals.IndexableCollection);
  11525. $core.addMethod(
  11526. $core.method({
  11527. selector: "at:ifPresent:ifAbsent:",
  11528. protocol: 'accessing',
  11529. fn: function (anIndex,aBlock,anotherBlock){
  11530. var self=this;
  11531. return $core.withContext(function($ctx1) {
  11532. self._subclassResponsibility();
  11533. return self;
  11534. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11535. },
  11536. args: ["anIndex", "aBlock", "anotherBlock"],
  11537. 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",
  11538. referencedClasses: [],
  11539. messageSends: ["subclassResponsibility"]
  11540. }),
  11541. $globals.IndexableCollection);
  11542. $core.addMethod(
  11543. $core.method({
  11544. selector: "at:put:",
  11545. protocol: 'accessing',
  11546. fn: function (anIndex,anObject){
  11547. var self=this;
  11548. return $core.withContext(function($ctx1) {
  11549. self._subclassResponsibility();
  11550. return self;
  11551. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11552. },
  11553. args: ["anIndex", "anObject"],
  11554. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11555. referencedClasses: [],
  11556. messageSends: ["subclassResponsibility"]
  11557. }),
  11558. $globals.IndexableCollection);
  11559. $core.addMethod(
  11560. $core.method({
  11561. selector: "indexOf:",
  11562. protocol: 'accessing',
  11563. fn: function (anObject){
  11564. var self=this;
  11565. return $core.withContext(function($ctx1) {
  11566. var $1;
  11567. $1=self._indexOf_ifAbsent_(anObject,(function(){
  11568. return $core.withContext(function($ctx2) {
  11569. return self._errorNotFound();
  11570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11571. }));
  11572. return $1;
  11573. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  11574. },
  11575. args: ["anObject"],
  11576. 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 ]",
  11577. referencedClasses: [],
  11578. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  11579. }),
  11580. $globals.IndexableCollection);
  11581. $core.addMethod(
  11582. $core.method({
  11583. selector: "indexOf:ifAbsent:",
  11584. protocol: 'accessing',
  11585. fn: function (anObject,aBlock){
  11586. var self=this;
  11587. return $core.withContext(function($ctx1) {
  11588. self._subclassResponsibility();
  11589. return self;
  11590. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  11591. },
  11592. args: ["anObject", "aBlock"],
  11593. 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",
  11594. referencedClasses: [],
  11595. messageSends: ["subclassResponsibility"]
  11596. }),
  11597. $globals.IndexableCollection);
  11598. $core.addMethod(
  11599. $core.method({
  11600. selector: "with:do:",
  11601. protocol: 'enumerating',
  11602. fn: function (anotherCollection,aBlock){
  11603. var self=this;
  11604. return $core.withContext(function($ctx1) {
  11605. self._withIndexDo_((function(each,index){
  11606. return $core.withContext(function($ctx2) {
  11607. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  11608. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  11609. }));
  11610. return self;
  11611. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  11612. },
  11613. args: ["anotherCollection", "aBlock"],
  11614. 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) ]",
  11615. referencedClasses: [],
  11616. messageSends: ["withIndexDo:", "value:value:", "at:"]
  11617. }),
  11618. $globals.IndexableCollection);
  11619. $core.addMethod(
  11620. $core.method({
  11621. selector: "withIndexDo:",
  11622. protocol: 'enumerating',
  11623. fn: function (aBlock){
  11624. var self=this;
  11625. return $core.withContext(function($ctx1) {
  11626. self._subclassResponsibility();
  11627. return self;
  11628. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  11629. },
  11630. args: ["aBlock"],
  11631. 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",
  11632. referencedClasses: [],
  11633. messageSends: ["subclassResponsibility"]
  11634. }),
  11635. $globals.IndexableCollection);
  11636. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  11637. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  11638. $core.addMethod(
  11639. $core.method({
  11640. selector: "=",
  11641. protocol: 'comparing',
  11642. fn: function (anAssocitativeCollection){
  11643. var self=this;
  11644. return $core.withContext(function($ctx1) {
  11645. var $2,$1,$4,$3,$6,$5;
  11646. $2=self._class();
  11647. $ctx1.sendIdx["class"]=1;
  11648. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  11649. $ctx1.sendIdx["="]=1;
  11650. if(!$core.assert($1)){
  11651. return false;
  11652. };
  11653. $4=self._size();
  11654. $ctx1.sendIdx["size"]=1;
  11655. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  11656. $ctx1.sendIdx["="]=2;
  11657. if(!$core.assert($3)){
  11658. return false;
  11659. };
  11660. $6=self._associations();
  11661. $ctx1.sendIdx["associations"]=1;
  11662. $5=$recv($6).__eq($recv(anAssocitativeCollection)._associations());
  11663. return $5;
  11664. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  11665. },
  11666. args: ["anAssocitativeCollection"],
  11667. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  11668. referencedClasses: [],
  11669. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  11670. }),
  11671. $globals.AssociativeCollection);
  11672. $core.addMethod(
  11673. $core.method({
  11674. selector: "add:",
  11675. protocol: 'adding/removing',
  11676. fn: function (anAssociation){
  11677. var self=this;
  11678. return $core.withContext(function($ctx1) {
  11679. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  11680. return self;
  11681. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  11682. },
  11683. args: ["anAssociation"],
  11684. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11685. referencedClasses: [],
  11686. messageSends: ["at:put:", "key", "value"]
  11687. }),
  11688. $globals.AssociativeCollection);
  11689. $core.addMethod(
  11690. $core.method({
  11691. selector: "addAll:",
  11692. protocol: 'adding/removing',
  11693. fn: function (anAssociativeCollection){
  11694. var self=this;
  11695. return $core.withContext(function($ctx1) {
  11696. (
  11697. $ctx1.supercall = true,
  11698. $globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  11699. $ctx1.supercall = false;
  11700. return anAssociativeCollection;
  11701. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  11702. },
  11703. args: ["anAssociativeCollection"],
  11704. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  11705. referencedClasses: [],
  11706. messageSends: ["addAll:", "associations"]
  11707. }),
  11708. $globals.AssociativeCollection);
  11709. $core.addMethod(
  11710. $core.method({
  11711. selector: "asDictionary",
  11712. protocol: 'converting',
  11713. fn: function (){
  11714. var self=this;
  11715. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  11716. return $core.withContext(function($ctx1) {
  11717. var $1;
  11718. $1=$recv($Dictionary())._from_(self._associations());
  11719. return $1;
  11720. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  11721. },
  11722. args: [],
  11723. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  11724. referencedClasses: ["Dictionary"],
  11725. messageSends: ["from:", "associations"]
  11726. }),
  11727. $globals.AssociativeCollection);
  11728. $core.addMethod(
  11729. $core.method({
  11730. selector: "asHashedCollection",
  11731. protocol: 'converting',
  11732. fn: function (){
  11733. var self=this;
  11734. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11735. return $core.withContext(function($ctx1) {
  11736. var $1;
  11737. $1=$recv($HashedCollection())._from_(self._associations());
  11738. return $1;
  11739. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  11740. },
  11741. args: [],
  11742. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  11743. referencedClasses: ["HashedCollection"],
  11744. messageSends: ["from:", "associations"]
  11745. }),
  11746. $globals.AssociativeCollection);
  11747. $core.addMethod(
  11748. $core.method({
  11749. selector: "asJSON",
  11750. protocol: 'converting',
  11751. fn: function (){
  11752. var self=this;
  11753. var hash;
  11754. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11755. return $core.withContext(function($ctx1) {
  11756. var $1;
  11757. hash=$recv($HashedCollection())._new();
  11758. self._keysAndValuesDo_((function(key,value){
  11759. return $core.withContext(function($ctx2) {
  11760. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  11761. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11762. }));
  11763. $1=hash;
  11764. return $1;
  11765. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  11766. },
  11767. args: [],
  11768. 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",
  11769. referencedClasses: ["HashedCollection"],
  11770. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  11771. }),
  11772. $globals.AssociativeCollection);
  11773. $core.addMethod(
  11774. $core.method({
  11775. selector: "associations",
  11776. protocol: 'accessing',
  11777. fn: function (){
  11778. var self=this;
  11779. var associations;
  11780. return $core.withContext(function($ctx1) {
  11781. var $1;
  11782. associations=[];
  11783. self._associationsDo_((function(each){
  11784. return $core.withContext(function($ctx2) {
  11785. return $recv(associations)._add_(each);
  11786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11787. }));
  11788. $1=associations;
  11789. return $1;
  11790. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  11791. },
  11792. args: [],
  11793. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  11794. referencedClasses: [],
  11795. messageSends: ["associationsDo:", "add:"]
  11796. }),
  11797. $globals.AssociativeCollection);
  11798. $core.addMethod(
  11799. $core.method({
  11800. selector: "associationsDo:",
  11801. protocol: 'enumerating',
  11802. fn: function (aBlock){
  11803. var self=this;
  11804. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  11805. return $core.withContext(function($ctx1) {
  11806. self._keysAndValuesDo_((function(key,value){
  11807. return $core.withContext(function($ctx2) {
  11808. return $recv(aBlock)._value_($recv($Association())._key_value_(key,value));
  11809. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11810. }));
  11811. return self;
  11812. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11813. },
  11814. args: ["aBlock"],
  11815. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  11816. referencedClasses: ["Association"],
  11817. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  11818. }),
  11819. $globals.AssociativeCollection);
  11820. $core.addMethod(
  11821. $core.method({
  11822. selector: "at:ifPresent:ifAbsent:",
  11823. protocol: 'accessing',
  11824. fn: function (aKey,aBlock,anotherBlock){
  11825. var self=this;
  11826. return $core.withContext(function($ctx1) {
  11827. var $2,$1;
  11828. $2=self._includesKey_(aKey);
  11829. if($core.assert($2)){
  11830. $1=$recv(aBlock)._value_(self._at_(aKey));
  11831. } else {
  11832. $1=$recv(anotherBlock)._value();
  11833. };
  11834. return $1;
  11835. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11836. },
  11837. args: ["aKey", "aBlock", "anotherBlock"],
  11838. 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 ]",
  11839. referencedClasses: [],
  11840. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  11841. }),
  11842. $globals.AssociativeCollection);
  11843. $core.addMethod(
  11844. $core.method({
  11845. selector: "collect:",
  11846. protocol: 'enumerating',
  11847. fn: function (aBlock){
  11848. var self=this;
  11849. var newDict;
  11850. return $core.withContext(function($ctx1) {
  11851. var $1;
  11852. newDict=$recv(self._class())._new();
  11853. self._keysAndValuesDo_((function(key,value){
  11854. return $core.withContext(function($ctx2) {
  11855. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  11856. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11857. }));
  11858. $1=newDict;
  11859. return $1;
  11860. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  11861. },
  11862. args: ["aBlock"],
  11863. 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",
  11864. referencedClasses: [],
  11865. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  11866. }),
  11867. $globals.AssociativeCollection);
  11868. $core.addMethod(
  11869. $core.method({
  11870. selector: "deepCopy",
  11871. protocol: 'copying',
  11872. fn: function (){
  11873. var self=this;
  11874. var copy;
  11875. return $core.withContext(function($ctx1) {
  11876. var $1;
  11877. copy=$recv(self._class())._new();
  11878. self._keysAndValuesDo_((function(key,value){
  11879. return $core.withContext(function($ctx2) {
  11880. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  11881. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11882. }));
  11883. $1=copy;
  11884. return $1;
  11885. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  11886. },
  11887. args: [],
  11888. 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",
  11889. referencedClasses: [],
  11890. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  11891. }),
  11892. $globals.AssociativeCollection);
  11893. $core.addMethod(
  11894. $core.method({
  11895. selector: "detect:ifNone:",
  11896. protocol: 'enumerating',
  11897. fn: function (aBlock,anotherBlock){
  11898. var self=this;
  11899. return $core.withContext(function($ctx1) {
  11900. var $1;
  11901. $1=$recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  11902. return $1;
  11903. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11904. },
  11905. args: ["aBlock", "anotherBlock"],
  11906. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  11907. referencedClasses: [],
  11908. messageSends: ["detect:ifNone:", "values"]
  11909. }),
  11910. $globals.AssociativeCollection);
  11911. $core.addMethod(
  11912. $core.method({
  11913. selector: "do:",
  11914. protocol: 'enumerating',
  11915. fn: function (aBlock){
  11916. var self=this;
  11917. return $core.withContext(function($ctx1) {
  11918. self._valuesDo_(aBlock);
  11919. return self;
  11920. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11921. },
  11922. args: ["aBlock"],
  11923. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  11924. referencedClasses: [],
  11925. messageSends: ["valuesDo:"]
  11926. }),
  11927. $globals.AssociativeCollection);
  11928. $core.addMethod(
  11929. $core.method({
  11930. selector: "includes:",
  11931. protocol: 'enumerating',
  11932. fn: function (anObject){
  11933. var self=this;
  11934. return $core.withContext(function($ctx1) {
  11935. var $1;
  11936. $1=$recv(self._values())._includes_(anObject);
  11937. return $1;
  11938. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  11939. },
  11940. args: ["anObject"],
  11941. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  11942. referencedClasses: [],
  11943. messageSends: ["includes:", "values"]
  11944. }),
  11945. $globals.AssociativeCollection);
  11946. $core.addMethod(
  11947. $core.method({
  11948. selector: "includesKey:",
  11949. protocol: 'testing',
  11950. fn: function (aKey){
  11951. var self=this;
  11952. return $core.withContext(function($ctx1) {
  11953. self._subclassResponsibility();
  11954. return self;
  11955. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  11956. },
  11957. args: ["aKey"],
  11958. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  11959. referencedClasses: [],
  11960. messageSends: ["subclassResponsibility"]
  11961. }),
  11962. $globals.AssociativeCollection);
  11963. $core.addMethod(
  11964. $core.method({
  11965. selector: "indexOf:ifAbsent:",
  11966. protocol: 'accessing',
  11967. fn: function (anObject,aBlock){
  11968. var self=this;
  11969. return $core.withContext(function($ctx1) {
  11970. var $1;
  11971. $1=$recv(self._keys())._detect_ifNone_((function(each){
  11972. return $core.withContext(function($ctx2) {
  11973. return $recv(self._at_(each)).__eq(anObject);
  11974. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11975. }),aBlock);
  11976. return $1;
  11977. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  11978. },
  11979. args: ["anObject", "aBlock"],
  11980. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  11981. referencedClasses: [],
  11982. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  11983. }),
  11984. $globals.AssociativeCollection);
  11985. $core.addMethod(
  11986. $core.method({
  11987. selector: "keyAtValue:",
  11988. protocol: 'accessing',
  11989. fn: function (anObject){
  11990. var self=this;
  11991. return $core.withContext(function($ctx1) {
  11992. var $1;
  11993. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  11994. return $core.withContext(function($ctx2) {
  11995. return self._errorNotFound();
  11996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11997. }));
  11998. return $1;
  11999. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  12000. },
  12001. args: ["anObject"],
  12002. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  12003. referencedClasses: [],
  12004. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  12005. }),
  12006. $globals.AssociativeCollection);
  12007. $core.addMethod(
  12008. $core.method({
  12009. selector: "keyAtValue:ifAbsent:",
  12010. protocol: 'accessing',
  12011. fn: function (anObject,aBlock){
  12012. var self=this;
  12013. return $core.withContext(function($ctx1) {
  12014. var $1;
  12015. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  12016. return $1;
  12017. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12018. },
  12019. args: ["anObject", "aBlock"],
  12020. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  12021. referencedClasses: [],
  12022. messageSends: ["indexOf:ifAbsent:"]
  12023. }),
  12024. $globals.AssociativeCollection);
  12025. $core.addMethod(
  12026. $core.method({
  12027. selector: "keys",
  12028. protocol: 'accessing',
  12029. fn: function (){
  12030. var self=this;
  12031. return $core.withContext(function($ctx1) {
  12032. self._subclassResponsibility();
  12033. return self;
  12034. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  12035. },
  12036. args: [],
  12037. source: "keys\x0a\x09self subclassResponsibility",
  12038. referencedClasses: [],
  12039. messageSends: ["subclassResponsibility"]
  12040. }),
  12041. $globals.AssociativeCollection);
  12042. $core.addMethod(
  12043. $core.method({
  12044. selector: "keysAndValuesDo:",
  12045. protocol: 'enumerating',
  12046. fn: function (aBlock){
  12047. var self=this;
  12048. return $core.withContext(function($ctx1) {
  12049. self._keysDo_((function(each){
  12050. return $core.withContext(function($ctx2) {
  12051. return $recv(aBlock)._value_value_(each,self._at_(each));
  12052. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12053. }));
  12054. return self;
  12055. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12056. },
  12057. args: ["aBlock"],
  12058. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  12059. referencedClasses: [],
  12060. messageSends: ["keysDo:", "value:value:", "at:"]
  12061. }),
  12062. $globals.AssociativeCollection);
  12063. $core.addMethod(
  12064. $core.method({
  12065. selector: "keysDo:",
  12066. protocol: 'enumerating',
  12067. fn: function (aBlock){
  12068. var self=this;
  12069. return $core.withContext(function($ctx1) {
  12070. self._subclassResponsibility();
  12071. return self;
  12072. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12073. },
  12074. args: ["aBlock"],
  12075. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  12076. referencedClasses: [],
  12077. messageSends: ["subclassResponsibility"]
  12078. }),
  12079. $globals.AssociativeCollection);
  12080. $core.addMethod(
  12081. $core.method({
  12082. selector: "printOn:",
  12083. protocol: 'printing',
  12084. fn: function (aStream){
  12085. var self=this;
  12086. return $core.withContext(function($ctx1) {
  12087. (
  12088. $ctx1.supercall = true,
  12089. $globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  12090. $ctx1.supercall = false;
  12091. $ctx1.sendIdx["printOn:"]=1;
  12092. $recv(aStream)._nextPutAll_(" (");
  12093. $ctx1.sendIdx["nextPutAll:"]=1;
  12094. $recv(self._associations())._do_separatedBy_((function(each){
  12095. return $core.withContext(function($ctx2) {
  12096. return $recv(each)._printOn_(aStream);
  12097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12098. }),(function(){
  12099. return $core.withContext(function($ctx2) {
  12100. return $recv(aStream)._nextPutAll_(" , ");
  12101. $ctx2.sendIdx["nextPutAll:"]=2;
  12102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12103. }));
  12104. $recv(aStream)._nextPutAll_(")");
  12105. return self;
  12106. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  12107. },
  12108. args: ["aStream"],
  12109. 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: ')'",
  12110. referencedClasses: [],
  12111. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  12112. }),
  12113. $globals.AssociativeCollection);
  12114. $core.addMethod(
  12115. $core.method({
  12116. selector: "remove:ifAbsent:",
  12117. protocol: 'adding/removing',
  12118. fn: function (aKey,aBlock){
  12119. var self=this;
  12120. return $core.withContext(function($ctx1) {
  12121. var $1;
  12122. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  12123. return $1;
  12124. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12125. },
  12126. args: ["aKey", "aBlock"],
  12127. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  12128. referencedClasses: [],
  12129. messageSends: ["removeKey:ifAbsent:"]
  12130. }),
  12131. $globals.AssociativeCollection);
  12132. $core.addMethod(
  12133. $core.method({
  12134. selector: "removeAll",
  12135. protocol: 'adding/removing',
  12136. fn: function (){
  12137. var self=this;
  12138. return $core.withContext(function($ctx1) {
  12139. var $1;
  12140. $1=$recv(self._keys())._do_((function(each){
  12141. return $core.withContext(function($ctx2) {
  12142. return self._removeKey_(each);
  12143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12144. }));
  12145. return $1;
  12146. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  12147. },
  12148. args: [],
  12149. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  12150. referencedClasses: [],
  12151. messageSends: ["do:", "keys", "removeKey:"]
  12152. }),
  12153. $globals.AssociativeCollection);
  12154. $core.addMethod(
  12155. $core.method({
  12156. selector: "removeKey:",
  12157. protocol: 'adding/removing',
  12158. fn: function (aKey){
  12159. var self=this;
  12160. return $core.withContext(function($ctx1) {
  12161. var $1;
  12162. $1=self._remove_(aKey);
  12163. return $1;
  12164. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12165. },
  12166. args: ["aKey"],
  12167. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  12168. referencedClasses: [],
  12169. messageSends: ["remove:"]
  12170. }),
  12171. $globals.AssociativeCollection);
  12172. $core.addMethod(
  12173. $core.method({
  12174. selector: "removeKey:ifAbsent:",
  12175. protocol: 'adding/removing',
  12176. fn: function (aKey,aBlock){
  12177. var self=this;
  12178. return $core.withContext(function($ctx1) {
  12179. self._subclassResponsibility();
  12180. return self;
  12181. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12182. },
  12183. args: ["aKey", "aBlock"],
  12184. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  12185. referencedClasses: [],
  12186. messageSends: ["subclassResponsibility"]
  12187. }),
  12188. $globals.AssociativeCollection);
  12189. $core.addMethod(
  12190. $core.method({
  12191. selector: "select:",
  12192. protocol: 'enumerating',
  12193. fn: function (aBlock){
  12194. var self=this;
  12195. var newDict;
  12196. return $core.withContext(function($ctx1) {
  12197. var $1,$2;
  12198. newDict=$recv(self._class())._new();
  12199. self._keysAndValuesDo_((function(key,value){
  12200. return $core.withContext(function($ctx2) {
  12201. $1=$recv(aBlock)._value_(value);
  12202. if($core.assert($1)){
  12203. return $recv(newDict)._at_put_(key,value);
  12204. };
  12205. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12206. }));
  12207. $2=newDict;
  12208. return $2;
  12209. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12210. },
  12211. args: ["aBlock"],
  12212. 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",
  12213. referencedClasses: [],
  12214. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  12215. }),
  12216. $globals.AssociativeCollection);
  12217. $core.addMethod(
  12218. $core.method({
  12219. selector: "shallowCopy",
  12220. protocol: 'copying',
  12221. fn: function (){
  12222. var self=this;
  12223. var copy;
  12224. return $core.withContext(function($ctx1) {
  12225. var $1;
  12226. copy=$recv(self._class())._new();
  12227. self._keysAndValuesDo_((function(key,value){
  12228. return $core.withContext(function($ctx2) {
  12229. return $recv(copy)._at_put_(key,value);
  12230. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12231. }));
  12232. $1=copy;
  12233. return $1;
  12234. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  12235. },
  12236. args: [],
  12237. 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",
  12238. referencedClasses: [],
  12239. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  12240. }),
  12241. $globals.AssociativeCollection);
  12242. $core.addMethod(
  12243. $core.method({
  12244. selector: "size",
  12245. protocol: 'accessing',
  12246. fn: function (){
  12247. var self=this;
  12248. return $core.withContext(function($ctx1) {
  12249. var $1;
  12250. $1=$recv(self._keys())._size();
  12251. return $1;
  12252. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  12253. },
  12254. args: [],
  12255. source: "size\x0a\x09^ self keys size",
  12256. referencedClasses: [],
  12257. messageSends: ["size", "keys"]
  12258. }),
  12259. $globals.AssociativeCollection);
  12260. $core.addMethod(
  12261. $core.method({
  12262. selector: "values",
  12263. protocol: 'accessing',
  12264. fn: function (){
  12265. var self=this;
  12266. return $core.withContext(function($ctx1) {
  12267. self._subclassResponsibility();
  12268. return self;
  12269. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  12270. },
  12271. args: [],
  12272. source: "values\x0a\x09self subclassResponsibility",
  12273. referencedClasses: [],
  12274. messageSends: ["subclassResponsibility"]
  12275. }),
  12276. $globals.AssociativeCollection);
  12277. $core.addMethod(
  12278. $core.method({
  12279. selector: "valuesDo:",
  12280. protocol: 'enumerating',
  12281. fn: function (aBlock){
  12282. var self=this;
  12283. return $core.withContext(function($ctx1) {
  12284. self._subclassResponsibility();
  12285. return self;
  12286. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12287. },
  12288. args: ["aBlock"],
  12289. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  12290. referencedClasses: [],
  12291. messageSends: ["subclassResponsibility"]
  12292. }),
  12293. $globals.AssociativeCollection);
  12294. $core.addMethod(
  12295. $core.method({
  12296. selector: "withIndexDo:",
  12297. protocol: 'enumerating',
  12298. fn: function (aBlock){
  12299. var self=this;
  12300. return $core.withContext(function($ctx1) {
  12301. self._keysAndValuesDo_((function(key,value){
  12302. return $core.withContext(function($ctx2) {
  12303. return $recv(aBlock)._value_value_(value,key);
  12304. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12305. }));
  12306. return self;
  12307. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12308. },
  12309. args: ["aBlock"],
  12310. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  12311. referencedClasses: [],
  12312. messageSends: ["keysAndValuesDo:", "value:value:"]
  12313. }),
  12314. $globals.AssociativeCollection);
  12315. $core.addMethod(
  12316. $core.method({
  12317. selector: "from:",
  12318. protocol: 'instance creation',
  12319. fn: function (aCollection){
  12320. var self=this;
  12321. var newCollection;
  12322. return $core.withContext(function($ctx1) {
  12323. var $1;
  12324. newCollection=self._new();
  12325. $recv(aCollection)._do_((function(each){
  12326. return $core.withContext(function($ctx2) {
  12327. return $recv(newCollection)._add_(each);
  12328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12329. }));
  12330. $1=newCollection;
  12331. return $1;
  12332. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12333. },
  12334. args: ["aCollection"],
  12335. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  12336. referencedClasses: [],
  12337. messageSends: ["new", "do:", "add:"]
  12338. }),
  12339. $globals.AssociativeCollection.klass);
  12340. $core.addMethod(
  12341. $core.method({
  12342. selector: "fromPairs:",
  12343. protocol: 'instance creation',
  12344. fn: function (aCollection){
  12345. var self=this;
  12346. return $core.withContext(function($ctx1) {
  12347. var $1;
  12348. $1=self._from_(aCollection);
  12349. return $1;
  12350. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12351. },
  12352. args: ["aCollection"],
  12353. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12354. referencedClasses: [],
  12355. messageSends: ["from:"]
  12356. }),
  12357. $globals.AssociativeCollection.klass);
  12358. $core.addMethod(
  12359. $core.method({
  12360. selector: "newFromPairs:",
  12361. protocol: 'instance creation',
  12362. fn: function (aCollection){
  12363. var self=this;
  12364. var newCollection;
  12365. return $core.withContext(function($ctx1) {
  12366. var $2,$1,$3,$4,$5;
  12367. $2=$recv(aCollection)._size();
  12368. $ctx1.sendIdx["size"]=1;
  12369. $1=$recv($2)._even();
  12370. if(!$core.assert($1)){
  12371. self._error_("#newFromPairs only accepts arrays of an even length");
  12372. };
  12373. newCollection=self._new();
  12374. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12375. return $core.withContext(function($ctx2) {
  12376. $3=newCollection;
  12377. $4=$recv(aCollection)._at_(each);
  12378. $ctx2.sendIdx["at:"]=1;
  12379. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12380. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12381. }));
  12382. $5=newCollection;
  12383. return $5;
  12384. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12385. },
  12386. args: ["aCollection"],
  12387. 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",
  12388. referencedClasses: [],
  12389. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12390. }),
  12391. $globals.AssociativeCollection.klass);
  12392. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12393. $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.";
  12394. $core.addMethod(
  12395. $core.method({
  12396. selector: "at:ifAbsent:",
  12397. protocol: 'accessing',
  12398. fn: function (aKey,aBlock){
  12399. var self=this;
  12400. return $core.withContext(function($ctx1) {
  12401. var index = self._positionOfKey_(aKey);
  12402. return index >=0 ? self['@values'][index] : aBlock._value();
  12403. ;
  12404. return self;
  12405. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12406. },
  12407. args: ["aKey", "aBlock"],
  12408. 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>",
  12409. referencedClasses: [],
  12410. messageSends: []
  12411. }),
  12412. $globals.Dictionary);
  12413. $core.addMethod(
  12414. $core.method({
  12415. selector: "at:put:",
  12416. protocol: 'accessing',
  12417. fn: function (aKey,aValue){
  12418. var self=this;
  12419. return $core.withContext(function($ctx1) {
  12420. var index = self._positionOfKey_(aKey);
  12421. if(index === -1) {
  12422. var keys = self['@keys'];
  12423. index = keys.length;
  12424. keys.push(aKey);
  12425. }
  12426. return self['@values'][index] = aValue;
  12427. ;
  12428. return self;
  12429. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12430. },
  12431. args: ["aKey", "aValue"],
  12432. 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>",
  12433. referencedClasses: [],
  12434. messageSends: []
  12435. }),
  12436. $globals.Dictionary);
  12437. $core.addMethod(
  12438. $core.method({
  12439. selector: "includesKey:",
  12440. protocol: 'testing',
  12441. fn: function (aKey){
  12442. var self=this;
  12443. return $core.withContext(function($ctx1) {
  12444. return self._positionOfKey_(aKey) >= 0; ;
  12445. return self;
  12446. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12447. },
  12448. args: ["aKey"],
  12449. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  12450. referencedClasses: [],
  12451. messageSends: []
  12452. }),
  12453. $globals.Dictionary);
  12454. $core.addMethod(
  12455. $core.method({
  12456. selector: "indexOf:ifAbsent:",
  12457. protocol: 'accessing',
  12458. fn: function (anObject,aBlock){
  12459. var self=this;
  12460. var index;
  12461. return $core.withContext(function($ctx1) {
  12462. var $2,$1;
  12463. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12464. return (0);
  12465. }));
  12466. $2=$recv(index).__eq((0));
  12467. if($core.assert($2)){
  12468. $1=$recv(aBlock)._value();
  12469. } else {
  12470. $1=$recv(self["@keys"])._at_(index);
  12471. };
  12472. return $1;
  12473. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12474. },
  12475. args: ["anObject", "aBlock"],
  12476. 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 ]",
  12477. referencedClasses: [],
  12478. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12479. }),
  12480. $globals.Dictionary);
  12481. $core.addMethod(
  12482. $core.method({
  12483. selector: "initialize",
  12484. protocol: 'initialization',
  12485. fn: function (){
  12486. var self=this;
  12487. return $core.withContext(function($ctx1) {
  12488. (
  12489. $ctx1.supercall = true,
  12490. $globals.Dictionary.superclass.fn.prototype._initialize.apply($recv(self), []));
  12491. $ctx1.supercall = false;
  12492. self["@keys"]=[];
  12493. self["@values"]=[];
  12494. return self;
  12495. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12496. },
  12497. args: [],
  12498. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12499. referencedClasses: [],
  12500. messageSends: ["initialize"]
  12501. }),
  12502. $globals.Dictionary);
  12503. $core.addMethod(
  12504. $core.method({
  12505. selector: "keys",
  12506. protocol: 'accessing',
  12507. fn: function (){
  12508. var self=this;
  12509. return $core.withContext(function($ctx1) {
  12510. var $1;
  12511. $1=$recv(self["@keys"])._copy();
  12512. return $1;
  12513. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12514. },
  12515. args: [],
  12516. source: "keys\x0a\x09^ keys copy",
  12517. referencedClasses: [],
  12518. messageSends: ["copy"]
  12519. }),
  12520. $globals.Dictionary);
  12521. $core.addMethod(
  12522. $core.method({
  12523. selector: "keysAndValuesDo:",
  12524. protocol: 'enumerating',
  12525. fn: function (aBlock){
  12526. var self=this;
  12527. return $core.withContext(function($ctx1) {
  12528. var $1;
  12529. $1=$recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12530. return $1;
  12531. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12532. },
  12533. args: ["aBlock"],
  12534. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12535. referencedClasses: [],
  12536. messageSends: ["with:do:"]
  12537. }),
  12538. $globals.Dictionary);
  12539. $core.addMethod(
  12540. $core.method({
  12541. selector: "keysDo:",
  12542. protocol: 'enumerating',
  12543. fn: function (aBlock){
  12544. var self=this;
  12545. return $core.withContext(function($ctx1) {
  12546. var $1;
  12547. $1=$recv(self["@keys"])._do_(aBlock);
  12548. return $1;
  12549. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12550. },
  12551. args: ["aBlock"],
  12552. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12553. referencedClasses: [],
  12554. messageSends: ["do:"]
  12555. }),
  12556. $globals.Dictionary);
  12557. $core.addMethod(
  12558. $core.method({
  12559. selector: "positionOfKey:",
  12560. protocol: 'private',
  12561. fn: function (anObject){
  12562. var self=this;
  12563. return $core.withContext(function($ctx1) {
  12564. var keys = self['@keys'];
  12565. for(var i=0;i<keys.length;i++){
  12566. if(keys[i].__eq(anObject)) { return i;}
  12567. }
  12568. return -1;
  12569. ;
  12570. return self;
  12571. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12572. },
  12573. args: ["anObject"],
  12574. 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>",
  12575. referencedClasses: [],
  12576. messageSends: []
  12577. }),
  12578. $globals.Dictionary);
  12579. $core.addMethod(
  12580. $core.method({
  12581. selector: "removeAll",
  12582. protocol: 'adding/removing',
  12583. fn: function (){
  12584. var self=this;
  12585. return $core.withContext(function($ctx1) {
  12586. $recv(self["@keys"])._removeAll();
  12587. $ctx1.sendIdx["removeAll"]=1;
  12588. $recv(self["@values"])._removeAll();
  12589. return self;
  12590. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12591. },
  12592. args: [],
  12593. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12594. referencedClasses: [],
  12595. messageSends: ["removeAll"]
  12596. }),
  12597. $globals.Dictionary);
  12598. $core.addMethod(
  12599. $core.method({
  12600. selector: "removeKey:ifAbsent:",
  12601. protocol: 'adding/removing',
  12602. fn: function (aKey,aBlock){
  12603. var self=this;
  12604. return $core.withContext(function($ctx1) {
  12605. var index = self._positionOfKey_(aKey);
  12606. if(index === -1) {
  12607. return aBlock._value()
  12608. } else {
  12609. var keys = self['@keys'], values = self['@values'];
  12610. var value = values[index], l = keys.length;
  12611. keys[index] = keys[l-1];
  12612. keys.pop();
  12613. values[index] = values[l-1];
  12614. values.pop();
  12615. return value;
  12616. }
  12617. ;
  12618. return self;
  12619. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12620. },
  12621. args: ["aKey", "aBlock"],
  12622. 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>",
  12623. referencedClasses: [],
  12624. messageSends: []
  12625. }),
  12626. $globals.Dictionary);
  12627. $core.addMethod(
  12628. $core.method({
  12629. selector: "values",
  12630. protocol: 'accessing',
  12631. fn: function (){
  12632. var self=this;
  12633. var $1;
  12634. $1=self["@values"];
  12635. return $1;
  12636. },
  12637. args: [],
  12638. source: "values\x0a\x09^ values",
  12639. referencedClasses: [],
  12640. messageSends: []
  12641. }),
  12642. $globals.Dictionary);
  12643. $core.addMethod(
  12644. $core.method({
  12645. selector: "valuesDo:",
  12646. protocol: 'enumerating',
  12647. fn: function (aBlock){
  12648. var self=this;
  12649. return $core.withContext(function($ctx1) {
  12650. var $1;
  12651. $1=$recv(self["@values"])._do_(aBlock);
  12652. return $1;
  12653. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12654. },
  12655. args: ["aBlock"],
  12656. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  12657. referencedClasses: [],
  12658. messageSends: ["do:"]
  12659. }),
  12660. $globals.Dictionary);
  12661. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  12662. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  12663. $core.addMethod(
  12664. $core.method({
  12665. selector: "at:ifAbsent:",
  12666. protocol: 'accessing',
  12667. fn: function (aKey,aBlock){
  12668. var self=this;
  12669. return $core.withContext(function($ctx1) {
  12670. var $2,$1;
  12671. $2=self._includesKey_(aKey);
  12672. if($core.assert($2)){
  12673. $1=self._basicAt_(aKey);
  12674. } else {
  12675. $1=$recv(aBlock)._value();
  12676. };
  12677. return $1;
  12678. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12679. },
  12680. args: ["aKey", "aBlock"],
  12681. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  12682. referencedClasses: [],
  12683. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  12684. }),
  12685. $globals.HashedCollection);
  12686. $core.addMethod(
  12687. $core.method({
  12688. selector: "at:put:",
  12689. protocol: 'accessing',
  12690. fn: function (aKey,aValue){
  12691. var self=this;
  12692. return $core.withContext(function($ctx1) {
  12693. var $1;
  12694. $1=self._basicAt_put_(aKey,aValue);
  12695. return $1;
  12696. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  12697. },
  12698. args: ["aKey", "aValue"],
  12699. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  12700. referencedClasses: [],
  12701. messageSends: ["basicAt:put:"]
  12702. }),
  12703. $globals.HashedCollection);
  12704. $core.addMethod(
  12705. $core.method({
  12706. selector: "includesKey:",
  12707. protocol: 'testing',
  12708. fn: function (aKey){
  12709. var self=this;
  12710. return $core.withContext(function($ctx1) {
  12711. return self.hasOwnProperty(aKey);
  12712. return self;
  12713. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  12714. },
  12715. args: ["aKey"],
  12716. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  12717. referencedClasses: [],
  12718. messageSends: []
  12719. }),
  12720. $globals.HashedCollection);
  12721. $core.addMethod(
  12722. $core.method({
  12723. selector: "keys",
  12724. protocol: 'accessing',
  12725. fn: function (){
  12726. var self=this;
  12727. return $core.withContext(function($ctx1) {
  12728. return Object.keys(self);
  12729. return self;
  12730. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  12731. },
  12732. args: [],
  12733. source: "keys\x0a\x09<return Object.keys(self)>",
  12734. referencedClasses: [],
  12735. messageSends: []
  12736. }),
  12737. $globals.HashedCollection);
  12738. $core.addMethod(
  12739. $core.method({
  12740. selector: "keysDo:",
  12741. protocol: 'enumerating',
  12742. fn: function (aBlock){
  12743. var self=this;
  12744. return $core.withContext(function($ctx1) {
  12745. $recv(self._keys())._do_(aBlock);
  12746. return self;
  12747. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12748. },
  12749. args: ["aBlock"],
  12750. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  12751. referencedClasses: [],
  12752. messageSends: ["do:", "keys"]
  12753. }),
  12754. $globals.HashedCollection);
  12755. $core.addMethod(
  12756. $core.method({
  12757. selector: "removeKey:ifAbsent:",
  12758. protocol: 'adding/removing',
  12759. fn: function (aKey,aBlock){
  12760. var self=this;
  12761. return $core.withContext(function($ctx1) {
  12762. var $1;
  12763. $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  12764. return $core.withContext(function($ctx2) {
  12765. self._basicDelete_(aKey);
  12766. return removed;
  12767. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  12768. }),(function(){
  12769. return $core.withContext(function($ctx2) {
  12770. return $recv(aBlock)._value();
  12771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12772. }));
  12773. return $1;
  12774. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12775. },
  12776. args: ["aKey", "aBlock"],
  12777. 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 ]",
  12778. referencedClasses: [],
  12779. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  12780. }),
  12781. $globals.HashedCollection);
  12782. $core.addMethod(
  12783. $core.method({
  12784. selector: "values",
  12785. protocol: 'accessing',
  12786. fn: function (){
  12787. var self=this;
  12788. return $core.withContext(function($ctx1) {
  12789. return self._keys().map(function(key){
  12790. return self._at_(key);
  12791. });
  12792. ;
  12793. return self;
  12794. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  12795. },
  12796. args: [],
  12797. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  12798. referencedClasses: [],
  12799. messageSends: []
  12800. }),
  12801. $globals.HashedCollection);
  12802. $core.addMethod(
  12803. $core.method({
  12804. selector: "valuesDo:",
  12805. protocol: 'enumerating',
  12806. fn: function (aBlock){
  12807. var self=this;
  12808. return $core.withContext(function($ctx1) {
  12809. $recv(self._values())._do_(aBlock);
  12810. return self;
  12811. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12812. },
  12813. args: ["aBlock"],
  12814. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  12815. referencedClasses: [],
  12816. messageSends: ["do:", "values"]
  12817. }),
  12818. $globals.HashedCollection);
  12819. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12820. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  12821. $core.addMethod(
  12822. $core.method({
  12823. selector: "=",
  12824. protocol: 'comparing',
  12825. fn: function (aCollection){
  12826. var self=this;
  12827. return $core.withContext(function($ctx1) {
  12828. var $3,$2,$4,$1,$5;
  12829. var $early={};
  12830. try {
  12831. $3=self._class();
  12832. $ctx1.sendIdx["class"]=1;
  12833. $2=$recv($3).__eq($recv(aCollection)._class());
  12834. $ctx1.sendIdx["="]=1;
  12835. $1=$recv($2)._and_((function(){
  12836. return $core.withContext(function($ctx2) {
  12837. $4=self._size();
  12838. $ctx2.sendIdx["size"]=1;
  12839. return $recv($4).__eq($recv(aCollection)._size());
  12840. $ctx2.sendIdx["="]=2;
  12841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12842. }));
  12843. if(!$core.assert($1)){
  12844. return false;
  12845. };
  12846. self._withIndexDo_((function(each,i){
  12847. return $core.withContext(function($ctx2) {
  12848. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  12849. if(!$core.assert($5)){
  12850. throw $early=[false];
  12851. };
  12852. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  12853. }));
  12854. return true;
  12855. }
  12856. catch(e) {if(e===$early)return e[0]; throw e}
  12857. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  12858. },
  12859. args: ["aCollection"],
  12860. 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",
  12861. referencedClasses: [],
  12862. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  12863. }),
  12864. $globals.SequenceableCollection);
  12865. $core.addMethod(
  12866. $core.method({
  12867. selector: "addLast:",
  12868. protocol: 'adding/removing',
  12869. fn: function (anObject){
  12870. var self=this;
  12871. return $core.withContext(function($ctx1) {
  12872. self._add_(anObject);
  12873. return self;
  12874. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  12875. },
  12876. args: ["anObject"],
  12877. source: "addLast: anObject\x0a\x09self add: anObject",
  12878. referencedClasses: [],
  12879. messageSends: ["add:"]
  12880. }),
  12881. $globals.SequenceableCollection);
  12882. $core.addMethod(
  12883. $core.method({
  12884. selector: "allButFirst",
  12885. protocol: 'accessing',
  12886. fn: function (){
  12887. var self=this;
  12888. return $core.withContext(function($ctx1) {
  12889. var $1;
  12890. $1=self._copyFrom_to_((2),self._size());
  12891. return $1;
  12892. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  12893. },
  12894. args: [],
  12895. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  12896. referencedClasses: [],
  12897. messageSends: ["copyFrom:to:", "size"]
  12898. }),
  12899. $globals.SequenceableCollection);
  12900. $core.addMethod(
  12901. $core.method({
  12902. selector: "allButLast",
  12903. protocol: 'accessing',
  12904. fn: function (){
  12905. var self=this;
  12906. return $core.withContext(function($ctx1) {
  12907. var $1;
  12908. $1=self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  12909. return $1;
  12910. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  12911. },
  12912. args: [],
  12913. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  12914. referencedClasses: [],
  12915. messageSends: ["copyFrom:to:", "-", "size"]
  12916. }),
  12917. $globals.SequenceableCollection);
  12918. $core.addMethod(
  12919. $core.method({
  12920. selector: "atRandom",
  12921. protocol: 'accessing',
  12922. fn: function (){
  12923. var self=this;
  12924. return $core.withContext(function($ctx1) {
  12925. var $1;
  12926. $1=self._at_($recv(self._size())._atRandom());
  12927. return $1;
  12928. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  12929. },
  12930. args: [],
  12931. source: "atRandom\x0a\x09^ self at: self size atRandom",
  12932. referencedClasses: [],
  12933. messageSends: ["at:", "atRandom", "size"]
  12934. }),
  12935. $globals.SequenceableCollection);
  12936. $core.addMethod(
  12937. $core.method({
  12938. selector: "beginsWith:",
  12939. protocol: 'testing',
  12940. fn: function (prefix){
  12941. var self=this;
  12942. return $core.withContext(function($ctx1) {
  12943. var $2,$3,$1,$4;
  12944. $2=self._size();
  12945. $ctx1.sendIdx["size"]=1;
  12946. $3=$recv(prefix)._size();
  12947. $ctx1.sendIdx["size"]=2;
  12948. $1=$recv($2).__lt($3);
  12949. if($core.assert($1)){
  12950. return false;
  12951. };
  12952. $4=$recv(self._first_($recv(prefix)._size())).__eq(prefix);
  12953. return $4;
  12954. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  12955. },
  12956. args: ["prefix"],
  12957. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  12958. referencedClasses: [],
  12959. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  12960. }),
  12961. $globals.SequenceableCollection);
  12962. $core.addMethod(
  12963. $core.method({
  12964. selector: "copyFrom:to:",
  12965. protocol: 'copying',
  12966. fn: function (anIndex,anotherIndex){
  12967. var self=this;
  12968. var range,newCollection;
  12969. return $core.withContext(function($ctx1) {
  12970. var $1;
  12971. range=$recv(anIndex)._to_(anotherIndex);
  12972. newCollection=$recv(self._class())._new_($recv(range)._size());
  12973. $recv(range)._withIndexDo_((function(each,i){
  12974. return $core.withContext(function($ctx2) {
  12975. return $recv(newCollection)._at_put_(i,self._at_(each));
  12976. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  12977. }));
  12978. $1=newCollection;
  12979. return $1;
  12980. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},$globals.SequenceableCollection)});
  12981. },
  12982. args: ["anIndex", "anotherIndex"],
  12983. source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [ :each :i |\x0a\x09\x09newCollection at: i put: (self at: each) ].\x0a\x09^ newCollection",
  12984. referencedClasses: [],
  12985. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"]
  12986. }),
  12987. $globals.SequenceableCollection);
  12988. $core.addMethod(
  12989. $core.method({
  12990. selector: "deepCopy",
  12991. protocol: 'copying',
  12992. fn: function (){
  12993. var self=this;
  12994. var newCollection;
  12995. return $core.withContext(function($ctx1) {
  12996. var $1;
  12997. newCollection=$recv(self._class())._new_(self._size());
  12998. self._withIndexDo_((function(each,index){
  12999. return $core.withContext(function($ctx2) {
  13000. return $recv(newCollection)._at_put_(index,$recv(each)._deepCopy());
  13001. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  13002. }));
  13003. $1=newCollection;
  13004. return $1;
  13005. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},$globals.SequenceableCollection)});
  13006. },
  13007. args: [],
  13008. source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each deepCopy ].\x0a\x09^ newCollection",
  13009. referencedClasses: [],
  13010. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"]
  13011. }),
  13012. $globals.SequenceableCollection);
  13013. $core.addMethod(
  13014. $core.method({
  13015. selector: "detect:ifNone:",
  13016. protocol: 'enumerating',
  13017. fn: function (aBlock,anotherBlock){
  13018. var self=this;
  13019. return $core.withContext(function($ctx1) {
  13020. self = self._numericallyIndexable();
  13021. for(var i = 0; i < self.length; i++)
  13022. if(aBlock._value_(self[i]))
  13023. return self[i];
  13024. return anotherBlock._value();
  13025. ;
  13026. return self;
  13027. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  13028. },
  13029. args: ["aBlock", "anotherBlock"],
  13030. 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>",
  13031. referencedClasses: [],
  13032. messageSends: []
  13033. }),
  13034. $globals.SequenceableCollection);
  13035. $core.addMethod(
  13036. $core.method({
  13037. selector: "do:",
  13038. protocol: 'enumerating',
  13039. fn: function (aBlock){
  13040. var self=this;
  13041. return $core.withContext(function($ctx1) {
  13042. self = self._numericallyIndexable();
  13043. for(var i=0; i < self.length; i++) {
  13044. aBlock._value_(self[i]);
  13045. }
  13046. ;
  13047. return self;
  13048. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13049. },
  13050. args: ["aBlock"],
  13051. 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>",
  13052. referencedClasses: [],
  13053. messageSends: []
  13054. }),
  13055. $globals.SequenceableCollection);
  13056. $core.addMethod(
  13057. $core.method({
  13058. selector: "endsWith:",
  13059. protocol: 'testing',
  13060. fn: function (suffix){
  13061. var self=this;
  13062. return $core.withContext(function($ctx1) {
  13063. var $2,$3,$1,$4;
  13064. $2=self._size();
  13065. $ctx1.sendIdx["size"]=1;
  13066. $3=$recv(suffix)._size();
  13067. $ctx1.sendIdx["size"]=2;
  13068. $1=$recv($2).__lt($3);
  13069. if($core.assert($1)){
  13070. return false;
  13071. };
  13072. $4=$recv(self._last_($recv(suffix)._size())).__eq(suffix);
  13073. return $4;
  13074. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  13075. },
  13076. args: ["suffix"],
  13077. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  13078. referencedClasses: [],
  13079. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  13080. }),
  13081. $globals.SequenceableCollection);
  13082. $core.addMethod(
  13083. $core.method({
  13084. selector: "first",
  13085. protocol: 'accessing',
  13086. fn: function (){
  13087. var self=this;
  13088. return $core.withContext(function($ctx1) {
  13089. var $1;
  13090. $1=self._at_((1));
  13091. return $1;
  13092. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  13093. },
  13094. args: [],
  13095. source: "first\x0a\x09^ self at: 1",
  13096. referencedClasses: [],
  13097. messageSends: ["at:"]
  13098. }),
  13099. $globals.SequenceableCollection);
  13100. $core.addMethod(
  13101. $core.method({
  13102. selector: "first:",
  13103. protocol: 'accessing',
  13104. fn: function (aNumber){
  13105. var self=this;
  13106. return $core.withContext(function($ctx1) {
  13107. var $1,$2;
  13108. $1=$recv(self._size()).__lt(aNumber);
  13109. if($core.assert($1)){
  13110. self._error_("Invalid number of elements");
  13111. };
  13112. $2=self._copyFrom_to_((1),aNumber);
  13113. return $2;
  13114. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13115. },
  13116. args: ["aNumber"],
  13117. 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",
  13118. referencedClasses: [],
  13119. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  13120. }),
  13121. $globals.SequenceableCollection);
  13122. $core.addMethod(
  13123. $core.method({
  13124. selector: "fourth",
  13125. protocol: 'accessing',
  13126. fn: function (){
  13127. var self=this;
  13128. return $core.withContext(function($ctx1) {
  13129. var $1;
  13130. $1=self._at_((4));
  13131. return $1;
  13132. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  13133. },
  13134. args: [],
  13135. source: "fourth\x0a\x09^ self at: 4",
  13136. referencedClasses: [],
  13137. messageSends: ["at:"]
  13138. }),
  13139. $globals.SequenceableCollection);
  13140. $core.addMethod(
  13141. $core.method({
  13142. selector: "includes:",
  13143. protocol: 'testing',
  13144. fn: function (anObject){
  13145. var self=this;
  13146. return $core.withContext(function($ctx1) {
  13147. var $1;
  13148. $1=$recv(self._indexOf_ifAbsent_(anObject,(function(){
  13149. return nil;
  13150. })))._notNil();
  13151. return $1;
  13152. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  13153. },
  13154. args: ["anObject"],
  13155. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  13156. referencedClasses: [],
  13157. messageSends: ["notNil", "indexOf:ifAbsent:"]
  13158. }),
  13159. $globals.SequenceableCollection);
  13160. $core.addMethod(
  13161. $core.method({
  13162. selector: "indexOf:ifAbsent:",
  13163. protocol: 'accessing',
  13164. fn: function (anObject,aBlock){
  13165. var self=this;
  13166. return $core.withContext(function($ctx1) {
  13167. self = self._numericallyIndexable();
  13168. for(var i=0; i < self.length; i++) {
  13169. if($recv(self[i]).__eq(anObject)) {return i+1}
  13170. };
  13171. return aBlock._value();
  13172. ;
  13173. return self;
  13174. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  13175. },
  13176. args: ["anObject", "aBlock"],
  13177. 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>",
  13178. referencedClasses: [],
  13179. messageSends: []
  13180. }),
  13181. $globals.SequenceableCollection);
  13182. $core.addMethod(
  13183. $core.method({
  13184. selector: "indexOf:startingAt:",
  13185. protocol: 'accessing',
  13186. fn: function (anObject,start){
  13187. var self=this;
  13188. return $core.withContext(function($ctx1) {
  13189. var $1;
  13190. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  13191. return (0);
  13192. }));
  13193. return $1;
  13194. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  13195. },
  13196. args: ["anObject", "start"],
  13197. 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 ]",
  13198. referencedClasses: [],
  13199. messageSends: ["indexOf:startingAt:ifAbsent:"]
  13200. }),
  13201. $globals.SequenceableCollection);
  13202. $core.addMethod(
  13203. $core.method({
  13204. selector: "indexOf:startingAt:ifAbsent:",
  13205. protocol: 'accessing',
  13206. fn: function (anObject,start,aBlock){
  13207. var self=this;
  13208. return $core.withContext(function($ctx1) {
  13209. self = self._numericallyIndexable();
  13210. for(var i=start - 1; i < self.length; i++){
  13211. if($recv(self[i]).__eq(anObject)) {return i+1}
  13212. }
  13213. return aBlock._value();
  13214. ;
  13215. return self;
  13216. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  13217. },
  13218. args: ["anObject", "start", "aBlock"],
  13219. 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>",
  13220. referencedClasses: [],
  13221. messageSends: []
  13222. }),
  13223. $globals.SequenceableCollection);
  13224. $core.addMethod(
  13225. $core.method({
  13226. selector: "last",
  13227. protocol: 'accessing',
  13228. fn: function (){
  13229. var self=this;
  13230. return $core.withContext(function($ctx1) {
  13231. var $1;
  13232. $1=self._at_(self._size());
  13233. return $1;
  13234. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  13235. },
  13236. args: [],
  13237. source: "last\x0a\x09^ self at: self size",
  13238. referencedClasses: [],
  13239. messageSends: ["at:", "size"]
  13240. }),
  13241. $globals.SequenceableCollection);
  13242. $core.addMethod(
  13243. $core.method({
  13244. selector: "last:",
  13245. protocol: 'accessing',
  13246. fn: function (aNumber){
  13247. var self=this;
  13248. return $core.withContext(function($ctx1) {
  13249. var $2,$1,$6,$5,$4,$3;
  13250. $2=self._size();
  13251. $ctx1.sendIdx["size"]=1;
  13252. $1=$recv($2).__lt(aNumber);
  13253. if($core.assert($1)){
  13254. self._error_("Invalid number of elements");
  13255. };
  13256. $6=self._size();
  13257. $ctx1.sendIdx["size"]=2;
  13258. $5=$recv($6).__minus(aNumber);
  13259. $4=$recv($5).__plus((1));
  13260. $3=self._copyFrom_to_($4,self._size());
  13261. return $3;
  13262. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13263. },
  13264. args: ["aNumber"],
  13265. 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",
  13266. referencedClasses: [],
  13267. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  13268. }),
  13269. $globals.SequenceableCollection);
  13270. $core.addMethod(
  13271. $core.method({
  13272. selector: "newStream",
  13273. protocol: 'streaming',
  13274. fn: function (){
  13275. var self=this;
  13276. return $core.withContext(function($ctx1) {
  13277. var $1;
  13278. $1=$recv(self._streamClass())._on_(self);
  13279. return $1;
  13280. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  13281. },
  13282. args: [],
  13283. source: "newStream\x0a\x09^ self streamClass on: self",
  13284. referencedClasses: [],
  13285. messageSends: ["on:", "streamClass"]
  13286. }),
  13287. $globals.SequenceableCollection);
  13288. $core.addMethod(
  13289. $core.method({
  13290. selector: "numericallyIndexable",
  13291. protocol: 'private',
  13292. fn: function (){
  13293. var self=this;
  13294. return $core.withContext(function($ctx1) {
  13295. self._subclassResponsibility();
  13296. return self;
  13297. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  13298. },
  13299. args: [],
  13300. 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",
  13301. referencedClasses: [],
  13302. messageSends: ["subclassResponsibility"]
  13303. }),
  13304. $globals.SequenceableCollection);
  13305. $core.addMethod(
  13306. $core.method({
  13307. selector: "readStream",
  13308. protocol: 'streaming',
  13309. fn: function (){
  13310. var self=this;
  13311. return $core.withContext(function($ctx1) {
  13312. var $1;
  13313. $1=self._stream();
  13314. return $1;
  13315. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  13316. },
  13317. args: [],
  13318. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13319. referencedClasses: [],
  13320. messageSends: ["stream"]
  13321. }),
  13322. $globals.SequenceableCollection);
  13323. $core.addMethod(
  13324. $core.method({
  13325. selector: "removeLast",
  13326. protocol: 'adding/removing',
  13327. fn: function (){
  13328. var self=this;
  13329. return $core.withContext(function($ctx1) {
  13330. var $1;
  13331. $1=self._remove_(self._last());
  13332. return $1;
  13333. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  13334. },
  13335. args: [],
  13336. source: "removeLast\x0a\x09^ self remove: self last",
  13337. referencedClasses: [],
  13338. messageSends: ["remove:", "last"]
  13339. }),
  13340. $globals.SequenceableCollection);
  13341. $core.addMethod(
  13342. $core.method({
  13343. selector: "reversed",
  13344. protocol: 'converting',
  13345. fn: function (){
  13346. var self=this;
  13347. return $core.withContext(function($ctx1) {
  13348. self._subclassResponsibility();
  13349. return self;
  13350. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  13351. },
  13352. args: [],
  13353. source: "reversed\x0a\x09self subclassResponsibility",
  13354. referencedClasses: [],
  13355. messageSends: ["subclassResponsibility"]
  13356. }),
  13357. $globals.SequenceableCollection);
  13358. $core.addMethod(
  13359. $core.method({
  13360. selector: "second",
  13361. protocol: 'accessing',
  13362. fn: function (){
  13363. var self=this;
  13364. return $core.withContext(function($ctx1) {
  13365. var $1;
  13366. $1=self._at_((2));
  13367. return $1;
  13368. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  13369. },
  13370. args: [],
  13371. source: "second\x0a\x09^ self at: 2",
  13372. referencedClasses: [],
  13373. messageSends: ["at:"]
  13374. }),
  13375. $globals.SequenceableCollection);
  13376. $core.addMethod(
  13377. $core.method({
  13378. selector: "shallowCopy",
  13379. protocol: 'copying',
  13380. fn: function (){
  13381. var self=this;
  13382. var newCollection;
  13383. return $core.withContext(function($ctx1) {
  13384. var $1;
  13385. newCollection=$recv(self._class())._new_(self._size());
  13386. self._withIndexDo_((function(each,index){
  13387. return $core.withContext(function($ctx2) {
  13388. return $recv(newCollection)._at_put_(index,each);
  13389. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  13390. }));
  13391. $1=newCollection;
  13392. return $1;
  13393. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},$globals.SequenceableCollection)});
  13394. },
  13395. args: [],
  13396. source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each ].\x0a\x09^ newCollection",
  13397. referencedClasses: [],
  13398. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"]
  13399. }),
  13400. $globals.SequenceableCollection);
  13401. $core.addMethod(
  13402. $core.method({
  13403. selector: "stream",
  13404. protocol: 'streaming',
  13405. fn: function (){
  13406. var self=this;
  13407. return $core.withContext(function($ctx1) {
  13408. var $1;
  13409. $1=self._newStream();
  13410. return $1;
  13411. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  13412. },
  13413. args: [],
  13414. source: "stream\x0a\x09^ self newStream",
  13415. referencedClasses: [],
  13416. messageSends: ["newStream"]
  13417. }),
  13418. $globals.SequenceableCollection);
  13419. $core.addMethod(
  13420. $core.method({
  13421. selector: "streamClass",
  13422. protocol: 'streaming',
  13423. fn: function (){
  13424. var self=this;
  13425. return $core.withContext(function($ctx1) {
  13426. var $1;
  13427. $1=$recv(self._class())._streamClass();
  13428. return $1;
  13429. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  13430. },
  13431. args: [],
  13432. source: "streamClass\x0a\x09^ self class streamClass",
  13433. referencedClasses: [],
  13434. messageSends: ["streamClass", "class"]
  13435. }),
  13436. $globals.SequenceableCollection);
  13437. $core.addMethod(
  13438. $core.method({
  13439. selector: "third",
  13440. protocol: 'accessing',
  13441. fn: function (){
  13442. var self=this;
  13443. return $core.withContext(function($ctx1) {
  13444. var $1;
  13445. $1=self._at_((3));
  13446. return $1;
  13447. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  13448. },
  13449. args: [],
  13450. source: "third\x0a\x09^ self at: 3",
  13451. referencedClasses: [],
  13452. messageSends: ["at:"]
  13453. }),
  13454. $globals.SequenceableCollection);
  13455. $core.addMethod(
  13456. $core.method({
  13457. selector: "with:do:",
  13458. protocol: 'enumerating',
  13459. fn: function (anotherCollection,aBlock){
  13460. var self=this;
  13461. return $core.withContext(function($ctx1) {
  13462. self = self._numericallyIndexable();
  13463. anotherCollection = anotherCollection._numericallyIndexable();
  13464. for(var i=0; i<self.length; i++) {
  13465. aBlock._value_value_(self[i], anotherCollection[i]);
  13466. }
  13467. ;
  13468. return self;
  13469. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13470. },
  13471. args: ["anotherCollection", "aBlock"],
  13472. 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>",
  13473. referencedClasses: [],
  13474. messageSends: []
  13475. }),
  13476. $globals.SequenceableCollection);
  13477. $core.addMethod(
  13478. $core.method({
  13479. selector: "withIndexDo:",
  13480. protocol: 'enumerating',
  13481. fn: function (aBlock){
  13482. var self=this;
  13483. return $core.withContext(function($ctx1) {
  13484. self = self._numericallyIndexable();
  13485. for(var i=0; i < self.length; i++) {
  13486. aBlock._value_value_(self[i], i+1);
  13487. }
  13488. ;
  13489. return self;
  13490. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13491. },
  13492. args: ["aBlock"],
  13493. 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>",
  13494. referencedClasses: [],
  13495. messageSends: []
  13496. }),
  13497. $globals.SequenceableCollection);
  13498. $core.addMethod(
  13499. $core.method({
  13500. selector: "writeStream",
  13501. protocol: 'streaming',
  13502. fn: function (){
  13503. var self=this;
  13504. return $core.withContext(function($ctx1) {
  13505. var $1;
  13506. $1=self._stream();
  13507. return $1;
  13508. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13509. },
  13510. args: [],
  13511. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13512. referencedClasses: [],
  13513. messageSends: ["stream"]
  13514. }),
  13515. $globals.SequenceableCollection);
  13516. $core.addMethod(
  13517. $core.method({
  13518. selector: "streamClass",
  13519. protocol: 'accessing',
  13520. fn: function (){
  13521. var self=this;
  13522. function $Stream(){return $globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  13523. return $Stream();
  13524. },
  13525. args: [],
  13526. source: "streamClass\x0a\x09\x09^ Stream",
  13527. referencedClasses: ["Stream"],
  13528. messageSends: []
  13529. }),
  13530. $globals.SequenceableCollection.klass);
  13531. $core.addMethod(
  13532. $core.method({
  13533. selector: "streamContents:",
  13534. protocol: 'streaming',
  13535. fn: function (aBlock){
  13536. var self=this;
  13537. var stream;
  13538. return $core.withContext(function($ctx1) {
  13539. var $1;
  13540. stream=$recv(self._streamClass())._on_(self._new());
  13541. $recv(aBlock)._value_(stream);
  13542. $1=$recv(stream)._contents();
  13543. return $1;
  13544. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13545. },
  13546. args: ["aBlock"],
  13547. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13548. referencedClasses: [],
  13549. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13550. }),
  13551. $globals.SequenceableCollection.klass);
  13552. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13553. $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`.";
  13554. $core.addMethod(
  13555. $core.method({
  13556. selector: "add:",
  13557. protocol: 'adding/removing',
  13558. fn: function (anObject){
  13559. var self=this;
  13560. return $core.withContext(function($ctx1) {
  13561. self.push(anObject); return anObject;;
  13562. return self;
  13563. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13564. },
  13565. args: ["anObject"],
  13566. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  13567. referencedClasses: [],
  13568. messageSends: []
  13569. }),
  13570. $globals.Array);
  13571. $core.addMethod(
  13572. $core.method({
  13573. selector: "addFirst:",
  13574. protocol: 'adding/removing',
  13575. fn: function (anObject){
  13576. var self=this;
  13577. return $core.withContext(function($ctx1) {
  13578. self.unshift(anObject); return anObject;;
  13579. return self;
  13580. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13581. },
  13582. args: ["anObject"],
  13583. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  13584. referencedClasses: [],
  13585. messageSends: []
  13586. }),
  13587. $globals.Array);
  13588. $core.addMethod(
  13589. $core.method({
  13590. selector: "asJavascript",
  13591. protocol: 'converting',
  13592. fn: function (){
  13593. var self=this;
  13594. return $core.withContext(function($ctx1) {
  13595. var $1;
  13596. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13597. return $core.withContext(function($ctx2) {
  13598. return $recv(each)._asJavascript();
  13599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13600. })))._join_(", "))).__comma("]");
  13601. $ctx1.sendIdx[","]=1;
  13602. return $1;
  13603. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13604. },
  13605. args: [],
  13606. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13607. referencedClasses: [],
  13608. messageSends: [",", "join:", "collect:", "asJavascript"]
  13609. }),
  13610. $globals.Array);
  13611. $core.addMethod(
  13612. $core.method({
  13613. selector: "at:ifAbsent:",
  13614. protocol: 'accessing',
  13615. fn: function (anIndex,aBlock){
  13616. var self=this;
  13617. return $core.withContext(function($ctx1) {
  13618. return anIndex >= 1 && anIndex <= self.length
  13619. ? self[anIndex - 1]
  13620. : aBlock._value()
  13621. ;
  13622. return self;
  13623. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13624. },
  13625. args: ["anIndex", "aBlock"],
  13626. 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>",
  13627. referencedClasses: [],
  13628. messageSends: []
  13629. }),
  13630. $globals.Array);
  13631. $core.addMethod(
  13632. $core.method({
  13633. selector: "at:ifPresent:ifAbsent:",
  13634. protocol: 'accessing',
  13635. fn: function (anIndex,aBlock,anotherBlock){
  13636. var self=this;
  13637. return $core.withContext(function($ctx1) {
  13638. return anIndex >= 1 && anIndex <= self.length
  13639. ? aBlock._value_(self[anIndex - 1])
  13640. : anotherBlock._value()
  13641. ;
  13642. return self;
  13643. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13644. },
  13645. args: ["anIndex", "aBlock", "anotherBlock"],
  13646. 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>",
  13647. referencedClasses: [],
  13648. messageSends: []
  13649. }),
  13650. $globals.Array);
  13651. $core.addMethod(
  13652. $core.method({
  13653. selector: "at:put:",
  13654. protocol: 'accessing',
  13655. fn: function (anIndex,anObject){
  13656. var self=this;
  13657. return $core.withContext(function($ctx1) {
  13658. return self[anIndex - 1] = anObject;
  13659. return self;
  13660. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13661. },
  13662. args: ["anIndex", "anObject"],
  13663. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  13664. referencedClasses: [],
  13665. messageSends: []
  13666. }),
  13667. $globals.Array);
  13668. $core.addMethod(
  13669. $core.method({
  13670. selector: "collect:",
  13671. protocol: 'enumerating',
  13672. fn: function (aBlock){
  13673. var self=this;
  13674. return $core.withContext(function($ctx1) {
  13675. return self.map(function(each) {return aBlock._value_(each)});
  13676. return self;
  13677. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13678. },
  13679. args: ["aBlock"],
  13680. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  13681. referencedClasses: [],
  13682. messageSends: []
  13683. }),
  13684. $globals.Array);
  13685. $core.addMethod(
  13686. $core.method({
  13687. selector: "join:",
  13688. protocol: 'enumerating',
  13689. fn: function (aString){
  13690. var self=this;
  13691. return $core.withContext(function($ctx1) {
  13692. return self.join(aString);
  13693. return self;
  13694. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  13695. },
  13696. args: ["aString"],
  13697. source: "join: aString\x0a\x09<return self.join(aString)>",
  13698. referencedClasses: [],
  13699. messageSends: []
  13700. }),
  13701. $globals.Array);
  13702. $core.addMethod(
  13703. $core.method({
  13704. selector: "numericallyIndexable",
  13705. protocol: 'private',
  13706. fn: function (){
  13707. var self=this;
  13708. return self;
  13709. },
  13710. args: [],
  13711. source: "numericallyIndexable\x0a\x09^ self",
  13712. referencedClasses: [],
  13713. messageSends: []
  13714. }),
  13715. $globals.Array);
  13716. $core.addMethod(
  13717. $core.method({
  13718. selector: "printOn:",
  13719. protocol: 'printing',
  13720. fn: function (aStream){
  13721. var self=this;
  13722. return $core.withContext(function($ctx1) {
  13723. (
  13724. $ctx1.supercall = true,
  13725. $globals.Array.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  13726. $ctx1.supercall = false;
  13727. $ctx1.sendIdx["printOn:"]=1;
  13728. $recv(aStream)._nextPutAll_(" (");
  13729. $ctx1.sendIdx["nextPutAll:"]=1;
  13730. self._do_separatedBy_((function(each){
  13731. return $core.withContext(function($ctx2) {
  13732. return $recv(each)._printOn_(aStream);
  13733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13734. }),(function(){
  13735. return $core.withContext(function($ctx2) {
  13736. return $recv(aStream)._nextPutAll_(" ");
  13737. $ctx2.sendIdx["nextPutAll:"]=2;
  13738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13739. }));
  13740. $recv(aStream)._nextPutAll_(")");
  13741. return self;
  13742. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  13743. },
  13744. args: ["aStream"],
  13745. 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: ')'",
  13746. referencedClasses: [],
  13747. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13748. }),
  13749. $globals.Array);
  13750. $core.addMethod(
  13751. $core.method({
  13752. selector: "remove:ifAbsent:",
  13753. protocol: 'adding/removing',
  13754. fn: function (anObject,aBlock){
  13755. var self=this;
  13756. var index;
  13757. return $core.withContext(function($ctx1) {
  13758. var $2,$1;
  13759. index=self._indexOf_ifAbsent_(anObject,(function(){
  13760. return (0);
  13761. }));
  13762. $2=$recv(index).__eq((0));
  13763. if($core.assert($2)){
  13764. $1=$recv(aBlock)._value();
  13765. } else {
  13766. self._removeIndex_(index);
  13767. $1=anObject;
  13768. };
  13769. return $1;
  13770. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  13771. },
  13772. args: ["anObject", "aBlock"],
  13773. 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 ]",
  13774. referencedClasses: [],
  13775. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  13776. }),
  13777. $globals.Array);
  13778. $core.addMethod(
  13779. $core.method({
  13780. selector: "removeAll",
  13781. protocol: 'adding/removing',
  13782. fn: function (){
  13783. var self=this;
  13784. return $core.withContext(function($ctx1) {
  13785. self.length = 0;
  13786. return self;
  13787. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  13788. },
  13789. args: [],
  13790. source: "removeAll\x0a\x09<self.length = 0>",
  13791. referencedClasses: [],
  13792. messageSends: []
  13793. }),
  13794. $globals.Array);
  13795. $core.addMethod(
  13796. $core.method({
  13797. selector: "removeFrom:to:",
  13798. protocol: 'adding/removing',
  13799. fn: function (aNumber,anotherNumber){
  13800. var self=this;
  13801. return $core.withContext(function($ctx1) {
  13802. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  13803. return self;
  13804. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  13805. },
  13806. args: ["aNumber", "anotherNumber"],
  13807. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  13808. referencedClasses: [],
  13809. messageSends: []
  13810. }),
  13811. $globals.Array);
  13812. $core.addMethod(
  13813. $core.method({
  13814. selector: "removeIndex:",
  13815. protocol: 'adding/removing',
  13816. fn: function (anInteger){
  13817. var self=this;
  13818. return $core.withContext(function($ctx1) {
  13819. self.splice(anInteger - 1, 1);
  13820. return self;
  13821. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  13822. },
  13823. args: ["anInteger"],
  13824. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  13825. referencedClasses: [],
  13826. messageSends: []
  13827. }),
  13828. $globals.Array);
  13829. $core.addMethod(
  13830. $core.method({
  13831. selector: "removeLast",
  13832. protocol: 'adding/removing',
  13833. fn: function (){
  13834. var self=this;
  13835. return $core.withContext(function($ctx1) {
  13836. return self.pop();;
  13837. return self;
  13838. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  13839. },
  13840. args: [],
  13841. source: "removeLast\x0a\x09<return self.pop();>",
  13842. referencedClasses: [],
  13843. messageSends: []
  13844. }),
  13845. $globals.Array);
  13846. $core.addMethod(
  13847. $core.method({
  13848. selector: "reversed",
  13849. protocol: 'converting',
  13850. fn: function (){
  13851. var self=this;
  13852. return $core.withContext(function($ctx1) {
  13853. return self._copy().reverse();
  13854. return self;
  13855. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  13856. },
  13857. args: [],
  13858. source: "reversed\x0a\x09<return self._copy().reverse()>",
  13859. referencedClasses: [],
  13860. messageSends: []
  13861. }),
  13862. $globals.Array);
  13863. $core.addMethod(
  13864. $core.method({
  13865. selector: "select:",
  13866. protocol: 'enumerating',
  13867. fn: function (aBlock){
  13868. var self=this;
  13869. return $core.withContext(function($ctx1) {
  13870. var result = self.klass._new();
  13871. for(var i=0; i<self.length; i++) {
  13872. if(aBlock._value_(self[i])) {
  13873. result.push(self[i]);
  13874. }
  13875. }
  13876. return result;
  13877. ;
  13878. return self;
  13879. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  13880. },
  13881. args: ["aBlock"],
  13882. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<\x0a\x09\x09var result = self.klass._new();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09if(aBlock._value_(self[i])) {\x0a\x09\x09\x09\x09result.push(self[i]);\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09return result;\x0a\x09>",
  13883. referencedClasses: [],
  13884. messageSends: []
  13885. }),
  13886. $globals.Array);
  13887. $core.addMethod(
  13888. $core.method({
  13889. selector: "size",
  13890. protocol: 'accessing',
  13891. fn: function (){
  13892. var self=this;
  13893. return $core.withContext(function($ctx1) {
  13894. return self.length;
  13895. return self;
  13896. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  13897. },
  13898. args: [],
  13899. source: "size\x0a\x09<return self.length>",
  13900. referencedClasses: [],
  13901. messageSends: []
  13902. }),
  13903. $globals.Array);
  13904. $core.addMethod(
  13905. $core.method({
  13906. selector: "sort",
  13907. protocol: 'enumerating',
  13908. fn: function (){
  13909. var self=this;
  13910. return $core.withContext(function($ctx1) {
  13911. var $1;
  13912. $1=self._sort_((function(a,b){
  13913. return $core.withContext(function($ctx2) {
  13914. return $recv(a).__lt(b);
  13915. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  13916. }));
  13917. return $1;
  13918. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  13919. },
  13920. args: [],
  13921. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  13922. referencedClasses: [],
  13923. messageSends: ["sort:", "<"]
  13924. }),
  13925. $globals.Array);
  13926. $core.addMethod(
  13927. $core.method({
  13928. selector: "sort:",
  13929. protocol: 'enumerating',
  13930. fn: function (aBlock){
  13931. var self=this;
  13932. return $core.withContext(function($ctx1) {
  13933. return self.sort(function(a, b) {
  13934. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  13935. })
  13936. ;
  13937. return self;
  13938. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  13939. },
  13940. args: ["aBlock"],
  13941. 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>",
  13942. referencedClasses: [],
  13943. messageSends: []
  13944. }),
  13945. $globals.Array);
  13946. $core.addMethod(
  13947. $core.method({
  13948. selector: "sorted",
  13949. protocol: 'enumerating',
  13950. fn: function (){
  13951. var self=this;
  13952. return $core.withContext(function($ctx1) {
  13953. var $1;
  13954. $1=$recv(self._copy())._sort();
  13955. return $1;
  13956. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  13957. },
  13958. args: [],
  13959. source: "sorted\x0a\x09^ self copy sort",
  13960. referencedClasses: [],
  13961. messageSends: ["sort", "copy"]
  13962. }),
  13963. $globals.Array);
  13964. $core.addMethod(
  13965. $core.method({
  13966. selector: "sorted:",
  13967. protocol: 'enumerating',
  13968. fn: function (aBlock){
  13969. var self=this;
  13970. return $core.withContext(function($ctx1) {
  13971. var $1;
  13972. $1=$recv(self._copy())._sort_(aBlock);
  13973. return $1;
  13974. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  13975. },
  13976. args: ["aBlock"],
  13977. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  13978. referencedClasses: [],
  13979. messageSends: ["sort:", "copy"]
  13980. }),
  13981. $globals.Array);
  13982. $core.addMethod(
  13983. $core.method({
  13984. selector: "new:",
  13985. protocol: 'instance creation',
  13986. fn: function (anInteger){
  13987. var self=this;
  13988. return $core.withContext(function($ctx1) {
  13989. return new Array(anInteger);
  13990. return self;
  13991. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  13992. },
  13993. args: ["anInteger"],
  13994. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  13995. referencedClasses: [],
  13996. messageSends: []
  13997. }),
  13998. $globals.Array.klass);
  13999. $core.addMethod(
  14000. $core.method({
  14001. selector: "with:",
  14002. protocol: 'instance creation',
  14003. fn: function (anObject){
  14004. var self=this;
  14005. return $core.withContext(function($ctx1) {
  14006. var $2,$3,$1;
  14007. $2=self._new_((1));
  14008. $recv($2)._at_put_((1),anObject);
  14009. $3=$recv($2)._yourself();
  14010. $1=$3;
  14011. return $1;
  14012. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  14013. },
  14014. args: ["anObject"],
  14015. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  14016. referencedClasses: [],
  14017. messageSends: ["at:put:", "new:", "yourself"]
  14018. }),
  14019. $globals.Array.klass);
  14020. $core.addMethod(
  14021. $core.method({
  14022. selector: "with:with:",
  14023. protocol: 'instance creation',
  14024. fn: function (anObject,anObject2){
  14025. var self=this;
  14026. return $core.withContext(function($ctx1) {
  14027. var $2,$3,$1;
  14028. $2=self._new_((2));
  14029. $recv($2)._at_put_((1),anObject);
  14030. $ctx1.sendIdx["at:put:"]=1;
  14031. $recv($2)._at_put_((2),anObject2);
  14032. $3=$recv($2)._yourself();
  14033. $1=$3;
  14034. return $1;
  14035. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  14036. },
  14037. args: ["anObject", "anObject2"],
  14038. 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",
  14039. referencedClasses: [],
  14040. messageSends: ["at:put:", "new:", "yourself"]
  14041. }),
  14042. $globals.Array.klass);
  14043. $core.addMethod(
  14044. $core.method({
  14045. selector: "with:with:with:",
  14046. protocol: 'instance creation',
  14047. fn: function (anObject,anObject2,anObject3){
  14048. var self=this;
  14049. return $core.withContext(function($ctx1) {
  14050. var $2,$3,$1;
  14051. $2=self._new_((3));
  14052. $recv($2)._at_put_((1),anObject);
  14053. $ctx1.sendIdx["at:put:"]=1;
  14054. $recv($2)._at_put_((2),anObject2);
  14055. $ctx1.sendIdx["at:put:"]=2;
  14056. $recv($2)._at_put_((3),anObject3);
  14057. $3=$recv($2)._yourself();
  14058. $1=$3;
  14059. return $1;
  14060. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  14061. },
  14062. args: ["anObject", "anObject2", "anObject3"],
  14063. 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",
  14064. referencedClasses: [],
  14065. messageSends: ["at:put:", "new:", "yourself"]
  14066. }),
  14067. $globals.Array.klass);
  14068. $core.addMethod(
  14069. $core.method({
  14070. selector: "withAll:",
  14071. protocol: 'instance creation',
  14072. fn: function (aCollection){
  14073. var self=this;
  14074. var instance,index;
  14075. return $core.withContext(function($ctx1) {
  14076. var $1;
  14077. index=(1);
  14078. instance=self._new_($recv(aCollection)._size());
  14079. $recv(aCollection)._do_((function(each){
  14080. return $core.withContext(function($ctx2) {
  14081. $recv(instance)._at_put_(index,each);
  14082. index=$recv(index).__plus((1));
  14083. return index;
  14084. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14085. }));
  14086. $1=instance;
  14087. return $1;
  14088. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  14089. },
  14090. args: ["aCollection"],
  14091. 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",
  14092. referencedClasses: [],
  14093. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  14094. }),
  14095. $globals.Array.klass);
  14096. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  14097. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  14098. $core.addMethod(
  14099. $core.method({
  14100. selector: ",",
  14101. protocol: 'copying',
  14102. fn: function (aString){
  14103. var self=this;
  14104. return $core.withContext(function($ctx1) {
  14105. var $2,$1;
  14106. $2=self._asString();
  14107. $ctx1.sendIdx["asString"]=1;
  14108. $1=$recv($2).__comma($recv(aString)._asString());
  14109. return $1;
  14110. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  14111. },
  14112. args: ["aString"],
  14113. source: ", aString\x0a\x09^ self asString, aString asString",
  14114. referencedClasses: [],
  14115. messageSends: [",", "asString"]
  14116. }),
  14117. $globals.CharacterArray);
  14118. $core.addMethod(
  14119. $core.method({
  14120. selector: "add:",
  14121. protocol: 'adding/removing',
  14122. fn: function (anObject){
  14123. var self=this;
  14124. return $core.withContext(function($ctx1) {
  14125. self._errorReadOnly();
  14126. return self;
  14127. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  14128. },
  14129. args: ["anObject"],
  14130. source: "add: anObject\x0a\x09self errorReadOnly",
  14131. referencedClasses: [],
  14132. messageSends: ["errorReadOnly"]
  14133. }),
  14134. $globals.CharacterArray);
  14135. $core.addMethod(
  14136. $core.method({
  14137. selector: "asLowercase",
  14138. protocol: 'converting',
  14139. fn: function (){
  14140. var self=this;
  14141. return $core.withContext(function($ctx1) {
  14142. var $1;
  14143. $1=$recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  14144. return $1;
  14145. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  14146. },
  14147. args: [],
  14148. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  14149. referencedClasses: [],
  14150. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  14151. }),
  14152. $globals.CharacterArray);
  14153. $core.addMethod(
  14154. $core.method({
  14155. selector: "asNumber",
  14156. protocol: 'converting',
  14157. fn: function (){
  14158. var self=this;
  14159. return $core.withContext(function($ctx1) {
  14160. var $1;
  14161. $1=$recv(self._asString())._asNumber();
  14162. return $1;
  14163. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  14164. },
  14165. args: [],
  14166. source: "asNumber\x0a\x09^ self asString asNumber",
  14167. referencedClasses: [],
  14168. messageSends: ["asNumber", "asString"]
  14169. }),
  14170. $globals.CharacterArray);
  14171. $core.addMethod(
  14172. $core.method({
  14173. selector: "asString",
  14174. protocol: 'converting',
  14175. fn: function (){
  14176. var self=this;
  14177. return $core.withContext(function($ctx1) {
  14178. var $1;
  14179. $1=self._subclassResponsibility();
  14180. return $1;
  14181. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  14182. },
  14183. args: [],
  14184. source: "asString\x0a\x09^ self subclassResponsibility",
  14185. referencedClasses: [],
  14186. messageSends: ["subclassResponsibility"]
  14187. }),
  14188. $globals.CharacterArray);
  14189. $core.addMethod(
  14190. $core.method({
  14191. selector: "asSymbol",
  14192. protocol: 'converting',
  14193. fn: function (){
  14194. var self=this;
  14195. return $core.withContext(function($ctx1) {
  14196. var $1;
  14197. $1=self._asString();
  14198. return $1;
  14199. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  14200. },
  14201. args: [],
  14202. source: "asSymbol\x0a\x09^ self asString",
  14203. referencedClasses: [],
  14204. messageSends: ["asString"]
  14205. }),
  14206. $globals.CharacterArray);
  14207. $core.addMethod(
  14208. $core.method({
  14209. selector: "asUppercase",
  14210. protocol: 'converting',
  14211. fn: function (){
  14212. var self=this;
  14213. return $core.withContext(function($ctx1) {
  14214. var $1;
  14215. $1=$recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  14216. return $1;
  14217. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  14218. },
  14219. args: [],
  14220. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  14221. referencedClasses: [],
  14222. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  14223. }),
  14224. $globals.CharacterArray);
  14225. $core.addMethod(
  14226. $core.method({
  14227. selector: "at:put:",
  14228. protocol: 'accessing',
  14229. fn: function (anIndex,anObject){
  14230. var self=this;
  14231. return $core.withContext(function($ctx1) {
  14232. self._errorReadOnly();
  14233. return self;
  14234. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  14235. },
  14236. args: ["anIndex", "anObject"],
  14237. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  14238. referencedClasses: [],
  14239. messageSends: ["errorReadOnly"]
  14240. }),
  14241. $globals.CharacterArray);
  14242. $core.addMethod(
  14243. $core.method({
  14244. selector: "errorReadOnly",
  14245. protocol: 'error handling',
  14246. fn: function (){
  14247. var self=this;
  14248. return $core.withContext(function($ctx1) {
  14249. self._error_("Object is read-only");
  14250. return self;
  14251. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  14252. },
  14253. args: [],
  14254. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  14255. referencedClasses: [],
  14256. messageSends: ["error:"]
  14257. }),
  14258. $globals.CharacterArray);
  14259. $core.addMethod(
  14260. $core.method({
  14261. selector: "printOn:",
  14262. protocol: 'printing',
  14263. fn: function (aStream){
  14264. var self=this;
  14265. return $core.withContext(function($ctx1) {
  14266. $recv(self._asString())._printOn_(aStream);
  14267. return self;
  14268. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  14269. },
  14270. args: ["aStream"],
  14271. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  14272. referencedClasses: [],
  14273. messageSends: ["printOn:", "asString"]
  14274. }),
  14275. $globals.CharacterArray);
  14276. $core.addMethod(
  14277. $core.method({
  14278. selector: "putOn:",
  14279. protocol: 'streaming',
  14280. fn: function (aStream){
  14281. var self=this;
  14282. return $core.withContext(function($ctx1) {
  14283. $recv(aStream)._nextPutString_(self);
  14284. return self;
  14285. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  14286. },
  14287. args: ["aStream"],
  14288. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  14289. referencedClasses: [],
  14290. messageSends: ["nextPutString:"]
  14291. }),
  14292. $globals.CharacterArray);
  14293. $core.addMethod(
  14294. $core.method({
  14295. selector: "remove:",
  14296. protocol: 'adding/removing',
  14297. fn: function (anObject){
  14298. var self=this;
  14299. return $core.withContext(function($ctx1) {
  14300. self._errorReadOnly();
  14301. return self;
  14302. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  14303. },
  14304. args: ["anObject"],
  14305. source: "remove: anObject\x0a\x09self errorReadOnly",
  14306. referencedClasses: [],
  14307. messageSends: ["errorReadOnly"]
  14308. }),
  14309. $globals.CharacterArray);
  14310. $core.addMethod(
  14311. $core.method({
  14312. selector: "fromString:",
  14313. protocol: 'instance creation',
  14314. fn: function (aString){
  14315. var self=this;
  14316. return $core.withContext(function($ctx1) {
  14317. self._subclassResponsibility();
  14318. return self;
  14319. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  14320. },
  14321. args: ["aString"],
  14322. source: "fromString: aString\x0a\x09self subclassResponsibility",
  14323. referencedClasses: [],
  14324. messageSends: ["subclassResponsibility"]
  14325. }),
  14326. $globals.CharacterArray.klass);
  14327. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  14328. $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 >> #,`";
  14329. $core.addMethod(
  14330. $core.method({
  14331. selector: ",",
  14332. protocol: 'copying',
  14333. fn: function (aString){
  14334. var self=this;
  14335. return $core.withContext(function($ctx1) {
  14336. return String(self) + aString;
  14337. return self;
  14338. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  14339. },
  14340. args: ["aString"],
  14341. source: ", aString\x0a\x09<return String(self) + aString>",
  14342. referencedClasses: [],
  14343. messageSends: []
  14344. }),
  14345. $globals.String);
  14346. $core.addMethod(
  14347. $core.method({
  14348. selector: "<",
  14349. protocol: 'comparing',
  14350. fn: function (aString){
  14351. var self=this;
  14352. return $core.withContext(function($ctx1) {
  14353. return String(self) < aString._asString();
  14354. return self;
  14355. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  14356. },
  14357. args: ["aString"],
  14358. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  14359. referencedClasses: [],
  14360. messageSends: []
  14361. }),
  14362. $globals.String);
  14363. $core.addMethod(
  14364. $core.method({
  14365. selector: "<=",
  14366. protocol: 'comparing',
  14367. fn: function (aString){
  14368. var self=this;
  14369. return $core.withContext(function($ctx1) {
  14370. return String(self) <= aString._asString();
  14371. return self;
  14372. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  14373. },
  14374. args: ["aString"],
  14375. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  14376. referencedClasses: [],
  14377. messageSends: []
  14378. }),
  14379. $globals.String);
  14380. $core.addMethod(
  14381. $core.method({
  14382. selector: "=",
  14383. protocol: 'comparing',
  14384. fn: function (aString){
  14385. var self=this;
  14386. return $core.withContext(function($ctx1) {
  14387. var $1;
  14388. $1=self.__eq_eq(aString);
  14389. return $1;
  14390. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  14391. },
  14392. args: ["aString"],
  14393. source: "= aString\x0a\x09^ self == aString",
  14394. referencedClasses: [],
  14395. messageSends: ["=="]
  14396. }),
  14397. $globals.String);
  14398. $core.addMethod(
  14399. $core.method({
  14400. selector: "==",
  14401. protocol: 'comparing',
  14402. fn: function (aString){
  14403. var self=this;
  14404. return $core.withContext(function($ctx1) {
  14405. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14406. return self;
  14407. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  14408. },
  14409. args: ["aString"],
  14410. source: "== aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  14411. referencedClasses: [],
  14412. messageSends: []
  14413. }),
  14414. $globals.String);
  14415. $core.addMethod(
  14416. $core.method({
  14417. selector: ">",
  14418. protocol: 'comparing',
  14419. fn: function (aString){
  14420. var self=this;
  14421. return $core.withContext(function($ctx1) {
  14422. return String(self) > aString._asString();
  14423. return self;
  14424. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  14425. },
  14426. args: ["aString"],
  14427. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  14428. referencedClasses: [],
  14429. messageSends: []
  14430. }),
  14431. $globals.String);
  14432. $core.addMethod(
  14433. $core.method({
  14434. selector: ">=",
  14435. protocol: 'comparing',
  14436. fn: function (aString){
  14437. var self=this;
  14438. return $core.withContext(function($ctx1) {
  14439. return String(self) >= aString._asString();
  14440. return self;
  14441. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14442. },
  14443. args: ["aString"],
  14444. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  14445. referencedClasses: [],
  14446. messageSends: []
  14447. }),
  14448. $globals.String);
  14449. $core.addMethod(
  14450. $core.method({
  14451. selector: "asJSON",
  14452. protocol: 'converting',
  14453. fn: function (){
  14454. var self=this;
  14455. return self;
  14456. },
  14457. args: [],
  14458. source: "asJSON\x0a\x09^ self",
  14459. referencedClasses: [],
  14460. messageSends: []
  14461. }),
  14462. $globals.String);
  14463. $core.addMethod(
  14464. $core.method({
  14465. selector: "asJavaScriptMethodName",
  14466. protocol: 'converting',
  14467. fn: function (){
  14468. var self=this;
  14469. return $core.withContext(function($ctx1) {
  14470. return $core.st2js(self);
  14471. return self;
  14472. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14473. },
  14474. args: [],
  14475. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  14476. referencedClasses: [],
  14477. messageSends: []
  14478. }),
  14479. $globals.String);
  14480. $core.addMethod(
  14481. $core.method({
  14482. selector: "asJavascript",
  14483. protocol: 'converting',
  14484. fn: function (){
  14485. var self=this;
  14486. return $core.withContext(function($ctx1) {
  14487. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14488. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14489. else
  14490. return "\"" + self + "\"";
  14491. ;
  14492. return self;
  14493. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14494. },
  14495. args: [],
  14496. 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>",
  14497. referencedClasses: [],
  14498. messageSends: []
  14499. }),
  14500. $globals.String);
  14501. $core.addMethod(
  14502. $core.method({
  14503. selector: "asLowercase",
  14504. protocol: 'converting',
  14505. fn: function (){
  14506. var self=this;
  14507. return $core.withContext(function($ctx1) {
  14508. return self.toLowerCase();
  14509. return self;
  14510. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14511. },
  14512. args: [],
  14513. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  14514. referencedClasses: [],
  14515. messageSends: []
  14516. }),
  14517. $globals.String);
  14518. $core.addMethod(
  14519. $core.method({
  14520. selector: "asMutator",
  14521. protocol: 'converting',
  14522. fn: function (){
  14523. var self=this;
  14524. return $core.withContext(function($ctx1) {
  14525. var $1,$2;
  14526. $1=$recv(self._last()).__eq(":");
  14527. if(!$core.assert($1)){
  14528. $2=self.__comma(":");
  14529. return $2;
  14530. };
  14531. return self;
  14532. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14533. },
  14534. args: [],
  14535. 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",
  14536. referencedClasses: [],
  14537. messageSends: ["ifFalse:", "=", "last", ","]
  14538. }),
  14539. $globals.String);
  14540. $core.addMethod(
  14541. $core.method({
  14542. selector: "asNumber",
  14543. protocol: 'converting',
  14544. fn: function (){
  14545. var self=this;
  14546. return $core.withContext(function($ctx1) {
  14547. return Number(self);
  14548. return self;
  14549. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14550. },
  14551. args: [],
  14552. source: "asNumber\x0a\x09<return Number(self)>",
  14553. referencedClasses: [],
  14554. messageSends: []
  14555. }),
  14556. $globals.String);
  14557. $core.addMethod(
  14558. $core.method({
  14559. selector: "asRegexp",
  14560. protocol: 'converting',
  14561. fn: function (){
  14562. var self=this;
  14563. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14564. return $core.withContext(function($ctx1) {
  14565. var $1;
  14566. $1=$recv($RegularExpression())._fromString_(self);
  14567. return $1;
  14568. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14569. },
  14570. args: [],
  14571. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14572. referencedClasses: ["RegularExpression"],
  14573. messageSends: ["fromString:"]
  14574. }),
  14575. $globals.String);
  14576. $core.addMethod(
  14577. $core.method({
  14578. selector: "asString",
  14579. protocol: 'converting',
  14580. fn: function (){
  14581. var self=this;
  14582. return self;
  14583. },
  14584. args: [],
  14585. source: "asString\x0a\x09^ self",
  14586. referencedClasses: [],
  14587. messageSends: []
  14588. }),
  14589. $globals.String);
  14590. $core.addMethod(
  14591. $core.method({
  14592. selector: "asSymbol",
  14593. protocol: 'converting',
  14594. fn: function (){
  14595. var self=this;
  14596. return self;
  14597. },
  14598. args: [],
  14599. source: "asSymbol\x0a\x09^ self",
  14600. referencedClasses: [],
  14601. messageSends: []
  14602. }),
  14603. $globals.String);
  14604. $core.addMethod(
  14605. $core.method({
  14606. selector: "asUppercase",
  14607. protocol: 'converting',
  14608. fn: function (){
  14609. var self=this;
  14610. return $core.withContext(function($ctx1) {
  14611. return self.toUpperCase();
  14612. return self;
  14613. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14614. },
  14615. args: [],
  14616. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  14617. referencedClasses: [],
  14618. messageSends: []
  14619. }),
  14620. $globals.String);
  14621. $core.addMethod(
  14622. $core.method({
  14623. selector: "asciiValue",
  14624. protocol: 'accessing',
  14625. fn: function (){
  14626. var self=this;
  14627. return $core.withContext(function($ctx1) {
  14628. return self.charCodeAt(0);;
  14629. return self;
  14630. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14631. },
  14632. args: [],
  14633. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  14634. referencedClasses: [],
  14635. messageSends: []
  14636. }),
  14637. $globals.String);
  14638. $core.addMethod(
  14639. $core.method({
  14640. selector: "at:ifAbsent:",
  14641. protocol: 'accessing',
  14642. fn: function (anIndex,aBlock){
  14643. var self=this;
  14644. return $core.withContext(function($ctx1) {
  14645. return String(self)[anIndex - 1] || aBlock._value();
  14646. return self;
  14647. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14648. },
  14649. args: ["anIndex", "aBlock"],
  14650. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  14651. referencedClasses: [],
  14652. messageSends: []
  14653. }),
  14654. $globals.String);
  14655. $core.addMethod(
  14656. $core.method({
  14657. selector: "at:ifPresent:ifAbsent:",
  14658. protocol: 'accessing',
  14659. fn: function (anIndex,aBlock,anotherBlock){
  14660. var self=this;
  14661. return $core.withContext(function($ctx1) {
  14662. var result = String(self)[anIndex - 1];
  14663. return result ? aBlock._value_(result) : anotherBlock._value();
  14664. ;
  14665. return self;
  14666. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14667. },
  14668. args: ["anIndex", "aBlock", "anotherBlock"],
  14669. 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>",
  14670. referencedClasses: [],
  14671. messageSends: []
  14672. }),
  14673. $globals.String);
  14674. $core.addMethod(
  14675. $core.method({
  14676. selector: "capitalized",
  14677. protocol: 'converting',
  14678. fn: function (){
  14679. var self=this;
  14680. return $core.withContext(function($ctx1) {
  14681. var $2,$1;
  14682. $2=self._isEmpty();
  14683. if($core.assert($2)){
  14684. $1=self;
  14685. } else {
  14686. $1=$recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14687. };
  14688. return $1;
  14689. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14690. },
  14691. args: [],
  14692. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  14693. referencedClasses: [],
  14694. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  14695. }),
  14696. $globals.String);
  14697. $core.addMethod(
  14698. $core.method({
  14699. selector: "charCodeAt:",
  14700. protocol: 'accessing',
  14701. fn: function (anInteger){
  14702. var self=this;
  14703. return $core.withContext(function($ctx1) {
  14704. return self.charCodeAt(anInteger - 1);
  14705. return self;
  14706. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  14707. },
  14708. args: ["anInteger"],
  14709. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  14710. referencedClasses: [],
  14711. messageSends: []
  14712. }),
  14713. $globals.String);
  14714. $core.addMethod(
  14715. $core.method({
  14716. selector: "copyFrom:to:",
  14717. protocol: 'copying',
  14718. fn: function (anIndex,anotherIndex){
  14719. var self=this;
  14720. return $core.withContext(function($ctx1) {
  14721. return self.substring(anIndex - 1, anotherIndex);
  14722. return self;
  14723. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  14724. },
  14725. args: ["anIndex", "anotherIndex"],
  14726. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  14727. referencedClasses: [],
  14728. messageSends: []
  14729. }),
  14730. $globals.String);
  14731. $core.addMethod(
  14732. $core.method({
  14733. selector: "crlfSanitized",
  14734. protocol: 'converting',
  14735. fn: function (){
  14736. var self=this;
  14737. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14738. return $core.withContext(function($ctx1) {
  14739. var $1;
  14740. $1=$recv(self._lines())._join_($recv($String())._lf());
  14741. return $1;
  14742. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  14743. },
  14744. args: [],
  14745. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  14746. referencedClasses: ["String"],
  14747. messageSends: ["join:", "lines", "lf"]
  14748. }),
  14749. $globals.String);
  14750. $core.addMethod(
  14751. $core.method({
  14752. selector: "deepCopy",
  14753. protocol: 'copying',
  14754. fn: function (){
  14755. var self=this;
  14756. return $core.withContext(function($ctx1) {
  14757. var $1;
  14758. $1=self._shallowCopy();
  14759. return $1;
  14760. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  14761. },
  14762. args: [],
  14763. source: "deepCopy\x0a\x09^ self shallowCopy",
  14764. referencedClasses: [],
  14765. messageSends: ["shallowCopy"]
  14766. }),
  14767. $globals.String);
  14768. $core.addMethod(
  14769. $core.method({
  14770. selector: "escaped",
  14771. protocol: 'converting',
  14772. fn: function (){
  14773. var self=this;
  14774. return $core.withContext(function($ctx1) {
  14775. return escape(self);
  14776. return self;
  14777. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  14778. },
  14779. args: [],
  14780. source: "escaped\x0a\x09<return escape(self)>",
  14781. referencedClasses: [],
  14782. messageSends: []
  14783. }),
  14784. $globals.String);
  14785. $core.addMethod(
  14786. $core.method({
  14787. selector: "includesSubString:",
  14788. protocol: 'testing',
  14789. fn: function (subString){
  14790. var self=this;
  14791. return $core.withContext(function($ctx1) {
  14792. return self.indexOf(subString) != -1;
  14793. return self;
  14794. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  14795. },
  14796. args: ["subString"],
  14797. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  14798. referencedClasses: [],
  14799. messageSends: []
  14800. }),
  14801. $globals.String);
  14802. $core.addMethod(
  14803. $core.method({
  14804. selector: "isCapitalized",
  14805. protocol: 'testing',
  14806. fn: function (){
  14807. var self=this;
  14808. return $core.withContext(function($ctx1) {
  14809. var $3,$2,$1;
  14810. $3=self._first();
  14811. $ctx1.sendIdx["first"]=1;
  14812. $2=$recv($3)._asUppercase();
  14813. $1=$recv($2).__eq_eq(self._first());
  14814. return $1;
  14815. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  14816. },
  14817. args: [],
  14818. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  14819. referencedClasses: [],
  14820. messageSends: ["==", "asUppercase", "first"]
  14821. }),
  14822. $globals.String);
  14823. $core.addMethod(
  14824. $core.method({
  14825. selector: "isImmutable",
  14826. protocol: 'testing',
  14827. fn: function (){
  14828. var self=this;
  14829. return true;
  14830. },
  14831. args: [],
  14832. source: "isImmutable\x0a\x09^ true",
  14833. referencedClasses: [],
  14834. messageSends: []
  14835. }),
  14836. $globals.String);
  14837. $core.addMethod(
  14838. $core.method({
  14839. selector: "isString",
  14840. protocol: 'testing',
  14841. fn: function (){
  14842. var self=this;
  14843. return true;
  14844. },
  14845. args: [],
  14846. source: "isString\x0a\x09^ true",
  14847. referencedClasses: [],
  14848. messageSends: []
  14849. }),
  14850. $globals.String);
  14851. $core.addMethod(
  14852. $core.method({
  14853. selector: "isVowel",
  14854. protocol: 'testing',
  14855. fn: function (){
  14856. var self=this;
  14857. return $core.withContext(function($ctx1) {
  14858. var $1;
  14859. $1=$recv($recv(self._size()).__eq((1)))._and_((function(){
  14860. return $core.withContext(function($ctx2) {
  14861. return "aeiou"._includes_(self._asLowercase());
  14862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14863. }));
  14864. return $1;
  14865. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  14866. },
  14867. args: [],
  14868. 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 ]",
  14869. referencedClasses: [],
  14870. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  14871. }),
  14872. $globals.String);
  14873. $core.addMethod(
  14874. $core.method({
  14875. selector: "join:",
  14876. protocol: 'split join',
  14877. fn: function (aCollection){
  14878. var self=this;
  14879. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14880. return $core.withContext(function($ctx1) {
  14881. var $1;
  14882. $1=$recv($String())._streamContents_((function(stream){
  14883. return $core.withContext(function($ctx2) {
  14884. return $recv(aCollection)._do_separatedBy_((function(each){
  14885. return $core.withContext(function($ctx3) {
  14886. return $recv(stream)._nextPutAll_($recv(each)._asString());
  14887. $ctx3.sendIdx["nextPutAll:"]=1;
  14888. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14889. }),(function(){
  14890. return $core.withContext(function($ctx3) {
  14891. return $recv(stream)._nextPutAll_(self);
  14892. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14893. }));
  14894. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14895. }));
  14896. return $1;
  14897. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  14898. },
  14899. args: ["aCollection"],
  14900. 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 ]]",
  14901. referencedClasses: ["String"],
  14902. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  14903. }),
  14904. $globals.String);
  14905. $core.addMethod(
  14906. $core.method({
  14907. selector: "lineIndicesDo:",
  14908. protocol: 'split join',
  14909. fn: function (aBlock){
  14910. var self=this;
  14911. var cr,lf,start,sz,nextLF,nextCR;
  14912. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14913. return $core.withContext(function($ctx1) {
  14914. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  14915. var $early={};
  14916. try {
  14917. start=(1);
  14918. sz=self._size();
  14919. cr=$recv($String())._cr();
  14920. nextCR=self._indexOf_startingAt_(cr,(1));
  14921. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  14922. lf=$recv($String())._lf();
  14923. nextLF=self._indexOf_startingAt_(lf,(1));
  14924. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  14925. $recv((function(){
  14926. return $core.withContext(function($ctx2) {
  14927. return $recv(start).__lt_eq(sz);
  14928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14929. }))._whileTrue_((function(){
  14930. return $core.withContext(function($ctx2) {
  14931. $2=$recv(nextLF).__eq((0));
  14932. $ctx2.sendIdx["="]=1;
  14933. $1=$recv($2)._and_((function(){
  14934. return $core.withContext(function($ctx3) {
  14935. return $recv(nextCR).__eq((0));
  14936. $ctx3.sendIdx["="]=2;
  14937. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14938. }));
  14939. $ctx2.sendIdx["and:"]=1;
  14940. if($core.assert($1)){
  14941. $recv(aBlock)._value_value_value_(start,sz,sz);
  14942. $ctx2.sendIdx["value:value:value:"]=1;
  14943. throw $early=[self];
  14944. };
  14945. $4=$recv(nextCR).__eq((0));
  14946. $ctx2.sendIdx["="]=3;
  14947. $3=$recv($4)._or_((function(){
  14948. return $core.withContext(function($ctx3) {
  14949. $5=(0).__lt(nextLF);
  14950. $ctx3.sendIdx["<"]=1;
  14951. return $recv($5)._and_((function(){
  14952. return $core.withContext(function($ctx4) {
  14953. return $recv(nextLF).__lt(nextCR);
  14954. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  14955. }));
  14956. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  14957. }));
  14958. if($core.assert($3)){
  14959. $6=start;
  14960. $7=$recv(nextLF).__minus((1));
  14961. $ctx2.sendIdx["-"]=1;
  14962. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  14963. $ctx2.sendIdx["value:value:value:"]=2;
  14964. start=(1).__plus(nextLF);
  14965. $ctx2.sendIdx["+"]=1;
  14966. start;
  14967. nextLF=self._indexOf_startingAt_(lf,start);
  14968. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  14969. return nextLF;
  14970. } else {
  14971. $9=(1).__plus(nextCR);
  14972. $ctx2.sendIdx["+"]=2;
  14973. $8=$recv($9).__eq(nextLF);
  14974. if($core.assert($8)){
  14975. $10=start;
  14976. $11=$recv(nextCR).__minus((1));
  14977. $ctx2.sendIdx["-"]=2;
  14978. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  14979. $ctx2.sendIdx["value:value:value:"]=3;
  14980. start=(1).__plus(nextLF);
  14981. $ctx2.sendIdx["+"]=3;
  14982. start;
  14983. nextCR=self._indexOf_startingAt_(cr,start);
  14984. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  14985. nextCR;
  14986. nextLF=self._indexOf_startingAt_(lf,start);
  14987. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  14988. return nextLF;
  14989. } else {
  14990. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  14991. start=(1).__plus(nextCR);
  14992. start;
  14993. nextCR=self._indexOf_startingAt_(cr,start);
  14994. return nextCR;
  14995. };
  14996. };
  14997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14998. }));
  14999. return self;
  15000. }
  15001. catch(e) {if(e===$early)return e[0]; throw e}
  15002. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  15003. },
  15004. args: ["aBlock"],
  15005. 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 ] ]]",
  15006. referencedClasses: ["String"],
  15007. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  15008. }),
  15009. $globals.String);
  15010. $core.addMethod(
  15011. $core.method({
  15012. selector: "lineNumber:",
  15013. protocol: 'split join',
  15014. fn: function (anIndex){
  15015. var self=this;
  15016. var lineCount;
  15017. return $core.withContext(function($ctx1) {
  15018. var $2,$1,$3;
  15019. var $early={};
  15020. try {
  15021. lineCount=(0);
  15022. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15023. return $core.withContext(function($ctx2) {
  15024. lineCount=$recv(lineCount).__plus((1));
  15025. $2=lineCount;
  15026. $1=$recv($2).__eq(anIndex);
  15027. if($core.assert($1)){
  15028. $3=self._copyFrom_to_(start,endWithoutDelimiters);
  15029. throw $early=[$3];
  15030. };
  15031. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15032. }));
  15033. return nil;
  15034. }
  15035. catch(e) {if(e===$early)return e[0]; throw e}
  15036. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  15037. },
  15038. args: ["anIndex"],
  15039. 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",
  15040. referencedClasses: [],
  15041. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  15042. }),
  15043. $globals.String);
  15044. $core.addMethod(
  15045. $core.method({
  15046. selector: "lines",
  15047. protocol: 'split join',
  15048. fn: function (){
  15049. var self=this;
  15050. var lines;
  15051. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  15052. return $core.withContext(function($ctx1) {
  15053. var $1;
  15054. lines=$recv($Array())._new();
  15055. self._linesDo_((function(aLine){
  15056. return $core.withContext(function($ctx2) {
  15057. return $recv(lines)._add_(aLine);
  15058. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)});
  15059. }));
  15060. $1=lines;
  15061. return $1;
  15062. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},$globals.String)});
  15063. },
  15064. args: [],
  15065. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [ :aLine | lines add: aLine ].\x0a\x09^ lines",
  15066. referencedClasses: ["Array"],
  15067. messageSends: ["new", "linesDo:", "add:"]
  15068. }),
  15069. $globals.String);
  15070. $core.addMethod(
  15071. $core.method({
  15072. selector: "linesDo:",
  15073. protocol: 'split join',
  15074. fn: function (aBlock){
  15075. var self=this;
  15076. return $core.withContext(function($ctx1) {
  15077. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15078. return $core.withContext(function($ctx2) {
  15079. return $recv(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  15080. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15081. }));
  15082. return self;
  15083. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  15084. },
  15085. args: ["aBlock"],
  15086. 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 lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters) ]",
  15087. referencedClasses: [],
  15088. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"]
  15089. }),
  15090. $globals.String);
  15091. $core.addMethod(
  15092. $core.method({
  15093. selector: "match:",
  15094. protocol: 'regular expressions',
  15095. fn: function (aRegexp){
  15096. var self=this;
  15097. return $core.withContext(function($ctx1) {
  15098. return self.search(aRegexp) != -1;
  15099. return self;
  15100. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  15101. },
  15102. args: ["aRegexp"],
  15103. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  15104. referencedClasses: [],
  15105. messageSends: []
  15106. }),
  15107. $globals.String);
  15108. $core.addMethod(
  15109. $core.method({
  15110. selector: "matchesOf:",
  15111. protocol: 'regular expressions',
  15112. fn: function (aRegularExpression){
  15113. var self=this;
  15114. return $core.withContext(function($ctx1) {
  15115. return self.match(aRegularExpression);
  15116. return self;
  15117. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  15118. },
  15119. args: ["aRegularExpression"],
  15120. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  15121. referencedClasses: [],
  15122. messageSends: []
  15123. }),
  15124. $globals.String);
  15125. $core.addMethod(
  15126. $core.method({
  15127. selector: "numericallyIndexable",
  15128. protocol: 'private',
  15129. fn: function (){
  15130. var self=this;
  15131. return $core.withContext(function($ctx1) {
  15132. return String(self);
  15133. return self;
  15134. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  15135. },
  15136. args: [],
  15137. source: "numericallyIndexable\x0a\x09<return String(self)>",
  15138. referencedClasses: [],
  15139. messageSends: []
  15140. }),
  15141. $globals.String);
  15142. $core.addMethod(
  15143. $core.method({
  15144. selector: "printNl",
  15145. protocol: 'printing',
  15146. fn: function (){
  15147. var self=this;
  15148. return $core.withContext(function($ctx1) {
  15149. console.log(self);
  15150. return self;
  15151. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  15152. },
  15153. args: [],
  15154. source: "printNl\x0a\x09<console.log(self)>",
  15155. referencedClasses: [],
  15156. messageSends: []
  15157. }),
  15158. $globals.String);
  15159. $core.addMethod(
  15160. $core.method({
  15161. selector: "printOn:",
  15162. protocol: 'printing',
  15163. fn: function (aStream){
  15164. var self=this;
  15165. return $core.withContext(function($ctx1) {
  15166. var $1;
  15167. $recv(aStream)._nextPutAll_("'");
  15168. $ctx1.sendIdx["nextPutAll:"]=1;
  15169. $recv(aStream)._nextPutAll_(self);
  15170. $ctx1.sendIdx["nextPutAll:"]=2;
  15171. $1=$recv(aStream)._nextPutAll_("'");
  15172. return self;
  15173. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  15174. },
  15175. args: ["aStream"],
  15176. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  15177. referencedClasses: [],
  15178. messageSends: ["nextPutAll:"]
  15179. }),
  15180. $globals.String);
  15181. $core.addMethod(
  15182. $core.method({
  15183. selector: "replace:with:",
  15184. protocol: 'regular expressions',
  15185. fn: function (aString,anotherString){
  15186. var self=this;
  15187. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15188. return $core.withContext(function($ctx1) {
  15189. var $1;
  15190. $1=self._replaceRegexp_with_($recv($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  15191. return $1;
  15192. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  15193. },
  15194. args: ["aString", "anotherString"],
  15195. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  15196. referencedClasses: ["RegularExpression"],
  15197. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  15198. }),
  15199. $globals.String);
  15200. $core.addMethod(
  15201. $core.method({
  15202. selector: "replaceRegexp:with:",
  15203. protocol: 'regular expressions',
  15204. fn: function (aRegexp,aString){
  15205. var self=this;
  15206. return $core.withContext(function($ctx1) {
  15207. return self.replace(aRegexp, aString);
  15208. return self;
  15209. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  15210. },
  15211. args: ["aRegexp", "aString"],
  15212. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  15213. referencedClasses: [],
  15214. messageSends: []
  15215. }),
  15216. $globals.String);
  15217. $core.addMethod(
  15218. $core.method({
  15219. selector: "reversed",
  15220. protocol: 'converting',
  15221. fn: function (){
  15222. var self=this;
  15223. return $core.withContext(function($ctx1) {
  15224. return self.split("").reverse().join("");
  15225. return self;
  15226. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  15227. },
  15228. args: [],
  15229. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  15230. referencedClasses: [],
  15231. messageSends: []
  15232. }),
  15233. $globals.String);
  15234. $core.addMethod(
  15235. $core.method({
  15236. selector: "shallowCopy",
  15237. protocol: 'copying',
  15238. fn: function (){
  15239. var self=this;
  15240. return $core.withContext(function($ctx1) {
  15241. var $1;
  15242. $1=$recv(self._class())._fromString_(self);
  15243. return $1;
  15244. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.String)});
  15245. },
  15246. args: [],
  15247. source: "shallowCopy\x0a\x09^ self class fromString: self",
  15248. referencedClasses: [],
  15249. messageSends: ["fromString:", "class"]
  15250. }),
  15251. $globals.String);
  15252. $core.addMethod(
  15253. $core.method({
  15254. selector: "size",
  15255. protocol: 'accessing',
  15256. fn: function (){
  15257. var self=this;
  15258. return $core.withContext(function($ctx1) {
  15259. return self.length;
  15260. return self;
  15261. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  15262. },
  15263. args: [],
  15264. source: "size\x0a\x09<return self.length>",
  15265. referencedClasses: [],
  15266. messageSends: []
  15267. }),
  15268. $globals.String);
  15269. $core.addMethod(
  15270. $core.method({
  15271. selector: "subStrings:",
  15272. protocol: 'split join',
  15273. fn: function (aString){
  15274. var self=this;
  15275. return $core.withContext(function($ctx1) {
  15276. var $1;
  15277. $1=self._tokenize_(aString);
  15278. return $1;
  15279. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  15280. },
  15281. args: ["aString"],
  15282. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  15283. referencedClasses: [],
  15284. messageSends: ["tokenize:"]
  15285. }),
  15286. $globals.String);
  15287. $core.addMethod(
  15288. $core.method({
  15289. selector: "tokenize:",
  15290. protocol: 'split join',
  15291. fn: function (aString){
  15292. var self=this;
  15293. return $core.withContext(function($ctx1) {
  15294. return self.split(aString);
  15295. return self;
  15296. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  15297. },
  15298. args: ["aString"],
  15299. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  15300. referencedClasses: [],
  15301. messageSends: []
  15302. }),
  15303. $globals.String);
  15304. $core.addMethod(
  15305. $core.method({
  15306. selector: "trimBoth",
  15307. protocol: 'regular expressions',
  15308. fn: function (){
  15309. var self=this;
  15310. return $core.withContext(function($ctx1) {
  15311. var $1;
  15312. $1=self._trimBoth_("\x5cs");
  15313. return $1;
  15314. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  15315. },
  15316. args: [],
  15317. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  15318. referencedClasses: [],
  15319. messageSends: ["trimBoth:"]
  15320. }),
  15321. $globals.String);
  15322. $core.addMethod(
  15323. $core.method({
  15324. selector: "trimBoth:",
  15325. protocol: 'regular expressions',
  15326. fn: function (separators){
  15327. var self=this;
  15328. return $core.withContext(function($ctx1) {
  15329. var $1;
  15330. $1=$recv(self._trimLeft_(separators))._trimRight_(separators);
  15331. return $1;
  15332. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  15333. },
  15334. args: ["separators"],
  15335. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  15336. referencedClasses: [],
  15337. messageSends: ["trimRight:", "trimLeft:"]
  15338. }),
  15339. $globals.String);
  15340. $core.addMethod(
  15341. $core.method({
  15342. selector: "trimLeft",
  15343. protocol: 'regular expressions',
  15344. fn: function (){
  15345. var self=this;
  15346. return $core.withContext(function($ctx1) {
  15347. var $1;
  15348. $1=self._trimLeft_("\x5cs");
  15349. return $1;
  15350. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  15351. },
  15352. args: [],
  15353. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  15354. referencedClasses: [],
  15355. messageSends: ["trimLeft:"]
  15356. }),
  15357. $globals.String);
  15358. $core.addMethod(
  15359. $core.method({
  15360. selector: "trimLeft:",
  15361. protocol: 'regular expressions',
  15362. fn: function (separators){
  15363. var self=this;
  15364. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15365. return $core.withContext(function($ctx1) {
  15366. var $3,$2,$1;
  15367. $3=$recv("^[".__comma(separators)).__comma("]+");
  15368. $ctx1.sendIdx[","]=1;
  15369. $2=$recv($RegularExpression())._fromString_flag_($3,"g");
  15370. $1=self._replaceRegexp_with_($2,"");
  15371. return $1;
  15372. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  15373. },
  15374. args: ["separators"],
  15375. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  15376. referencedClasses: ["RegularExpression"],
  15377. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15378. }),
  15379. $globals.String);
  15380. $core.addMethod(
  15381. $core.method({
  15382. selector: "trimRight",
  15383. protocol: 'regular expressions',
  15384. fn: function (){
  15385. var self=this;
  15386. return $core.withContext(function($ctx1) {
  15387. var $1;
  15388. $1=self._trimRight_("\x5cs");
  15389. return $1;
  15390. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  15391. },
  15392. args: [],
  15393. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  15394. referencedClasses: [],
  15395. messageSends: ["trimRight:"]
  15396. }),
  15397. $globals.String);
  15398. $core.addMethod(
  15399. $core.method({
  15400. selector: "trimRight:",
  15401. protocol: 'regular expressions',
  15402. fn: function (separators){
  15403. var self=this;
  15404. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15405. return $core.withContext(function($ctx1) {
  15406. var $3,$2,$1;
  15407. $3=$recv("[".__comma(separators)).__comma("]+$");
  15408. $ctx1.sendIdx[","]=1;
  15409. $2=$recv($RegularExpression())._fromString_flag_($3,"g");
  15410. $1=self._replaceRegexp_with_($2,"");
  15411. return $1;
  15412. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  15413. },
  15414. args: ["separators"],
  15415. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  15416. referencedClasses: ["RegularExpression"],
  15417. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15418. }),
  15419. $globals.String);
  15420. $core.addMethod(
  15421. $core.method({
  15422. selector: "unescaped",
  15423. protocol: 'converting',
  15424. fn: function (){
  15425. var self=this;
  15426. return $core.withContext(function($ctx1) {
  15427. return unescape(self);
  15428. return self;
  15429. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  15430. },
  15431. args: [],
  15432. source: "unescaped\x0a\x09<return unescape(self)>",
  15433. referencedClasses: [],
  15434. messageSends: []
  15435. }),
  15436. $globals.String);
  15437. $core.addMethod(
  15438. $core.method({
  15439. selector: "uriComponentDecoded",
  15440. protocol: 'converting',
  15441. fn: function (){
  15442. var self=this;
  15443. return $core.withContext(function($ctx1) {
  15444. return decodeURIComponent(self);
  15445. return self;
  15446. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  15447. },
  15448. args: [],
  15449. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  15450. referencedClasses: [],
  15451. messageSends: []
  15452. }),
  15453. $globals.String);
  15454. $core.addMethod(
  15455. $core.method({
  15456. selector: "uriComponentEncoded",
  15457. protocol: 'converting',
  15458. fn: function (){
  15459. var self=this;
  15460. return $core.withContext(function($ctx1) {
  15461. return encodeURIComponent(self);
  15462. return self;
  15463. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  15464. },
  15465. args: [],
  15466. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  15467. referencedClasses: [],
  15468. messageSends: []
  15469. }),
  15470. $globals.String);
  15471. $core.addMethod(
  15472. $core.method({
  15473. selector: "uriDecoded",
  15474. protocol: 'converting',
  15475. fn: function (){
  15476. var self=this;
  15477. return $core.withContext(function($ctx1) {
  15478. return decodeURI(self);
  15479. return self;
  15480. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15481. },
  15482. args: [],
  15483. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  15484. referencedClasses: [],
  15485. messageSends: []
  15486. }),
  15487. $globals.String);
  15488. $core.addMethod(
  15489. $core.method({
  15490. selector: "uriEncoded",
  15491. protocol: 'converting',
  15492. fn: function (){
  15493. var self=this;
  15494. return $core.withContext(function($ctx1) {
  15495. return encodeURI(self);
  15496. return self;
  15497. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15498. },
  15499. args: [],
  15500. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  15501. referencedClasses: [],
  15502. messageSends: []
  15503. }),
  15504. $globals.String);
  15505. $core.addMethod(
  15506. $core.method({
  15507. selector: "value:",
  15508. protocol: 'evaluating',
  15509. fn: function (anObject){
  15510. var self=this;
  15511. return $core.withContext(function($ctx1) {
  15512. var $1;
  15513. $1=$recv(anObject)._perform_(self);
  15514. return $1;
  15515. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15516. },
  15517. args: ["anObject"],
  15518. source: "value: anObject \x0a\x09^ anObject perform: self",
  15519. referencedClasses: [],
  15520. messageSends: ["perform:"]
  15521. }),
  15522. $globals.String);
  15523. $core.addMethod(
  15524. $core.method({
  15525. selector: "cr",
  15526. protocol: 'accessing',
  15527. fn: function (){
  15528. var self=this;
  15529. return $core.withContext(function($ctx1) {
  15530. return '\r';
  15531. return self;
  15532. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15533. },
  15534. args: [],
  15535. source: "cr\x0a\x09<return '\x5cr'>",
  15536. referencedClasses: [],
  15537. messageSends: []
  15538. }),
  15539. $globals.String.klass);
  15540. $core.addMethod(
  15541. $core.method({
  15542. selector: "crlf",
  15543. protocol: 'accessing',
  15544. fn: function (){
  15545. var self=this;
  15546. return $core.withContext(function($ctx1) {
  15547. return '\r\n';
  15548. return self;
  15549. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15550. },
  15551. args: [],
  15552. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  15553. referencedClasses: [],
  15554. messageSends: []
  15555. }),
  15556. $globals.String.klass);
  15557. $core.addMethod(
  15558. $core.method({
  15559. selector: "esc",
  15560. protocol: 'accessing',
  15561. fn: function (){
  15562. var self=this;
  15563. return $core.withContext(function($ctx1) {
  15564. var $1;
  15565. $1=self._fromCharCode_((27));
  15566. return $1;
  15567. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15568. },
  15569. args: [],
  15570. source: "esc\x0a\x09^ self fromCharCode: 27",
  15571. referencedClasses: [],
  15572. messageSends: ["fromCharCode:"]
  15573. }),
  15574. $globals.String.klass);
  15575. $core.addMethod(
  15576. $core.method({
  15577. selector: "fromCharCode:",
  15578. protocol: 'instance creation',
  15579. fn: function (anInteger){
  15580. var self=this;
  15581. return $core.withContext(function($ctx1) {
  15582. return String.fromCharCode(anInteger);
  15583. return self;
  15584. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15585. },
  15586. args: ["anInteger"],
  15587. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  15588. referencedClasses: [],
  15589. messageSends: []
  15590. }),
  15591. $globals.String.klass);
  15592. $core.addMethod(
  15593. $core.method({
  15594. selector: "fromString:",
  15595. protocol: 'instance creation',
  15596. fn: function (aString){
  15597. var self=this;
  15598. return $core.withContext(function($ctx1) {
  15599. return String(aString);
  15600. return self;
  15601. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15602. },
  15603. args: ["aString"],
  15604. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  15605. referencedClasses: [],
  15606. messageSends: []
  15607. }),
  15608. $globals.String.klass);
  15609. $core.addMethod(
  15610. $core.method({
  15611. selector: "lf",
  15612. protocol: 'accessing',
  15613. fn: function (){
  15614. var self=this;
  15615. return $core.withContext(function($ctx1) {
  15616. return '\n';
  15617. return self;
  15618. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15619. },
  15620. args: [],
  15621. source: "lf\x0a\x09<return '\x5cn'>",
  15622. referencedClasses: [],
  15623. messageSends: []
  15624. }),
  15625. $globals.String.klass);
  15626. $core.addMethod(
  15627. $core.method({
  15628. selector: "random",
  15629. protocol: 'random',
  15630. fn: function (){
  15631. var self=this;
  15632. return $core.withContext(function($ctx1) {
  15633. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15634. return self;
  15635. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15636. },
  15637. args: [],
  15638. 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);>",
  15639. referencedClasses: [],
  15640. messageSends: []
  15641. }),
  15642. $globals.String.klass);
  15643. $core.addMethod(
  15644. $core.method({
  15645. selector: "randomNotIn:",
  15646. protocol: 'random',
  15647. fn: function (aString){
  15648. var self=this;
  15649. var result;
  15650. return $core.withContext(function($ctx1) {
  15651. var $1;
  15652. $recv((function(){
  15653. return $core.withContext(function($ctx2) {
  15654. result=self._random();
  15655. result;
  15656. return $recv(aString)._includesSubString_(result);
  15657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15658. }))._whileTrue();
  15659. $1=result;
  15660. return $1;
  15661. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15662. },
  15663. args: ["aString"],
  15664. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15665. referencedClasses: [],
  15666. messageSends: ["whileTrue", "random", "includesSubString:"]
  15667. }),
  15668. $globals.String.klass);
  15669. $core.addMethod(
  15670. $core.method({
  15671. selector: "space",
  15672. protocol: 'accessing',
  15673. fn: function (){
  15674. var self=this;
  15675. return $core.withContext(function($ctx1) {
  15676. return ' ';
  15677. return self;
  15678. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15679. },
  15680. args: [],
  15681. source: "space\x0a\x09<return ' '>",
  15682. referencedClasses: [],
  15683. messageSends: []
  15684. }),
  15685. $globals.String.klass);
  15686. $core.addMethod(
  15687. $core.method({
  15688. selector: "streamClass",
  15689. protocol: 'accessing',
  15690. fn: function (){
  15691. var self=this;
  15692. function $StringStream(){return $globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  15693. return $StringStream();
  15694. },
  15695. args: [],
  15696. source: "streamClass\x0a\x09\x09^ StringStream",
  15697. referencedClasses: ["StringStream"],
  15698. messageSends: []
  15699. }),
  15700. $globals.String.klass);
  15701. $core.addMethod(
  15702. $core.method({
  15703. selector: "tab",
  15704. protocol: 'accessing',
  15705. fn: function (){
  15706. var self=this;
  15707. return $core.withContext(function($ctx1) {
  15708. return '\t';
  15709. return self;
  15710. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15711. },
  15712. args: [],
  15713. source: "tab\x0a\x09<return '\x5ct'>",
  15714. referencedClasses: [],
  15715. messageSends: []
  15716. }),
  15717. $globals.String.klass);
  15718. $core.addMethod(
  15719. $core.method({
  15720. selector: "value:",
  15721. protocol: 'instance creation',
  15722. fn: function (aUTFCharCode){
  15723. var self=this;
  15724. return $core.withContext(function($ctx1) {
  15725. return String.fromCharCode(aUTFCharCode);;
  15726. return self;
  15727. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15728. },
  15729. args: ["aUTFCharCode"],
  15730. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  15731. referencedClasses: [],
  15732. messageSends: []
  15733. }),
  15734. $globals.String.klass);
  15735. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15736. $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`.";
  15737. $core.addMethod(
  15738. $core.method({
  15739. selector: "=",
  15740. protocol: 'comparing',
  15741. fn: function (aCollection){
  15742. var self=this;
  15743. return $core.withContext(function($ctx1) {
  15744. var $2,$1,$4,$3,$5;
  15745. var $early={};
  15746. try {
  15747. $2=self._class();
  15748. $ctx1.sendIdx["class"]=1;
  15749. $1=$recv($2).__eq($recv(aCollection)._class());
  15750. $ctx1.sendIdx["="]=1;
  15751. if(!$core.assert($1)){
  15752. return false;
  15753. };
  15754. $4=self._size();
  15755. $ctx1.sendIdx["size"]=1;
  15756. $3=$recv($4).__eq($recv(aCollection)._size());
  15757. if(!$core.assert($3)){
  15758. return false;
  15759. };
  15760. self._do_((function(each){
  15761. return $core.withContext(function($ctx2) {
  15762. $5=$recv(aCollection)._includes_(each);
  15763. if(!$core.assert($5)){
  15764. throw $early=[false];
  15765. };
  15766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15767. }));
  15768. return true;
  15769. }
  15770. catch(e) {if(e===$early)return e[0]; throw e}
  15771. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  15772. },
  15773. args: ["aCollection"],
  15774. 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",
  15775. referencedClasses: [],
  15776. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  15777. }),
  15778. $globals.Set);
  15779. $core.addMethod(
  15780. $core.method({
  15781. selector: "add:",
  15782. protocol: 'adding/removing',
  15783. fn: function (anObject){
  15784. var self=this;
  15785. var bucket;
  15786. return $core.withContext(function($ctx1) {
  15787. var $2,$1,$receiver;
  15788. bucket=self._bucketsOfElement_(anObject);
  15789. $2=$recv(bucket)._second();
  15790. if(($receiver = $2) == null || $receiver.isNil){
  15791. var object,slowBucket;
  15792. object=$recv(bucket)._first();
  15793. $ctx1.sendIdx["first"]=1;
  15794. object;
  15795. slowBucket=$recv(bucket)._third();
  15796. slowBucket;
  15797. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  15798. return $core.withContext(function($ctx2) {
  15799. $recv(slowBucket)._add_(object);
  15800. self["@size"]=$recv(self["@size"]).__plus((1));
  15801. return self["@size"];
  15802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15803. }));
  15804. $1=object;
  15805. } else {
  15806. var primitiveBucket;
  15807. primitiveBucket=$receiver;
  15808. $1=self._add_in_($recv(bucket)._first(),primitiveBucket);
  15809. };
  15810. return $1;
  15811. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15812. },
  15813. args: ["anObject"],
  15814. 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 ]",
  15815. referencedClasses: [],
  15816. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  15817. }),
  15818. $globals.Set);
  15819. $core.addMethod(
  15820. $core.method({
  15821. selector: "add:in:",
  15822. protocol: 'private',
  15823. fn: function (anObject,anotherObject){
  15824. var self=this;
  15825. return $core.withContext(function($ctx1) {
  15826. if (anObject in anotherObject.store) { return false; }
  15827. self['@size']++;
  15828. anotherObject.store[anObject] = true;
  15829. return anObject;
  15830. ;
  15831. return self;
  15832. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15833. },
  15834. args: ["anObject", "anotherObject"],
  15835. 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>",
  15836. referencedClasses: [],
  15837. messageSends: []
  15838. }),
  15839. $globals.Set);
  15840. $core.addMethod(
  15841. $core.method({
  15842. selector: "bucketsOfElement:",
  15843. protocol: 'private',
  15844. fn: function (anObject){
  15845. var self=this;
  15846. return $core.withContext(function($ctx1) {
  15847. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  15848. if ((type = typeof prim) === "object") {
  15849. if (anObject !== nil) {
  15850. bucket = null;
  15851. self['@slowBucketStores'].some(function (store) {
  15852. return bucket = store._bucketOfElement_(anObject);
  15853. });
  15854. return [ anObject, null, bucket || self['@defaultBucket'] ];
  15855. }
  15856. // include nil to well-known objects under 'boolean' fastBucket
  15857. prim = null;
  15858. type = 'boolean';
  15859. }
  15860. return [ prim, self['@fastBuckets'][type] ];
  15861. ;
  15862. return self;
  15863. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  15864. },
  15865. args: ["anObject"],
  15866. 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\x09var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();\x0a\x09\x09if ((type = typeof prim) === \x22object\x22) {\x0a\x09\x09\x09if (anObject !== nil) {\x0a\x09\x09\x09\x09bucket = null;\x0a\x09\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09\x09});\x0a\x09\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09\x09}\x0a\x09\x09\x09\x0a\x09\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09\x09prim = null;\x0a\x09\x09\x09type = 'boolean';\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][type] ];\x0a\x09>",
  15867. referencedClasses: [],
  15868. messageSends: []
  15869. }),
  15870. $globals.Set);
  15871. $core.addMethod(
  15872. $core.method({
  15873. selector: "classNameOf:",
  15874. protocol: 'private',
  15875. fn: function (anObject){
  15876. var self=this;
  15877. return $core.withContext(function($ctx1) {
  15878. return anObject.klass != null && anObject.klass.className;
  15879. return self;
  15880. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  15881. },
  15882. args: ["anObject"],
  15883. 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>",
  15884. referencedClasses: [],
  15885. messageSends: []
  15886. }),
  15887. $globals.Set);
  15888. $core.addMethod(
  15889. $core.method({
  15890. selector: "collect:",
  15891. protocol: 'enumerating',
  15892. fn: function (aBlock){
  15893. var self=this;
  15894. var collection;
  15895. return $core.withContext(function($ctx1) {
  15896. var $1;
  15897. collection=$recv(self._class())._new();
  15898. self._do_((function(each){
  15899. return $core.withContext(function($ctx2) {
  15900. return $recv(collection)._add_($recv(aBlock)._value_(each));
  15901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15902. }));
  15903. $1=collection;
  15904. return $1;
  15905. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15906. },
  15907. args: ["aBlock"],
  15908. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  15909. referencedClasses: [],
  15910. messageSends: ["new", "class", "do:", "add:", "value:"]
  15911. }),
  15912. $globals.Set);
  15913. $core.addMethod(
  15914. $core.method({
  15915. selector: "detect:ifNone:",
  15916. protocol: 'enumerating',
  15917. fn: function (aBlock,anotherBlock){
  15918. var self=this;
  15919. return $core.withContext(function($ctx1) {
  15920. var $1,$2;
  15921. var $early={};
  15922. try {
  15923. self._do_((function(each){
  15924. return $core.withContext(function($ctx2) {
  15925. $1=$recv(aBlock)._value_(each);
  15926. if($core.assert($1)){
  15927. throw $early=[each];
  15928. };
  15929. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15930. }));
  15931. $2=$recv(anotherBlock)._value();
  15932. return $2;
  15933. }
  15934. catch(e) {if(e===$early)return e[0]; throw e}
  15935. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  15936. },
  15937. args: ["aBlock", "anotherBlock"],
  15938. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  15939. referencedClasses: [],
  15940. messageSends: ["do:", "ifTrue:", "value:", "value"]
  15941. }),
  15942. $globals.Set);
  15943. $core.addMethod(
  15944. $core.method({
  15945. selector: "do:",
  15946. protocol: 'enumerating',
  15947. fn: function (aBlock){
  15948. var self=this;
  15949. return $core.withContext(function($ctx1) {
  15950. var el, keys, i;
  15951. el = self['@fastBuckets'];
  15952. keys = Object.keys(el);
  15953. for (i = 0; i < keys.length; ++i) {
  15954. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  15955. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  15956. else { store._do_(aBlock); }
  15957. }
  15958. el = self['@slowBucketStores'];
  15959. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  15960. self['@defaultBucket']._do_(aBlock);
  15961. ;
  15962. return self;
  15963. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  15964. },
  15965. args: ["aBlock"],
  15966. 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>",
  15967. referencedClasses: [],
  15968. messageSends: []
  15969. }),
  15970. $globals.Set);
  15971. $core.addMethod(
  15972. $core.method({
  15973. selector: "includes:",
  15974. protocol: 'testing',
  15975. fn: function (anObject){
  15976. var self=this;
  15977. var bucket;
  15978. return $core.withContext(function($ctx1) {
  15979. var $2,$3,$4,$1,$receiver;
  15980. bucket=self._bucketsOfElement_(anObject);
  15981. $2=$recv(bucket)._second();
  15982. if(($receiver = $2) == null || $receiver.isNil){
  15983. $3=$recv(bucket)._third();
  15984. $4=$recv(bucket)._first();
  15985. $ctx1.sendIdx["first"]=1;
  15986. $1=$recv($3)._includes_($4);
  15987. } else {
  15988. var primitiveBucket;
  15989. primitiveBucket=$receiver;
  15990. $1=self._includes_in_($recv(bucket)._first(),primitiveBucket);
  15991. };
  15992. return $1;
  15993. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15994. },
  15995. args: ["anObject"],
  15996. 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 ]",
  15997. referencedClasses: [],
  15998. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  15999. }),
  16000. $globals.Set);
  16001. $core.addMethod(
  16002. $core.method({
  16003. selector: "includes:in:",
  16004. protocol: 'private',
  16005. fn: function (anObject,anotherObject){
  16006. var self=this;
  16007. return $core.withContext(function($ctx1) {
  16008. return anObject in anotherObject.store;
  16009. return self;
  16010. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16011. },
  16012. args: ["anObject", "anotherObject"],
  16013. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  16014. referencedClasses: [],
  16015. messageSends: []
  16016. }),
  16017. $globals.Set);
  16018. $core.addMethod(
  16019. $core.method({
  16020. selector: "initialize",
  16021. protocol: 'initialization',
  16022. fn: function (){
  16023. var self=this;
  16024. return $core.withContext(function($ctx1) {
  16025. var $1;
  16026. (
  16027. $ctx1.supercall = true,
  16028. $globals.Set.superclass.fn.prototype._initialize.apply($recv(self), []));
  16029. $ctx1.supercall = false;
  16030. self["@defaultBucket"]=[];
  16031. self._initializeSlowBucketStores();
  16032. $1=self._removeAll();
  16033. return self;
  16034. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  16035. },
  16036. args: [],
  16037. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  16038. referencedClasses: [],
  16039. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  16040. }),
  16041. $globals.Set);
  16042. $core.addMethod(
  16043. $core.method({
  16044. selector: "initializeSlowBucketStores",
  16045. protocol: 'initialization',
  16046. fn: function (){
  16047. var self=this;
  16048. function $ArrayBucketStore(){return $globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  16049. return $core.withContext(function($ctx1) {
  16050. var $1;
  16051. $1=$recv($ArrayBucketStore())._hashBlock_((function(x){
  16052. return $core.withContext(function($ctx2) {
  16053. return self._classNameOf_(x);
  16054. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  16055. }));
  16056. $ctx1.sendIdx["hashBlock:"]=1;
  16057. self["@slowBucketStores"]=[$1,$recv($ArrayBucketStore())._hashBlock_((function(x){
  16058. return $core.withContext(function($ctx2) {
  16059. return self._jsConstructorNameOf_(x);
  16060. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  16061. }))];
  16062. return self;
  16063. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  16064. },
  16065. args: [],
  16066. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  16067. referencedClasses: ["ArrayBucketStore"],
  16068. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  16069. }),
  16070. $globals.Set);
  16071. $core.addMethod(
  16072. $core.method({
  16073. selector: "jsConstructorNameOf:",
  16074. protocol: 'private',
  16075. fn: function (anObject){
  16076. var self=this;
  16077. return $core.withContext(function($ctx1) {
  16078. return anObject.constructor && anObject.constructor.name;
  16079. return self;
  16080. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  16081. },
  16082. args: ["anObject"],
  16083. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  16084. referencedClasses: [],
  16085. messageSends: []
  16086. }),
  16087. $globals.Set);
  16088. $core.addMethod(
  16089. $core.method({
  16090. selector: "printOn:",
  16091. protocol: 'printing',
  16092. fn: function (aStream){
  16093. var self=this;
  16094. return $core.withContext(function($ctx1) {
  16095. (
  16096. $ctx1.supercall = true,
  16097. $globals.Set.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  16098. $ctx1.supercall = false;
  16099. $ctx1.sendIdx["printOn:"]=1;
  16100. $recv(aStream)._nextPutAll_(" (");
  16101. $ctx1.sendIdx["nextPutAll:"]=1;
  16102. self._do_separatedBy_((function(each){
  16103. return $core.withContext(function($ctx2) {
  16104. return $recv(each)._printOn_(aStream);
  16105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16106. }),(function(){
  16107. return $core.withContext(function($ctx2) {
  16108. return $recv(aStream)._nextPutAll_(" ");
  16109. $ctx2.sendIdx["nextPutAll:"]=2;
  16110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16111. }));
  16112. $recv(aStream)._nextPutAll_(")");
  16113. return self;
  16114. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  16115. },
  16116. args: ["aStream"],
  16117. 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: ')'",
  16118. referencedClasses: [],
  16119. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  16120. }),
  16121. $globals.Set);
  16122. $core.addMethod(
  16123. $core.method({
  16124. selector: "remove:ifAbsent:",
  16125. protocol: 'adding/removing',
  16126. fn: function (anObject,aBlock){
  16127. var self=this;
  16128. var bucket;
  16129. return $core.withContext(function($ctx1) {
  16130. var $2,$3,$4,$5,$1,$receiver;
  16131. var $early={};
  16132. try {
  16133. bucket=self._bucketsOfElement_(anObject);
  16134. $2=$recv(bucket)._second();
  16135. if(($receiver = $2) == null || $receiver.isNil){
  16136. $3=$recv(bucket)._third();
  16137. $4=$recv(bucket)._first();
  16138. $ctx1.sendIdx["first"]=1;
  16139. $recv($3)._remove_ifAbsent_($4,(function(){
  16140. return $core.withContext(function($ctx2) {
  16141. $5=$recv(aBlock)._value();
  16142. throw $early=[$5];
  16143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16144. }));
  16145. self["@size"]=$recv(self["@size"]).__minus((1));
  16146. $1=self["@size"];
  16147. } else {
  16148. var primitiveBucket;
  16149. primitiveBucket=$receiver;
  16150. $1=self._remove_in_($recv(bucket)._first(),primitiveBucket);
  16151. };
  16152. return $1;
  16153. }
  16154. catch(e) {if(e===$early)return e[0]; throw e}
  16155. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  16156. },
  16157. args: ["anObject", "aBlock"],
  16158. 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 ]",
  16159. referencedClasses: [],
  16160. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  16161. }),
  16162. $globals.Set);
  16163. $core.addMethod(
  16164. $core.method({
  16165. selector: "remove:in:",
  16166. protocol: 'private',
  16167. fn: function (anObject,anotherObject){
  16168. var self=this;
  16169. return $core.withContext(function($ctx1) {
  16170. if (delete anotherObject.store[anObject]) self['@size']--;
  16171. return self;
  16172. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16173. },
  16174. args: ["anObject", "anotherObject"],
  16175. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  16176. referencedClasses: [],
  16177. messageSends: []
  16178. }),
  16179. $globals.Set);
  16180. $core.addMethod(
  16181. $core.method({
  16182. selector: "removeAll",
  16183. protocol: 'adding/removing',
  16184. fn: function (){
  16185. var self=this;
  16186. return $core.withContext(function($ctx1) {
  16187. self['@fastBuckets'] = {
  16188. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  16189. 'number': { store: Object.create(null), fn: Number },
  16190. 'string': { store: Object.create(null) }
  16191. };
  16192. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  16193. self['@defaultBucket']._removeAll();
  16194. self['@size'] = 0;
  16195. ;
  16196. return self;
  16197. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  16198. },
  16199. args: [],
  16200. 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>",
  16201. referencedClasses: [],
  16202. messageSends: []
  16203. }),
  16204. $globals.Set);
  16205. $core.addMethod(
  16206. $core.method({
  16207. selector: "select:",
  16208. protocol: 'enumerating',
  16209. fn: function (aBlock){
  16210. var self=this;
  16211. var collection;
  16212. return $core.withContext(function($ctx1) {
  16213. var $1,$2;
  16214. collection=$recv(self._class())._new();
  16215. self._do_((function(each){
  16216. return $core.withContext(function($ctx2) {
  16217. $1=$recv(aBlock)._value_(each);
  16218. if($core.assert($1)){
  16219. return $recv(collection)._add_(each);
  16220. };
  16221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16222. }));
  16223. $2=collection;
  16224. return $2;
  16225. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16226. },
  16227. args: ["aBlock"],
  16228. 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",
  16229. referencedClasses: [],
  16230. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  16231. }),
  16232. $globals.Set);
  16233. $core.addMethod(
  16234. $core.method({
  16235. selector: "size",
  16236. protocol: 'accessing',
  16237. fn: function (){
  16238. var self=this;
  16239. var $1;
  16240. $1=self["@size"];
  16241. return $1;
  16242. },
  16243. args: [],
  16244. source: "size\x0a\x09^ size",
  16245. referencedClasses: [],
  16246. messageSends: []
  16247. }),
  16248. $globals.Set);
  16249. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  16250. $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.";
  16251. $core.addMethod(
  16252. $core.method({
  16253. selector: "<<",
  16254. protocol: 'writing',
  16255. fn: function (anObject){
  16256. var self=this;
  16257. return $core.withContext(function($ctx1) {
  16258. self._write_(anObject);
  16259. return self;
  16260. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  16261. },
  16262. args: ["anObject"],
  16263. source: "<< anObject\x0a\x09self write: anObject",
  16264. referencedClasses: [],
  16265. messageSends: ["write:"]
  16266. }),
  16267. $globals.ProtoStream);
  16268. $core.addMethod(
  16269. $core.method({
  16270. selector: "atEnd",
  16271. protocol: 'testing',
  16272. fn: function (){
  16273. var self=this;
  16274. return $core.withContext(function($ctx1) {
  16275. self._subclassResponsibility();
  16276. return self;
  16277. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  16278. },
  16279. args: [],
  16280. source: "atEnd\x0a\x09self subclassResponsibility",
  16281. referencedClasses: [],
  16282. messageSends: ["subclassResponsibility"]
  16283. }),
  16284. $globals.ProtoStream);
  16285. $core.addMethod(
  16286. $core.method({
  16287. selector: "atStart",
  16288. protocol: 'testing',
  16289. fn: function (){
  16290. var self=this;
  16291. return $core.withContext(function($ctx1) {
  16292. self._subclassResponsibility();
  16293. return self;
  16294. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  16295. },
  16296. args: [],
  16297. source: "atStart\x0a\x09self subclassResponsibility",
  16298. referencedClasses: [],
  16299. messageSends: ["subclassResponsibility"]
  16300. }),
  16301. $globals.ProtoStream);
  16302. $core.addMethod(
  16303. $core.method({
  16304. selector: "contents",
  16305. protocol: 'accessing',
  16306. fn: function (){
  16307. var self=this;
  16308. return $core.withContext(function($ctx1) {
  16309. self._subclassResponsibility();
  16310. return self;
  16311. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  16312. },
  16313. args: [],
  16314. source: "contents\x0a\x09self subclassResponsibility",
  16315. referencedClasses: [],
  16316. messageSends: ["subclassResponsibility"]
  16317. }),
  16318. $globals.ProtoStream);
  16319. $core.addMethod(
  16320. $core.method({
  16321. selector: "do:",
  16322. protocol: 'enumerating',
  16323. fn: function (aBlock){
  16324. var self=this;
  16325. return $core.withContext(function($ctx1) {
  16326. $recv((function(){
  16327. return $core.withContext(function($ctx2) {
  16328. return self._atEnd();
  16329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16330. }))._whileFalse_((function(){
  16331. return $core.withContext(function($ctx2) {
  16332. return $recv(aBlock)._value_(self._next());
  16333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16334. }));
  16335. return self;
  16336. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  16337. },
  16338. args: ["aBlock"],
  16339. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  16340. referencedClasses: [],
  16341. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  16342. }),
  16343. $globals.ProtoStream);
  16344. $core.addMethod(
  16345. $core.method({
  16346. selector: "isEmpty",
  16347. protocol: 'testing',
  16348. fn: function (){
  16349. var self=this;
  16350. return $core.withContext(function($ctx1) {
  16351. var $1;
  16352. $1=$recv(self._atStart())._and_((function(){
  16353. return $core.withContext(function($ctx2) {
  16354. return self._atEnd();
  16355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16356. }));
  16357. return $1;
  16358. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  16359. },
  16360. args: [],
  16361. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  16362. referencedClasses: [],
  16363. messageSends: ["and:", "atStart", "atEnd"]
  16364. }),
  16365. $globals.ProtoStream);
  16366. $core.addMethod(
  16367. $core.method({
  16368. selector: "next",
  16369. protocol: 'reading',
  16370. fn: function (){
  16371. var self=this;
  16372. return $core.withContext(function($ctx1) {
  16373. var $2,$1;
  16374. $2=self._atEnd();
  16375. if($core.assert($2)){
  16376. $1=nil;
  16377. } else {
  16378. $1=self._subclassResponsibility();
  16379. };
  16380. return $1;
  16381. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  16382. },
  16383. args: [],
  16384. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16385. referencedClasses: [],
  16386. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16387. }),
  16388. $globals.ProtoStream);
  16389. $core.addMethod(
  16390. $core.method({
  16391. selector: "nextPut:",
  16392. protocol: 'writing',
  16393. fn: function (anObject){
  16394. var self=this;
  16395. return $core.withContext(function($ctx1) {
  16396. self._subclassResponsibility();
  16397. return self;
  16398. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  16399. },
  16400. args: ["anObject"],
  16401. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  16402. referencedClasses: [],
  16403. messageSends: ["subclassResponsibility"]
  16404. }),
  16405. $globals.ProtoStream);
  16406. $core.addMethod(
  16407. $core.method({
  16408. selector: "nextPutAll:",
  16409. protocol: 'writing',
  16410. fn: function (aCollection){
  16411. var self=this;
  16412. return $core.withContext(function($ctx1) {
  16413. $recv(aCollection)._do_((function(each){
  16414. return $core.withContext(function($ctx2) {
  16415. return self._nextPut_(each);
  16416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16417. }));
  16418. return self;
  16419. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  16420. },
  16421. args: ["aCollection"],
  16422. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  16423. referencedClasses: [],
  16424. messageSends: ["do:", "nextPut:"]
  16425. }),
  16426. $globals.ProtoStream);
  16427. $core.addMethod(
  16428. $core.method({
  16429. selector: "nextPutJSObject:",
  16430. protocol: 'writing',
  16431. fn: function (aJSObject){
  16432. var self=this;
  16433. return $core.withContext(function($ctx1) {
  16434. self._nextPut_(aJSObject);
  16435. return self;
  16436. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  16437. },
  16438. args: ["aJSObject"],
  16439. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  16440. referencedClasses: [],
  16441. messageSends: ["nextPut:"]
  16442. }),
  16443. $globals.ProtoStream);
  16444. $core.addMethod(
  16445. $core.method({
  16446. selector: "nextPutString:",
  16447. protocol: 'writing',
  16448. fn: function (aString){
  16449. var self=this;
  16450. return $core.withContext(function($ctx1) {
  16451. self._nextPut_(aString);
  16452. return self;
  16453. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  16454. },
  16455. args: ["aString"],
  16456. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  16457. referencedClasses: [],
  16458. messageSends: ["nextPut:"]
  16459. }),
  16460. $globals.ProtoStream);
  16461. $core.addMethod(
  16462. $core.method({
  16463. selector: "peek",
  16464. protocol: 'reading',
  16465. fn: function (){
  16466. var self=this;
  16467. return $core.withContext(function($ctx1) {
  16468. var $2,$1;
  16469. $2=self._atEnd();
  16470. if($core.assert($2)){
  16471. $1=nil;
  16472. } else {
  16473. $1=self._subclassResponsibility();
  16474. };
  16475. return $1;
  16476. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  16477. },
  16478. args: [],
  16479. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16480. referencedClasses: [],
  16481. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16482. }),
  16483. $globals.ProtoStream);
  16484. $core.addMethod(
  16485. $core.method({
  16486. selector: "reset",
  16487. protocol: 'actions',
  16488. fn: function (){
  16489. var self=this;
  16490. return $core.withContext(function($ctx1) {
  16491. self._subclassResponsibility();
  16492. return self;
  16493. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  16494. },
  16495. args: [],
  16496. source: "reset\x0a\x09self subclassResponsibility",
  16497. referencedClasses: [],
  16498. messageSends: ["subclassResponsibility"]
  16499. }),
  16500. $globals.ProtoStream);
  16501. $core.addMethod(
  16502. $core.method({
  16503. selector: "resetContents",
  16504. protocol: 'actions',
  16505. fn: function (){
  16506. var self=this;
  16507. return $core.withContext(function($ctx1) {
  16508. self._subclassResponsibility();
  16509. return self;
  16510. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16511. },
  16512. args: [],
  16513. source: "resetContents\x0a\x09self subclassResponsibility",
  16514. referencedClasses: [],
  16515. messageSends: ["subclassResponsibility"]
  16516. }),
  16517. $globals.ProtoStream);
  16518. $core.addMethod(
  16519. $core.method({
  16520. selector: "setToEnd",
  16521. protocol: 'positioning',
  16522. fn: function (){
  16523. var self=this;
  16524. return $core.withContext(function($ctx1) {
  16525. self._subclassResponsibility();
  16526. return self;
  16527. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16528. },
  16529. args: [],
  16530. source: "setToEnd\x0a\x09self subclassResponsibility",
  16531. referencedClasses: [],
  16532. messageSends: ["subclassResponsibility"]
  16533. }),
  16534. $globals.ProtoStream);
  16535. $core.addMethod(
  16536. $core.method({
  16537. selector: "setToStart",
  16538. protocol: 'positioning',
  16539. fn: function (){
  16540. var self=this;
  16541. return $core.withContext(function($ctx1) {
  16542. self._reset();
  16543. return self;
  16544. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16545. },
  16546. args: [],
  16547. source: "setToStart\x0a\x09self reset",
  16548. referencedClasses: [],
  16549. messageSends: ["reset"]
  16550. }),
  16551. $globals.ProtoStream);
  16552. $core.addMethod(
  16553. $core.method({
  16554. selector: "write:",
  16555. protocol: 'writing',
  16556. fn: function (anObject){
  16557. var self=this;
  16558. return $core.withContext(function($ctx1) {
  16559. $recv(anObject)._putOn_(self);
  16560. return self;
  16561. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16562. },
  16563. args: ["anObject"],
  16564. source: "write: anObject\x0a\x09anObject putOn: self",
  16565. referencedClasses: [],
  16566. messageSends: ["putOn:"]
  16567. }),
  16568. $globals.ProtoStream);
  16569. $core.addMethod(
  16570. $core.method({
  16571. selector: "on:",
  16572. protocol: 'instance creation',
  16573. fn: function (aCollection){
  16574. var self=this;
  16575. return $core.withContext(function($ctx1) {
  16576. var $2,$3,$1;
  16577. $2=self._new();
  16578. $recv($2)._setCollection_(aCollection);
  16579. $recv($2)._setStreamSize_($recv(aCollection)._size());
  16580. $3=$recv($2)._yourself();
  16581. $1=$3;
  16582. return $1;
  16583. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16584. },
  16585. args: ["aCollection"],
  16586. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16587. referencedClasses: [],
  16588. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16589. }),
  16590. $globals.ProtoStream.klass);
  16591. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16592. $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.";
  16593. $core.addMethod(
  16594. $core.method({
  16595. selector: "atEnd",
  16596. protocol: 'testing',
  16597. fn: function (){
  16598. var self=this;
  16599. return $core.withContext(function($ctx1) {
  16600. var $1;
  16601. $1=$recv(self._position()).__eq(self._size());
  16602. return $1;
  16603. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16604. },
  16605. args: [],
  16606. source: "atEnd\x0a\x09^ self position = self size",
  16607. referencedClasses: [],
  16608. messageSends: ["=", "position", "size"]
  16609. }),
  16610. $globals.Stream);
  16611. $core.addMethod(
  16612. $core.method({
  16613. selector: "atStart",
  16614. protocol: 'testing',
  16615. fn: function (){
  16616. var self=this;
  16617. return $core.withContext(function($ctx1) {
  16618. var $1;
  16619. $1=$recv(self._position()).__eq((0));
  16620. return $1;
  16621. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16622. },
  16623. args: [],
  16624. source: "atStart\x0a\x09^ self position = 0",
  16625. referencedClasses: [],
  16626. messageSends: ["=", "position"]
  16627. }),
  16628. $globals.Stream);
  16629. $core.addMethod(
  16630. $core.method({
  16631. selector: "close",
  16632. protocol: 'actions',
  16633. fn: function (){
  16634. var self=this;
  16635. return self;
  16636. },
  16637. args: [],
  16638. source: "close",
  16639. referencedClasses: [],
  16640. messageSends: []
  16641. }),
  16642. $globals.Stream);
  16643. $core.addMethod(
  16644. $core.method({
  16645. selector: "collection",
  16646. protocol: 'accessing',
  16647. fn: function (){
  16648. var self=this;
  16649. var $1;
  16650. $1=self["@collection"];
  16651. return $1;
  16652. },
  16653. args: [],
  16654. source: "collection\x0a\x09^ collection",
  16655. referencedClasses: [],
  16656. messageSends: []
  16657. }),
  16658. $globals.Stream);
  16659. $core.addMethod(
  16660. $core.method({
  16661. selector: "contents",
  16662. protocol: 'accessing',
  16663. fn: function (){
  16664. var self=this;
  16665. return $core.withContext(function($ctx1) {
  16666. var $1;
  16667. $1=$recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16668. return $1;
  16669. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16670. },
  16671. args: [],
  16672. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16673. referencedClasses: [],
  16674. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16675. }),
  16676. $globals.Stream);
  16677. $core.addMethod(
  16678. $core.method({
  16679. selector: "flush",
  16680. protocol: 'actions',
  16681. fn: function (){
  16682. var self=this;
  16683. return self;
  16684. },
  16685. args: [],
  16686. source: "flush",
  16687. referencedClasses: [],
  16688. messageSends: []
  16689. }),
  16690. $globals.Stream);
  16691. $core.addMethod(
  16692. $core.method({
  16693. selector: "isEmpty",
  16694. protocol: 'testing',
  16695. fn: function (){
  16696. var self=this;
  16697. return $core.withContext(function($ctx1) {
  16698. var $1;
  16699. $1=$recv(self._size()).__eq((0));
  16700. return $1;
  16701. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16702. },
  16703. args: [],
  16704. source: "isEmpty\x0a\x09^ self size = 0",
  16705. referencedClasses: [],
  16706. messageSends: ["=", "size"]
  16707. }),
  16708. $globals.Stream);
  16709. $core.addMethod(
  16710. $core.method({
  16711. selector: "next",
  16712. protocol: 'reading',
  16713. fn: function (){
  16714. var self=this;
  16715. return $core.withContext(function($ctx1) {
  16716. var $2,$4,$3,$1;
  16717. $2=self._atEnd();
  16718. if($core.assert($2)){
  16719. $1=nil;
  16720. } else {
  16721. $4=self._position();
  16722. $ctx1.sendIdx["position"]=1;
  16723. $3=$recv($4).__plus((1));
  16724. self._position_($3);
  16725. $1=$recv(self["@collection"])._at_(self._position());
  16726. };
  16727. return $1;
  16728. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16729. },
  16730. args: [],
  16731. 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 ]",
  16732. referencedClasses: [],
  16733. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16734. }),
  16735. $globals.Stream);
  16736. $core.addMethod(
  16737. $core.method({
  16738. selector: "next:",
  16739. protocol: 'reading',
  16740. fn: function (anInteger){
  16741. var self=this;
  16742. var tempCollection;
  16743. return $core.withContext(function($ctx1) {
  16744. var $1,$2;
  16745. tempCollection=$recv($recv(self._collection())._class())._new();
  16746. $recv(anInteger)._timesRepeat_((function(){
  16747. return $core.withContext(function($ctx2) {
  16748. $1=self._atEnd();
  16749. if(!$core.assert($1)){
  16750. return $recv(tempCollection)._add_(self._next());
  16751. };
  16752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16753. }));
  16754. $2=tempCollection;
  16755. return $2;
  16756. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16757. },
  16758. args: ["anInteger"],
  16759. 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",
  16760. referencedClasses: [],
  16761. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16762. }),
  16763. $globals.Stream);
  16764. $core.addMethod(
  16765. $core.method({
  16766. selector: "nextPut:",
  16767. protocol: 'writing',
  16768. fn: function (anObject){
  16769. var self=this;
  16770. return $core.withContext(function($ctx1) {
  16771. var $2,$1,$3,$4;
  16772. $2=self._position();
  16773. $ctx1.sendIdx["position"]=1;
  16774. $1=$recv($2).__plus((1));
  16775. self._position_($1);
  16776. $3=self._collection();
  16777. $4=self._position();
  16778. $ctx1.sendIdx["position"]=2;
  16779. $recv($3)._at_put_($4,anObject);
  16780. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16781. return self;
  16782. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16783. },
  16784. args: ["anObject"],
  16785. 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)",
  16786. referencedClasses: [],
  16787. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  16788. }),
  16789. $globals.Stream);
  16790. $core.addMethod(
  16791. $core.method({
  16792. selector: "peek",
  16793. protocol: 'reading',
  16794. fn: function (){
  16795. var self=this;
  16796. return $core.withContext(function($ctx1) {
  16797. var $2,$1;
  16798. $2=self._atEnd();
  16799. if(!$core.assert($2)){
  16800. $1=$recv(self._collection())._at_($recv(self._position()).__plus((1)));
  16801. };
  16802. return $1;
  16803. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  16804. },
  16805. args: [],
  16806. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  16807. referencedClasses: [],
  16808. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  16809. }),
  16810. $globals.Stream);
  16811. $core.addMethod(
  16812. $core.method({
  16813. selector: "position",
  16814. protocol: 'accessing',
  16815. fn: function (){
  16816. var self=this;
  16817. return $core.withContext(function($ctx1) {
  16818. var $2,$1,$receiver;
  16819. $2=self["@position"];
  16820. if(($receiver = $2) == null || $receiver.isNil){
  16821. self["@position"]=(0);
  16822. $1=self["@position"];
  16823. } else {
  16824. $1=$2;
  16825. };
  16826. return $1;
  16827. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  16828. },
  16829. args: [],
  16830. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  16831. referencedClasses: [],
  16832. messageSends: ["ifNil:"]
  16833. }),
  16834. $globals.Stream);
  16835. $core.addMethod(
  16836. $core.method({
  16837. selector: "position:",
  16838. protocol: 'accessing',
  16839. fn: function (anInteger){
  16840. var self=this;
  16841. self["@position"]=anInteger;
  16842. return self;
  16843. },
  16844. args: ["anInteger"],
  16845. source: "position: anInteger\x0a\x09position := anInteger",
  16846. referencedClasses: [],
  16847. messageSends: []
  16848. }),
  16849. $globals.Stream);
  16850. $core.addMethod(
  16851. $core.method({
  16852. selector: "reset",
  16853. protocol: 'actions',
  16854. fn: function (){
  16855. var self=this;
  16856. return $core.withContext(function($ctx1) {
  16857. self._position_((0));
  16858. return self;
  16859. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  16860. },
  16861. args: [],
  16862. source: "reset\x0a\x09self position: 0",
  16863. referencedClasses: [],
  16864. messageSends: ["position:"]
  16865. }),
  16866. $globals.Stream);
  16867. $core.addMethod(
  16868. $core.method({
  16869. selector: "resetContents",
  16870. protocol: 'actions',
  16871. fn: function (){
  16872. var self=this;
  16873. return $core.withContext(function($ctx1) {
  16874. self._reset();
  16875. self._setStreamSize_((0));
  16876. return self;
  16877. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  16878. },
  16879. args: [],
  16880. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  16881. referencedClasses: [],
  16882. messageSends: ["reset", "setStreamSize:"]
  16883. }),
  16884. $globals.Stream);
  16885. $core.addMethod(
  16886. $core.method({
  16887. selector: "setCollection:",
  16888. protocol: 'accessing',
  16889. fn: function (aCollection){
  16890. var self=this;
  16891. self["@collection"]=aCollection;
  16892. return self;
  16893. },
  16894. args: ["aCollection"],
  16895. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  16896. referencedClasses: [],
  16897. messageSends: []
  16898. }),
  16899. $globals.Stream);
  16900. $core.addMethod(
  16901. $core.method({
  16902. selector: "setStreamSize:",
  16903. protocol: 'accessing',
  16904. fn: function (anInteger){
  16905. var self=this;
  16906. self["@streamSize"]=anInteger;
  16907. return self;
  16908. },
  16909. args: ["anInteger"],
  16910. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  16911. referencedClasses: [],
  16912. messageSends: []
  16913. }),
  16914. $globals.Stream);
  16915. $core.addMethod(
  16916. $core.method({
  16917. selector: "setToEnd",
  16918. protocol: 'positioning',
  16919. fn: function (){
  16920. var self=this;
  16921. return $core.withContext(function($ctx1) {
  16922. self._position_(self._size());
  16923. return self;
  16924. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  16925. },
  16926. args: [],
  16927. source: "setToEnd\x0a\x09self position: self size",
  16928. referencedClasses: [],
  16929. messageSends: ["position:", "size"]
  16930. }),
  16931. $globals.Stream);
  16932. $core.addMethod(
  16933. $core.method({
  16934. selector: "size",
  16935. protocol: 'accessing',
  16936. fn: function (){
  16937. var self=this;
  16938. return $core.withContext(function($ctx1) {
  16939. var $1;
  16940. $1=self._streamSize();
  16941. return $1;
  16942. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  16943. },
  16944. args: [],
  16945. source: "size\x0a\x09^ self streamSize",
  16946. referencedClasses: [],
  16947. messageSends: ["streamSize"]
  16948. }),
  16949. $globals.Stream);
  16950. $core.addMethod(
  16951. $core.method({
  16952. selector: "skip:",
  16953. protocol: 'positioning',
  16954. fn: function (anInteger){
  16955. var self=this;
  16956. return $core.withContext(function($ctx1) {
  16957. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  16958. return self;
  16959. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  16960. },
  16961. args: ["anInteger"],
  16962. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  16963. referencedClasses: [],
  16964. messageSends: ["position:", "min:max:", "+", "position", "size"]
  16965. }),
  16966. $globals.Stream);
  16967. $core.addMethod(
  16968. $core.method({
  16969. selector: "streamSize",
  16970. protocol: 'accessing',
  16971. fn: function (){
  16972. var self=this;
  16973. var $1;
  16974. $1=self["@streamSize"];
  16975. return $1;
  16976. },
  16977. args: [],
  16978. source: "streamSize\x0a\x09^ streamSize",
  16979. referencedClasses: [],
  16980. messageSends: []
  16981. }),
  16982. $globals.Stream);
  16983. $core.addMethod(
  16984. $core.method({
  16985. selector: "on:",
  16986. protocol: 'instance creation',
  16987. fn: function (aCollection){
  16988. var self=this;
  16989. return $core.withContext(function($ctx1) {
  16990. var $2,$3,$1;
  16991. $2=self._new();
  16992. $recv($2)._setCollection_(aCollection);
  16993. $recv($2)._setStreamSize_($recv(aCollection)._size());
  16994. $3=$recv($2)._yourself();
  16995. $1=$3;
  16996. return $1;
  16997. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  16998. },
  16999. args: ["aCollection"],
  17000. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  17001. referencedClasses: [],
  17002. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  17003. }),
  17004. $globals.Stream.klass);
  17005. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  17006. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  17007. $core.addMethod(
  17008. $core.method({
  17009. selector: "cr",
  17010. protocol: 'writing',
  17011. fn: function (){
  17012. var self=this;
  17013. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17014. return $core.withContext(function($ctx1) {
  17015. var $1;
  17016. $1=self._nextPutAll_($recv($String())._cr());
  17017. return $1;
  17018. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  17019. },
  17020. args: [],
  17021. source: "cr\x0a\x09^ self nextPutAll: String cr",
  17022. referencedClasses: ["String"],
  17023. messageSends: ["nextPutAll:", "cr"]
  17024. }),
  17025. $globals.StringStream);
  17026. $core.addMethod(
  17027. $core.method({
  17028. selector: "crlf",
  17029. protocol: 'writing',
  17030. fn: function (){
  17031. var self=this;
  17032. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17033. return $core.withContext(function($ctx1) {
  17034. var $1;
  17035. $1=self._nextPutAll_($recv($String())._crlf());
  17036. return $1;
  17037. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  17038. },
  17039. args: [],
  17040. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  17041. referencedClasses: ["String"],
  17042. messageSends: ["nextPutAll:", "crlf"]
  17043. }),
  17044. $globals.StringStream);
  17045. $core.addMethod(
  17046. $core.method({
  17047. selector: "lf",
  17048. protocol: 'writing',
  17049. fn: function (){
  17050. var self=this;
  17051. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17052. return $core.withContext(function($ctx1) {
  17053. var $1;
  17054. $1=self._nextPutAll_($recv($String())._lf());
  17055. return $1;
  17056. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  17057. },
  17058. args: [],
  17059. source: "lf\x0a\x09^ self nextPutAll: String lf",
  17060. referencedClasses: ["String"],
  17061. messageSends: ["nextPutAll:", "lf"]
  17062. }),
  17063. $globals.StringStream);
  17064. $core.addMethod(
  17065. $core.method({
  17066. selector: "next:",
  17067. protocol: 'reading',
  17068. fn: function (anInteger){
  17069. var self=this;
  17070. var tempCollection;
  17071. return $core.withContext(function($ctx1) {
  17072. var $1,$2;
  17073. tempCollection=$recv($recv(self._collection())._class())._new();
  17074. $recv(anInteger)._timesRepeat_((function(){
  17075. return $core.withContext(function($ctx2) {
  17076. $1=self._atEnd();
  17077. if(!$core.assert($1)){
  17078. tempCollection=$recv(tempCollection).__comma(self._next());
  17079. return tempCollection;
  17080. };
  17081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17082. }));
  17083. $2=tempCollection;
  17084. return $2;
  17085. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  17086. },
  17087. args: ["anInteger"],
  17088. 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",
  17089. referencedClasses: [],
  17090. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  17091. }),
  17092. $globals.StringStream);
  17093. $core.addMethod(
  17094. $core.method({
  17095. selector: "nextPut:",
  17096. protocol: 'writing',
  17097. fn: function (aString){
  17098. var self=this;
  17099. return $core.withContext(function($ctx1) {
  17100. self._nextPutAll_(aString);
  17101. return self;
  17102. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  17103. },
  17104. args: ["aString"],
  17105. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  17106. referencedClasses: [],
  17107. messageSends: ["nextPutAll:"]
  17108. }),
  17109. $globals.StringStream);
  17110. $core.addMethod(
  17111. $core.method({
  17112. selector: "nextPutAll:",
  17113. protocol: 'writing',
  17114. fn: function (aString){
  17115. var self=this;
  17116. var pre,post;
  17117. return $core.withContext(function($ctx1) {
  17118. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  17119. $1=self._atEnd();
  17120. if($core.assert($1)){
  17121. $3=self._collection();
  17122. $ctx1.sendIdx["collection"]=1;
  17123. $2=$recv($3).__comma(aString);
  17124. $ctx1.sendIdx[","]=1;
  17125. self._setCollection_($2);
  17126. $ctx1.sendIdx["setCollection:"]=1;
  17127. } else {
  17128. $4=self._collection();
  17129. $ctx1.sendIdx["collection"]=2;
  17130. $5=self._position();
  17131. $ctx1.sendIdx["position"]=1;
  17132. pre=$recv($4)._copyFrom_to_((1),$5);
  17133. $ctx1.sendIdx["copyFrom:to:"]=1;
  17134. pre;
  17135. $6=self._collection();
  17136. $ctx1.sendIdx["collection"]=3;
  17137. $9=self._position();
  17138. $ctx1.sendIdx["position"]=2;
  17139. $8=$recv($9).__plus((1));
  17140. $ctx1.sendIdx["+"]=2;
  17141. $10=$recv(aString)._size();
  17142. $ctx1.sendIdx["size"]=1;
  17143. $7=$recv($8).__plus($10);
  17144. $ctx1.sendIdx["+"]=1;
  17145. $11=$recv(self._collection())._size();
  17146. $ctx1.sendIdx["size"]=2;
  17147. post=$recv($6)._copyFrom_to_($7,$11);
  17148. post;
  17149. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  17150. $ctx1.sendIdx[","]=2;
  17151. self._setCollection_($12);
  17152. };
  17153. $14=self._position();
  17154. $ctx1.sendIdx["position"]=3;
  17155. $13=$recv($14).__plus($recv(aString)._size());
  17156. self._position_($13);
  17157. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  17158. return self;
  17159. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  17160. },
  17161. args: ["aString"],
  17162. 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)",
  17163. referencedClasses: [],
  17164. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  17165. }),
  17166. $globals.StringStream);
  17167. $core.addMethod(
  17168. $core.method({
  17169. selector: "nextPutString:",
  17170. protocol: 'writing',
  17171. fn: function (aString){
  17172. var self=this;
  17173. return $core.withContext(function($ctx1) {
  17174. self._nextPutAll_(aString);
  17175. return self;
  17176. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  17177. },
  17178. args: ["aString"],
  17179. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  17180. referencedClasses: [],
  17181. messageSends: ["nextPutAll:"]
  17182. }),
  17183. $globals.StringStream);
  17184. $core.addMethod(
  17185. $core.method({
  17186. selector: "space",
  17187. protocol: 'writing',
  17188. fn: function (){
  17189. var self=this;
  17190. return $core.withContext(function($ctx1) {
  17191. self._nextPut_(" ");
  17192. return self;
  17193. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  17194. },
  17195. args: [],
  17196. source: "space\x0a\x09self nextPut: ' '",
  17197. referencedClasses: [],
  17198. messageSends: ["nextPut:"]
  17199. }),
  17200. $globals.StringStream);
  17201. $core.addMethod(
  17202. $core.method({
  17203. selector: "tab",
  17204. protocol: 'writing',
  17205. fn: function (){
  17206. var self=this;
  17207. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17208. return $core.withContext(function($ctx1) {
  17209. var $1;
  17210. $1=self._nextPutAll_($recv($String())._tab());
  17211. return $1;
  17212. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  17213. },
  17214. args: [],
  17215. source: "tab\x0a\x09^ self nextPutAll: String tab",
  17216. referencedClasses: ["String"],
  17217. messageSends: ["nextPutAll:", "tab"]
  17218. }),
  17219. $globals.StringStream);
  17220. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  17221. $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.";
  17222. $core.addMethod(
  17223. $core.method({
  17224. selector: "initialize",
  17225. protocol: 'initialization',
  17226. fn: function (){
  17227. var self=this;
  17228. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  17229. return $core.withContext(function($ctx1) {
  17230. (
  17231. $ctx1.supercall = true,
  17232. $globals.Queue.superclass.fn.prototype._initialize.apply($recv(self), []));
  17233. $ctx1.supercall = false;
  17234. self["@read"]=$recv($OrderedCollection())._new();
  17235. $ctx1.sendIdx["new"]=1;
  17236. self["@write"]=$recv($OrderedCollection())._new();
  17237. self["@readIndex"]=(1);
  17238. return self;
  17239. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  17240. },
  17241. args: [],
  17242. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  17243. referencedClasses: ["OrderedCollection"],
  17244. messageSends: ["initialize", "new"]
  17245. }),
  17246. $globals.Queue);
  17247. $core.addMethod(
  17248. $core.method({
  17249. selector: "next",
  17250. protocol: 'accessing',
  17251. fn: function (){
  17252. var self=this;
  17253. return $core.withContext(function($ctx1) {
  17254. var $1;
  17255. $1=self._nextIfAbsent_((function(){
  17256. return $core.withContext(function($ctx2) {
  17257. return self._error_("Cannot read from empty Queue.");
  17258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17259. }));
  17260. return $1;
  17261. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  17262. },
  17263. args: [],
  17264. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  17265. referencedClasses: [],
  17266. messageSends: ["nextIfAbsent:", "error:"]
  17267. }),
  17268. $globals.Queue);
  17269. $core.addMethod(
  17270. $core.method({
  17271. selector: "nextIfAbsent:",
  17272. protocol: 'accessing',
  17273. fn: function (aBlock){
  17274. var self=this;
  17275. var result;
  17276. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  17277. return $core.withContext(function($ctx1) {
  17278. var $1,$2,$3,$4;
  17279. var $early={};
  17280. try {
  17281. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  17282. return $core.withContext(function($ctx2) {
  17283. $1=$recv(self["@write"])._isEmpty();
  17284. if($core.assert($1)){
  17285. $2=$recv(self["@readIndex"]).__gt((1));
  17286. if($core.assert($2)){
  17287. self["@read"]=[];
  17288. self["@read"];
  17289. self["@readIndex"]=(1);
  17290. self["@readIndex"];
  17291. };
  17292. $3=$recv(aBlock)._value();
  17293. throw $early=[$3];
  17294. };
  17295. self["@read"]=self["@write"];
  17296. self["@read"];
  17297. self["@readIndex"]=(1);
  17298. self["@readIndex"];
  17299. self["@write"]=$recv($OrderedCollection())._new();
  17300. self["@write"];
  17301. return $recv(self["@read"])._first();
  17302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17303. }));
  17304. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  17305. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  17306. $4=result;
  17307. return $4;
  17308. }
  17309. catch(e) {if(e===$early)return e[0]; throw e}
  17310. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  17311. },
  17312. args: ["aBlock"],
  17313. 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",
  17314. referencedClasses: ["OrderedCollection"],
  17315. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  17316. }),
  17317. $globals.Queue);
  17318. $core.addMethod(
  17319. $core.method({
  17320. selector: "nextPut:",
  17321. protocol: 'accessing',
  17322. fn: function (anObject){
  17323. var self=this;
  17324. return $core.withContext(function($ctx1) {
  17325. $recv(self["@write"])._add_(anObject);
  17326. return self;
  17327. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  17328. },
  17329. args: ["anObject"],
  17330. source: "nextPut: anObject\x0a\x09write add: anObject",
  17331. referencedClasses: [],
  17332. messageSends: ["add:"]
  17333. }),
  17334. $globals.Queue);
  17335. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  17336. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  17337. $core.addMethod(
  17338. $core.method({
  17339. selector: "compile:",
  17340. protocol: 'evaluating',
  17341. fn: function (aString){
  17342. var self=this;
  17343. return $core.withContext(function($ctx1) {
  17344. return self.compile(aString);
  17345. return self;
  17346. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  17347. },
  17348. args: ["aString"],
  17349. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  17350. referencedClasses: [],
  17351. messageSends: []
  17352. }),
  17353. $globals.RegularExpression);
  17354. $core.addMethod(
  17355. $core.method({
  17356. selector: "exec:",
  17357. protocol: 'evaluating',
  17358. fn: function (aString){
  17359. var self=this;
  17360. return $core.withContext(function($ctx1) {
  17361. return self.exec(aString) || nil;
  17362. return self;
  17363. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  17364. },
  17365. args: ["aString"],
  17366. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  17367. referencedClasses: [],
  17368. messageSends: []
  17369. }),
  17370. $globals.RegularExpression);
  17371. $core.addMethod(
  17372. $core.method({
  17373. selector: "test:",
  17374. protocol: 'evaluating',
  17375. fn: function (aString){
  17376. var self=this;
  17377. return $core.withContext(function($ctx1) {
  17378. return self.test(aString);
  17379. return self;
  17380. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  17381. },
  17382. args: ["aString"],
  17383. source: "test: aString\x0a\x09<return self.test(aString)>",
  17384. referencedClasses: [],
  17385. messageSends: []
  17386. }),
  17387. $globals.RegularExpression);
  17388. $core.addMethod(
  17389. $core.method({
  17390. selector: "fromString:",
  17391. protocol: 'instance creation',
  17392. fn: function (aString){
  17393. var self=this;
  17394. return $core.withContext(function($ctx1) {
  17395. var $1;
  17396. $1=self._fromString_flag_(aString,"");
  17397. return $1;
  17398. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  17399. },
  17400. args: ["aString"],
  17401. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  17402. referencedClasses: [],
  17403. messageSends: ["fromString:flag:"]
  17404. }),
  17405. $globals.RegularExpression.klass);
  17406. $core.addMethod(
  17407. $core.method({
  17408. selector: "fromString:flag:",
  17409. protocol: 'instance creation',
  17410. fn: function (aString,anotherString){
  17411. var self=this;
  17412. return $core.withContext(function($ctx1) {
  17413. return new RegExp(aString, anotherString);
  17414. return self;
  17415. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  17416. },
  17417. args: ["aString", "anotherString"],
  17418. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  17419. referencedClasses: [],
  17420. messageSends: []
  17421. }),
  17422. $globals.RegularExpression.klass);
  17423. });
  17424. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){"use strict";
  17425. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  17426. $core.addPackage('Kernel-Infrastructure');
  17427. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  17428. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17429. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  17430. $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`.";
  17431. $core.addMethod(
  17432. $core.method({
  17433. selector: "=",
  17434. protocol: 'comparing',
  17435. fn: function (anObject){
  17436. var self=this;
  17437. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  17438. return $core.withContext(function($ctx1) {
  17439. var $2,$1,$3;
  17440. $2=$recv(anObject)._class();
  17441. $ctx1.sendIdx["class"]=1;
  17442. $1=$recv($2).__eq_eq(self._class());
  17443. if(!$core.assert($1)){
  17444. return false;
  17445. };
  17446. $3=$recv($JSObjectProxy())._compareJSObjectOfProxy_withProxy_(self,anObject);
  17447. return $3;
  17448. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  17449. },
  17450. args: ["anObject"],
  17451. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  17452. referencedClasses: ["JSObjectProxy"],
  17453. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  17454. }),
  17455. $globals.JSObjectProxy);
  17456. $core.addMethod(
  17457. $core.method({
  17458. selector: "asJSON",
  17459. protocol: 'enumerating',
  17460. fn: function (){
  17461. var self=this;
  17462. var $1;
  17463. $1=self["@jsObject"];
  17464. return $1;
  17465. },
  17466. args: [],
  17467. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  17468. referencedClasses: [],
  17469. messageSends: []
  17470. }),
  17471. $globals.JSObjectProxy);
  17472. $core.addMethod(
  17473. $core.method({
  17474. selector: "at:",
  17475. protocol: 'accessing',
  17476. fn: function (aString){
  17477. var self=this;
  17478. return $core.withContext(function($ctx1) {
  17479. return self['@jsObject'][aString];
  17480. return self;
  17481. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  17482. },
  17483. args: ["aString"],
  17484. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  17485. referencedClasses: [],
  17486. messageSends: []
  17487. }),
  17488. $globals.JSObjectProxy);
  17489. $core.addMethod(
  17490. $core.method({
  17491. selector: "at:ifAbsent:",
  17492. protocol: 'accessing',
  17493. fn: function (aString,aBlock){
  17494. var self=this;
  17495. return $core.withContext(function($ctx1) {
  17496. var obj = self['@jsObject'];
  17497. return aString in obj ? obj[aString] : aBlock._value();
  17498. ;
  17499. return self;
  17500. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  17501. },
  17502. args: ["aString", "aBlock"],
  17503. 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>",
  17504. referencedClasses: [],
  17505. messageSends: []
  17506. }),
  17507. $globals.JSObjectProxy);
  17508. $core.addMethod(
  17509. $core.method({
  17510. selector: "at:ifPresent:",
  17511. protocol: 'accessing',
  17512. fn: function (aString,aBlock){
  17513. var self=this;
  17514. return $core.withContext(function($ctx1) {
  17515. var obj = self['@jsObject'];
  17516. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  17517. ;
  17518. return self;
  17519. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  17520. },
  17521. args: ["aString", "aBlock"],
  17522. 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>",
  17523. referencedClasses: [],
  17524. messageSends: []
  17525. }),
  17526. $globals.JSObjectProxy);
  17527. $core.addMethod(
  17528. $core.method({
  17529. selector: "at:ifPresent:ifAbsent:",
  17530. protocol: 'accessing',
  17531. fn: function (aString,aBlock,anotherBlock){
  17532. var self=this;
  17533. return $core.withContext(function($ctx1) {
  17534. var obj = self['@jsObject'];
  17535. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  17536. ;
  17537. return self;
  17538. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  17539. },
  17540. args: ["aString", "aBlock", "anotherBlock"],
  17541. 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>",
  17542. referencedClasses: [],
  17543. messageSends: []
  17544. }),
  17545. $globals.JSObjectProxy);
  17546. $core.addMethod(
  17547. $core.method({
  17548. selector: "at:put:",
  17549. protocol: 'accessing',
  17550. fn: function (aString,anObject){
  17551. var self=this;
  17552. return $core.withContext(function($ctx1) {
  17553. return self['@jsObject'][aString] = anObject;
  17554. return self;
  17555. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  17556. },
  17557. args: ["aString", "anObject"],
  17558. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  17559. referencedClasses: [],
  17560. messageSends: []
  17561. }),
  17562. $globals.JSObjectProxy);
  17563. $core.addMethod(
  17564. $core.method({
  17565. selector: "doesNotUnderstand:",
  17566. protocol: 'proxy',
  17567. fn: function (aMessage){
  17568. var self=this;
  17569. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  17570. return $core.withContext(function($ctx1) {
  17571. var $2,$1,$receiver;
  17572. $2=$recv($JSObjectProxy())._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  17573. if(($receiver = $2) == null || $receiver.isNil){
  17574. $1=(
  17575. $ctx1.supercall = true,
  17576. $globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  17577. $ctx1.supercall = false;
  17578. } else {
  17579. var jsSelector;
  17580. jsSelector=$receiver;
  17581. $1=$recv($JSObjectProxy())._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  17582. };
  17583. return $1;
  17584. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  17585. },
  17586. args: ["aMessage"],
  17587. 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 ]",
  17588. referencedClasses: ["JSObjectProxy"],
  17589. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  17590. }),
  17591. $globals.JSObjectProxy);
  17592. $core.addMethod(
  17593. $core.method({
  17594. selector: "in:",
  17595. protocol: 'accessing',
  17596. fn: function (aValuable){
  17597. var self=this;
  17598. return $core.withContext(function($ctx1) {
  17599. var $1;
  17600. $1=$recv(aValuable)._value_(self["@jsObject"]);
  17601. return $1;
  17602. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  17603. },
  17604. args: ["aValuable"],
  17605. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  17606. referencedClasses: [],
  17607. messageSends: ["value:"]
  17608. }),
  17609. $globals.JSObjectProxy);
  17610. $core.addMethod(
  17611. $core.method({
  17612. selector: "jsObject",
  17613. protocol: 'accessing',
  17614. fn: function (){
  17615. var self=this;
  17616. var $1;
  17617. $1=self["@jsObject"];
  17618. return $1;
  17619. },
  17620. args: [],
  17621. source: "jsObject\x0a\x09^ jsObject",
  17622. referencedClasses: [],
  17623. messageSends: []
  17624. }),
  17625. $globals.JSObjectProxy);
  17626. $core.addMethod(
  17627. $core.method({
  17628. selector: "keysAndValuesDo:",
  17629. protocol: 'enumerating',
  17630. fn: function (aBlock){
  17631. var self=this;
  17632. return $core.withContext(function($ctx1) {
  17633. var o = self['@jsObject'];
  17634. for(var i in o) {
  17635. aBlock._value_value_(i, o[i]);
  17636. }
  17637. ;
  17638. return self;
  17639. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  17640. },
  17641. args: ["aBlock"],
  17642. 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>",
  17643. referencedClasses: [],
  17644. messageSends: []
  17645. }),
  17646. $globals.JSObjectProxy);
  17647. $core.addMethod(
  17648. $core.method({
  17649. selector: "printOn:",
  17650. protocol: 'printing',
  17651. fn: function (aStream){
  17652. var self=this;
  17653. return $core.withContext(function($ctx1) {
  17654. $recv(aStream)._nextPutAll_(self._printString());
  17655. return self;
  17656. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  17657. },
  17658. args: ["aStream"],
  17659. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  17660. referencedClasses: [],
  17661. messageSends: ["nextPutAll:", "printString"]
  17662. }),
  17663. $globals.JSObjectProxy);
  17664. $core.addMethod(
  17665. $core.method({
  17666. selector: "printString",
  17667. protocol: 'printing',
  17668. fn: function (){
  17669. var self=this;
  17670. return $core.withContext(function($ctx1) {
  17671. var js = self['@jsObject'];
  17672. return js.toString
  17673. ? js.toString()
  17674. : Object.prototype.toString.call(js)
  17675. ;
  17676. return self;
  17677. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  17678. },
  17679. args: [],
  17680. 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>",
  17681. referencedClasses: [],
  17682. messageSends: []
  17683. }),
  17684. $globals.JSObjectProxy);
  17685. $core.addMethod(
  17686. $core.method({
  17687. selector: "putOn:",
  17688. protocol: 'streaming',
  17689. fn: function (aStream){
  17690. var self=this;
  17691. return $core.withContext(function($ctx1) {
  17692. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  17693. return self;
  17694. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  17695. },
  17696. args: ["aStream"],
  17697. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  17698. referencedClasses: [],
  17699. messageSends: ["nextPutJSObject:"]
  17700. }),
  17701. $globals.JSObjectProxy);
  17702. $core.addMethod(
  17703. $core.method({
  17704. selector: "addObjectVariablesTo:ofProxy:",
  17705. protocol: 'proxy',
  17706. fn: function (aDictionary,aProxy){
  17707. var self=this;
  17708. return $core.withContext(function($ctx1) {
  17709. var jsObject = aProxy['@jsObject'];
  17710. for(var i in jsObject) {
  17711. aDictionary._at_put_(i, jsObject[i]);
  17712. }
  17713. ;
  17714. return self;
  17715. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17716. },
  17717. args: ["aDictionary", "aProxy"],
  17718. 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>",
  17719. referencedClasses: [],
  17720. messageSends: []
  17721. }),
  17722. $globals.JSObjectProxy.klass);
  17723. $core.addMethod(
  17724. $core.method({
  17725. selector: "compareJSObjectOfProxy:withProxy:",
  17726. protocol: 'proxy',
  17727. fn: function (aProxy,anotherProxy){
  17728. var self=this;
  17729. return $core.withContext(function($ctx1) {
  17730. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  17731. return aProxy["@jsObject"] === anotherJSObject;
  17732. return self;
  17733. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  17734. },
  17735. args: ["aProxy", "anotherProxy"],
  17736. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>",
  17737. referencedClasses: [],
  17738. messageSends: []
  17739. }),
  17740. $globals.JSObjectProxy.klass);
  17741. $core.addMethod(
  17742. $core.method({
  17743. selector: "forwardMessage:withArguments:ofProxy:",
  17744. protocol: 'proxy',
  17745. fn: function (aString,anArray,aProxy){
  17746. var self=this;
  17747. return $core.withContext(function($ctx1) {
  17748. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  17749. ;
  17750. return self;
  17751. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17752. },
  17753. args: ["aString", "anArray", "aProxy"],
  17754. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>",
  17755. referencedClasses: [],
  17756. messageSends: []
  17757. }),
  17758. $globals.JSObjectProxy.klass);
  17759. $core.addMethod(
  17760. $core.method({
  17761. selector: "jsObject:ofProxy:",
  17762. protocol: 'proxy',
  17763. fn: function (aJSObject,aProxy){
  17764. var self=this;
  17765. return $core.withContext(function($ctx1) {
  17766. aProxy['@jsObject'] = aJSObject;
  17767. return self;
  17768. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17769. },
  17770. args: ["aJSObject", "aProxy"],
  17771. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<aProxy['@jsObject'] = aJSObject>",
  17772. referencedClasses: [],
  17773. messageSends: []
  17774. }),
  17775. $globals.JSObjectProxy.klass);
  17776. $core.addMethod(
  17777. $core.method({
  17778. selector: "lookupProperty:ofProxy:",
  17779. protocol: 'proxy',
  17780. fn: function (aString,aProxy){
  17781. var self=this;
  17782. return $core.withContext(function($ctx1) {
  17783. return aString in aProxy._jsObject() ? aString : nil;
  17784. return self;
  17785. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17786. },
  17787. args: ["aString", "aProxy"],
  17788. 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>",
  17789. referencedClasses: [],
  17790. messageSends: []
  17791. }),
  17792. $globals.JSObjectProxy.klass);
  17793. $core.addMethod(
  17794. $core.method({
  17795. selector: "on:",
  17796. protocol: 'instance creation',
  17797. fn: function (aJSObject){
  17798. var self=this;
  17799. var instance;
  17800. return $core.withContext(function($ctx1) {
  17801. var $1;
  17802. instance=self._new();
  17803. self._jsObject_ofProxy_(aJSObject,instance);
  17804. $1=instance;
  17805. return $1;
  17806. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  17807. },
  17808. args: ["aJSObject"],
  17809. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  17810. referencedClasses: [],
  17811. messageSends: ["new", "jsObject:ofProxy:"]
  17812. }),
  17813. $globals.JSObjectProxy.klass);
  17814. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  17815. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  17816. $core.addMethod(
  17817. $core.method({
  17818. selector: "addElement:",
  17819. protocol: 'accessing',
  17820. fn: function (anObject){
  17821. var self=this;
  17822. return $core.withContext(function($ctx1) {
  17823. self.elements.addElement(anObject);
  17824. return self;
  17825. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  17826. },
  17827. args: ["anObject"],
  17828. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  17829. referencedClasses: [],
  17830. messageSends: []
  17831. }),
  17832. $globals.Organizer);
  17833. $core.addMethod(
  17834. $core.method({
  17835. selector: "elements",
  17836. protocol: 'accessing',
  17837. fn: function (){
  17838. var self=this;
  17839. return $core.withContext(function($ctx1) {
  17840. var $1;
  17841. $1=$recv(self._basicAt_("elements"))._copy();
  17842. return $1;
  17843. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  17844. },
  17845. args: [],
  17846. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  17847. referencedClasses: [],
  17848. messageSends: ["copy", "basicAt:"]
  17849. }),
  17850. $globals.Organizer);
  17851. $core.addMethod(
  17852. $core.method({
  17853. selector: "removeElement:",
  17854. protocol: 'accessing',
  17855. fn: function (anObject){
  17856. var self=this;
  17857. return $core.withContext(function($ctx1) {
  17858. self.elements.removeElement(anObject);
  17859. return self;
  17860. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  17861. },
  17862. args: ["anObject"],
  17863. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  17864. referencedClasses: [],
  17865. messageSends: []
  17866. }),
  17867. $globals.Organizer);
  17868. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  17869. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  17870. $core.addMethod(
  17871. $core.method({
  17872. selector: "addElement:",
  17873. protocol: 'accessing',
  17874. fn: function (aString){
  17875. var self=this;
  17876. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17877. function $ProtocolAdded(){return $globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  17878. return $core.withContext(function($ctx1) {
  17879. var $1,$2;
  17880. (
  17881. $ctx1.supercall = true,
  17882. $globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply($recv(self), [aString]));
  17883. $ctx1.supercall = false;
  17884. $1=$recv($ProtocolAdded())._new();
  17885. $recv($1)._protocol_(aString);
  17886. $recv($1)._theClass_(self._theClass());
  17887. $2=$recv($1)._yourself();
  17888. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  17889. return self;
  17890. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  17891. },
  17892. args: ["aString"],
  17893. 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)",
  17894. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  17895. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  17896. }),
  17897. $globals.ClassOrganizer);
  17898. $core.addMethod(
  17899. $core.method({
  17900. selector: "removeElement:",
  17901. protocol: 'accessing',
  17902. fn: function (aString){
  17903. var self=this;
  17904. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17905. function $ProtocolRemoved(){return $globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  17906. return $core.withContext(function($ctx1) {
  17907. var $1,$2;
  17908. (
  17909. $ctx1.supercall = true,
  17910. $globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply($recv(self), [aString]));
  17911. $ctx1.supercall = false;
  17912. $1=$recv($ProtocolRemoved())._new();
  17913. $recv($1)._protocol_(aString);
  17914. $recv($1)._theClass_(self._theClass());
  17915. $2=$recv($1)._yourself();
  17916. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  17917. return self;
  17918. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  17919. },
  17920. args: ["aString"],
  17921. 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)",
  17922. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  17923. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  17924. }),
  17925. $globals.ClassOrganizer);
  17926. $core.addMethod(
  17927. $core.method({
  17928. selector: "theClass",
  17929. protocol: 'accessing',
  17930. fn: function (){
  17931. var self=this;
  17932. return $core.withContext(function($ctx1) {
  17933. return self.theClass ;
  17934. return self;
  17935. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  17936. },
  17937. args: [],
  17938. source: "theClass\x0a\x09< return self.theClass >",
  17939. referencedClasses: [],
  17940. messageSends: []
  17941. }),
  17942. $globals.ClassOrganizer);
  17943. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  17944. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  17945. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  17946. $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'";
  17947. $core.addMethod(
  17948. $core.method({
  17949. selector: "basicImports",
  17950. protocol: 'private',
  17951. fn: function (){
  17952. var self=this;
  17953. return $core.withContext(function($ctx1) {
  17954. return self.imports || [];
  17955. return self;
  17956. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  17957. },
  17958. args: [],
  17959. 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 || []>",
  17960. referencedClasses: [],
  17961. messageSends: []
  17962. }),
  17963. $globals.Package);
  17964. $core.addMethod(
  17965. $core.method({
  17966. selector: "basicName:",
  17967. protocol: 'private',
  17968. fn: function (aString){
  17969. var self=this;
  17970. return $core.withContext(function($ctx1) {
  17971. self.pkgName = aString;
  17972. return self;
  17973. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  17974. },
  17975. args: ["aString"],
  17976. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  17977. referencedClasses: [],
  17978. messageSends: []
  17979. }),
  17980. $globals.Package);
  17981. $core.addMethod(
  17982. $core.method({
  17983. selector: "basicTransport",
  17984. protocol: 'private',
  17985. fn: function (){
  17986. var self=this;
  17987. return $core.withContext(function($ctx1) {
  17988. return self.transport;
  17989. return self;
  17990. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  17991. },
  17992. args: [],
  17993. 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>",
  17994. referencedClasses: [],
  17995. messageSends: []
  17996. }),
  17997. $globals.Package);
  17998. $core.addMethod(
  17999. $core.method({
  18000. selector: "beClean",
  18001. protocol: 'accessing',
  18002. fn: function (){
  18003. var self=this;
  18004. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18005. function $PackageClean(){return $globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
  18006. return $core.withContext(function($ctx1) {
  18007. var $1,$2;
  18008. self["@dirty"]=false;
  18009. $1=$recv($PackageClean())._new();
  18010. $recv($1)._package_(self);
  18011. $2=$recv($1)._yourself();
  18012. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  18013. return self;
  18014. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  18015. },
  18016. args: [],
  18017. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18018. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  18019. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18020. }),
  18021. $globals.Package);
  18022. $core.addMethod(
  18023. $core.method({
  18024. selector: "beDirty",
  18025. protocol: 'accessing',
  18026. fn: function (){
  18027. var self=this;
  18028. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18029. function $PackageDirty(){return $globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)}
  18030. return $core.withContext(function($ctx1) {
  18031. var $1,$2;
  18032. self["@dirty"]=true;
  18033. $1=$recv($PackageDirty())._new();
  18034. $recv($1)._package_(self);
  18035. $2=$recv($1)._yourself();
  18036. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  18037. return self;
  18038. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  18039. },
  18040. args: [],
  18041. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18042. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  18043. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18044. }),
  18045. $globals.Package);
  18046. $core.addMethod(
  18047. $core.method({
  18048. selector: "classTemplate",
  18049. protocol: 'accessing',
  18050. fn: function (){
  18051. var self=this;
  18052. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18053. return $core.withContext(function($ctx1) {
  18054. var $3,$4,$2,$5,$6,$7,$1;
  18055. $1=$recv($String())._streamContents_((function(stream){
  18056. return $core.withContext(function($ctx2) {
  18057. $recv(stream)._nextPutAll_("Object");
  18058. $ctx2.sendIdx["nextPutAll:"]=1;
  18059. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  18060. $ctx2.sendIdx["nextPutAll:"]=2;
  18061. $3=$recv($String())._lf();
  18062. $ctx2.sendIdx["lf"]=1;
  18063. $4=$recv($String())._tab();
  18064. $ctx2.sendIdx["tab"]=1;
  18065. $2=$recv($3).__comma($4);
  18066. $ctx2.sendIdx[","]=1;
  18067. $recv(stream)._nextPutAll_($2);
  18068. $ctx2.sendIdx["nextPutAll:"]=3;
  18069. $5=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  18070. $ctx2.sendIdx["nextPutAll:"]=4;
  18071. $5;
  18072. $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  18073. $ctx2.sendIdx[","]=2;
  18074. $recv(stream)._nextPutAll_($6);
  18075. $ctx2.sendIdx["nextPutAll:"]=5;
  18076. $recv(stream)._nextPutAll_("package: '");
  18077. $ctx2.sendIdx["nextPutAll:"]=6;
  18078. $recv(stream)._nextPutAll_(self._name());
  18079. $ctx2.sendIdx["nextPutAll:"]=7;
  18080. $7=$recv(stream)._nextPutAll_("'");
  18081. return $7;
  18082. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18083. }));
  18084. return $1;
  18085. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  18086. },
  18087. args: [],
  18088. 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: '''' ]",
  18089. referencedClasses: ["String"],
  18090. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  18091. }),
  18092. $globals.Package);
  18093. $core.addMethod(
  18094. $core.method({
  18095. selector: "classes",
  18096. protocol: 'classes',
  18097. fn: function (){
  18098. var self=this;
  18099. return $core.withContext(function($ctx1) {
  18100. var $1;
  18101. $1=$recv(self._organization())._elements();
  18102. return $1;
  18103. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  18104. },
  18105. args: [],
  18106. source: "classes\x0a\x09^ self organization elements",
  18107. referencedClasses: [],
  18108. messageSends: ["elements", "organization"]
  18109. }),
  18110. $globals.Package);
  18111. $core.addMethod(
  18112. $core.method({
  18113. selector: "definition",
  18114. protocol: 'accessing',
  18115. fn: function (){
  18116. var self=this;
  18117. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18118. return $core.withContext(function($ctx1) {
  18119. var $2,$4,$5,$3,$7,$6,$9,$10,$8,$11,$12,$1;
  18120. $1=$recv($String())._streamContents_((function(stream){
  18121. return $core.withContext(function($ctx2) {
  18122. $2=$recv(self._class())._name();
  18123. $ctx2.sendIdx["name"]=1;
  18124. $recv(stream)._nextPutAll_($2);
  18125. $ctx2.sendIdx["nextPutAll:"]=1;
  18126. $4=$recv($String())._lf();
  18127. $ctx2.sendIdx["lf"]=1;
  18128. $5=$recv($String())._tab();
  18129. $ctx2.sendIdx["tab"]=1;
  18130. $3=$recv($4).__comma($5);
  18131. $ctx2.sendIdx[","]=1;
  18132. $recv(stream)._nextPutAll_($3);
  18133. $ctx2.sendIdx["nextPutAll:"]=2;
  18134. $recv(stream)._nextPutAll_("named: ");
  18135. $ctx2.sendIdx["nextPutAll:"]=3;
  18136. $7="'".__comma(self._name());
  18137. $ctx2.sendIdx[","]=3;
  18138. $6=$recv($7).__comma("'");
  18139. $ctx2.sendIdx[","]=2;
  18140. $recv(stream)._nextPutAll_($6);
  18141. $ctx2.sendIdx["nextPutAll:"]=4;
  18142. $9=$recv($String())._lf();
  18143. $ctx2.sendIdx["lf"]=2;
  18144. $10=$recv($String())._tab();
  18145. $ctx2.sendIdx["tab"]=2;
  18146. $8=$recv($9).__comma($10);
  18147. $ctx2.sendIdx[","]=4;
  18148. $recv(stream)._nextPutAll_($8);
  18149. $ctx2.sendIdx["nextPutAll:"]=5;
  18150. $recv(stream)._nextPutAll_("imports: ");
  18151. $ctx2.sendIdx["nextPutAll:"]=6;
  18152. $recv(stream)._nextPutAll_(self._importsDefinition());
  18153. $ctx2.sendIdx["nextPutAll:"]=7;
  18154. $11=$recv($recv($String())._lf()).__comma($recv($String())._tab());
  18155. $ctx2.sendIdx[","]=5;
  18156. $recv(stream)._nextPutAll_($11);
  18157. $ctx2.sendIdx["nextPutAll:"]=8;
  18158. $recv(stream)._nextPutAll_("transport: (");
  18159. $ctx2.sendIdx["nextPutAll:"]=9;
  18160. $12=$recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  18161. return $12;
  18162. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18163. }));
  18164. return $1;
  18165. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  18166. },
  18167. args: [],
  18168. 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, ')' ]",
  18169. referencedClasses: ["String"],
  18170. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  18171. }),
  18172. $globals.Package);
  18173. $core.addMethod(
  18174. $core.method({
  18175. selector: "imports",
  18176. protocol: 'accessing',
  18177. fn: function (){
  18178. var self=this;
  18179. return $core.withContext(function($ctx1) {
  18180. var $2,$1,$receiver;
  18181. $2=self["@imports"];
  18182. if(($receiver = $2) == null || $receiver.isNil){
  18183. var parsed;
  18184. parsed=self._importsFromJson_(self._basicImports());
  18185. parsed;
  18186. self._imports_(parsed);
  18187. $1=self["@imports"];
  18188. } else {
  18189. $1=$2;
  18190. };
  18191. return $1;
  18192. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  18193. },
  18194. args: [],
  18195. 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 ]",
  18196. referencedClasses: [],
  18197. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  18198. }),
  18199. $globals.Package);
  18200. $core.addMethod(
  18201. $core.method({
  18202. selector: "imports:",
  18203. protocol: 'accessing',
  18204. fn: function (anArray){
  18205. var self=this;
  18206. return $core.withContext(function($ctx1) {
  18207. self._validateImports_(anArray);
  18208. self["@imports"]=$recv(anArray)._asSet();
  18209. return self;
  18210. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  18211. },
  18212. args: ["anArray"],
  18213. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  18214. referencedClasses: [],
  18215. messageSends: ["validateImports:", "asSet"]
  18216. }),
  18217. $globals.Package);
  18218. $core.addMethod(
  18219. $core.method({
  18220. selector: "importsAsJson",
  18221. protocol: 'converting',
  18222. fn: function (){
  18223. var self=this;
  18224. return $core.withContext(function($ctx1) {
  18225. var $2,$1;
  18226. $1=$recv(self._sortedImportsAsArray())._collect_((function(each){
  18227. return $core.withContext(function($ctx2) {
  18228. $2=$recv(each)._isString();
  18229. if($core.assert($2)){
  18230. return each;
  18231. } else {
  18232. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  18233. $ctx2.sendIdx[","]=1;
  18234. };
  18235. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18236. }));
  18237. return $1;
  18238. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  18239. },
  18240. args: [],
  18241. 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 ]]",
  18242. referencedClasses: [],
  18243. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  18244. }),
  18245. $globals.Package);
  18246. $core.addMethod(
  18247. $core.method({
  18248. selector: "importsDefinition",
  18249. protocol: 'accessing',
  18250. fn: function (){
  18251. var self=this;
  18252. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18253. return $core.withContext(function($ctx1) {
  18254. var $1;
  18255. $1=$recv($String())._streamContents_((function(stream){
  18256. return $core.withContext(function($ctx2) {
  18257. $recv(stream)._nextPutAll_("{");
  18258. $ctx2.sendIdx["nextPutAll:"]=1;
  18259. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  18260. return $core.withContext(function($ctx3) {
  18261. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  18262. $ctx3.sendIdx["nextPutAll:"]=2;
  18263. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  18264. }),(function(){
  18265. return $core.withContext(function($ctx3) {
  18266. return $recv(stream)._nextPutAll_(". ");
  18267. $ctx3.sendIdx["nextPutAll:"]=3;
  18268. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  18269. }));
  18270. return $recv(stream)._nextPutAll_("}");
  18271. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18272. }));
  18273. return $1;
  18274. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  18275. },
  18276. args: [],
  18277. 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: '}' ]",
  18278. referencedClasses: ["String"],
  18279. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  18280. }),
  18281. $globals.Package);
  18282. $core.addMethod(
  18283. $core.method({
  18284. selector: "importsFromJson:",
  18285. protocol: 'converting',
  18286. fn: function (anArray){
  18287. var self=this;
  18288. return $core.withContext(function($ctx1) {
  18289. var $2,$1;
  18290. $1=$recv(anArray)._collect_((function(each){
  18291. var split;
  18292. return $core.withContext(function($ctx2) {
  18293. split=$recv(each)._tokenize_("=");
  18294. split;
  18295. $2=$recv($recv(split)._size()).__eq((1));
  18296. if($core.assert($2)){
  18297. return $recv(split)._first();
  18298. $ctx2.sendIdx["first"]=1;
  18299. } else {
  18300. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  18301. };
  18302. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  18303. }));
  18304. return $1;
  18305. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  18306. },
  18307. args: ["anArray"],
  18308. 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 ]]",
  18309. referencedClasses: [],
  18310. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  18311. }),
  18312. $globals.Package);
  18313. $core.addMethod(
  18314. $core.method({
  18315. selector: "isDirty",
  18316. protocol: 'testing',
  18317. fn: function (){
  18318. var self=this;
  18319. return $core.withContext(function($ctx1) {
  18320. var $2,$1,$receiver;
  18321. $2=self["@dirty"];
  18322. if(($receiver = $2) == null || $receiver.isNil){
  18323. $1=false;
  18324. } else {
  18325. $1=$2;
  18326. };
  18327. return $1;
  18328. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  18329. },
  18330. args: [],
  18331. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  18332. referencedClasses: [],
  18333. messageSends: ["ifNil:"]
  18334. }),
  18335. $globals.Package);
  18336. $core.addMethod(
  18337. $core.method({
  18338. selector: "isPackage",
  18339. protocol: 'testing',
  18340. fn: function (){
  18341. var self=this;
  18342. return true;
  18343. },
  18344. args: [],
  18345. source: "isPackage\x0a\x09^ true",
  18346. referencedClasses: [],
  18347. messageSends: []
  18348. }),
  18349. $globals.Package);
  18350. $core.addMethod(
  18351. $core.method({
  18352. selector: "loadDependencies",
  18353. protocol: 'dependencies',
  18354. fn: function (){
  18355. var self=this;
  18356. var classes,packages;
  18357. return $core.withContext(function($ctx1) {
  18358. var $2,$3,$1;
  18359. classes=self._loadDependencyClasses();
  18360. $2=$recv($recv(classes)._collect_((function(each){
  18361. return $core.withContext(function($ctx2) {
  18362. return $recv(each)._package();
  18363. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18364. })))._asSet();
  18365. $recv($2)._remove_ifAbsent_(self,(function(){
  18366. }));
  18367. $3=$recv($2)._yourself();
  18368. $1=$3;
  18369. return $1;
  18370. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  18371. },
  18372. args: [],
  18373. 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",
  18374. referencedClasses: [],
  18375. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  18376. }),
  18377. $globals.Package);
  18378. $core.addMethod(
  18379. $core.method({
  18380. selector: "loadDependencyClasses",
  18381. protocol: 'dependencies',
  18382. fn: function (){
  18383. var self=this;
  18384. var starCategoryName;
  18385. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18386. return $core.withContext(function($ctx1) {
  18387. var $4,$3,$2,$6,$5,$7,$1;
  18388. starCategoryName="*".__comma(self._name());
  18389. $ctx1.sendIdx[","]=1;
  18390. $4=self._classes();
  18391. $ctx1.sendIdx["classes"]=1;
  18392. $3=$recv($4)._collect_((function(each){
  18393. return $core.withContext(function($ctx2) {
  18394. return $recv(each)._superclass();
  18395. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18396. }));
  18397. $2=$recv($3)._asSet();
  18398. $recv($2)._remove_ifAbsent_(nil,(function(){
  18399. }));
  18400. $recv($2)._addAll_($recv($recv($Smalltalk())._classes())._select_((function(each){
  18401. return $core.withContext(function($ctx2) {
  18402. $6=$recv(each)._protocols();
  18403. $ctx2.sendIdx["protocols"]=1;
  18404. $5=$recv($6).__comma($recv($recv(each)._class())._protocols());
  18405. return $recv($5)._includes_(starCategoryName);
  18406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  18407. })));
  18408. $7=$recv($2)._yourself();
  18409. $1=$7;
  18410. return $1;
  18411. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  18412. },
  18413. args: [],
  18414. 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",
  18415. referencedClasses: ["Smalltalk"],
  18416. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  18417. }),
  18418. $globals.Package);
  18419. $core.addMethod(
  18420. $core.method({
  18421. selector: "name",
  18422. protocol: 'accessing',
  18423. fn: function (){
  18424. var self=this;
  18425. return $core.withContext(function($ctx1) {
  18426. return self.pkgName;
  18427. return self;
  18428. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  18429. },
  18430. args: [],
  18431. source: "name\x0a\x09<return self.pkgName>",
  18432. referencedClasses: [],
  18433. messageSends: []
  18434. }),
  18435. $globals.Package);
  18436. $core.addMethod(
  18437. $core.method({
  18438. selector: "name:",
  18439. protocol: 'accessing',
  18440. fn: function (aString){
  18441. var self=this;
  18442. return $core.withContext(function($ctx1) {
  18443. self._basicName_(aString);
  18444. self._beDirty();
  18445. return self;
  18446. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  18447. },
  18448. args: ["aString"],
  18449. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  18450. referencedClasses: [],
  18451. messageSends: ["basicName:", "beDirty"]
  18452. }),
  18453. $globals.Package);
  18454. $core.addMethod(
  18455. $core.method({
  18456. selector: "organization",
  18457. protocol: 'accessing',
  18458. fn: function (){
  18459. var self=this;
  18460. return $core.withContext(function($ctx1) {
  18461. var $1;
  18462. $1=self._basicAt_("organization");
  18463. return $1;
  18464. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  18465. },
  18466. args: [],
  18467. source: "organization\x0a\x09^ self basicAt: 'organization'",
  18468. referencedClasses: [],
  18469. messageSends: ["basicAt:"]
  18470. }),
  18471. $globals.Package);
  18472. $core.addMethod(
  18473. $core.method({
  18474. selector: "printOn:",
  18475. protocol: 'printing',
  18476. fn: function (aStream){
  18477. var self=this;
  18478. return $core.withContext(function($ctx1) {
  18479. var $1;
  18480. (
  18481. $ctx1.supercall = true,
  18482. $globals.Package.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  18483. $ctx1.supercall = false;
  18484. $recv(aStream)._nextPutAll_(" (");
  18485. $ctx1.sendIdx["nextPutAll:"]=1;
  18486. $recv(aStream)._nextPutAll_(self._name());
  18487. $ctx1.sendIdx["nextPutAll:"]=2;
  18488. $1=$recv(aStream)._nextPutAll_(")");
  18489. return self;
  18490. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  18491. },
  18492. args: ["aStream"],
  18493. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  18494. referencedClasses: [],
  18495. messageSends: ["printOn:", "nextPutAll:", "name"]
  18496. }),
  18497. $globals.Package);
  18498. $core.addMethod(
  18499. $core.method({
  18500. selector: "setupClasses",
  18501. protocol: 'classes',
  18502. fn: function (){
  18503. var self=this;
  18504. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  18505. return $core.withContext(function($ctx1) {
  18506. var $1,$2;
  18507. $1=self._classes();
  18508. $recv($1)._do_((function(each){
  18509. return $core.withContext(function($ctx2) {
  18510. return $recv($recv($ClassBuilder())._new())._setupClass_(each);
  18511. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18512. }));
  18513. $ctx1.sendIdx["do:"]=1;
  18514. $2=$recv($1)._do_((function(each){
  18515. return $core.withContext(function($ctx2) {
  18516. return $recv(each)._initialize();
  18517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  18518. }));
  18519. return self;
  18520. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  18521. },
  18522. args: [],
  18523. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  18524. referencedClasses: ["ClassBuilder"],
  18525. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  18526. }),
  18527. $globals.Package);
  18528. $core.addMethod(
  18529. $core.method({
  18530. selector: "sortedClasses",
  18531. protocol: 'classes',
  18532. fn: function (){
  18533. var self=this;
  18534. return $core.withContext(function($ctx1) {
  18535. var $1;
  18536. $1=$recv(self._class())._sortedClasses_(self._classes());
  18537. return $1;
  18538. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  18539. },
  18540. args: [],
  18541. 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",
  18542. referencedClasses: [],
  18543. messageSends: ["sortedClasses:", "class", "classes"]
  18544. }),
  18545. $globals.Package);
  18546. $core.addMethod(
  18547. $core.method({
  18548. selector: "sortedImportsAsArray",
  18549. protocol: 'private',
  18550. fn: function (){
  18551. var self=this;
  18552. return $core.withContext(function($ctx1) {
  18553. var $4,$3,$5,$2,$7,$6,$8,$1;
  18554. $1=$recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  18555. return $core.withContext(function($ctx2) {
  18556. $4=$recv(a)._isString();
  18557. $ctx2.sendIdx["isString"]=1;
  18558. $3=$recv($4)._not();
  18559. $5=$recv(b)._isString();
  18560. $ctx2.sendIdx["isString"]=2;
  18561. $2=$recv($3).__and($5);
  18562. return $recv($2)._or_((function(){
  18563. return $core.withContext(function($ctx3) {
  18564. $7=$recv(a)._isString();
  18565. $ctx3.sendIdx["isString"]=3;
  18566. $6=$recv($7).__eq($recv(b)._isString());
  18567. return $recv($6)._and_((function(){
  18568. return $core.withContext(function($ctx4) {
  18569. $8=$recv(a)._value();
  18570. $ctx4.sendIdx["value"]=1;
  18571. return $recv($8).__lt_eq($recv(b)._value());
  18572. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  18573. }));
  18574. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  18575. }));
  18576. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  18577. }));
  18578. return $1;
  18579. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  18580. },
  18581. args: [],
  18582. 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 ]]]",
  18583. referencedClasses: [],
  18584. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  18585. }),
  18586. $globals.Package);
  18587. $core.addMethod(
  18588. $core.method({
  18589. selector: "transport",
  18590. protocol: 'accessing',
  18591. fn: function (){
  18592. var self=this;
  18593. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  18594. return $core.withContext(function($ctx1) {
  18595. var $2,$3,$4,$1,$receiver;
  18596. $2=self["@transport"];
  18597. if(($receiver = $2) == null || $receiver.isNil){
  18598. $3=$recv($PackageTransport())._fromJson_(self._basicTransport());
  18599. $recv($3)._package_(self);
  18600. $4=$recv($3)._yourself();
  18601. self["@transport"]=$4;
  18602. $1=self["@transport"];
  18603. } else {
  18604. $1=$2;
  18605. };
  18606. return $1;
  18607. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  18608. },
  18609. args: [],
  18610. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  18611. referencedClasses: ["PackageTransport"],
  18612. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  18613. }),
  18614. $globals.Package);
  18615. $core.addMethod(
  18616. $core.method({
  18617. selector: "transport:",
  18618. protocol: 'accessing',
  18619. fn: function (aPackageTransport){
  18620. var self=this;
  18621. return $core.withContext(function($ctx1) {
  18622. self["@transport"]=aPackageTransport;
  18623. $recv(aPackageTransport)._package_(self);
  18624. return self;
  18625. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  18626. },
  18627. args: ["aPackageTransport"],
  18628. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  18629. referencedClasses: [],
  18630. messageSends: ["package:"]
  18631. }),
  18632. $globals.Package);
  18633. $core.addMethod(
  18634. $core.method({
  18635. selector: "validateImports:",
  18636. protocol: 'validation',
  18637. fn: function (aCollection){
  18638. var self=this;
  18639. return $core.withContext(function($ctx1) {
  18640. var $1,$2,$5,$4,$3,$6;
  18641. $recv(aCollection)._do_((function(import_){
  18642. return $core.withContext(function($ctx2) {
  18643. $1=$recv(import_)._isString();
  18644. $ctx2.sendIdx["isString"]=1;
  18645. if(!$core.assert($1)){
  18646. $2=$recv(import_)._respondsTo_("key");
  18647. if(!$core.assert($2)){
  18648. self._error_("Imports must be Strings or Associations");
  18649. $ctx2.sendIdx["error:"]=1;
  18650. };
  18651. $5=$recv(import_)._key();
  18652. $ctx2.sendIdx["key"]=1;
  18653. $4=$recv($5)._isString();
  18654. $ctx2.sendIdx["isString"]=2;
  18655. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  18656. if(!$core.assert($3)){
  18657. self._error_("Key and value must be Strings");
  18658. $ctx2.sendIdx["error:"]=2;
  18659. };
  18660. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  18661. if(!$core.assert($6)){
  18662. return self._error_("Keys must be identifiers");
  18663. };
  18664. };
  18665. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  18666. }));
  18667. return self;
  18668. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  18669. },
  18670. args: ["aCollection"],
  18671. 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' ]]]",
  18672. referencedClasses: [],
  18673. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  18674. }),
  18675. $globals.Package);
  18676. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  18677. $core.addMethod(
  18678. $core.method({
  18679. selector: "named:",
  18680. protocol: 'accessing',
  18681. fn: function (aPackageName){
  18682. var self=this;
  18683. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18684. return $core.withContext(function($ctx1) {
  18685. var $1;
  18686. $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
  18687. return $core.withContext(function($ctx2) {
  18688. return $recv($Smalltalk())._createPackage_(aPackageName);
  18689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18690. }));
  18691. return $1;
  18692. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  18693. },
  18694. args: ["aPackageName"],
  18695. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  18696. referencedClasses: ["Smalltalk"],
  18697. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  18698. }),
  18699. $globals.Package.klass);
  18700. $core.addMethod(
  18701. $core.method({
  18702. selector: "named:ifAbsent:",
  18703. protocol: 'accessing',
  18704. fn: function (aPackageName,aBlock){
  18705. var self=this;
  18706. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18707. return $core.withContext(function($ctx1) {
  18708. var $1;
  18709. $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
  18710. return $1;
  18711. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  18712. },
  18713. args: ["aPackageName", "aBlock"],
  18714. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  18715. referencedClasses: ["Smalltalk"],
  18716. messageSends: ["packageAt:ifAbsent:"]
  18717. }),
  18718. $globals.Package.klass);
  18719. $core.addMethod(
  18720. $core.method({
  18721. selector: "named:imports:transport:",
  18722. protocol: 'accessing',
  18723. fn: function (aPackageName,anArray,aTransport){
  18724. var self=this;
  18725. var package_;
  18726. return $core.withContext(function($ctx1) {
  18727. var $1;
  18728. package_=self._named_(aPackageName);
  18729. $recv(package_)._imports_(anArray);
  18730. $recv(package_)._transport_(aTransport);
  18731. $1=package_;
  18732. return $1;
  18733. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  18734. },
  18735. args: ["aPackageName", "anArray", "aTransport"],
  18736. 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",
  18737. referencedClasses: [],
  18738. messageSends: ["named:", "imports:", "transport:"]
  18739. }),
  18740. $globals.Package.klass);
  18741. $core.addMethod(
  18742. $core.method({
  18743. selector: "named:transport:",
  18744. protocol: 'accessing',
  18745. fn: function (aPackageName,aTransport){
  18746. var self=this;
  18747. var package_;
  18748. return $core.withContext(function($ctx1) {
  18749. var $1;
  18750. package_=self._named_(aPackageName);
  18751. $recv(package_)._transport_(aTransport);
  18752. $1=package_;
  18753. return $1;
  18754. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  18755. },
  18756. args: ["aPackageName", "aTransport"],
  18757. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  18758. referencedClasses: [],
  18759. messageSends: ["named:", "transport:"]
  18760. }),
  18761. $globals.Package.klass);
  18762. $core.addMethod(
  18763. $core.method({
  18764. selector: "sortedClasses:",
  18765. protocol: 'sorting',
  18766. fn: function (classes){
  18767. var self=this;
  18768. var children,others,nodes,expandedClasses;
  18769. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  18770. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  18771. return $core.withContext(function($ctx1) {
  18772. var $1,$3,$2,$4;
  18773. children=[];
  18774. others=[];
  18775. $recv(classes)._do_((function(each){
  18776. return $core.withContext(function($ctx2) {
  18777. $1=$recv(classes)._includes_($recv(each)._superclass());
  18778. if($core.assert($1)){
  18779. return $recv(others)._add_(each);
  18780. } else {
  18781. return $recv(children)._add_(each);
  18782. $ctx2.sendIdx["add:"]=1;
  18783. };
  18784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18785. }));
  18786. $ctx1.sendIdx["do:"]=1;
  18787. nodes=$recv(children)._collect_((function(each){
  18788. return $core.withContext(function($ctx2) {
  18789. return $recv($ClassSorterNode())._on_classes_level_(each,others,(0));
  18790. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  18791. }));
  18792. nodes=$recv(nodes)._sorted_((function(a,b){
  18793. return $core.withContext(function($ctx2) {
  18794. $3=$recv(a)._theClass();
  18795. $ctx2.sendIdx["theClass"]=1;
  18796. $2=$recv($3)._name();
  18797. $ctx2.sendIdx["name"]=1;
  18798. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  18799. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  18800. }));
  18801. expandedClasses=$recv($Array())._new();
  18802. $recv(nodes)._do_((function(aNode){
  18803. return $core.withContext(function($ctx2) {
  18804. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  18805. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  18806. }));
  18807. $4=expandedClasses;
  18808. return $4;
  18809. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  18810. },
  18811. args: ["classes"],
  18812. 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",
  18813. referencedClasses: ["ClassSorterNode", "Array"],
  18814. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  18815. }),
  18816. $globals.Package.klass);
  18817. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  18818. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  18819. $core.addMethod(
  18820. $core.method({
  18821. selector: "announcer",
  18822. protocol: 'accessing',
  18823. fn: function (){
  18824. var self=this;
  18825. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18826. return $core.withContext(function($ctx1) {
  18827. var $1;
  18828. $1=$recv($SystemAnnouncer())._current();
  18829. return $1;
  18830. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  18831. },
  18832. args: [],
  18833. source: "announcer\x0a\x09^ SystemAnnouncer current",
  18834. referencedClasses: ["SystemAnnouncer"],
  18835. messageSends: ["current"]
  18836. }),
  18837. $globals.PackageStateObserver);
  18838. $core.addMethod(
  18839. $core.method({
  18840. selector: "observeSystem",
  18841. protocol: 'actions',
  18842. fn: function (){
  18843. var self=this;
  18844. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  18845. function $ClassAnnouncement(){return $globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)}
  18846. function $MethodAnnouncement(){return $globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)}
  18847. function $ProtocolAnnouncement(){return $globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)}
  18848. return $core.withContext(function($ctx1) {
  18849. var $1,$2;
  18850. $1=self._announcer();
  18851. $recv($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
  18852. $ctx1.sendIdx["on:send:to:"]=1;
  18853. $recv($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self);
  18854. $ctx1.sendIdx["on:send:to:"]=2;
  18855. $recv($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self);
  18856. $ctx1.sendIdx["on:send:to:"]=3;
  18857. $2=$recv($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self);
  18858. return self;
  18859. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  18860. },
  18861. args: [],
  18862. 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",
  18863. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  18864. messageSends: ["on:send:to:", "announcer"]
  18865. }),
  18866. $globals.PackageStateObserver);
  18867. $core.addMethod(
  18868. $core.method({
  18869. selector: "onClassModification:",
  18870. protocol: 'reactions',
  18871. fn: function (anAnnouncement){
  18872. var self=this;
  18873. return $core.withContext(function($ctx1) {
  18874. var $1,$receiver;
  18875. $1=$recv(anAnnouncement)._theClass();
  18876. if(($receiver = $1) == null || $receiver.isNil){
  18877. $1;
  18878. } else {
  18879. var theClass;
  18880. theClass=$receiver;
  18881. $recv($recv(theClass)._package())._beDirty();
  18882. };
  18883. return self;
  18884. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18885. },
  18886. args: ["anAnnouncement"],
  18887. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  18888. referencedClasses: [],
  18889. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  18890. }),
  18891. $globals.PackageStateObserver);
  18892. $core.addMethod(
  18893. $core.method({
  18894. selector: "onMethodModification:",
  18895. protocol: 'reactions',
  18896. fn: function (anAnnouncement){
  18897. var self=this;
  18898. return $core.withContext(function($ctx1) {
  18899. var $1,$receiver;
  18900. $1=$recv($recv(anAnnouncement)._method())._package();
  18901. if(($receiver = $1) == null || $receiver.isNil){
  18902. $1;
  18903. } else {
  18904. var package_;
  18905. package_=$receiver;
  18906. $recv(package_)._beDirty();
  18907. };
  18908. return self;
  18909. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18910. },
  18911. args: ["anAnnouncement"],
  18912. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  18913. referencedClasses: [],
  18914. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  18915. }),
  18916. $globals.PackageStateObserver);
  18917. $core.addMethod(
  18918. $core.method({
  18919. selector: "onPackageAdded:",
  18920. protocol: 'reactions',
  18921. fn: function (anAnnouncement){
  18922. var self=this;
  18923. return $core.withContext(function($ctx1) {
  18924. $recv($recv(anAnnouncement)._package())._beDirty();
  18925. return self;
  18926. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18927. },
  18928. args: ["anAnnouncement"],
  18929. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  18930. referencedClasses: [],
  18931. messageSends: ["beDirty", "package"]
  18932. }),
  18933. $globals.PackageStateObserver);
  18934. $core.addMethod(
  18935. $core.method({
  18936. selector: "onProtocolModification:",
  18937. protocol: 'reactions',
  18938. fn: function (anAnnouncement){
  18939. var self=this;
  18940. return $core.withContext(function($ctx1) {
  18941. var $1,$receiver;
  18942. $1=$recv(anAnnouncement)._package();
  18943. if(($receiver = $1) == null || $receiver.isNil){
  18944. $1;
  18945. } else {
  18946. var package_;
  18947. package_=$receiver;
  18948. $recv(package_)._beDirty();
  18949. };
  18950. return self;
  18951. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18952. },
  18953. args: ["anAnnouncement"],
  18954. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  18955. referencedClasses: [],
  18956. messageSends: ["ifNotNil:", "package", "beDirty"]
  18957. }),
  18958. $globals.PackageStateObserver);
  18959. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  18960. $core.addMethod(
  18961. $core.method({
  18962. selector: "current",
  18963. protocol: 'accessing',
  18964. fn: function (){
  18965. var self=this;
  18966. return $core.withContext(function($ctx1) {
  18967. var $2,$1,$receiver;
  18968. $2=self["@current"];
  18969. if(($receiver = $2) == null || $receiver.isNil){
  18970. self["@current"]=self._new();
  18971. $1=self["@current"];
  18972. } else {
  18973. $1=$2;
  18974. };
  18975. return $1;
  18976. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  18977. },
  18978. args: [],
  18979. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  18980. referencedClasses: [],
  18981. messageSends: ["ifNil:", "new"]
  18982. }),
  18983. $globals.PackageStateObserver.klass);
  18984. $core.addMethod(
  18985. $core.method({
  18986. selector: "initialize",
  18987. protocol: 'initialization',
  18988. fn: function (){
  18989. var self=this;
  18990. return $core.withContext(function($ctx1) {
  18991. $recv(self._current())._observeSystem();
  18992. return self;
  18993. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  18994. },
  18995. args: [],
  18996. source: "initialize\x0a\x09self current observeSystem",
  18997. referencedClasses: [],
  18998. messageSends: ["observeSystem", "current"]
  18999. }),
  19000. $globals.PackageStateObserver.klass);
  19001. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  19002. $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`";
  19003. $core.addMethod(
  19004. $core.method({
  19005. selector: "defaultValue",
  19006. protocol: 'accessing',
  19007. fn: function (){
  19008. var self=this;
  19009. var $1;
  19010. $1=self["@defaultValue"];
  19011. return $1;
  19012. },
  19013. args: [],
  19014. source: "defaultValue\x0a\x09^ defaultValue",
  19015. referencedClasses: [],
  19016. messageSends: []
  19017. }),
  19018. $globals.Setting);
  19019. $core.addMethod(
  19020. $core.method({
  19021. selector: "defaultValue:",
  19022. protocol: 'accessing',
  19023. fn: function (aStringifiableObject){
  19024. var self=this;
  19025. self["@defaultValue"]=aStringifiableObject;
  19026. return self;
  19027. },
  19028. args: ["aStringifiableObject"],
  19029. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  19030. referencedClasses: [],
  19031. messageSends: []
  19032. }),
  19033. $globals.Setting);
  19034. $core.addMethod(
  19035. $core.method({
  19036. selector: "key",
  19037. protocol: 'accessing',
  19038. fn: function (){
  19039. var self=this;
  19040. var $1;
  19041. $1=self["@key"];
  19042. return $1;
  19043. },
  19044. args: [],
  19045. source: "key\x0a\x09^ key",
  19046. referencedClasses: [],
  19047. messageSends: []
  19048. }),
  19049. $globals.Setting);
  19050. $core.addMethod(
  19051. $core.method({
  19052. selector: "key:",
  19053. protocol: 'accessing',
  19054. fn: function (aString){
  19055. var self=this;
  19056. self["@key"]=aString;
  19057. return self;
  19058. },
  19059. args: ["aString"],
  19060. source: "key: aString\x0a\x09key := aString",
  19061. referencedClasses: [],
  19062. messageSends: []
  19063. }),
  19064. $globals.Setting);
  19065. $core.addMethod(
  19066. $core.method({
  19067. selector: "value",
  19068. protocol: 'accessing',
  19069. fn: function (){
  19070. var self=this;
  19071. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19072. return $core.withContext(function($ctx1) {
  19073. var $1;
  19074. $1=$recv($recv($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
  19075. return $core.withContext(function($ctx2) {
  19076. return self._defaultValue();
  19077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19078. }));
  19079. return $1;
  19080. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19081. },
  19082. args: [],
  19083. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19084. referencedClasses: ["Smalltalk"],
  19085. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19086. }),
  19087. $globals.Setting);
  19088. $core.addMethod(
  19089. $core.method({
  19090. selector: "value:",
  19091. protocol: 'accessing',
  19092. fn: function (aStringifiableObject){
  19093. var self=this;
  19094. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19095. return $core.withContext(function($ctx1) {
  19096. var $1;
  19097. $1=$recv($recv($Smalltalk())._settings())._at_put_(self._key(),aStringifiableObject);
  19098. return $1;
  19099. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  19100. },
  19101. args: ["aStringifiableObject"],
  19102. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  19103. referencedClasses: ["Smalltalk"],
  19104. messageSends: ["at:put:", "settings", "key"]
  19105. }),
  19106. $globals.Setting);
  19107. $core.addMethod(
  19108. $core.method({
  19109. selector: "at:ifAbsent:",
  19110. protocol: 'instance creation',
  19111. fn: function (aString,aDefaultValue){
  19112. var self=this;
  19113. return $core.withContext(function($ctx1) {
  19114. var $2,$3,$1;
  19115. $2=(
  19116. $ctx1.supercall = true,
  19117. $globals.Setting.klass.superclass.fn.prototype._new.apply($recv(self), []));
  19118. $ctx1.supercall = false;
  19119. $recv($2)._key_(aString);
  19120. $recv($2)._defaultValue_(aDefaultValue);
  19121. $3=$recv($2)._yourself();
  19122. $1=$3;
  19123. return $1;
  19124. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  19125. },
  19126. args: ["aString", "aDefaultValue"],
  19127. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  19128. referencedClasses: [],
  19129. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  19130. }),
  19131. $globals.Setting.klass);
  19132. $core.addMethod(
  19133. $core.method({
  19134. selector: "new",
  19135. protocol: 'instance creation',
  19136. fn: function (){
  19137. var self=this;
  19138. return $core.withContext(function($ctx1) {
  19139. self._shouldNotImplement();
  19140. return self;
  19141. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  19142. },
  19143. args: [],
  19144. source: "new\x0a\x09self shouldNotImplement",
  19145. referencedClasses: [],
  19146. messageSends: ["shouldNotImplement"]
  19147. }),
  19148. $globals.Setting.klass);
  19149. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  19150. $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.";
  19151. $core.addMethod(
  19152. $core.method({
  19153. selector: "addGlobalJsVariable:",
  19154. protocol: 'globals',
  19155. fn: function (aString){
  19156. var self=this;
  19157. return $core.withContext(function($ctx1) {
  19158. $recv(self._globalJsVariables())._add_(aString);
  19159. return self;
  19160. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19161. },
  19162. args: ["aString"],
  19163. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  19164. referencedClasses: [],
  19165. messageSends: ["add:", "globalJsVariables"]
  19166. }),
  19167. $globals.SmalltalkImage);
  19168. $core.addMethod(
  19169. $core.method({
  19170. selector: "amdRequire",
  19171. protocol: 'accessing amd',
  19172. fn: function (){
  19173. var self=this;
  19174. return $core.withContext(function($ctx1) {
  19175. var $1;
  19176. $1=$recv(self._core())._at_("amdRequire");
  19177. return $1;
  19178. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  19179. },
  19180. args: [],
  19181. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  19182. referencedClasses: [],
  19183. messageSends: ["at:", "core"]
  19184. }),
  19185. $globals.SmalltalkImage);
  19186. $core.addMethod(
  19187. $core.method({
  19188. selector: "asSmalltalkException:",
  19189. protocol: 'error handling',
  19190. fn: function (anObject){
  19191. var self=this;
  19192. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  19193. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  19194. return $core.withContext(function($ctx1) {
  19195. var $2,$1;
  19196. $2=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  19197. return $core.withContext(function($ctx2) {
  19198. return $recv(anObject)._isKindOf_($Error());
  19199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19200. }));
  19201. if($core.assert($2)){
  19202. $1=anObject;
  19203. } else {
  19204. $1=$recv($JavaScriptException())._on_(anObject);
  19205. };
  19206. return $1;
  19207. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  19208. },
  19209. args: ["anObject"],
  19210. 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 ]",
  19211. referencedClasses: ["Error", "JavaScriptException"],
  19212. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  19213. }),
  19214. $globals.SmalltalkImage);
  19215. $core.addMethod(
  19216. $core.method({
  19217. selector: "basicCreatePackage:",
  19218. protocol: 'private',
  19219. fn: function (packageName){
  19220. var self=this;
  19221. return $core.withContext(function($ctx1) {
  19222. return $core.addPackage(packageName);
  19223. return self;
  19224. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19225. },
  19226. args: ["packageName"],
  19227. 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)>",
  19228. referencedClasses: [],
  19229. messageSends: []
  19230. }),
  19231. $globals.SmalltalkImage);
  19232. $core.addMethod(
  19233. $core.method({
  19234. selector: "basicParse:",
  19235. protocol: 'private',
  19236. fn: function (aString){
  19237. var self=this;
  19238. function $SmalltalkParser(){return $globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
  19239. return $core.withContext(function($ctx1) {
  19240. var $1;
  19241. $1=$recv($SmalltalkParser())._parse_(aString);
  19242. return $1;
  19243. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  19244. },
  19245. args: ["aString"],
  19246. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  19247. referencedClasses: ["SmalltalkParser"],
  19248. messageSends: ["parse:"]
  19249. }),
  19250. $globals.SmalltalkImage);
  19251. $core.addMethod(
  19252. $core.method({
  19253. selector: "basicRegisterPackage:",
  19254. protocol: 'private',
  19255. fn: function (aPackage){
  19256. var self=this;
  19257. return $core.withContext(function($ctx1) {
  19258. $core.packages[aPackage.pkgName]=aPackage;
  19259. return self;
  19260. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  19261. },
  19262. args: ["aPackage"],
  19263. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>",
  19264. referencedClasses: [],
  19265. messageSends: []
  19266. }),
  19267. $globals.SmalltalkImage);
  19268. $core.addMethod(
  19269. $core.method({
  19270. selector: "cancelOptOut:",
  19271. protocol: 'accessing',
  19272. fn: function (anObject){
  19273. var self=this;
  19274. return $core.withContext(function($ctx1) {
  19275. delete anObject.klass;
  19276. return self;
  19277. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19278. },
  19279. args: ["anObject"],
  19280. 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>",
  19281. referencedClasses: [],
  19282. messageSends: []
  19283. }),
  19284. $globals.SmalltalkImage);
  19285. $core.addMethod(
  19286. $core.method({
  19287. selector: "classes",
  19288. protocol: 'classes',
  19289. fn: function (){
  19290. var self=this;
  19291. return $core.withContext(function($ctx1) {
  19292. return $core.classes();
  19293. return self;
  19294. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  19295. },
  19296. args: [],
  19297. source: "classes\x0a\x09<return $core.classes()>",
  19298. referencedClasses: [],
  19299. messageSends: []
  19300. }),
  19301. $globals.SmalltalkImage);
  19302. $core.addMethod(
  19303. $core.method({
  19304. selector: "core",
  19305. protocol: 'accessing',
  19306. fn: function (){
  19307. var self=this;
  19308. return $core.withContext(function($ctx1) {
  19309. return $core;
  19310. return self;
  19311. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  19312. },
  19313. args: [],
  19314. source: "core\x0a\x09<return $core>",
  19315. referencedClasses: [],
  19316. messageSends: []
  19317. }),
  19318. $globals.SmalltalkImage);
  19319. $core.addMethod(
  19320. $core.method({
  19321. selector: "createPackage:",
  19322. protocol: 'packages',
  19323. fn: function (packageName){
  19324. var self=this;
  19325. var package_,announcement;
  19326. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  19327. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19328. return $core.withContext(function($ctx1) {
  19329. var $1,$2,$3;
  19330. package_=self._basicCreatePackage_(packageName);
  19331. $1=$recv($PackageAdded())._new();
  19332. $recv($1)._package_(package_);
  19333. $2=$recv($1)._yourself();
  19334. announcement=$2;
  19335. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  19336. $3=package_;
  19337. return $3;
  19338. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  19339. },
  19340. args: ["packageName"],
  19341. 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",
  19342. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  19343. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  19344. }),
  19345. $globals.SmalltalkImage);
  19346. $core.addMethod(
  19347. $core.method({
  19348. selector: "defaultAmdNamespace",
  19349. protocol: 'accessing amd',
  19350. fn: function (){
  19351. var self=this;
  19352. return $core.withContext(function($ctx1) {
  19353. var $1;
  19354. $1="transport.defaultAmdNamespace"._settingValue();
  19355. return $1;
  19356. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  19357. },
  19358. args: [],
  19359. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  19360. referencedClasses: [],
  19361. messageSends: ["settingValue"]
  19362. }),
  19363. $globals.SmalltalkImage);
  19364. $core.addMethod(
  19365. $core.method({
  19366. selector: "defaultAmdNamespace:",
  19367. protocol: 'accessing amd',
  19368. fn: function (aString){
  19369. var self=this;
  19370. return $core.withContext(function($ctx1) {
  19371. "transport.defaultAmdNamespace"._settingValue_(aString);
  19372. return self;
  19373. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  19374. },
  19375. args: ["aString"],
  19376. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  19377. referencedClasses: [],
  19378. messageSends: ["settingValue:"]
  19379. }),
  19380. $globals.SmalltalkImage);
  19381. $core.addMethod(
  19382. $core.method({
  19383. selector: "deleteClass:",
  19384. protocol: 'private',
  19385. fn: function (aClass){
  19386. var self=this;
  19387. return $core.withContext(function($ctx1) {
  19388. $core.removeClass(aClass);
  19389. return self;
  19390. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19391. },
  19392. args: ["aClass"],
  19393. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>",
  19394. referencedClasses: [],
  19395. messageSends: []
  19396. }),
  19397. $globals.SmalltalkImage);
  19398. $core.addMethod(
  19399. $core.method({
  19400. selector: "deleteGlobalJsVariable:",
  19401. protocol: 'globals',
  19402. fn: function (aString){
  19403. var self=this;
  19404. return $core.withContext(function($ctx1) {
  19405. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  19406. }));
  19407. return self;
  19408. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19409. },
  19410. args: ["aString"],
  19411. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  19412. referencedClasses: [],
  19413. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  19414. }),
  19415. $globals.SmalltalkImage);
  19416. $core.addMethod(
  19417. $core.method({
  19418. selector: "deletePackage:",
  19419. protocol: 'private',
  19420. fn: function (packageName){
  19421. var self=this;
  19422. return $core.withContext(function($ctx1) {
  19423. delete $core.packages[packageName];
  19424. return self;
  19425. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19426. },
  19427. args: ["packageName"],
  19428. 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]>",
  19429. referencedClasses: [],
  19430. messageSends: []
  19431. }),
  19432. $globals.SmalltalkImage);
  19433. $core.addMethod(
  19434. $core.method({
  19435. selector: "existsJsGlobal:",
  19436. protocol: 'testing',
  19437. fn: function (aString){
  19438. var self=this;
  19439. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  19440. return $core.withContext(function($ctx1) {
  19441. var $1;
  19442. $1=$recv($recv($Platform())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  19443. return true;
  19444. }),(function(){
  19445. return false;
  19446. }));
  19447. return $1;
  19448. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  19449. },
  19450. args: ["aString"],
  19451. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  19452. referencedClasses: ["Platform"],
  19453. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  19454. }),
  19455. $globals.SmalltalkImage);
  19456. $core.addMethod(
  19457. $core.method({
  19458. selector: "globalJsVariables",
  19459. protocol: 'globals',
  19460. fn: function (){
  19461. var self=this;
  19462. return $core.withContext(function($ctx1) {
  19463. return $core.globalJsVariables;
  19464. return self;
  19465. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  19466. },
  19467. args: [],
  19468. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return $core.globalJsVariables>",
  19469. referencedClasses: [],
  19470. messageSends: []
  19471. }),
  19472. $globals.SmalltalkImage);
  19473. $core.addMethod(
  19474. $core.method({
  19475. selector: "globals",
  19476. protocol: 'accessing',
  19477. fn: function (){
  19478. var self=this;
  19479. return $core.withContext(function($ctx1) {
  19480. return $globals;
  19481. return self;
  19482. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  19483. },
  19484. args: [],
  19485. source: "globals\x0a\x09<return $globals>",
  19486. referencedClasses: [],
  19487. messageSends: []
  19488. }),
  19489. $globals.SmalltalkImage);
  19490. $core.addMethod(
  19491. $core.method({
  19492. selector: "includesKey:",
  19493. protocol: 'accessing',
  19494. fn: function (aKey){
  19495. var self=this;
  19496. return $core.withContext(function($ctx1) {
  19497. return $core.hasOwnProperty(aKey);
  19498. return self;
  19499. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  19500. },
  19501. args: ["aKey"],
  19502. source: "includesKey: aKey\x0a\x09<return $core.hasOwnProperty(aKey)>",
  19503. referencedClasses: [],
  19504. messageSends: []
  19505. }),
  19506. $globals.SmalltalkImage);
  19507. $core.addMethod(
  19508. $core.method({
  19509. selector: "isSmalltalkObject:",
  19510. protocol: 'testing',
  19511. fn: function (anObject){
  19512. var self=this;
  19513. return $core.withContext(function($ctx1) {
  19514. return anObject.klass != null;
  19515. return self;
  19516. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  19517. },
  19518. args: ["anObject"],
  19519. 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>",
  19520. referencedClasses: [],
  19521. messageSends: []
  19522. }),
  19523. $globals.SmalltalkImage);
  19524. $core.addMethod(
  19525. $core.method({
  19526. selector: "optOut:",
  19527. protocol: 'accessing',
  19528. fn: function (anObject){
  19529. var self=this;
  19530. return $core.withContext(function($ctx1) {
  19531. anObject.klass = null;
  19532. return self;
  19533. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19534. },
  19535. args: ["anObject"],
  19536. 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>",
  19537. referencedClasses: [],
  19538. messageSends: []
  19539. }),
  19540. $globals.SmalltalkImage);
  19541. $core.addMethod(
  19542. $core.method({
  19543. selector: "packageAt:",
  19544. protocol: 'packages',
  19545. fn: function (packageName){
  19546. var self=this;
  19547. return $core.withContext(function($ctx1) {
  19548. return $core.packages[packageName];
  19549. return self;
  19550. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  19551. },
  19552. args: ["packageName"],
  19553. source: "packageAt: packageName\x0a\x09<return $core.packages[packageName]>",
  19554. referencedClasses: [],
  19555. messageSends: []
  19556. }),
  19557. $globals.SmalltalkImage);
  19558. $core.addMethod(
  19559. $core.method({
  19560. selector: "packageAt:ifAbsent:",
  19561. protocol: 'packages',
  19562. fn: function (packageName,aBlock){
  19563. var self=this;
  19564. return $core.withContext(function($ctx1) {
  19565. var $2,$1;
  19566. $2=self._packageAt_(packageName);
  19567. $1=$recv($2)._ifNil_(aBlock);
  19568. return $1;
  19569. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  19570. },
  19571. args: ["packageName", "aBlock"],
  19572. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  19573. referencedClasses: [],
  19574. messageSends: ["ifNil:", "packageAt:"]
  19575. }),
  19576. $globals.SmalltalkImage);
  19577. $core.addMethod(
  19578. $core.method({
  19579. selector: "packages",
  19580. protocol: 'packages',
  19581. fn: function (){
  19582. var self=this;
  19583. return $core.withContext(function($ctx1) {
  19584. return Object.keys($core.packages).map(function(k) {
  19585. return $core.packages[k];
  19586. })
  19587. ;
  19588. return self;
  19589. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  19590. },
  19591. args: [],
  19592. 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>",
  19593. referencedClasses: [],
  19594. messageSends: []
  19595. }),
  19596. $globals.SmalltalkImage);
  19597. $core.addMethod(
  19598. $core.method({
  19599. selector: "parse:",
  19600. protocol: 'accessing',
  19601. fn: function (aString){
  19602. var self=this;
  19603. var result;
  19604. return $core.withContext(function($ctx1) {
  19605. var $2,$3,$1;
  19606. $recv((function(){
  19607. return $core.withContext(function($ctx2) {
  19608. result=self._basicParse_(aString);
  19609. return result;
  19610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19611. }))._tryCatch_((function(ex){
  19612. return $core.withContext(function($ctx2) {
  19613. return $recv(self._parseError_parsing_(ex,aString))._signal();
  19614. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  19615. }));
  19616. $2=result;
  19617. $recv($2)._source_(aString);
  19618. $3=$recv($2)._yourself();
  19619. $1=$3;
  19620. return $1;
  19621. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  19622. },
  19623. args: ["aString"],
  19624. 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",
  19625. referencedClasses: [],
  19626. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  19627. }),
  19628. $globals.SmalltalkImage);
  19629. $core.addMethod(
  19630. $core.method({
  19631. selector: "parseError:parsing:",
  19632. protocol: 'error handling',
  19633. fn: function (anException,aString){
  19634. var self=this;
  19635. function $ParseError(){return $globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  19636. return $core.withContext(function($ctx1) {
  19637. var $2,$8,$7,$6,$9,$5,$4,$3,$1;
  19638. $2=$recv($ParseError())._new();
  19639. $8=$recv(anException)._basicAt_("line");
  19640. $ctx1.sendIdx["basicAt:"]=1;
  19641. $7="Parse error on line ".__comma($8);
  19642. $6=$recv($7).__comma(" column ");
  19643. $ctx1.sendIdx[","]=4;
  19644. $9=$recv(anException)._basicAt_("column");
  19645. $ctx1.sendIdx["basicAt:"]=2;
  19646. $5=$recv($6).__comma($9);
  19647. $ctx1.sendIdx[","]=3;
  19648. $4=$recv($5).__comma(" : Unexpected character ");
  19649. $ctx1.sendIdx[","]=2;
  19650. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  19651. $ctx1.sendIdx[","]=1;
  19652. $1=$recv($2)._messageText_($3);
  19653. return $1;
  19654. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  19655. },
  19656. args: ["anException", "aString"],
  19657. 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')",
  19658. referencedClasses: ["ParseError"],
  19659. messageSends: ["messageText:", "new", ",", "basicAt:"]
  19660. }),
  19661. $globals.SmalltalkImage);
  19662. $core.addMethod(
  19663. $core.method({
  19664. selector: "pseudoVariableNames",
  19665. protocol: 'accessing',
  19666. fn: function (){
  19667. var self=this;
  19668. var $1;
  19669. $1=["self", "super", "nil", "true", "false", "thisContext"];
  19670. return $1;
  19671. },
  19672. args: [],
  19673. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  19674. referencedClasses: [],
  19675. messageSends: []
  19676. }),
  19677. $globals.SmalltalkImage);
  19678. $core.addMethod(
  19679. $core.method({
  19680. selector: "readJSObject:",
  19681. protocol: 'accessing',
  19682. fn: function (anObject){
  19683. var self=this;
  19684. return $core.withContext(function($ctx1) {
  19685. return $core.readJSObject(anObject);
  19686. return self;
  19687. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  19688. },
  19689. args: ["anObject"],
  19690. source: "readJSObject: anObject\x0a\x09<return $core.readJSObject(anObject)>",
  19691. referencedClasses: [],
  19692. messageSends: []
  19693. }),
  19694. $globals.SmalltalkImage);
  19695. $core.addMethod(
  19696. $core.method({
  19697. selector: "removeClass:",
  19698. protocol: 'classes',
  19699. fn: function (aClass){
  19700. var self=this;
  19701. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19702. function $ClassRemoved(){return $globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  19703. return $core.withContext(function($ctx1) {
  19704. var $1,$2,$3;
  19705. $1=$recv(aClass)._isMetaclass();
  19706. if($core.assert($1)){
  19707. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  19708. };
  19709. self._deleteClass_(aClass);
  19710. $2=$recv($ClassRemoved())._new();
  19711. $recv($2)._theClass_(aClass);
  19712. $3=$recv($2)._yourself();
  19713. $recv($recv($SystemAnnouncer())._current())._announce_($3);
  19714. return self;
  19715. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19716. },
  19717. args: ["aClass"],
  19718. 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)",
  19719. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  19720. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  19721. }),
  19722. $globals.SmalltalkImage);
  19723. $core.addMethod(
  19724. $core.method({
  19725. selector: "removePackage:",
  19726. protocol: 'packages',
  19727. fn: function (packageName){
  19728. var self=this;
  19729. var pkg;
  19730. return $core.withContext(function($ctx1) {
  19731. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19732. return $core.withContext(function($ctx2) {
  19733. return self._error_("Missing package: ".__comma(packageName));
  19734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19735. }));
  19736. $recv($recv(pkg)._classes())._do_((function(each){
  19737. return $core.withContext(function($ctx2) {
  19738. return self._removeClass_(each);
  19739. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19740. }));
  19741. self._deletePackage_(packageName);
  19742. return self;
  19743. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  19744. },
  19745. args: ["packageName"],
  19746. 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",
  19747. referencedClasses: [],
  19748. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  19749. }),
  19750. $globals.SmalltalkImage);
  19751. $core.addMethod(
  19752. $core.method({
  19753. selector: "renamePackage:to:",
  19754. protocol: 'packages',
  19755. fn: function (packageName,newName){
  19756. var self=this;
  19757. var pkg;
  19758. return $core.withContext(function($ctx1) {
  19759. var $1,$2,$receiver;
  19760. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19761. return $core.withContext(function($ctx2) {
  19762. $1="Missing package: ".__comma(packageName);
  19763. $ctx2.sendIdx[","]=1;
  19764. return self._error_($1);
  19765. $ctx2.sendIdx["error:"]=1;
  19766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19767. }));
  19768. $2=self._packageAt_(newName);
  19769. if(($receiver = $2) == null || $receiver.isNil){
  19770. $2;
  19771. } else {
  19772. self._error_("Already exists a package called: ".__comma(newName));
  19773. };
  19774. $recv(pkg)._name_(newName);
  19775. self._basicRegisterPackage_(pkg);
  19776. self._deletePackage_(packageName);
  19777. return self;
  19778. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  19779. },
  19780. args: ["packageName", "newName"],
  19781. 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.",
  19782. referencedClasses: [],
  19783. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  19784. }),
  19785. $globals.SmalltalkImage);
  19786. $core.addMethod(
  19787. $core.method({
  19788. selector: "reservedWords",
  19789. protocol: 'accessing',
  19790. fn: function (){
  19791. var self=this;
  19792. return $core.withContext(function($ctx1) {
  19793. return $core.reservedWords;
  19794. return self;
  19795. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  19796. },
  19797. args: [],
  19798. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return $core.reservedWords>",
  19799. referencedClasses: [],
  19800. messageSends: []
  19801. }),
  19802. $globals.SmalltalkImage);
  19803. $core.addMethod(
  19804. $core.method({
  19805. selector: "settings",
  19806. protocol: 'accessing',
  19807. fn: function (){
  19808. var self=this;
  19809. function $SmalltalkSettings(){return $globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
  19810. return $SmalltalkSettings();
  19811. },
  19812. args: [],
  19813. source: "settings\x0a\x09^ SmalltalkSettings",
  19814. referencedClasses: ["SmalltalkSettings"],
  19815. messageSends: []
  19816. }),
  19817. $globals.SmalltalkImage);
  19818. $core.addMethod(
  19819. $core.method({
  19820. selector: "version",
  19821. protocol: 'accessing',
  19822. fn: function (){
  19823. var self=this;
  19824. return "0.15.0-pre";
  19825. },
  19826. args: [],
  19827. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.15.0-pre'",
  19828. referencedClasses: [],
  19829. messageSends: []
  19830. }),
  19831. $globals.SmalltalkImage);
  19832. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  19833. $core.addMethod(
  19834. $core.method({
  19835. selector: "current",
  19836. protocol: 'instance creation',
  19837. fn: function (){
  19838. var self=this;
  19839. return $core.withContext(function($ctx1) {
  19840. var $2,$1,$receiver;
  19841. $2=self["@current"];
  19842. if(($receiver = $2) == null || $receiver.isNil){
  19843. self["@current"]=(
  19844. $ctx1.supercall = true,
  19845. $globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply($recv(self), []));
  19846. $ctx1.supercall = false;
  19847. $1=self["@current"];
  19848. } else {
  19849. self._deprecatedAPI();
  19850. $1=self["@current"];
  19851. };
  19852. return $1;
  19853. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  19854. },
  19855. args: [],
  19856. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  19857. referencedClasses: [],
  19858. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  19859. }),
  19860. $globals.SmalltalkImage.klass);
  19861. $core.addMethod(
  19862. $core.method({
  19863. selector: "initialize",
  19864. protocol: 'initialization',
  19865. fn: function (){
  19866. var self=this;
  19867. var st;
  19868. return $core.withContext(function($ctx1) {
  19869. st=self._current();
  19870. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  19871. return self;
  19872. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  19873. },
  19874. args: [],
  19875. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  19876. referencedClasses: [],
  19877. messageSends: ["current", "at:put:", "globals"]
  19878. }),
  19879. $globals.SmalltalkImage.klass);
  19880. $core.addMethod(
  19881. $core.method({
  19882. selector: "new",
  19883. protocol: 'instance creation',
  19884. fn: function (){
  19885. var self=this;
  19886. return $core.withContext(function($ctx1) {
  19887. self._shouldNotImplement();
  19888. return self;
  19889. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  19890. },
  19891. args: [],
  19892. source: "new\x0a\x09self shouldNotImplement",
  19893. referencedClasses: [],
  19894. messageSends: ["shouldNotImplement"]
  19895. }),
  19896. $globals.SmalltalkImage.klass);
  19897. $core.addMethod(
  19898. $core.method({
  19899. selector: "importsString",
  19900. protocol: '*Kernel-Infrastructure',
  19901. fn: function (){
  19902. var self=this;
  19903. return $core.withContext(function($ctx1) {
  19904. var $3,$2,$1;
  19905. $3=$recv(self._key())._importsString();
  19906. $ctx1.sendIdx["importsString"]=1;
  19907. $2=$recv($3).__comma(" -> ");
  19908. $1=$recv($2).__comma($recv(self._value())._importsString());
  19909. $ctx1.sendIdx[","]=1;
  19910. return $1;
  19911. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  19912. },
  19913. args: [],
  19914. 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",
  19915. referencedClasses: [],
  19916. messageSends: [",", "importsString", "key", "value"]
  19917. }),
  19918. $globals.Association);
  19919. $core.addMethod(
  19920. $core.method({
  19921. selector: "asJavaScriptPropertyName",
  19922. protocol: '*Kernel-Infrastructure',
  19923. fn: function (){
  19924. var self=this;
  19925. return $core.withContext(function($ctx1) {
  19926. return $core.st2prop(self);
  19927. return self;
  19928. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  19929. },
  19930. args: [],
  19931. source: "asJavaScriptPropertyName\x0a<return $core.st2prop(self)>",
  19932. referencedClasses: [],
  19933. messageSends: []
  19934. }),
  19935. $globals.String);
  19936. $core.addMethod(
  19937. $core.method({
  19938. selector: "asSetting",
  19939. protocol: '*Kernel-Infrastructure',
  19940. fn: function (){
  19941. var self=this;
  19942. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19943. return $core.withContext(function($ctx1) {
  19944. var $1;
  19945. $1=$recv($Setting())._at_ifAbsent_(self,nil);
  19946. return $1;
  19947. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  19948. },
  19949. args: [],
  19950. 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",
  19951. referencedClasses: ["Setting"],
  19952. messageSends: ["at:ifAbsent:"]
  19953. }),
  19954. $globals.String);
  19955. $core.addMethod(
  19956. $core.method({
  19957. selector: "asSettingIfAbsent:",
  19958. protocol: '*Kernel-Infrastructure',
  19959. fn: function (aDefaultValue){
  19960. var self=this;
  19961. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19962. return $core.withContext(function($ctx1) {
  19963. var $1;
  19964. $1=$recv($Setting())._at_ifAbsent_(self,aDefaultValue);
  19965. return $1;
  19966. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  19967. },
  19968. args: ["aDefaultValue"],
  19969. 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",
  19970. referencedClasses: ["Setting"],
  19971. messageSends: ["at:ifAbsent:"]
  19972. }),
  19973. $globals.String);
  19974. $core.addMethod(
  19975. $core.method({
  19976. selector: "importsString",
  19977. protocol: '*Kernel-Infrastructure',
  19978. fn: function (){
  19979. var self=this;
  19980. return $core.withContext(function($ctx1) {
  19981. var $1;
  19982. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  19983. $ctx1.sendIdx[","]=1;
  19984. return $1;
  19985. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  19986. },
  19987. args: [],
  19988. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  19989. referencedClasses: [],
  19990. messageSends: [",", "replace:with:"]
  19991. }),
  19992. $globals.String);
  19993. $core.addMethod(
  19994. $core.method({
  19995. selector: "settingValue",
  19996. protocol: '*Kernel-Infrastructure',
  19997. fn: function (){
  19998. var self=this;
  19999. return $core.withContext(function($ctx1) {
  20000. var $1;
  20001. $1=$recv(self._asSetting())._value();
  20002. return $1;
  20003. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  20004. },
  20005. args: [],
  20006. source: "settingValue\x0a\x09^ self asSetting value",
  20007. referencedClasses: [],
  20008. messageSends: ["value", "asSetting"]
  20009. }),
  20010. $globals.String);
  20011. $core.addMethod(
  20012. $core.method({
  20013. selector: "settingValue:",
  20014. protocol: '*Kernel-Infrastructure',
  20015. fn: function (aValue){
  20016. var self=this;
  20017. return $core.withContext(function($ctx1) {
  20018. var $1;
  20019. $1=$recv(self._asSetting())._value_(aValue);
  20020. return $1;
  20021. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  20022. },
  20023. args: ["aValue"],
  20024. 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",
  20025. referencedClasses: [],
  20026. messageSends: ["value:", "asSetting"]
  20027. }),
  20028. $globals.String);
  20029. $core.addMethod(
  20030. $core.method({
  20031. selector: "settingValueIfAbsent:",
  20032. protocol: '*Kernel-Infrastructure',
  20033. fn: function (aDefaultValue){
  20034. var self=this;
  20035. return $core.withContext(function($ctx1) {
  20036. var $1;
  20037. $1=$recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  20038. return $1;
  20039. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20040. },
  20041. args: ["aDefaultValue"],
  20042. 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",
  20043. referencedClasses: [],
  20044. messageSends: ["value", "asSettingIfAbsent:"]
  20045. }),
  20046. $globals.String);
  20047. });
  20048. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20049. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20050. $core.addPackage('Kernel-Exceptions');
  20051. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20052. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20053. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  20054. $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.";
  20055. $core.addMethod(
  20056. $core.method({
  20057. selector: "beHandled",
  20058. protocol: 'accessing',
  20059. fn: function (){
  20060. var self=this;
  20061. return $core.withContext(function($ctx1) {
  20062. self.amberHandled = true;
  20063. return self;
  20064. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20065. },
  20066. args: [],
  20067. source: "beHandled\x0a\x09<self.amberHandled = true>",
  20068. referencedClasses: [],
  20069. messageSends: []
  20070. }),
  20071. $globals.Error);
  20072. $core.addMethod(
  20073. $core.method({
  20074. selector: "beUnhandled",
  20075. protocol: 'accessing',
  20076. fn: function (){
  20077. var self=this;
  20078. return $core.withContext(function($ctx1) {
  20079. self.amberHandled = false;
  20080. return self;
  20081. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20082. },
  20083. args: [],
  20084. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  20085. referencedClasses: [],
  20086. messageSends: []
  20087. }),
  20088. $globals.Error);
  20089. $core.addMethod(
  20090. $core.method({
  20091. selector: "context",
  20092. protocol: 'accessing',
  20093. fn: function (){
  20094. var self=this;
  20095. return $core.withContext(function($ctx1) {
  20096. return self.context;
  20097. return self;
  20098. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20099. },
  20100. args: [],
  20101. source: "context\x0a\x09<return self.context>",
  20102. referencedClasses: [],
  20103. messageSends: []
  20104. }),
  20105. $globals.Error);
  20106. $core.addMethod(
  20107. $core.method({
  20108. selector: "initialize",
  20109. protocol: 'initialization',
  20110. fn: function (){
  20111. var self=this;
  20112. return $core.withContext(function($ctx1) {
  20113. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  20114. return self;
  20115. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20116. },
  20117. args: [],
  20118. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20119. referencedClasses: [],
  20120. messageSends: ["messageText:", ",", "name", "class"]
  20121. }),
  20122. $globals.Error);
  20123. $core.addMethod(
  20124. $core.method({
  20125. selector: "isSmalltalkError",
  20126. protocol: 'testing',
  20127. fn: function (){
  20128. var self=this;
  20129. return $core.withContext(function($ctx1) {
  20130. return self.smalltalkError === true;
  20131. return self;
  20132. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20133. },
  20134. args: [],
  20135. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  20136. referencedClasses: [],
  20137. messageSends: []
  20138. }),
  20139. $globals.Error);
  20140. $core.addMethod(
  20141. $core.method({
  20142. selector: "jsStack",
  20143. protocol: 'accessing',
  20144. fn: function (){
  20145. var self=this;
  20146. return $core.withContext(function($ctx1) {
  20147. return self.stack;
  20148. return self;
  20149. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20150. },
  20151. args: [],
  20152. source: "jsStack\x0a\x09<return self.stack>",
  20153. referencedClasses: [],
  20154. messageSends: []
  20155. }),
  20156. $globals.Error);
  20157. $core.addMethod(
  20158. $core.method({
  20159. selector: "messageText",
  20160. protocol: 'accessing',
  20161. fn: function (){
  20162. var self=this;
  20163. var $1;
  20164. $1=self["@messageText"];
  20165. return $1;
  20166. },
  20167. args: [],
  20168. source: "messageText\x0a\x09^ messageText",
  20169. referencedClasses: [],
  20170. messageSends: []
  20171. }),
  20172. $globals.Error);
  20173. $core.addMethod(
  20174. $core.method({
  20175. selector: "messageText:",
  20176. protocol: 'accessing',
  20177. fn: function (aString){
  20178. var self=this;
  20179. self["@messageText"]=aString;
  20180. return self;
  20181. },
  20182. args: ["aString"],
  20183. source: "messageText: aString\x0a\x09messageText := aString",
  20184. referencedClasses: [],
  20185. messageSends: []
  20186. }),
  20187. $globals.Error);
  20188. $core.addMethod(
  20189. $core.method({
  20190. selector: "resignal",
  20191. protocol: 'signaling',
  20192. fn: function (){
  20193. var self=this;
  20194. return $core.withContext(function($ctx1) {
  20195. self.amberHandled = false;
  20196. throw(self);
  20197. ;
  20198. return self;
  20199. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20200. },
  20201. args: [],
  20202. 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>",
  20203. referencedClasses: [],
  20204. messageSends: []
  20205. }),
  20206. $globals.Error);
  20207. $core.addMethod(
  20208. $core.method({
  20209. selector: "signal",
  20210. protocol: 'signaling',
  20211. fn: function (){
  20212. var self=this;
  20213. return $core.withContext(function($ctx1) {
  20214. self.amberHandled = false;
  20215. self.context = $core.getThisContext();
  20216. self.smalltalkError = true;
  20217. throw self;
  20218. ;
  20219. return self;
  20220. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20221. },
  20222. args: [],
  20223. 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>",
  20224. referencedClasses: [],
  20225. messageSends: []
  20226. }),
  20227. $globals.Error);
  20228. $core.addMethod(
  20229. $core.method({
  20230. selector: "signal:",
  20231. protocol: 'signaling',
  20232. fn: function (aString){
  20233. var self=this;
  20234. return $core.withContext(function($ctx1) {
  20235. self._messageText_(aString);
  20236. self._signal();
  20237. return self;
  20238. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20239. },
  20240. args: ["aString"],
  20241. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20242. referencedClasses: [],
  20243. messageSends: ["messageText:", "signal"]
  20244. }),
  20245. $globals.Error);
  20246. $core.addMethod(
  20247. $core.method({
  20248. selector: "signalerContext",
  20249. protocol: 'accessing',
  20250. fn: function (){
  20251. var self=this;
  20252. return $core.withContext(function($ctx1) {
  20253. var $1;
  20254. $1=self._signalerContextFrom_(self._context());
  20255. return $1;
  20256. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20257. },
  20258. args: [],
  20259. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20260. referencedClasses: [],
  20261. messageSends: ["signalerContextFrom:", "context"]
  20262. }),
  20263. $globals.Error);
  20264. $core.addMethod(
  20265. $core.method({
  20266. selector: "signalerContextFrom:",
  20267. protocol: 'accessing',
  20268. fn: function (aContext){
  20269. var self=this;
  20270. return $core.withContext(function($ctx1) {
  20271. var $4,$3,$2,$1;
  20272. $1=$recv(aContext)._findContextSuchThat_((function(context){
  20273. return $core.withContext(function($ctx2) {
  20274. $4=$recv(context)._receiver();
  20275. $ctx2.sendIdx["receiver"]=1;
  20276. $3=$recv($4).__eq_eq(self);
  20277. $ctx2.sendIdx["=="]=1;
  20278. $2=$recv($3)._or_((function(){
  20279. return $core.withContext(function($ctx3) {
  20280. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  20281. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20282. }));
  20283. return $recv($2)._not();
  20284. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20285. }));
  20286. return $1;
  20287. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20288. },
  20289. args: ["aContext"],
  20290. 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 ]",
  20291. referencedClasses: [],
  20292. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20293. }),
  20294. $globals.Error);
  20295. $core.addMethod(
  20296. $core.method({
  20297. selector: "wasHandled",
  20298. protocol: 'testing',
  20299. fn: function (){
  20300. var self=this;
  20301. return $core.withContext(function($ctx1) {
  20302. return self.amberHandled || false;
  20303. return self;
  20304. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20305. },
  20306. args: [],
  20307. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  20308. referencedClasses: [],
  20309. messageSends: []
  20310. }),
  20311. $globals.Error);
  20312. $core.addMethod(
  20313. $core.method({
  20314. selector: "classTag",
  20315. protocol: 'accessing',
  20316. fn: function (){
  20317. var self=this;
  20318. return "exception";
  20319. },
  20320. args: [],
  20321. 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'",
  20322. referencedClasses: [],
  20323. messageSends: []
  20324. }),
  20325. $globals.Error.klass);
  20326. $core.addMethod(
  20327. $core.method({
  20328. selector: "signal",
  20329. protocol: 'instance creation',
  20330. fn: function (){
  20331. var self=this;
  20332. return $core.withContext(function($ctx1) {
  20333. var $1;
  20334. $1=$recv(self._new())._signal();
  20335. return $1;
  20336. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  20337. },
  20338. args: [],
  20339. source: "signal\x0a\x09^ self new signal",
  20340. referencedClasses: [],
  20341. messageSends: ["signal", "new"]
  20342. }),
  20343. $globals.Error.klass);
  20344. $core.addMethod(
  20345. $core.method({
  20346. selector: "signal:",
  20347. protocol: 'instance creation',
  20348. fn: function (aString){
  20349. var self=this;
  20350. return $core.withContext(function($ctx1) {
  20351. var $1;
  20352. $1=$recv(self._new())._signal_(aString);
  20353. return $1;
  20354. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  20355. },
  20356. args: ["aString"],
  20357. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20358. referencedClasses: [],
  20359. messageSends: ["signal:", "new"]
  20360. }),
  20361. $globals.Error.klass);
  20362. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  20363. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20364. $core.addMethod(
  20365. $core.method({
  20366. selector: "messageText",
  20367. protocol: 'accessing',
  20368. fn: function (){
  20369. var self=this;
  20370. return "Halt encountered";
  20371. },
  20372. args: [],
  20373. source: "messageText\x0a\x09^ 'Halt encountered'",
  20374. referencedClasses: [],
  20375. messageSends: []
  20376. }),
  20377. $globals.Halt);
  20378. $core.addMethod(
  20379. $core.method({
  20380. selector: "signalerContextFrom:",
  20381. protocol: 'accessing',
  20382. fn: function (aContext){
  20383. var self=this;
  20384. return $core.withContext(function($ctx1) {
  20385. var $4,$3,$2,$1;
  20386. $1=$recv(aContext)._findContextSuchThat_((function(context){
  20387. return $core.withContext(function($ctx2) {
  20388. $4=$recv(context)._receiver();
  20389. $ctx2.sendIdx["receiver"]=1;
  20390. $3=$recv($4).__eq_eq(self);
  20391. $ctx2.sendIdx["=="]=1;
  20392. $2=$recv($3)._or_((function(){
  20393. return $core.withContext(function($ctx3) {
  20394. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  20395. return $core.withContext(function($ctx4) {
  20396. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20397. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20398. }));
  20399. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20400. }));
  20401. $ctx2.sendIdx["or:"]=1;
  20402. return $recv($2)._not();
  20403. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20404. }));
  20405. return $1;
  20406. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20407. },
  20408. args: ["aContext"],
  20409. 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 ]",
  20410. referencedClasses: [],
  20411. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20412. }),
  20413. $globals.Halt);
  20414. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  20415. $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:`";
  20416. $core.addMethod(
  20417. $core.method({
  20418. selector: "context:",
  20419. protocol: 'accessing',
  20420. fn: function (aMethodContext){
  20421. var self=this;
  20422. return $core.withContext(function($ctx1) {
  20423. self.context = aMethodContext;
  20424. return self;
  20425. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20426. },
  20427. args: ["aMethodContext"],
  20428. 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>",
  20429. referencedClasses: [],
  20430. messageSends: []
  20431. }),
  20432. $globals.JavaScriptException);
  20433. $core.addMethod(
  20434. $core.method({
  20435. selector: "exception",
  20436. protocol: 'accessing',
  20437. fn: function (){
  20438. var self=this;
  20439. var $1;
  20440. $1=self["@exception"];
  20441. return $1;
  20442. },
  20443. args: [],
  20444. source: "exception\x0a\x09^ exception",
  20445. referencedClasses: [],
  20446. messageSends: []
  20447. }),
  20448. $globals.JavaScriptException);
  20449. $core.addMethod(
  20450. $core.method({
  20451. selector: "exception:",
  20452. protocol: 'accessing',
  20453. fn: function (anException){
  20454. var self=this;
  20455. self["@exception"]=anException;
  20456. return self;
  20457. },
  20458. args: ["anException"],
  20459. source: "exception: anException\x0a\x09exception := anException",
  20460. referencedClasses: [],
  20461. messageSends: []
  20462. }),
  20463. $globals.JavaScriptException);
  20464. $core.addMethod(
  20465. $core.method({
  20466. selector: "messageText",
  20467. protocol: 'accessing',
  20468. fn: function (){
  20469. var self=this;
  20470. return $core.withContext(function($ctx1) {
  20471. return 'JavaScript exception: ' + self["@exception"].toString();
  20472. return self;
  20473. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20474. },
  20475. args: [],
  20476. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  20477. referencedClasses: [],
  20478. messageSends: []
  20479. }),
  20480. $globals.JavaScriptException);
  20481. $core.addMethod(
  20482. $core.method({
  20483. selector: "on:",
  20484. protocol: 'instance creation',
  20485. fn: function (anException){
  20486. var self=this;
  20487. return $core.withContext(function($ctx1) {
  20488. var $2,$3,$1;
  20489. $2=self._new();
  20490. $recv($2)._exception_(anException);
  20491. $3=$recv($2)._yourself();
  20492. $1=$3;
  20493. return $1;
  20494. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  20495. },
  20496. args: ["anException"],
  20497. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20498. referencedClasses: [],
  20499. messageSends: ["exception:", "new", "yourself"]
  20500. }),
  20501. $globals.JavaScriptException.klass);
  20502. $core.addMethod(
  20503. $core.method({
  20504. selector: "on:context:",
  20505. protocol: 'instance creation',
  20506. fn: function (anException,aMethodContext){
  20507. var self=this;
  20508. return $core.withContext(function($ctx1) {
  20509. var $2,$3,$1;
  20510. $2=self._new();
  20511. $recv($2)._exception_(anException);
  20512. $recv($2)._context_(aMethodContext);
  20513. $3=$recv($2)._yourself();
  20514. $1=$3;
  20515. return $1;
  20516. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  20517. },
  20518. args: ["anException", "aMethodContext"],
  20519. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20520. referencedClasses: [],
  20521. messageSends: ["exception:", "new", "context:", "yourself"]
  20522. }),
  20523. $globals.JavaScriptException.klass);
  20524. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  20525. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20526. $core.addMethod(
  20527. $core.method({
  20528. selector: "message",
  20529. protocol: 'accessing',
  20530. fn: function (){
  20531. var self=this;
  20532. var $1;
  20533. $1=self["@message"];
  20534. return $1;
  20535. },
  20536. args: [],
  20537. source: "message\x0a\x09^ message",
  20538. referencedClasses: [],
  20539. messageSends: []
  20540. }),
  20541. $globals.MessageNotUnderstood);
  20542. $core.addMethod(
  20543. $core.method({
  20544. selector: "message:",
  20545. protocol: 'accessing',
  20546. fn: function (aMessage){
  20547. var self=this;
  20548. self["@message"]=aMessage;
  20549. return self;
  20550. },
  20551. args: ["aMessage"],
  20552. source: "message: aMessage\x0a\x09message := aMessage",
  20553. referencedClasses: [],
  20554. messageSends: []
  20555. }),
  20556. $globals.MessageNotUnderstood);
  20557. $core.addMethod(
  20558. $core.method({
  20559. selector: "messageText",
  20560. protocol: 'accessing',
  20561. fn: function (){
  20562. var self=this;
  20563. return $core.withContext(function($ctx1) {
  20564. var $1;
  20565. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  20566. $ctx1.sendIdx[","]=1;
  20567. return $1;
  20568. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20569. },
  20570. args: [],
  20571. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20572. referencedClasses: [],
  20573. messageSends: [",", "asString", "receiver", "selector", "message"]
  20574. }),
  20575. $globals.MessageNotUnderstood);
  20576. $core.addMethod(
  20577. $core.method({
  20578. selector: "receiver",
  20579. protocol: 'accessing',
  20580. fn: function (){
  20581. var self=this;
  20582. var $1;
  20583. $1=self["@receiver"];
  20584. return $1;
  20585. },
  20586. args: [],
  20587. source: "receiver\x0a\x09^ receiver",
  20588. referencedClasses: [],
  20589. messageSends: []
  20590. }),
  20591. $globals.MessageNotUnderstood);
  20592. $core.addMethod(
  20593. $core.method({
  20594. selector: "receiver:",
  20595. protocol: 'accessing',
  20596. fn: function (anObject){
  20597. var self=this;
  20598. self["@receiver"]=anObject;
  20599. return self;
  20600. },
  20601. args: ["anObject"],
  20602. source: "receiver: anObject\x0a\x09receiver := anObject",
  20603. referencedClasses: [],
  20604. messageSends: []
  20605. }),
  20606. $globals.MessageNotUnderstood);
  20607. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  20608. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  20609. $core.addMethod(
  20610. $core.method({
  20611. selector: "object",
  20612. protocol: 'accessing',
  20613. fn: function (){
  20614. var self=this;
  20615. var $1;
  20616. $1=self["@object"];
  20617. return $1;
  20618. },
  20619. args: [],
  20620. source: "object\x0a\x09^ object",
  20621. referencedClasses: [],
  20622. messageSends: []
  20623. }),
  20624. $globals.NonBooleanReceiver);
  20625. $core.addMethod(
  20626. $core.method({
  20627. selector: "object:",
  20628. protocol: 'accessing',
  20629. fn: function (anObject){
  20630. var self=this;
  20631. self["@object"]=anObject;
  20632. return self;
  20633. },
  20634. args: ["anObject"],
  20635. source: "object: anObject\x0a\x09object := anObject",
  20636. referencedClasses: [],
  20637. messageSends: []
  20638. }),
  20639. $globals.NonBooleanReceiver);
  20640. });
  20641. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20642. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20643. $core.addPackage('Kernel-Announcements');
  20644. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  20645. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20646. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  20647. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  20648. $core.addMethod(
  20649. $core.method({
  20650. selector: "announcementClass",
  20651. protocol: 'accessing',
  20652. fn: function (){
  20653. var self=this;
  20654. var $1;
  20655. $1=self["@announcementClass"];
  20656. return $1;
  20657. },
  20658. args: [],
  20659. source: "announcementClass\x0a\x09^ announcementClass",
  20660. referencedClasses: [],
  20661. messageSends: []
  20662. }),
  20663. $globals.AnnouncementSubscription);
  20664. $core.addMethod(
  20665. $core.method({
  20666. selector: "announcementClass:",
  20667. protocol: 'accessing',
  20668. fn: function (aClass){
  20669. var self=this;
  20670. self["@announcementClass"]=aClass;
  20671. return self;
  20672. },
  20673. args: ["aClass"],
  20674. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  20675. referencedClasses: [],
  20676. messageSends: []
  20677. }),
  20678. $globals.AnnouncementSubscription);
  20679. $core.addMethod(
  20680. $core.method({
  20681. selector: "deliver:",
  20682. protocol: 'announcing',
  20683. fn: function (anAnnouncement){
  20684. var self=this;
  20685. return $core.withContext(function($ctx1) {
  20686. var $1;
  20687. $1=self._handlesAnnouncement_(anAnnouncement);
  20688. if($core.assert($1)){
  20689. $recv(self._valuable())._value_(anAnnouncement);
  20690. };
  20691. return self;
  20692. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20693. },
  20694. args: ["anAnnouncement"],
  20695. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  20696. referencedClasses: [],
  20697. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  20698. }),
  20699. $globals.AnnouncementSubscription);
  20700. $core.addMethod(
  20701. $core.method({
  20702. selector: "handlesAnnouncement:",
  20703. protocol: 'announcing',
  20704. fn: function (anAnnouncement){
  20705. var self=this;
  20706. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20707. return $core.withContext(function($ctx1) {
  20708. var $3,$4,$2,$1,$receiver;
  20709. $3=$recv($Smalltalk())._globals();
  20710. $ctx1.sendIdx["globals"]=1;
  20711. $4=$recv(self._announcementClass())._name();
  20712. $ctx1.sendIdx["name"]=1;
  20713. $2=$recv($3)._at_($4);
  20714. $ctx1.sendIdx["at:"]=1;
  20715. if(($receiver = $2) == null || $receiver.isNil){
  20716. return false;
  20717. } else {
  20718. var class_;
  20719. class_=$receiver;
  20720. $1=$recv($recv($recv($Smalltalk())._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  20721. };
  20722. return $1;
  20723. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20724. },
  20725. args: ["anAnnouncement"],
  20726. 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 ]",
  20727. referencedClasses: ["Smalltalk"],
  20728. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  20729. }),
  20730. $globals.AnnouncementSubscription);
  20731. $core.addMethod(
  20732. $core.method({
  20733. selector: "receiver",
  20734. protocol: 'accessing',
  20735. fn: function (){
  20736. var self=this;
  20737. return $core.withContext(function($ctx1) {
  20738. var $1;
  20739. $1=$recv(self._valuable())._receiver();
  20740. return $1;
  20741. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  20742. },
  20743. args: [],
  20744. source: "receiver\x0a\x09^ self valuable receiver",
  20745. referencedClasses: [],
  20746. messageSends: ["receiver", "valuable"]
  20747. }),
  20748. $globals.AnnouncementSubscription);
  20749. $core.addMethod(
  20750. $core.method({
  20751. selector: "valuable",
  20752. protocol: 'accessing',
  20753. fn: function (){
  20754. var self=this;
  20755. var $1;
  20756. $1=self["@valuable"];
  20757. return $1;
  20758. },
  20759. args: [],
  20760. source: "valuable\x0a\x09^ valuable",
  20761. referencedClasses: [],
  20762. messageSends: []
  20763. }),
  20764. $globals.AnnouncementSubscription);
  20765. $core.addMethod(
  20766. $core.method({
  20767. selector: "valuable:",
  20768. protocol: 'accessing',
  20769. fn: function (aValuable){
  20770. var self=this;
  20771. self["@valuable"]=aValuable;
  20772. return self;
  20773. },
  20774. args: ["aValuable"],
  20775. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  20776. referencedClasses: [],
  20777. messageSends: []
  20778. }),
  20779. $globals.AnnouncementSubscription);
  20780. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  20781. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  20782. $core.addMethod(
  20783. $core.method({
  20784. selector: "receiver",
  20785. protocol: 'accessing',
  20786. fn: function (){
  20787. var self=this;
  20788. var $1;
  20789. $1=self["@receiver"];
  20790. return $1;
  20791. },
  20792. args: [],
  20793. source: "receiver\x0a\x09^ receiver",
  20794. referencedClasses: [],
  20795. messageSends: []
  20796. }),
  20797. $globals.AnnouncementValuable);
  20798. $core.addMethod(
  20799. $core.method({
  20800. selector: "receiver:",
  20801. protocol: 'accessing',
  20802. fn: function (anObject){
  20803. var self=this;
  20804. self["@receiver"]=anObject;
  20805. return self;
  20806. },
  20807. args: ["anObject"],
  20808. source: "receiver: anObject\x0a\x09receiver := anObject",
  20809. referencedClasses: [],
  20810. messageSends: []
  20811. }),
  20812. $globals.AnnouncementValuable);
  20813. $core.addMethod(
  20814. $core.method({
  20815. selector: "valuable",
  20816. protocol: 'accessing',
  20817. fn: function (){
  20818. var self=this;
  20819. var $1;
  20820. $1=self["@valuable"];
  20821. return $1;
  20822. },
  20823. args: [],
  20824. source: "valuable\x0a\x09^ valuable",
  20825. referencedClasses: [],
  20826. messageSends: []
  20827. }),
  20828. $globals.AnnouncementValuable);
  20829. $core.addMethod(
  20830. $core.method({
  20831. selector: "valuable:",
  20832. protocol: 'accessing',
  20833. fn: function (anObject){
  20834. var self=this;
  20835. self["@valuable"]=anObject;
  20836. return self;
  20837. },
  20838. args: ["anObject"],
  20839. source: "valuable: anObject\x0a\x09valuable := anObject",
  20840. referencedClasses: [],
  20841. messageSends: []
  20842. }),
  20843. $globals.AnnouncementValuable);
  20844. $core.addMethod(
  20845. $core.method({
  20846. selector: "value",
  20847. protocol: 'evaluating',
  20848. fn: function (){
  20849. var self=this;
  20850. return $core.withContext(function($ctx1) {
  20851. var $1;
  20852. $1=$recv(self._valuable())._value();
  20853. return $1;
  20854. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  20855. },
  20856. args: [],
  20857. source: "value\x0a\x09^ self valuable value",
  20858. referencedClasses: [],
  20859. messageSends: ["value", "valuable"]
  20860. }),
  20861. $globals.AnnouncementValuable);
  20862. $core.addMethod(
  20863. $core.method({
  20864. selector: "value:",
  20865. protocol: 'evaluating',
  20866. fn: function (anObject){
  20867. var self=this;
  20868. return $core.withContext(function($ctx1) {
  20869. var $1;
  20870. $1=$recv(self._valuable())._value_(anObject);
  20871. return $1;
  20872. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  20873. },
  20874. args: ["anObject"],
  20875. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  20876. referencedClasses: [],
  20877. messageSends: ["value:", "valuable"]
  20878. }),
  20879. $globals.AnnouncementValuable);
  20880. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  20881. $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' ].";
  20882. $core.addMethod(
  20883. $core.method({
  20884. selector: "announce:",
  20885. protocol: 'announcing',
  20886. fn: function (anAnnouncement){
  20887. var self=this;
  20888. return $core.withContext(function($ctx1) {
  20889. $recv(self["@subscriptions"])._do_((function(each){
  20890. return $core.withContext(function($ctx2) {
  20891. return $recv(each)._deliver_(anAnnouncement);
  20892. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20893. }));
  20894. return self;
  20895. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  20896. },
  20897. args: ["anAnnouncement"],
  20898. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  20899. referencedClasses: [],
  20900. messageSends: ["do:", "deliver:"]
  20901. }),
  20902. $globals.Announcer);
  20903. $core.addMethod(
  20904. $core.method({
  20905. selector: "initialize",
  20906. protocol: 'initialization',
  20907. fn: function (){
  20908. var self=this;
  20909. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  20910. return $core.withContext(function($ctx1) {
  20911. (
  20912. $ctx1.supercall = true,
  20913. $globals.Announcer.superclass.fn.prototype._initialize.apply($recv(self), []));
  20914. $ctx1.supercall = false;
  20915. self["@subscriptions"]=$recv($OrderedCollection())._new();
  20916. return self;
  20917. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  20918. },
  20919. args: [],
  20920. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  20921. referencedClasses: ["OrderedCollection"],
  20922. messageSends: ["initialize", "new"]
  20923. }),
  20924. $globals.Announcer);
  20925. $core.addMethod(
  20926. $core.method({
  20927. selector: "on:do:",
  20928. protocol: 'subscribing',
  20929. fn: function (aClass,aBlock){
  20930. var self=this;
  20931. return $core.withContext(function($ctx1) {
  20932. self._on_do_for_(aClass,aBlock,nil);
  20933. return self;
  20934. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  20935. },
  20936. args: ["aClass", "aBlock"],
  20937. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  20938. referencedClasses: [],
  20939. messageSends: ["on:do:for:"]
  20940. }),
  20941. $globals.Announcer);
  20942. $core.addMethod(
  20943. $core.method({
  20944. selector: "on:do:for:",
  20945. protocol: 'subscribing',
  20946. fn: function (aClass,aBlock,aReceiver){
  20947. var self=this;
  20948. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20949. function $AnnouncementValuable(){return $globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)}
  20950. return $core.withContext(function($ctx1) {
  20951. var $1,$3,$4,$6,$7,$5,$8,$2;
  20952. $1=self["@subscriptions"];
  20953. $3=$recv($AnnouncementSubscription())._new();
  20954. $ctx1.sendIdx["new"]=1;
  20955. $4=$3;
  20956. $6=$recv($AnnouncementValuable())._new();
  20957. $recv($6)._valuable_(aBlock);
  20958. $recv($6)._receiver_(aReceiver);
  20959. $7=$recv($6)._yourself();
  20960. $ctx1.sendIdx["yourself"]=1;
  20961. $5=$7;
  20962. $recv($4)._valuable_($5);
  20963. $ctx1.sendIdx["valuable:"]=1;
  20964. $recv($3)._announcementClass_(aClass);
  20965. $8=$recv($3)._yourself();
  20966. $2=$8;
  20967. $recv($1)._add_($2);
  20968. return self;
  20969. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  20970. },
  20971. args: ["aClass", "aBlock", "aReceiver"],
  20972. 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)",
  20973. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  20974. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  20975. }),
  20976. $globals.Announcer);
  20977. $core.addMethod(
  20978. $core.method({
  20979. selector: "on:doOnce:",
  20980. protocol: 'subscribing',
  20981. fn: function (aClass,aBlock){
  20982. var self=this;
  20983. var subscription;
  20984. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20985. return $core.withContext(function($ctx1) {
  20986. var $1,$2;
  20987. $1=$recv($AnnouncementSubscription())._new();
  20988. $recv($1)._announcementClass_(aClass);
  20989. $2=$recv($1)._yourself();
  20990. subscription=$2;
  20991. $recv(subscription)._valuable_((function(ann){
  20992. return $core.withContext(function($ctx2) {
  20993. $recv(self["@subscriptions"])._remove_(subscription);
  20994. return $recv(aBlock)._value_(ann);
  20995. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  20996. }));
  20997. $recv(self["@subscriptions"])._add_(subscription);
  20998. return self;
  20999. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  21000. },
  21001. args: ["aClass", "aBlock"],
  21002. 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",
  21003. referencedClasses: ["AnnouncementSubscription"],
  21004. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  21005. }),
  21006. $globals.Announcer);
  21007. $core.addMethod(
  21008. $core.method({
  21009. selector: "on:send:to:",
  21010. protocol: 'subscribing',
  21011. fn: function (aClass,aSelector,anObject){
  21012. var self=this;
  21013. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  21014. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  21015. return $core.withContext(function($ctx1) {
  21016. var $1,$3,$4,$6,$7,$5,$8,$2;
  21017. $1=self["@subscriptions"];
  21018. $3=$recv($AnnouncementSubscription())._new();
  21019. $ctx1.sendIdx["new"]=1;
  21020. $4=$3;
  21021. $6=$recv($MessageSend())._new();
  21022. $recv($6)._receiver_(anObject);
  21023. $recv($6)._selector_(aSelector);
  21024. $7=$recv($6)._yourself();
  21025. $ctx1.sendIdx["yourself"]=1;
  21026. $5=$7;
  21027. $recv($4)._valuable_($5);
  21028. $recv($3)._announcementClass_(aClass);
  21029. $8=$recv($3)._yourself();
  21030. $2=$8;
  21031. $recv($1)._add_($2);
  21032. return self;
  21033. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  21034. },
  21035. args: ["aClass", "aSelector", "anObject"],
  21036. 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)",
  21037. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  21038. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  21039. }),
  21040. $globals.Announcer);
  21041. $core.addMethod(
  21042. $core.method({
  21043. selector: "unsubscribe:",
  21044. protocol: 'subscribing',
  21045. fn: function (anObject){
  21046. var self=this;
  21047. return $core.withContext(function($ctx1) {
  21048. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  21049. return $core.withContext(function($ctx2) {
  21050. return $recv($recv(each)._receiver()).__eq(anObject);
  21051. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21052. }));
  21053. return self;
  21054. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  21055. },
  21056. args: ["anObject"],
  21057. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  21058. referencedClasses: [],
  21059. messageSends: ["reject:", "=", "receiver"]
  21060. }),
  21061. $globals.Announcer);
  21062. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  21063. $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`";
  21064. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  21065. $core.addMethod(
  21066. $core.method({
  21067. selector: "current",
  21068. protocol: 'accessing',
  21069. fn: function (){
  21070. var self=this;
  21071. return $core.withContext(function($ctx1) {
  21072. var $2,$1,$receiver;
  21073. $2=self["@current"];
  21074. if(($receiver = $2) == null || $receiver.isNil){
  21075. self["@current"]=(
  21076. $ctx1.supercall = true,
  21077. $globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply($recv(self), []));
  21078. $ctx1.supercall = false;
  21079. $1=self["@current"];
  21080. } else {
  21081. $1=$2;
  21082. };
  21083. return $1;
  21084. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  21085. },
  21086. args: [],
  21087. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  21088. referencedClasses: [],
  21089. messageSends: ["ifNil:", "new"]
  21090. }),
  21091. $globals.SystemAnnouncer.klass);
  21092. $core.addMethod(
  21093. $core.method({
  21094. selector: "new",
  21095. protocol: 'instance creation',
  21096. fn: function (){
  21097. var self=this;
  21098. return $core.withContext(function($ctx1) {
  21099. self._shouldNotImplement();
  21100. return self;
  21101. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  21102. },
  21103. args: [],
  21104. source: "new\x0a\x09self shouldNotImplement",
  21105. referencedClasses: [],
  21106. messageSends: ["shouldNotImplement"]
  21107. }),
  21108. $globals.SystemAnnouncer.klass);
  21109. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  21110. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  21111. $core.addMethod(
  21112. $core.method({
  21113. selector: "classTag",
  21114. protocol: 'accessing',
  21115. fn: function (){
  21116. var self=this;
  21117. return "announcement";
  21118. },
  21119. args: [],
  21120. 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'",
  21121. referencedClasses: [],
  21122. messageSends: []
  21123. }),
  21124. $globals.SystemAnnouncement.klass);
  21125. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  21126. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  21127. $core.addMethod(
  21128. $core.method({
  21129. selector: "theClass",
  21130. protocol: 'accessing',
  21131. fn: function (){
  21132. var self=this;
  21133. var $1;
  21134. $1=self["@theClass"];
  21135. return $1;
  21136. },
  21137. args: [],
  21138. source: "theClass\x0a\x09^ theClass",
  21139. referencedClasses: [],
  21140. messageSends: []
  21141. }),
  21142. $globals.ClassAnnouncement);
  21143. $core.addMethod(
  21144. $core.method({
  21145. selector: "theClass:",
  21146. protocol: 'accessing',
  21147. fn: function (aClass){
  21148. var self=this;
  21149. self["@theClass"]=aClass;
  21150. return self;
  21151. },
  21152. args: ["aClass"],
  21153. source: "theClass: aClass\x0a\x09theClass := aClass",
  21154. referencedClasses: [],
  21155. messageSends: []
  21156. }),
  21157. $globals.ClassAnnouncement);
  21158. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21159. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  21160. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21161. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  21162. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21163. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  21164. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  21165. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  21166. $core.addMethod(
  21167. $core.method({
  21168. selector: "oldClass",
  21169. protocol: 'accessing',
  21170. fn: function (){
  21171. var self=this;
  21172. var $1;
  21173. $1=self["@oldClass"];
  21174. return $1;
  21175. },
  21176. args: [],
  21177. source: "oldClass\x0a\x09^ oldClass",
  21178. referencedClasses: [],
  21179. messageSends: []
  21180. }),
  21181. $globals.ClassMigrated);
  21182. $core.addMethod(
  21183. $core.method({
  21184. selector: "oldClass:",
  21185. protocol: 'accessing',
  21186. fn: function (aClass){
  21187. var self=this;
  21188. self["@oldClass"]=aClass;
  21189. return self;
  21190. },
  21191. args: ["aClass"],
  21192. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  21193. referencedClasses: [],
  21194. messageSends: []
  21195. }),
  21196. $globals.ClassMigrated);
  21197. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  21198. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  21199. $core.addMethod(
  21200. $core.method({
  21201. selector: "oldPackage",
  21202. protocol: 'accessing',
  21203. fn: function (){
  21204. var self=this;
  21205. var $1;
  21206. $1=self["@oldPackage"];
  21207. return $1;
  21208. },
  21209. args: [],
  21210. source: "oldPackage\x0a\x09^ oldPackage",
  21211. referencedClasses: [],
  21212. messageSends: []
  21213. }),
  21214. $globals.ClassMoved);
  21215. $core.addMethod(
  21216. $core.method({
  21217. selector: "oldPackage:",
  21218. protocol: 'accessing',
  21219. fn: function (aPackage){
  21220. var self=this;
  21221. self["@oldPackage"]=aPackage;
  21222. return self;
  21223. },
  21224. args: ["aPackage"],
  21225. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  21226. referencedClasses: [],
  21227. messageSends: []
  21228. }),
  21229. $globals.ClassMoved);
  21230. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21231. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  21232. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21233. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  21234. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  21235. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  21236. $core.addMethod(
  21237. $core.method({
  21238. selector: "method",
  21239. protocol: 'accessing',
  21240. fn: function (){
  21241. var self=this;
  21242. var $1;
  21243. $1=self["@method"];
  21244. return $1;
  21245. },
  21246. args: [],
  21247. source: "method\x0a\x09^ method",
  21248. referencedClasses: [],
  21249. messageSends: []
  21250. }),
  21251. $globals.MethodAnnouncement);
  21252. $core.addMethod(
  21253. $core.method({
  21254. selector: "method:",
  21255. protocol: 'accessing',
  21256. fn: function (aCompiledMethod){
  21257. var self=this;
  21258. self["@method"]=aCompiledMethod;
  21259. return self;
  21260. },
  21261. args: ["aCompiledMethod"],
  21262. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  21263. referencedClasses: [],
  21264. messageSends: []
  21265. }),
  21266. $globals.MethodAnnouncement);
  21267. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21268. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  21269. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  21270. $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.";
  21271. $core.addMethod(
  21272. $core.method({
  21273. selector: "oldMethod",
  21274. protocol: 'accessing',
  21275. fn: function (){
  21276. var self=this;
  21277. var $1;
  21278. $1=self["@oldMethod"];
  21279. return $1;
  21280. },
  21281. args: [],
  21282. source: "oldMethod\x0a\x09^ oldMethod",
  21283. referencedClasses: [],
  21284. messageSends: []
  21285. }),
  21286. $globals.MethodModified);
  21287. $core.addMethod(
  21288. $core.method({
  21289. selector: "oldMethod:",
  21290. protocol: 'accessing',
  21291. fn: function (aMethod){
  21292. var self=this;
  21293. self["@oldMethod"]=aMethod;
  21294. return self;
  21295. },
  21296. args: ["aMethod"],
  21297. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  21298. referencedClasses: [],
  21299. messageSends: []
  21300. }),
  21301. $globals.MethodModified);
  21302. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  21303. $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.";
  21304. $core.addMethod(
  21305. $core.method({
  21306. selector: "oldProtocol",
  21307. protocol: 'accessing',
  21308. fn: function (){
  21309. var self=this;
  21310. var $1;
  21311. $1=self["@oldProtocol"];
  21312. return $1;
  21313. },
  21314. args: [],
  21315. source: "oldProtocol\x0a\x09^ oldProtocol",
  21316. referencedClasses: [],
  21317. messageSends: []
  21318. }),
  21319. $globals.MethodMoved);
  21320. $core.addMethod(
  21321. $core.method({
  21322. selector: "oldProtocol:",
  21323. protocol: 'accessing',
  21324. fn: function (aString){
  21325. var self=this;
  21326. self["@oldProtocol"]=aString;
  21327. return self;
  21328. },
  21329. args: ["aString"],
  21330. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  21331. referencedClasses: [],
  21332. messageSends: []
  21333. }),
  21334. $globals.MethodMoved);
  21335. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21336. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  21337. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  21338. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  21339. $core.addMethod(
  21340. $core.method({
  21341. selector: "package",
  21342. protocol: 'accessing',
  21343. fn: function (){
  21344. var self=this;
  21345. var $1;
  21346. $1=self["@package"];
  21347. return $1;
  21348. },
  21349. args: [],
  21350. source: "package\x0a\x09^ package",
  21351. referencedClasses: [],
  21352. messageSends: []
  21353. }),
  21354. $globals.PackageAnnouncement);
  21355. $core.addMethod(
  21356. $core.method({
  21357. selector: "package:",
  21358. protocol: 'accessing',
  21359. fn: function (aPackage){
  21360. var self=this;
  21361. self["@package"]=aPackage;
  21362. return self;
  21363. },
  21364. args: ["aPackage"],
  21365. source: "package: aPackage\x0a\x09package := aPackage",
  21366. referencedClasses: [],
  21367. messageSends: []
  21368. }),
  21369. $globals.PackageAnnouncement);
  21370. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21371. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  21372. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21373. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  21374. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21375. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  21376. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21377. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  21378. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  21379. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  21380. $core.addMethod(
  21381. $core.method({
  21382. selector: "package",
  21383. protocol: 'accessing',
  21384. fn: function (){
  21385. var self=this;
  21386. return $core.withContext(function($ctx1) {
  21387. var $2,$1,$receiver;
  21388. $2=self._theClass();
  21389. if(($receiver = $2) == null || $receiver.isNil){
  21390. $1=$2;
  21391. } else {
  21392. var class_;
  21393. class_=$receiver;
  21394. $1=$recv(class_)._packageOfProtocol_(self._protocol());
  21395. };
  21396. return $1;
  21397. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  21398. },
  21399. args: [],
  21400. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  21401. referencedClasses: [],
  21402. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  21403. }),
  21404. $globals.ProtocolAnnouncement);
  21405. $core.addMethod(
  21406. $core.method({
  21407. selector: "protocol",
  21408. protocol: 'accessing',
  21409. fn: function (){
  21410. var self=this;
  21411. var $1;
  21412. $1=self["@protocol"];
  21413. return $1;
  21414. },
  21415. args: [],
  21416. source: "protocol\x0a\x09^ protocol",
  21417. referencedClasses: [],
  21418. messageSends: []
  21419. }),
  21420. $globals.ProtocolAnnouncement);
  21421. $core.addMethod(
  21422. $core.method({
  21423. selector: "protocol:",
  21424. protocol: 'accessing',
  21425. fn: function (aString){
  21426. var self=this;
  21427. self["@protocol"]=aString;
  21428. return self;
  21429. },
  21430. args: ["aString"],
  21431. source: "protocol: aString\x0a\x09protocol := aString",
  21432. referencedClasses: [],
  21433. messageSends: []
  21434. }),
  21435. $globals.ProtocolAnnouncement);
  21436. $core.addMethod(
  21437. $core.method({
  21438. selector: "theClass",
  21439. protocol: 'accessing',
  21440. fn: function (){
  21441. var self=this;
  21442. var $1;
  21443. $1=self["@theClass"];
  21444. return $1;
  21445. },
  21446. args: [],
  21447. source: "theClass\x0a\x09^ theClass",
  21448. referencedClasses: [],
  21449. messageSends: []
  21450. }),
  21451. $globals.ProtocolAnnouncement);
  21452. $core.addMethod(
  21453. $core.method({
  21454. selector: "theClass:",
  21455. protocol: 'accessing',
  21456. fn: function (aClass){
  21457. var self=this;
  21458. self["@theClass"]=aClass;
  21459. return self;
  21460. },
  21461. args: ["aClass"],
  21462. source: "theClass: aClass\x0a\x09theClass := aClass",
  21463. referencedClasses: [],
  21464. messageSends: []
  21465. }),
  21466. $globals.ProtocolAnnouncement);
  21467. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21468. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  21469. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21470. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  21471. });
  21472. define("amber_core/Platform-Services", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections", "amber_core/Kernel-Methods", "amber_core/Kernel-Infrastructure"], function($boot){"use strict";
  21473. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  21474. $core.addPackage('Platform-Services');
  21475. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  21476. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21477. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  21478. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  21479. $core.addMethod(
  21480. $core.method({
  21481. selector: "handleError:",
  21482. protocol: 'error handling',
  21483. fn: function (anError){
  21484. var self=this;
  21485. return $core.withContext(function($ctx1) {
  21486. var $1,$receiver;
  21487. $1=$recv(anError)._context();
  21488. $ctx1.sendIdx["context"]=1;
  21489. if(($receiver = $1) == null || $receiver.isNil){
  21490. $1;
  21491. } else {
  21492. self._logErrorContext_($recv(anError)._context());
  21493. };
  21494. self._logError_(anError);
  21495. return self;
  21496. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21497. },
  21498. args: ["anError"],
  21499. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  21500. referencedClasses: [],
  21501. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  21502. }),
  21503. $globals.ConsoleErrorHandler);
  21504. $core.addMethod(
  21505. $core.method({
  21506. selector: "log:",
  21507. protocol: 'private',
  21508. fn: function (aString){
  21509. var self=this;
  21510. return $core.withContext(function($ctx1) {
  21511. $recv(console)._log_(aString);
  21512. return self;
  21513. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  21514. },
  21515. args: ["aString"],
  21516. source: "log: aString\x0a\x09console log: aString",
  21517. referencedClasses: [],
  21518. messageSends: ["log:"]
  21519. }),
  21520. $globals.ConsoleErrorHandler);
  21521. $core.addMethod(
  21522. $core.method({
  21523. selector: "logContext:",
  21524. protocol: 'private',
  21525. fn: function (aContext){
  21526. var self=this;
  21527. return $core.withContext(function($ctx1) {
  21528. var $1,$receiver;
  21529. $1=$recv(aContext)._home();
  21530. $ctx1.sendIdx["home"]=1;
  21531. if(($receiver = $1) == null || $receiver.isNil){
  21532. $1;
  21533. } else {
  21534. self._logContext_($recv(aContext)._home());
  21535. };
  21536. self._log_($recv(aContext)._asString());
  21537. return self;
  21538. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21539. },
  21540. args: ["aContext"],
  21541. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  21542. referencedClasses: [],
  21543. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  21544. }),
  21545. $globals.ConsoleErrorHandler);
  21546. $core.addMethod(
  21547. $core.method({
  21548. selector: "logError:",
  21549. protocol: 'private',
  21550. fn: function (anError){
  21551. var self=this;
  21552. return $core.withContext(function($ctx1) {
  21553. self._log_($recv(anError)._messageText());
  21554. return self;
  21555. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21556. },
  21557. args: ["anError"],
  21558. source: "logError: anError\x0a\x09self log: anError messageText",
  21559. referencedClasses: [],
  21560. messageSends: ["log:", "messageText"]
  21561. }),
  21562. $globals.ConsoleErrorHandler);
  21563. $core.addMethod(
  21564. $core.method({
  21565. selector: "logErrorContext:",
  21566. protocol: 'private',
  21567. fn: function (aContext){
  21568. var self=this;
  21569. return $core.withContext(function($ctx1) {
  21570. var $1,$receiver;
  21571. if(($receiver = aContext) == null || $receiver.isNil){
  21572. aContext;
  21573. } else {
  21574. $1=$recv(aContext)._home();
  21575. $ctx1.sendIdx["home"]=1;
  21576. if(($receiver = $1) == null || $receiver.isNil){
  21577. $1;
  21578. } else {
  21579. self._logContext_($recv(aContext)._home());
  21580. };
  21581. };
  21582. return self;
  21583. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21584. },
  21585. args: ["aContext"],
  21586. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  21587. referencedClasses: [],
  21588. messageSends: ["ifNotNil:", "home", "logContext:"]
  21589. }),
  21590. $globals.ConsoleErrorHandler);
  21591. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  21592. $core.addMethod(
  21593. $core.method({
  21594. selector: "initialize",
  21595. protocol: 'initialization',
  21596. fn: function (){
  21597. var self=this;
  21598. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  21599. return $core.withContext(function($ctx1) {
  21600. $recv($ErrorHandler())._registerIfNone_(self._new());
  21601. return self;
  21602. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  21603. },
  21604. args: [],
  21605. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  21606. referencedClasses: ["ErrorHandler"],
  21607. messageSends: ["registerIfNone:", "new"]
  21608. }),
  21609. $globals.ConsoleErrorHandler.klass);
  21610. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  21611. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  21612. $core.addMethod(
  21613. $core.method({
  21614. selector: "clear",
  21615. protocol: 'printing',
  21616. fn: function (){
  21617. var self=this;
  21618. return self;
  21619. },
  21620. args: [],
  21621. source: "clear\x0a\x09\x22no op\x22",
  21622. referencedClasses: [],
  21623. messageSends: []
  21624. }),
  21625. $globals.ConsoleTranscript);
  21626. $core.addMethod(
  21627. $core.method({
  21628. selector: "cr",
  21629. protocol: 'printing',
  21630. fn: function (){
  21631. var self=this;
  21632. return self;
  21633. },
  21634. args: [],
  21635. source: "cr\x0a\x09\x22no op\x22",
  21636. referencedClasses: [],
  21637. messageSends: []
  21638. }),
  21639. $globals.ConsoleTranscript);
  21640. $core.addMethod(
  21641. $core.method({
  21642. selector: "open",
  21643. protocol: 'actions',
  21644. fn: function (){
  21645. var self=this;
  21646. return self;
  21647. },
  21648. args: [],
  21649. source: "open",
  21650. referencedClasses: [],
  21651. messageSends: []
  21652. }),
  21653. $globals.ConsoleTranscript);
  21654. $core.addMethod(
  21655. $core.method({
  21656. selector: "show:",
  21657. protocol: 'printing',
  21658. fn: function (anObject){
  21659. var self=this;
  21660. return $core.withContext(function($ctx1) {
  21661. console.log(String($recv(anObject)._asString()));
  21662. return self;
  21663. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  21664. },
  21665. args: ["anObject"],
  21666. 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()))>",
  21667. referencedClasses: [],
  21668. messageSends: []
  21669. }),
  21670. $globals.ConsoleTranscript);
  21671. $core.addMethod(
  21672. $core.method({
  21673. selector: "initialize",
  21674. protocol: 'initialization',
  21675. fn: function (){
  21676. var self=this;
  21677. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  21678. return $core.withContext(function($ctx1) {
  21679. $recv($Transcript())._registerIfNone_(self._new());
  21680. return self;
  21681. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  21682. },
  21683. args: [],
  21684. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  21685. referencedClasses: ["Transcript"],
  21686. messageSends: ["registerIfNone:", "new"]
  21687. }),
  21688. $globals.ConsoleTranscript.klass);
  21689. $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services');
  21690. $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 }.";
  21691. $core.addMethod(
  21692. $core.method({
  21693. selector: "ajax:",
  21694. protocol: 'actions',
  21695. fn: function (anObject){
  21696. var self=this;
  21697. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  21698. return $core.withContext(function($ctx1) {
  21699. var $1;
  21700. self._deprecatedAPI();
  21701. $1=$recv($PlatformInterface())._ajax_(anObject);
  21702. return $1;
  21703. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
  21704. },
  21705. args: ["anObject"],
  21706. source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject",
  21707. referencedClasses: ["PlatformInterface"],
  21708. messageSends: ["deprecatedAPI", "ajax:"]
  21709. }),
  21710. $globals.InterfacingObject);
  21711. $core.addMethod(
  21712. $core.method({
  21713. selector: "alert:",
  21714. protocol: 'actions',
  21715. fn: function (aString){
  21716. var self=this;
  21717. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21718. return $core.withContext(function($ctx1) {
  21719. var $1;
  21720. $1=$recv($Terminal())._alert_(aString);
  21721. return $1;
  21722. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
  21723. },
  21724. args: ["aString"],
  21725. source: "alert: aString\x0a\x09^ Terminal alert: aString",
  21726. referencedClasses: ["Terminal"],
  21727. messageSends: ["alert:"]
  21728. }),
  21729. $globals.InterfacingObject);
  21730. $core.addMethod(
  21731. $core.method({
  21732. selector: "confirm:",
  21733. protocol: 'actions',
  21734. fn: function (aString){
  21735. var self=this;
  21736. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21737. return $core.withContext(function($ctx1) {
  21738. var $1;
  21739. $1=$recv($Terminal())._confirm_(aString);
  21740. return $1;
  21741. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
  21742. },
  21743. args: ["aString"],
  21744. source: "confirm: aString\x0a\x09^ Terminal confirm: aString",
  21745. referencedClasses: ["Terminal"],
  21746. messageSends: ["confirm:"]
  21747. }),
  21748. $globals.InterfacingObject);
  21749. $core.addMethod(
  21750. $core.method({
  21751. selector: "prompt:",
  21752. protocol: 'actions',
  21753. fn: function (aString){
  21754. var self=this;
  21755. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21756. return $core.withContext(function($ctx1) {
  21757. var $1;
  21758. $1=$recv($Terminal())._prompt_(aString);
  21759. return $1;
  21760. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
  21761. },
  21762. args: ["aString"],
  21763. source: "prompt: aString\x0a\x09^ Terminal prompt: aString",
  21764. referencedClasses: ["Terminal"],
  21765. messageSends: ["prompt:"]
  21766. }),
  21767. $globals.InterfacingObject);
  21768. $core.addMethod(
  21769. $core.method({
  21770. selector: "prompt:default:",
  21771. protocol: 'actions',
  21772. fn: function (aString,defaultString){
  21773. var self=this;
  21774. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21775. return $core.withContext(function($ctx1) {
  21776. var $1;
  21777. $1=$recv($Terminal())._prompt_default_(aString,defaultString);
  21778. return $1;
  21779. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
  21780. },
  21781. args: ["aString", "defaultString"],
  21782. source: "prompt: aString default: defaultString\x0a\x09^ Terminal prompt: aString default: defaultString",
  21783. referencedClasses: ["Terminal"],
  21784. messageSends: ["prompt:default:"]
  21785. }),
  21786. $globals.InterfacingObject);
  21787. $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
  21788. $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.";
  21789. $core.addMethod(
  21790. $core.method({
  21791. selector: "addInstVarNamed:to:",
  21792. protocol: 'compiling',
  21793. fn: function (aString,aClass){
  21794. var self=this;
  21795. return $core.withContext(function($ctx1) {
  21796. var $1,$2,$3,$4,$5;
  21797. $1=self._classBuilder();
  21798. $2=$recv(aClass)._superclass();
  21799. $3=$recv(aClass)._name();
  21800. $ctx1.sendIdx["name"]=1;
  21801. $4=$recv($recv(aClass)._instanceVariableNames())._copy();
  21802. $recv($4)._add_(aString);
  21803. $5=$recv($4)._yourself();
  21804. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,$recv($recv(aClass)._package())._name());
  21805. return self;
  21806. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  21807. },
  21808. args: ["aString", "aClass"],
  21809. 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",
  21810. referencedClasses: [],
  21811. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  21812. }),
  21813. $globals.Environment);
  21814. $core.addMethod(
  21815. $core.method({
  21816. selector: "allSelectors",
  21817. protocol: 'accessing',
  21818. fn: function (){
  21819. var self=this;
  21820. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21821. return $core.withContext(function($ctx1) {
  21822. var $1;
  21823. $1=$recv($recv($Smalltalk())._core())._allSelectors();
  21824. return $1;
  21825. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  21826. },
  21827. args: [],
  21828. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  21829. referencedClasses: ["Smalltalk"],
  21830. messageSends: ["allSelectors", "core"]
  21831. }),
  21832. $globals.Environment);
  21833. $core.addMethod(
  21834. $core.method({
  21835. selector: "availableClassNames",
  21836. protocol: 'accessing',
  21837. fn: function (){
  21838. var self=this;
  21839. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21840. return $core.withContext(function($ctx1) {
  21841. var $1;
  21842. $1=$recv($recv($Smalltalk())._classes())._collect_((function(each){
  21843. return $core.withContext(function($ctx2) {
  21844. return $recv(each)._name();
  21845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21846. }));
  21847. return $1;
  21848. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  21849. },
  21850. args: [],
  21851. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  21852. referencedClasses: ["Smalltalk"],
  21853. messageSends: ["collect:", "classes", "name"]
  21854. }),
  21855. $globals.Environment);
  21856. $core.addMethod(
  21857. $core.method({
  21858. selector: "availablePackageNames",
  21859. protocol: 'accessing',
  21860. fn: function (){
  21861. var self=this;
  21862. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21863. return $core.withContext(function($ctx1) {
  21864. var $1;
  21865. $1=$recv($recv($Smalltalk())._packages())._collect_((function(each){
  21866. return $core.withContext(function($ctx2) {
  21867. return $recv(each)._name();
  21868. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21869. }));
  21870. return $1;
  21871. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  21872. },
  21873. args: [],
  21874. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  21875. referencedClasses: ["Smalltalk"],
  21876. messageSends: ["collect:", "packages", "name"]
  21877. }),
  21878. $globals.Environment);
  21879. $core.addMethod(
  21880. $core.method({
  21881. selector: "availableProtocolsFor:",
  21882. protocol: 'accessing',
  21883. fn: function (aClass){
  21884. var self=this;
  21885. var protocols;
  21886. return $core.withContext(function($ctx1) {
  21887. var $1,$2,$receiver;
  21888. protocols=$recv(aClass)._protocols();
  21889. $1=$recv(aClass)._superclass();
  21890. $ctx1.sendIdx["superclass"]=1;
  21891. if(($receiver = $1) == null || $receiver.isNil){
  21892. $1;
  21893. } else {
  21894. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  21895. };
  21896. $2=$recv($recv($recv(protocols)._asSet())._asArray())._sort();
  21897. return $2;
  21898. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  21899. },
  21900. args: ["aClass"],
  21901. 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",
  21902. referencedClasses: [],
  21903. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  21904. }),
  21905. $globals.Environment);
  21906. $core.addMethod(
  21907. $core.method({
  21908. selector: "classBuilder",
  21909. protocol: 'accessing',
  21910. fn: function (){
  21911. var self=this;
  21912. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  21913. return $core.withContext(function($ctx1) {
  21914. var $1;
  21915. $1=$recv($ClassBuilder())._new();
  21916. return $1;
  21917. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  21918. },
  21919. args: [],
  21920. source: "classBuilder\x0a\x09^ ClassBuilder new",
  21921. referencedClasses: ["ClassBuilder"],
  21922. messageSends: ["new"]
  21923. }),
  21924. $globals.Environment);
  21925. $core.addMethod(
  21926. $core.method({
  21927. selector: "classNamed:",
  21928. protocol: 'accessing',
  21929. fn: function (aString){
  21930. var self=this;
  21931. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21932. return $core.withContext(function($ctx1) {
  21933. var $2,$1,$receiver;
  21934. $2=$recv($recv($Smalltalk())._globals())._at_($recv(aString)._asSymbol());
  21935. if(($receiver = $2) == null || $receiver.isNil){
  21936. $1=self._error_("Invalid class name");
  21937. } else {
  21938. $1=$2;
  21939. };
  21940. return $1;
  21941. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  21942. },
  21943. args: ["aString"],
  21944. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  21945. referencedClasses: ["Smalltalk"],
  21946. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  21947. }),
  21948. $globals.Environment);
  21949. $core.addMethod(
  21950. $core.method({
  21951. selector: "classes",
  21952. protocol: 'accessing',
  21953. fn: function (){
  21954. var self=this;
  21955. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21956. return $core.withContext(function($ctx1) {
  21957. var $1;
  21958. $1=$recv($Smalltalk())._classes();
  21959. return $1;
  21960. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  21961. },
  21962. args: [],
  21963. source: "classes\x0a\x09^ Smalltalk classes",
  21964. referencedClasses: ["Smalltalk"],
  21965. messageSends: ["classes"]
  21966. }),
  21967. $globals.Environment);
  21968. $core.addMethod(
  21969. $core.method({
  21970. selector: "commitPackage:onSuccess:onError:",
  21971. protocol: 'actions',
  21972. fn: function (aPackage,aBlock,anotherBlock){
  21973. var self=this;
  21974. return $core.withContext(function($ctx1) {
  21975. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  21976. return self;
  21977. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  21978. },
  21979. args: ["aPackage", "aBlock", "anotherBlock"],
  21980. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  21981. referencedClasses: [],
  21982. messageSends: ["commitOnSuccess:onError:", "transport"]
  21983. }),
  21984. $globals.Environment);
  21985. $core.addMethod(
  21986. $core.method({
  21987. selector: "compileClassComment:for:",
  21988. protocol: 'compiling',
  21989. fn: function (aString,aClass){
  21990. var self=this;
  21991. return $core.withContext(function($ctx1) {
  21992. $recv(aClass)._comment_(aString);
  21993. return self;
  21994. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  21995. },
  21996. args: ["aString", "aClass"],
  21997. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  21998. referencedClasses: [],
  21999. messageSends: ["comment:"]
  22000. }),
  22001. $globals.Environment);
  22002. $core.addMethod(
  22003. $core.method({
  22004. selector: "compileClassDefinition:",
  22005. protocol: 'compiling',
  22006. fn: function (aString){
  22007. var self=this;
  22008. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  22009. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  22010. return $core.withContext(function($ctx1) {
  22011. $recv((function(){
  22012. return $core.withContext(function($ctx2) {
  22013. return self._evaluate_for_(aString,$recv($DoIt())._new());
  22014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22015. }))._on_do_($Error(),(function(error){
  22016. return $core.withContext(function($ctx2) {
  22017. return self._alert_($recv(error)._messageText());
  22018. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  22019. }));
  22020. return self;
  22021. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  22022. },
  22023. args: ["aString"],
  22024. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  22025. referencedClasses: ["DoIt", "Error"],
  22026. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  22027. }),
  22028. $globals.Environment);
  22029. $core.addMethod(
  22030. $core.method({
  22031. selector: "compileMethod:for:protocol:",
  22032. protocol: 'compiling',
  22033. fn: function (sourceCode,class_,protocol){
  22034. var self=this;
  22035. return $core.withContext(function($ctx1) {
  22036. var $1;
  22037. $1=$recv(class_)._compile_protocol_(sourceCode,protocol);
  22038. return $1;
  22039. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  22040. },
  22041. args: ["sourceCode", "class", "protocol"],
  22042. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  22043. referencedClasses: [],
  22044. messageSends: ["compile:protocol:"]
  22045. }),
  22046. $globals.Environment);
  22047. $core.addMethod(
  22048. $core.method({
  22049. selector: "copyClass:to:",
  22050. protocol: 'actions',
  22051. fn: function (aClass,aClassName){
  22052. var self=this;
  22053. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22054. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  22055. return $core.withContext(function($ctx1) {
  22056. var $1,$2,$receiver;
  22057. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  22058. if(($receiver = $1) == null || $receiver.isNil){
  22059. $1;
  22060. } else {
  22061. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22062. $ctx1.sendIdx[","]=1;
  22063. self._error_($2);
  22064. };
  22065. $recv($recv($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  22066. return self;
  22067. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22068. },
  22069. args: ["aClass", "aClassName"],
  22070. 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",
  22071. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22072. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  22073. }),
  22074. $globals.Environment);
  22075. $core.addMethod(
  22076. $core.method({
  22077. selector: "doItReceiver",
  22078. protocol: 'accessing',
  22079. fn: function (){
  22080. var self=this;
  22081. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  22082. return $core.withContext(function($ctx1) {
  22083. var $1;
  22084. $1=$recv($DoIt())._new();
  22085. return $1;
  22086. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  22087. },
  22088. args: [],
  22089. source: "doItReceiver\x0a\x09^ DoIt new",
  22090. referencedClasses: ["DoIt"],
  22091. messageSends: ["new"]
  22092. }),
  22093. $globals.Environment);
  22094. $core.addMethod(
  22095. $core.method({
  22096. selector: "evaluate:for:",
  22097. protocol: 'evaluating',
  22098. fn: function (aString,anObject){
  22099. var self=this;
  22100. function $Evaluator(){return $globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
  22101. return $core.withContext(function($ctx1) {
  22102. var $1;
  22103. $1=$recv($Evaluator())._evaluate_for_(aString,anObject);
  22104. return $1;
  22105. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  22106. },
  22107. args: ["aString", "anObject"],
  22108. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  22109. referencedClasses: ["Evaluator"],
  22110. messageSends: ["evaluate:for:"]
  22111. }),
  22112. $globals.Environment);
  22113. $core.addMethod(
  22114. $core.method({
  22115. selector: "evaluate:on:do:",
  22116. protocol: 'error handling',
  22117. fn: function (aBlock,anErrorClass,exceptionBlock){
  22118. var self=this;
  22119. return $core.withContext(function($ctx1) {
  22120. var $1;
  22121. $recv(aBlock)._tryCatch_((function(exception){
  22122. return $core.withContext(function($ctx2) {
  22123. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  22124. if($core.assert($1)){
  22125. return $recv(exceptionBlock)._value_(exception);
  22126. } else {
  22127. return $recv(exception)._resignal();
  22128. };
  22129. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  22130. }));
  22131. return self;
  22132. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  22133. },
  22134. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  22135. 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 ] ]",
  22136. referencedClasses: [],
  22137. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  22138. }),
  22139. $globals.Environment);
  22140. $core.addMethod(
  22141. $core.method({
  22142. selector: "inspect:",
  22143. protocol: 'actions',
  22144. fn: function (anObject){
  22145. var self=this;
  22146. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  22147. return $core.withContext(function($ctx1) {
  22148. $recv($Inspector())._inspect_(anObject);
  22149. return self;
  22150. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  22151. },
  22152. args: ["anObject"],
  22153. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  22154. referencedClasses: ["Inspector"],
  22155. messageSends: ["inspect:"]
  22156. }),
  22157. $globals.Environment);
  22158. $core.addMethod(
  22159. $core.method({
  22160. selector: "moveClass:toPackage:",
  22161. protocol: 'actions',
  22162. fn: function (aClass,aPackageName){
  22163. var self=this;
  22164. var package_;
  22165. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  22166. return $core.withContext(function($ctx1) {
  22167. var $1,$2,$receiver;
  22168. package_=$recv($Package())._named_(aPackageName);
  22169. $1=package_;
  22170. if(($receiver = $1) == null || $receiver.isNil){
  22171. self._error_("Invalid package name");
  22172. } else {
  22173. $1;
  22174. };
  22175. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  22176. if($core.assert($2)){
  22177. return self;
  22178. };
  22179. $recv(aClass)._package_(package_);
  22180. return self;
  22181. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  22182. },
  22183. args: ["aClass", "aPackageName"],
  22184. 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",
  22185. referencedClasses: ["Package"],
  22186. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  22187. }),
  22188. $globals.Environment);
  22189. $core.addMethod(
  22190. $core.method({
  22191. selector: "moveMethod:toClass:",
  22192. protocol: 'actions',
  22193. fn: function (aMethod,aClassName){
  22194. var self=this;
  22195. var destinationClass;
  22196. return $core.withContext(function($ctx1) {
  22197. var $2,$3,$1,$5,$4;
  22198. destinationClass=self._classNamed_(aClassName);
  22199. $2=destinationClass;
  22200. $3=$recv(aMethod)._methodClass();
  22201. $ctx1.sendIdx["methodClass"]=1;
  22202. $1=$recv($2).__eq_eq($3);
  22203. if($core.assert($1)){
  22204. return self;
  22205. };
  22206. $5=$recv(aMethod)._methodClass();
  22207. $ctx1.sendIdx["methodClass"]=2;
  22208. $4=$recv($5)._isMetaclass();
  22209. if($core.assert($4)){
  22210. destinationClass=$recv(destinationClass)._class();
  22211. destinationClass;
  22212. };
  22213. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  22214. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22215. return self;
  22216. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  22217. },
  22218. args: ["aMethod", "aClassName"],
  22219. 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",
  22220. referencedClasses: [],
  22221. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  22222. }),
  22223. $globals.Environment);
  22224. $core.addMethod(
  22225. $core.method({
  22226. selector: "moveMethod:toProtocol:",
  22227. protocol: 'actions',
  22228. fn: function (aMethod,aProtocol){
  22229. var self=this;
  22230. return $core.withContext(function($ctx1) {
  22231. $recv(aMethod)._protocol_(aProtocol);
  22232. return self;
  22233. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  22234. },
  22235. args: ["aMethod", "aProtocol"],
  22236. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  22237. referencedClasses: [],
  22238. messageSends: ["protocol:"]
  22239. }),
  22240. $globals.Environment);
  22241. $core.addMethod(
  22242. $core.method({
  22243. selector: "packages",
  22244. protocol: 'accessing',
  22245. fn: function (){
  22246. var self=this;
  22247. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22248. return $core.withContext(function($ctx1) {
  22249. var $1;
  22250. $1=$recv($Smalltalk())._packages();
  22251. return $1;
  22252. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  22253. },
  22254. args: [],
  22255. source: "packages\x0a\x09^ Smalltalk packages",
  22256. referencedClasses: ["Smalltalk"],
  22257. messageSends: ["packages"]
  22258. }),
  22259. $globals.Environment);
  22260. $core.addMethod(
  22261. $core.method({
  22262. selector: "registerErrorHandler:",
  22263. protocol: 'services',
  22264. fn: function (anErrorHandler){
  22265. var self=this;
  22266. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  22267. return $core.withContext(function($ctx1) {
  22268. $recv($ErrorHandler())._register_(anErrorHandler);
  22269. return self;
  22270. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  22271. },
  22272. args: ["anErrorHandler"],
  22273. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  22274. referencedClasses: ["ErrorHandler"],
  22275. messageSends: ["register:"]
  22276. }),
  22277. $globals.Environment);
  22278. $core.addMethod(
  22279. $core.method({
  22280. selector: "registerFinder:",
  22281. protocol: 'services',
  22282. fn: function (aFinder){
  22283. var self=this;
  22284. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  22285. return $core.withContext(function($ctx1) {
  22286. $recv($Finder())._register_(aFinder);
  22287. return self;
  22288. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  22289. },
  22290. args: ["aFinder"],
  22291. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  22292. referencedClasses: ["Finder"],
  22293. messageSends: ["register:"]
  22294. }),
  22295. $globals.Environment);
  22296. $core.addMethod(
  22297. $core.method({
  22298. selector: "registerInspector:",
  22299. protocol: 'services',
  22300. fn: function (anInspector){
  22301. var self=this;
  22302. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  22303. return $core.withContext(function($ctx1) {
  22304. $recv($Inspector())._register_(anInspector);
  22305. return self;
  22306. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  22307. },
  22308. args: ["anInspector"],
  22309. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  22310. referencedClasses: ["Inspector"],
  22311. messageSends: ["register:"]
  22312. }),
  22313. $globals.Environment);
  22314. $core.addMethod(
  22315. $core.method({
  22316. selector: "registerProgressHandler:",
  22317. protocol: 'services',
  22318. fn: function (aProgressHandler){
  22319. var self=this;
  22320. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  22321. return $core.withContext(function($ctx1) {
  22322. $recv($ProgressHandler())._register_(aProgressHandler);
  22323. return self;
  22324. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  22325. },
  22326. args: ["aProgressHandler"],
  22327. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  22328. referencedClasses: ["ProgressHandler"],
  22329. messageSends: ["register:"]
  22330. }),
  22331. $globals.Environment);
  22332. $core.addMethod(
  22333. $core.method({
  22334. selector: "registerTranscript:",
  22335. protocol: 'services',
  22336. fn: function (aTranscript){
  22337. var self=this;
  22338. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  22339. return $core.withContext(function($ctx1) {
  22340. $recv($Transcript())._register_(aTranscript);
  22341. return self;
  22342. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  22343. },
  22344. args: ["aTranscript"],
  22345. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  22346. referencedClasses: ["Transcript"],
  22347. messageSends: ["register:"]
  22348. }),
  22349. $globals.Environment);
  22350. $core.addMethod(
  22351. $core.method({
  22352. selector: "removeClass:",
  22353. protocol: 'actions',
  22354. fn: function (aClass){
  22355. var self=this;
  22356. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22357. return $core.withContext(function($ctx1) {
  22358. $recv($Smalltalk())._removeClass_(aClass);
  22359. return self;
  22360. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  22361. },
  22362. args: ["aClass"],
  22363. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  22364. referencedClasses: ["Smalltalk"],
  22365. messageSends: ["removeClass:"]
  22366. }),
  22367. $globals.Environment);
  22368. $core.addMethod(
  22369. $core.method({
  22370. selector: "removeMethod:",
  22371. protocol: 'actions',
  22372. fn: function (aMethod){
  22373. var self=this;
  22374. return $core.withContext(function($ctx1) {
  22375. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22376. return self;
  22377. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  22378. },
  22379. args: ["aMethod"],
  22380. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  22381. referencedClasses: [],
  22382. messageSends: ["removeCompiledMethod:", "methodClass"]
  22383. }),
  22384. $globals.Environment);
  22385. $core.addMethod(
  22386. $core.method({
  22387. selector: "removeProtocol:from:",
  22388. protocol: 'actions',
  22389. fn: function (aString,aClass){
  22390. var self=this;
  22391. return $core.withContext(function($ctx1) {
  22392. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22393. return $core.withContext(function($ctx2) {
  22394. return $recv(aClass)._removeCompiledMethod_(each);
  22395. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22396. }));
  22397. return self;
  22398. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  22399. },
  22400. args: ["aString", "aClass"],
  22401. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  22402. referencedClasses: [],
  22403. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  22404. }),
  22405. $globals.Environment);
  22406. $core.addMethod(
  22407. $core.method({
  22408. selector: "renameClass:to:",
  22409. protocol: 'actions',
  22410. fn: function (aClass,aClassName){
  22411. var self=this;
  22412. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22413. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  22414. return $core.withContext(function($ctx1) {
  22415. var $1,$2,$receiver;
  22416. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  22417. if(($receiver = $1) == null || $receiver.isNil){
  22418. $1;
  22419. } else {
  22420. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22421. $ctx1.sendIdx[","]=1;
  22422. self._error_($2);
  22423. };
  22424. $recv($recv($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  22425. return self;
  22426. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22427. },
  22428. args: ["aClass", "aClassName"],
  22429. 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",
  22430. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22431. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  22432. }),
  22433. $globals.Environment);
  22434. $core.addMethod(
  22435. $core.method({
  22436. selector: "renamePackage:to:",
  22437. protocol: 'actions',
  22438. fn: function (aPackageName,aNewPackageName){
  22439. var self=this;
  22440. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22441. return $core.withContext(function($ctx1) {
  22442. var $1,$2,$receiver;
  22443. $1=$recv($recv($Smalltalk())._globals())._at_(aNewPackageName);
  22444. if(($receiver = $1) == null || $receiver.isNil){
  22445. $1;
  22446. } else {
  22447. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  22448. $ctx1.sendIdx[","]=1;
  22449. self._error_($2);
  22450. };
  22451. $recv($Smalltalk())._renamePackage_to_(aPackageName,aNewPackageName);
  22452. return self;
  22453. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  22454. },
  22455. args: ["aPackageName", "aNewPackageName"],
  22456. 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",
  22457. referencedClasses: ["Smalltalk"],
  22458. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  22459. }),
  22460. $globals.Environment);
  22461. $core.addMethod(
  22462. $core.method({
  22463. selector: "renameProtocol:to:in:",
  22464. protocol: 'actions',
  22465. fn: function (aString,anotherString,aClass){
  22466. var self=this;
  22467. return $core.withContext(function($ctx1) {
  22468. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22469. return $core.withContext(function($ctx2) {
  22470. return $recv(each)._protocol_(anotherString);
  22471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22472. }));
  22473. return self;
  22474. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  22475. },
  22476. args: ["aString", "anotherString", "aClass"],
  22477. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  22478. referencedClasses: [],
  22479. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  22480. }),
  22481. $globals.Environment);
  22482. $core.addMethod(
  22483. $core.method({
  22484. selector: "setClassCommentOf:to:",
  22485. protocol: 'actions',
  22486. fn: function (aClass,aString){
  22487. var self=this;
  22488. return $core.withContext(function($ctx1) {
  22489. $recv(aClass)._comment_(aString);
  22490. return self;
  22491. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  22492. },
  22493. args: ["aClass", "aString"],
  22494. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  22495. referencedClasses: [],
  22496. messageSends: ["comment:"]
  22497. }),
  22498. $globals.Environment);
  22499. $core.addMethod(
  22500. $core.method({
  22501. selector: "systemAnnouncer",
  22502. protocol: 'accessing',
  22503. fn: function (){
  22504. var self=this;
  22505. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22506. return $core.withContext(function($ctx1) {
  22507. var $1;
  22508. $1=$recv($recv($recv($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  22509. return $1;
  22510. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  22511. },
  22512. args: [],
  22513. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  22514. referencedClasses: ["Smalltalk"],
  22515. messageSends: ["current", "at:", "globals"]
  22516. }),
  22517. $globals.Environment);
  22518. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  22519. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  22520. $core.addMethod(
  22521. $core.method({
  22522. selector: "do:on:displaying:",
  22523. protocol: 'progress handling',
  22524. fn: function (aBlock,aCollection,aString){
  22525. var self=this;
  22526. return $core.withContext(function($ctx1) {
  22527. $recv(aCollection)._do_(aBlock);
  22528. return self;
  22529. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  22530. },
  22531. args: ["aBlock", "aCollection", "aString"],
  22532. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  22533. referencedClasses: [],
  22534. messageSends: ["do:"]
  22535. }),
  22536. $globals.NullProgressHandler);
  22537. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  22538. $core.addMethod(
  22539. $core.method({
  22540. selector: "initialize",
  22541. protocol: 'initialization',
  22542. fn: function (){
  22543. var self=this;
  22544. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  22545. return $core.withContext(function($ctx1) {
  22546. $recv($ProgressHandler())._registerIfNone_(self._new());
  22547. return self;
  22548. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  22549. },
  22550. args: [],
  22551. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  22552. referencedClasses: ["ProgressHandler"],
  22553. messageSends: ["registerIfNone:", "new"]
  22554. }),
  22555. $globals.NullProgressHandler.klass);
  22556. $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
  22557. $globals.PlatformInterface.comment="Deprecated. Use `Platform` or `Terminal`.";
  22558. $core.addMethod(
  22559. $core.method({
  22560. selector: "ajax:",
  22561. protocol: 'actions',
  22562. fn: function (anObject){
  22563. var self=this;
  22564. function $JQuery(){return $globals.JQuery||(typeof JQuery=="undefined"?nil:JQuery)}
  22565. return $core.withContext(function($ctx1) {
  22566. var $1,$receiver;
  22567. self._deprecatedAPI_("Use Platform newXhr or dedicated library.");
  22568. if(($receiver = $JQuery()) == null || $receiver.isNil){
  22569. $1=self._error_("JQuery wrapper not loaded, cannot do AJAX.");
  22570. } else {
  22571. $1=$recv($recv($JQuery())._current())._ajax_(anObject);
  22572. };
  22573. return $1;
  22574. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
  22575. },
  22576. args: ["anObject"],
  22577. 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.' ]",
  22578. referencedClasses: ["JQuery"],
  22579. messageSends: ["deprecatedAPI:", "ifNotNil:ifNil:", "ajax:", "current", "error:"]
  22580. }),
  22581. $globals.PlatformInterface.klass);
  22582. $core.addMethod(
  22583. $core.method({
  22584. selector: "alert:",
  22585. protocol: 'actions',
  22586. fn: function (aString){
  22587. var self=this;
  22588. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22589. return $core.withContext(function($ctx1) {
  22590. var $1;
  22591. self._deprecatedAPI_("Use Terminal alert:");
  22592. $1=$recv($Terminal())._alert_(aString);
  22593. return $1;
  22594. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
  22595. },
  22596. args: ["aString"],
  22597. source: "alert: aString\x0a\x09self deprecatedAPI: 'Use Terminal alert:'.\x0a\x09^ Terminal alert: aString",
  22598. referencedClasses: ["Terminal"],
  22599. messageSends: ["deprecatedAPI:", "alert:"]
  22600. }),
  22601. $globals.PlatformInterface.klass);
  22602. $core.addMethod(
  22603. $core.method({
  22604. selector: "confirm:",
  22605. protocol: 'actions',
  22606. fn: function (aString){
  22607. var self=this;
  22608. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22609. return $core.withContext(function($ctx1) {
  22610. var $1;
  22611. self._deprecatedAPI_("Use Terminal confirm:");
  22612. $1=$recv($Terminal())._confirm_(aString);
  22613. return $1;
  22614. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
  22615. },
  22616. args: ["aString"],
  22617. source: "confirm: aString\x0a\x09self deprecatedAPI: 'Use Terminal confirm:'.\x0a\x09^ Terminal confirm: aString",
  22618. referencedClasses: ["Terminal"],
  22619. messageSends: ["deprecatedAPI:", "confirm:"]
  22620. }),
  22621. $globals.PlatformInterface.klass);
  22622. $core.addMethod(
  22623. $core.method({
  22624. selector: "existsGlobal:",
  22625. protocol: 'actions',
  22626. fn: function (aString){
  22627. var self=this;
  22628. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  22629. return $core.withContext(function($ctx1) {
  22630. var $1;
  22631. self._deprecatedAPI_("Use Smalltalk existsJsGlobal:");
  22632. $1=$recv($recv($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  22633. return true;
  22634. }),(function(){
  22635. return false;
  22636. }));
  22637. return $1;
  22638. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
  22639. },
  22640. args: ["aString"],
  22641. 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 ]",
  22642. referencedClasses: ["PlatformInterface"],
  22643. messageSends: ["deprecatedAPI:", "at:ifPresent:ifAbsent:", "globals"]
  22644. }),
  22645. $globals.PlatformInterface.klass);
  22646. $core.addMethod(
  22647. $core.method({
  22648. selector: "globals",
  22649. protocol: 'accessing',
  22650. fn: function (){
  22651. var self=this;
  22652. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  22653. return $core.withContext(function($ctx1) {
  22654. var $1;
  22655. self._deprecatedAPI_("Use Platform globals");
  22656. $1=$recv($Platform())._globals();
  22657. return $1;
  22658. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
  22659. },
  22660. args: [],
  22661. source: "globals\x0a\x09self deprecatedAPI: 'Use Platform globals'.\x0a\x09^ Platform globals",
  22662. referencedClasses: ["Platform"],
  22663. messageSends: ["deprecatedAPI:", "globals"]
  22664. }),
  22665. $globals.PlatformInterface.klass);
  22666. $core.addMethod(
  22667. $core.method({
  22668. selector: "newXhr",
  22669. protocol: 'actions',
  22670. fn: function (){
  22671. var self=this;
  22672. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  22673. return $core.withContext(function($ctx1) {
  22674. var $1;
  22675. self._deprecatedAPI_("Use Platform newXhr");
  22676. $1=$recv($Platform())._newXhr();
  22677. return $1;
  22678. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)});
  22679. },
  22680. args: [],
  22681. source: "newXhr\x0a\x09self deprecatedAPI: 'Use Platform newXhr'.\x0a\x09^ Platform newXhr",
  22682. referencedClasses: ["Platform"],
  22683. messageSends: ["deprecatedAPI:", "newXhr"]
  22684. }),
  22685. $globals.PlatformInterface.klass);
  22686. $core.addMethod(
  22687. $core.method({
  22688. selector: "prompt:",
  22689. protocol: 'actions',
  22690. fn: function (aString){
  22691. var self=this;
  22692. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22693. return $core.withContext(function($ctx1) {
  22694. var $1;
  22695. self._deprecatedAPI_("Use Terminal prompt:");
  22696. $1=$recv($Terminal())._prompt_(aString);
  22697. return $1;
  22698. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
  22699. },
  22700. args: ["aString"],
  22701. source: "prompt: aString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:'.\x0a\x09^ Terminal prompt: aString",
  22702. referencedClasses: ["Terminal"],
  22703. messageSends: ["deprecatedAPI:", "prompt:"]
  22704. }),
  22705. $globals.PlatformInterface.klass);
  22706. $core.addMethod(
  22707. $core.method({
  22708. selector: "prompt:default:",
  22709. protocol: 'actions',
  22710. fn: function (aString,defaultString){
  22711. var self=this;
  22712. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22713. return $core.withContext(function($ctx1) {
  22714. var $1;
  22715. self._deprecatedAPI_("Use Terminal prompt:default:");
  22716. $1=$recv($Terminal())._prompt_default_(aString,defaultString);
  22717. return $1;
  22718. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
  22719. },
  22720. args: ["aString", "defaultString"],
  22721. source: "prompt: aString default: defaultString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:default:'.\x0a\x09^ Terminal prompt: aString default: defaultString",
  22722. referencedClasses: ["Terminal"],
  22723. messageSends: ["deprecatedAPI:", "prompt:default:"]
  22724. }),
  22725. $globals.PlatformInterface.klass);
  22726. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  22727. $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.";
  22728. $globals.Service.klass.iVarNames = ['current'];
  22729. $core.addMethod(
  22730. $core.method({
  22731. selector: "current",
  22732. protocol: 'accessing',
  22733. fn: function (){
  22734. var self=this;
  22735. var $1;
  22736. $1=self["@current"];
  22737. return $1;
  22738. },
  22739. args: [],
  22740. source: "current\x0a\x09^ current",
  22741. referencedClasses: [],
  22742. messageSends: []
  22743. }),
  22744. $globals.Service.klass);
  22745. $core.addMethod(
  22746. $core.method({
  22747. selector: "new",
  22748. protocol: 'instance creation',
  22749. fn: function (){
  22750. var self=this;
  22751. return $core.withContext(function($ctx1) {
  22752. self._shouldNotImplement();
  22753. return self;
  22754. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  22755. },
  22756. args: [],
  22757. source: "new\x0a\x09self shouldNotImplement",
  22758. referencedClasses: [],
  22759. messageSends: ["shouldNotImplement"]
  22760. }),
  22761. $globals.Service.klass);
  22762. $core.addMethod(
  22763. $core.method({
  22764. selector: "register:",
  22765. protocol: 'registration',
  22766. fn: function (anObject){
  22767. var self=this;
  22768. self["@current"]=anObject;
  22769. return self;
  22770. },
  22771. args: ["anObject"],
  22772. source: "register: anObject\x0a\x09current := anObject",
  22773. referencedClasses: [],
  22774. messageSends: []
  22775. }),
  22776. $globals.Service.klass);
  22777. $core.addMethod(
  22778. $core.method({
  22779. selector: "registerIfNone:",
  22780. protocol: 'registration',
  22781. fn: function (anObject){
  22782. var self=this;
  22783. return $core.withContext(function($ctx1) {
  22784. var $1,$receiver;
  22785. $1=self._current();
  22786. if(($receiver = $1) == null || $receiver.isNil){
  22787. self._register_(anObject);
  22788. } else {
  22789. $1;
  22790. };
  22791. return self;
  22792. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  22793. },
  22794. args: ["anObject"],
  22795. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  22796. referencedClasses: [],
  22797. messageSends: ["ifNil:", "current", "register:"]
  22798. }),
  22799. $globals.Service.klass);
  22800. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  22801. $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.";
  22802. $core.addMethod(
  22803. $core.method({
  22804. selector: "handleError:",
  22805. protocol: 'error handling',
  22806. fn: function (anError){
  22807. var self=this;
  22808. return $core.withContext(function($ctx1) {
  22809. self._handleUnhandledError_(anError);
  22810. return self;
  22811. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  22812. },
  22813. args: ["anError"],
  22814. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  22815. referencedClasses: [],
  22816. messageSends: ["handleUnhandledError:"]
  22817. }),
  22818. $globals.ErrorHandler.klass);
  22819. $core.addMethod(
  22820. $core.method({
  22821. selector: "handleUnhandledError:",
  22822. protocol: 'error handling',
  22823. fn: function (anError){
  22824. var self=this;
  22825. return $core.withContext(function($ctx1) {
  22826. var $1,$2;
  22827. $1=$recv(anError)._wasHandled();
  22828. if($core.assert($1)){
  22829. return self;
  22830. };
  22831. $2=$recv(self._current())._handleError_(anError);
  22832. return $2;
  22833. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  22834. },
  22835. args: ["anError"],
  22836. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  22837. referencedClasses: [],
  22838. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  22839. }),
  22840. $globals.ErrorHandler.klass);
  22841. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  22842. $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.";
  22843. $core.addMethod(
  22844. $core.method({
  22845. selector: "findClass:",
  22846. protocol: 'finding',
  22847. fn: function (aClass){
  22848. var self=this;
  22849. return $core.withContext(function($ctx1) {
  22850. var $1;
  22851. $1=$recv(self._current())._findClass_(aClass);
  22852. return $1;
  22853. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  22854. },
  22855. args: ["aClass"],
  22856. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  22857. referencedClasses: [],
  22858. messageSends: ["findClass:", "current"]
  22859. }),
  22860. $globals.Finder.klass);
  22861. $core.addMethod(
  22862. $core.method({
  22863. selector: "findMethod:",
  22864. protocol: 'finding',
  22865. fn: function (aCompiledMethod){
  22866. var self=this;
  22867. return $core.withContext(function($ctx1) {
  22868. var $1;
  22869. $1=$recv(self._current())._findMethod_(aCompiledMethod);
  22870. return $1;
  22871. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  22872. },
  22873. args: ["aCompiledMethod"],
  22874. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  22875. referencedClasses: [],
  22876. messageSends: ["findMethod:", "current"]
  22877. }),
  22878. $globals.Finder.klass);
  22879. $core.addMethod(
  22880. $core.method({
  22881. selector: "findString:",
  22882. protocol: 'finding',
  22883. fn: function (aString){
  22884. var self=this;
  22885. return $core.withContext(function($ctx1) {
  22886. var $1;
  22887. $1=$recv(self._current())._findString_(aString);
  22888. return $1;
  22889. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  22890. },
  22891. args: ["aString"],
  22892. source: "findString: aString\x0a\x09^ self current findString: aString",
  22893. referencedClasses: [],
  22894. messageSends: ["findString:", "current"]
  22895. }),
  22896. $globals.Finder.klass);
  22897. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  22898. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  22899. $core.addMethod(
  22900. $core.method({
  22901. selector: "inspect:",
  22902. protocol: 'inspecting',
  22903. fn: function (anObject){
  22904. var self=this;
  22905. return $core.withContext(function($ctx1) {
  22906. var $1;
  22907. $1=$recv(self._current())._inspect_(anObject);
  22908. return $1;
  22909. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  22910. },
  22911. args: ["anObject"],
  22912. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  22913. referencedClasses: [],
  22914. messageSends: ["inspect:", "current"]
  22915. }),
  22916. $globals.Inspector.klass);
  22917. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  22918. $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";
  22919. $core.addMethod(
  22920. $core.method({
  22921. selector: "globals",
  22922. protocol: 'accessing',
  22923. fn: function (){
  22924. var self=this;
  22925. return $core.withContext(function($ctx1) {
  22926. var $1;
  22927. $1=$recv(self._current())._globals();
  22928. return $1;
  22929. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  22930. },
  22931. args: [],
  22932. source: "globals\x0a\x09^ self current globals",
  22933. referencedClasses: [],
  22934. messageSends: ["globals", "current"]
  22935. }),
  22936. $globals.Platform.klass);
  22937. $core.addMethod(
  22938. $core.method({
  22939. selector: "newXhr",
  22940. protocol: 'accessing',
  22941. fn: function (){
  22942. var self=this;
  22943. return $core.withContext(function($ctx1) {
  22944. var $1;
  22945. $1=$recv(self._current())._newXhr();
  22946. return $1;
  22947. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  22948. },
  22949. args: [],
  22950. source: "newXhr\x0a\x09^ self current newXhr",
  22951. referencedClasses: [],
  22952. messageSends: ["newXhr", "current"]
  22953. }),
  22954. $globals.Platform.klass);
  22955. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  22956. $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`.";
  22957. $core.addMethod(
  22958. $core.method({
  22959. selector: "do:on:displaying:",
  22960. protocol: 'progress handling',
  22961. fn: function (aBlock,aCollection,aString){
  22962. var self=this;
  22963. return $core.withContext(function($ctx1) {
  22964. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  22965. return self;
  22966. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  22967. },
  22968. args: ["aBlock", "aCollection", "aString"],
  22969. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  22970. referencedClasses: [],
  22971. messageSends: ["do:on:displaying:", "current"]
  22972. }),
  22973. $globals.ProgressHandler.klass);
  22974. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  22975. $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:'.";
  22976. $core.addMethod(
  22977. $core.method({
  22978. selector: "alert:",
  22979. protocol: 'dialogs',
  22980. fn: function (aString){
  22981. var self=this;
  22982. return $core.withContext(function($ctx1) {
  22983. var $1;
  22984. $1=$recv(self._current())._alert_(aString);
  22985. return $1;
  22986. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  22987. },
  22988. args: ["aString"],
  22989. source: "alert: aString\x0a\x09^ self current alert: aString",
  22990. referencedClasses: [],
  22991. messageSends: ["alert:", "current"]
  22992. }),
  22993. $globals.Terminal.klass);
  22994. $core.addMethod(
  22995. $core.method({
  22996. selector: "confirm:",
  22997. protocol: 'dialogs',
  22998. fn: function (aString){
  22999. var self=this;
  23000. return $core.withContext(function($ctx1) {
  23001. var $1;
  23002. $1=$recv(self._current())._confirm_(aString);
  23003. return $1;
  23004. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  23005. },
  23006. args: ["aString"],
  23007. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  23008. referencedClasses: [],
  23009. messageSends: ["confirm:", "current"]
  23010. }),
  23011. $globals.Terminal.klass);
  23012. $core.addMethod(
  23013. $core.method({
  23014. selector: "prompt:",
  23015. protocol: 'dialogs',
  23016. fn: function (aString){
  23017. var self=this;
  23018. return $core.withContext(function($ctx1) {
  23019. var $1;
  23020. $1=$recv(self._current())._prompt_(aString);
  23021. return $1;
  23022. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  23023. },
  23024. args: ["aString"],
  23025. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  23026. referencedClasses: [],
  23027. messageSends: ["prompt:", "current"]
  23028. }),
  23029. $globals.Terminal.klass);
  23030. $core.addMethod(
  23031. $core.method({
  23032. selector: "prompt:default:",
  23033. protocol: 'dialogs',
  23034. fn: function (aString,defaultString){
  23035. var self=this;
  23036. return $core.withContext(function($ctx1) {
  23037. var $1;
  23038. $1=$recv(self._current())._prompt_default_(aString,defaultString);
  23039. return $1;
  23040. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  23041. },
  23042. args: ["aString", "defaultString"],
  23043. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  23044. referencedClasses: [],
  23045. messageSends: ["prompt:default:", "current"]
  23046. }),
  23047. $globals.Terminal.klass);
  23048. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  23049. $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.";
  23050. $core.addMethod(
  23051. $core.method({
  23052. selector: "clear",
  23053. protocol: 'printing',
  23054. fn: function (){
  23055. var self=this;
  23056. return $core.withContext(function($ctx1) {
  23057. $recv(self._current())._clear();
  23058. return self;
  23059. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  23060. },
  23061. args: [],
  23062. source: "clear\x0a\x09self current clear",
  23063. referencedClasses: [],
  23064. messageSends: ["clear", "current"]
  23065. }),
  23066. $globals.Transcript.klass);
  23067. $core.addMethod(
  23068. $core.method({
  23069. selector: "cr",
  23070. protocol: 'printing',
  23071. fn: function (){
  23072. var self=this;
  23073. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  23074. return $core.withContext(function($ctx1) {
  23075. $recv(self._current())._show_($recv($String())._cr());
  23076. return self;
  23077. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  23078. },
  23079. args: [],
  23080. source: "cr\x0a\x09self current show: String cr",
  23081. referencedClasses: ["String"],
  23082. messageSends: ["show:", "current", "cr"]
  23083. }),
  23084. $globals.Transcript.klass);
  23085. $core.addMethod(
  23086. $core.method({
  23087. selector: "inspect:",
  23088. protocol: 'printing',
  23089. fn: function (anObject){
  23090. var self=this;
  23091. return $core.withContext(function($ctx1) {
  23092. self._show_(anObject);
  23093. return self;
  23094. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  23095. },
  23096. args: ["anObject"],
  23097. source: "inspect: anObject\x0a\x09self show: anObject",
  23098. referencedClasses: [],
  23099. messageSends: ["show:"]
  23100. }),
  23101. $globals.Transcript.klass);
  23102. $core.addMethod(
  23103. $core.method({
  23104. selector: "open",
  23105. protocol: 'instance creation',
  23106. fn: function (){
  23107. var self=this;
  23108. return $core.withContext(function($ctx1) {
  23109. $recv(self._current())._open();
  23110. return self;
  23111. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  23112. },
  23113. args: [],
  23114. source: "open\x0a\x09self current open",
  23115. referencedClasses: [],
  23116. messageSends: ["open", "current"]
  23117. }),
  23118. $globals.Transcript.klass);
  23119. $core.addMethod(
  23120. $core.method({
  23121. selector: "show:",
  23122. protocol: 'printing',
  23123. fn: function (anObject){
  23124. var self=this;
  23125. return $core.withContext(function($ctx1) {
  23126. $recv(self._current())._show_(anObject);
  23127. return self;
  23128. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  23129. },
  23130. args: ["anObject"],
  23131. source: "show: anObject\x0a\x09self current show: anObject",
  23132. referencedClasses: [],
  23133. messageSends: ["show:", "current"]
  23134. }),
  23135. $globals.Transcript.klass);
  23136. $core.addMethod(
  23137. $core.method({
  23138. selector: "inspectOn:",
  23139. protocol: '*Platform-Services',
  23140. fn: function (anInspector){
  23141. var self=this;
  23142. var variables;
  23143. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23144. return $core.withContext(function($ctx1) {
  23145. var $1;
  23146. variables=$recv($Dictionary())._new();
  23147. $recv(variables)._at_put_("#self",self);
  23148. $ctx1.sendIdx["at:put:"]=1;
  23149. $recv(variables)._at_put_("#keys",self._keys());
  23150. $ctx1.sendIdx["at:put:"]=2;
  23151. self._keysAndValuesDo_((function(key,value){
  23152. return $core.withContext(function($ctx2) {
  23153. return $recv(variables)._at_put_(key,value);
  23154. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23155. }));
  23156. $recv(anInspector)._setLabel_(self._printString());
  23157. $1=$recv(anInspector)._setVariables_(variables);
  23158. return self;
  23159. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  23160. },
  23161. args: ["anInspector"],
  23162. 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",
  23163. referencedClasses: ["Dictionary"],
  23164. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  23165. }),
  23166. $globals.AssociativeCollection);
  23167. $core.addMethod(
  23168. $core.method({
  23169. selector: "inspectOn:",
  23170. protocol: '*Platform-Services',
  23171. fn: function (anInspector){
  23172. var self=this;
  23173. var variables;
  23174. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23175. return $core.withContext(function($ctx1) {
  23176. var $1;
  23177. variables=$recv($Dictionary())._new();
  23178. $recv(variables)._at_put_("#self",self);
  23179. $ctx1.sendIdx["at:put:"]=1;
  23180. self._withIndexDo_((function(each,i){
  23181. return $core.withContext(function($ctx2) {
  23182. return $recv(variables)._at_put_(i,each);
  23183. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  23184. }));
  23185. $recv(anInspector)._setLabel_(self._printString());
  23186. $1=$recv(anInspector)._setVariables_(variables);
  23187. return self;
  23188. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  23189. },
  23190. args: ["anInspector"],
  23191. 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",
  23192. referencedClasses: ["Dictionary"],
  23193. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  23194. }),
  23195. $globals.Collection);
  23196. $core.addMethod(
  23197. $core.method({
  23198. selector: "inspectOn:",
  23199. protocol: '*Platform-Services',
  23200. fn: function (anInspector){
  23201. var self=this;
  23202. var variables;
  23203. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23204. return $core.withContext(function($ctx1) {
  23205. var $1;
  23206. variables=$recv($Dictionary())._new();
  23207. $recv(variables)._at_put_("#self",self);
  23208. $ctx1.sendIdx["at:put:"]=1;
  23209. $recv(variables)._at_put_("#year",self._year());
  23210. $ctx1.sendIdx["at:put:"]=2;
  23211. $recv(variables)._at_put_("#month",self._month());
  23212. $ctx1.sendIdx["at:put:"]=3;
  23213. $recv(variables)._at_put_("#day",self._day());
  23214. $ctx1.sendIdx["at:put:"]=4;
  23215. $recv(variables)._at_put_("#hours",self._hours());
  23216. $ctx1.sendIdx["at:put:"]=5;
  23217. $recv(variables)._at_put_("#minutes",self._minutes());
  23218. $ctx1.sendIdx["at:put:"]=6;
  23219. $recv(variables)._at_put_("#seconds",self._seconds());
  23220. $ctx1.sendIdx["at:put:"]=7;
  23221. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  23222. $recv(anInspector)._setLabel_(self._printString());
  23223. $1=$recv(anInspector)._setVariables_(variables);
  23224. return self;
  23225. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  23226. },
  23227. args: ["anInspector"],
  23228. 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",
  23229. referencedClasses: ["Dictionary"],
  23230. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  23231. }),
  23232. $globals.Date);
  23233. $core.addMethod(
  23234. $core.method({
  23235. selector: "inspectOn:",
  23236. protocol: '*Platform-Services',
  23237. fn: function (anInspector){
  23238. var self=this;
  23239. var variables;
  23240. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23241. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  23242. return $core.withContext(function($ctx1) {
  23243. variables=$recv($Dictionary())._new();
  23244. $recv(variables)._at_put_("#self",self._jsObject());
  23245. $recv(anInspector)._setLabel_(self._printString());
  23246. $recv($JSObjectProxy())._addObjectVariablesTo_ofProxy_(variables,self);
  23247. $recv(anInspector)._setVariables_(variables);
  23248. return self;
  23249. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  23250. },
  23251. args: ["anInspector"],
  23252. 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",
  23253. referencedClasses: ["Dictionary", "JSObjectProxy"],
  23254. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  23255. }),
  23256. $globals.JSObjectProxy);
  23257. $core.addMethod(
  23258. $core.method({
  23259. selector: "inspectOn:",
  23260. protocol: '*Platform-Services',
  23261. fn: function (anInspector){
  23262. var self=this;
  23263. var variables;
  23264. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23265. return $core.withContext(function($ctx1) {
  23266. var $1;
  23267. variables=$recv($Dictionary())._new();
  23268. $recv(variables)._at_put_("#self",self);
  23269. $ctx1.sendIdx["at:put:"]=1;
  23270. $recv(variables)._at_put_("#home",self._home());
  23271. $ctx1.sendIdx["at:put:"]=2;
  23272. $recv(variables)._at_put_("#receiver",self._receiver());
  23273. $ctx1.sendIdx["at:put:"]=3;
  23274. $recv(variables)._at_put_("#selector",self._selector());
  23275. $ctx1.sendIdx["at:put:"]=4;
  23276. $recv(variables)._at_put_("#locals",self._locals());
  23277. $ctx1.sendIdx["at:put:"]=5;
  23278. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  23279. return $core.withContext(function($ctx2) {
  23280. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23282. }));
  23283. $recv(anInspector)._setLabel_(self._printString());
  23284. $1=$recv(anInspector)._setVariables_(variables);
  23285. return self;
  23286. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  23287. },
  23288. args: ["anInspector"],
  23289. 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",
  23290. referencedClasses: ["Dictionary"],
  23291. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23292. }),
  23293. $globals.MethodContext);
  23294. $core.addMethod(
  23295. $core.method({
  23296. selector: "inspectOn:",
  23297. protocol: '*Platform-Services',
  23298. fn: function (anInspector){
  23299. var self=this;
  23300. var variables;
  23301. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23302. return $core.withContext(function($ctx1) {
  23303. var $1;
  23304. variables=$recv($Dictionary())._new();
  23305. $recv(variables)._at_put_("#self",self);
  23306. $ctx1.sendIdx["at:put:"]=1;
  23307. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  23308. return $core.withContext(function($ctx2) {
  23309. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23310. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23311. }));
  23312. $recv(anInspector)._setLabel_(self._printString());
  23313. $1=$recv(anInspector)._setVariables_(variables);
  23314. return self;
  23315. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  23316. },
  23317. args: ["anInspector"],
  23318. 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",
  23319. referencedClasses: ["Dictionary"],
  23320. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23321. }),
  23322. $globals.Object);
  23323. $core.addMethod(
  23324. $core.method({
  23325. selector: "do:displayingProgress:",
  23326. protocol: '*Platform-Services',
  23327. fn: function (aBlock,aString){
  23328. var self=this;
  23329. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  23330. return $core.withContext(function($ctx1) {
  23331. $recv($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  23332. return self;
  23333. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  23334. },
  23335. args: ["aBlock", "aString"],
  23336. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  23337. referencedClasses: ["ProgressHandler"],
  23338. messageSends: ["do:on:displaying:"]
  23339. }),
  23340. $globals.SequenceableCollection);
  23341. $core.addMethod(
  23342. $core.method({
  23343. selector: "inspectOn:",
  23344. protocol: '*Platform-Services',
  23345. fn: function (anInspector){
  23346. var self=this;
  23347. var variables,i;
  23348. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23349. return $core.withContext(function($ctx1) {
  23350. var $1;
  23351. variables=$recv($Dictionary())._new();
  23352. $recv(variables)._at_put_("#self",self);
  23353. $ctx1.sendIdx["at:put:"]=1;
  23354. i=(1);
  23355. self._do_((function(each){
  23356. return $core.withContext(function($ctx2) {
  23357. $recv(variables)._at_put_(i,each);
  23358. i=$recv(i).__plus((1));
  23359. return i;
  23360. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23361. }));
  23362. $recv(anInspector)._setLabel_(self._printString());
  23363. $1=$recv(anInspector)._setVariables_(variables);
  23364. return self;
  23365. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  23366. },
  23367. args: ["anInspector"],
  23368. 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",
  23369. referencedClasses: ["Dictionary"],
  23370. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  23371. }),
  23372. $globals.Set);
  23373. $core.addMethod(
  23374. $core.method({
  23375. selector: "inspectOn:",
  23376. protocol: '*Platform-Services',
  23377. fn: function (anInspector){
  23378. var self=this;
  23379. var label;
  23380. return $core.withContext(function($ctx1) {
  23381. var $3,$2,$1,$5,$4;
  23382. (
  23383. $ctx1.supercall = true,
  23384. $globals.String.superclass.fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  23385. $ctx1.supercall = false;
  23386. $3=self._printString();
  23387. $ctx1.sendIdx["printString"]=1;
  23388. $2=$recv($3)._size();
  23389. $1=$recv($2).__gt((30));
  23390. if($core.assert($1)){
  23391. $5=self._printString();
  23392. $ctx1.sendIdx["printString"]=2;
  23393. $4=$recv($5)._copyFrom_to_((1),(30));
  23394. label=$recv($4).__comma("...'");
  23395. label;
  23396. } else {
  23397. label=self._printString();
  23398. label;
  23399. };
  23400. $recv(anInspector)._setLabel_(label);
  23401. return self;
  23402. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  23403. },
  23404. args: ["anInspector"],
  23405. 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",
  23406. referencedClasses: [],
  23407. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  23408. }),
  23409. $globals.String);
  23410. });
  23411. define("amber_core/Platform-Node", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23412. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  23413. $core.addPackage('Platform-Node');
  23414. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  23415. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23416. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  23417. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  23418. $core.addMethod(
  23419. $core.method({
  23420. selector: "globals",
  23421. protocol: 'accessing',
  23422. fn: function (){
  23423. var self=this;
  23424. var $1;
  23425. $1=global;
  23426. return $1;
  23427. },
  23428. args: [],
  23429. source: "globals\x0a\x09^ global",
  23430. referencedClasses: [],
  23431. messageSends: []
  23432. }),
  23433. $globals.NodePlatform);
  23434. $core.addMethod(
  23435. $core.method({
  23436. selector: "newXhr",
  23437. protocol: 'accessing',
  23438. fn: function (){
  23439. var self=this;
  23440. function $XMLHttpRequest(){return $globals.XMLHttpRequest||(typeof XMLHttpRequest=="undefined"?nil:XMLHttpRequest)}
  23441. return $core.withContext(function($ctx1) {
  23442. var $1,$receiver;
  23443. if(($receiver = $XMLHttpRequest()) == null || $receiver.isNil){
  23444. self._error_("XMLHttpRequest not available.");
  23445. } else {
  23446. $1=$recv($XMLHttpRequest())._new();
  23447. return $1;
  23448. };
  23449. return self;
  23450. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  23451. },
  23452. args: [],
  23453. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  23454. referencedClasses: ["XMLHttpRequest"],
  23455. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  23456. }),
  23457. $globals.NodePlatform);
  23458. $core.addMethod(
  23459. $core.method({
  23460. selector: "initialize",
  23461. protocol: 'testing',
  23462. fn: function (){
  23463. var self=this;
  23464. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  23465. return $core.withContext(function($ctx1) {
  23466. var $1;
  23467. $1=self._isFeasible();
  23468. if($core.assert($1)){
  23469. $recv($Platform())._registerIfNone_(self._new());
  23470. };
  23471. return self;
  23472. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  23473. },
  23474. args: [],
  23475. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  23476. referencedClasses: ["Platform"],
  23477. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  23478. }),
  23479. $globals.NodePlatform.klass);
  23480. $core.addMethod(
  23481. $core.method({
  23482. selector: "isFeasible",
  23483. protocol: 'testing',
  23484. fn: function (){
  23485. var self=this;
  23486. return $core.withContext(function($ctx1) {
  23487. return typeof global !== "undefined";
  23488. return self;
  23489. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  23490. },
  23491. args: [],
  23492. source: "isFeasible\x0a<return typeof global !== \x22undefined\x22>",
  23493. referencedClasses: [],
  23494. messageSends: []
  23495. }),
  23496. $globals.NodePlatform.klass);
  23497. });
  23498. define('amber/deploy',[
  23499. './helpers',
  23500. // --- packages of the core Amber begin here ---
  23501. 'amber_core/Kernel-Objects',
  23502. 'amber_core/Kernel-Classes',
  23503. 'amber_core/Kernel-Methods',
  23504. 'amber_core/Kernel-Collections',
  23505. 'amber_core/Kernel-Infrastructure',
  23506. 'amber_core/Kernel-Exceptions',
  23507. 'amber_core/Kernel-Announcements',
  23508. 'amber_core/Platform-Services',
  23509. 'amber_core/Platform-Browser'
  23510. // --- packages of the core Amber end here ---
  23511. ], function (amber) { return amber; });
  23512. define("amber/parser", ["./boot"], function($boot) {
  23513. var $globals = $boot.globals, nil = $boot.nil;
  23514. $globals.SmalltalkParser = (function() {
  23515. /*
  23516. * Generated by PEG.js 0.8.0.
  23517. *
  23518. * http://pegjs.majda.cz/
  23519. */
  23520. function peg$subclass(child, parent) {
  23521. function ctor() { this.constructor = child; }
  23522. ctor.prototype = parent.prototype;
  23523. child.prototype = new ctor();
  23524. }
  23525. function SyntaxError(message, expected, found, offset, line, column) {
  23526. this.message = message;
  23527. this.expected = expected;
  23528. this.found = found;
  23529. this.offset = offset;
  23530. this.line = line;
  23531. this.column = column;
  23532. this.name = "SyntaxError";
  23533. }
  23534. peg$subclass(SyntaxError, Error);
  23535. function parse(input) {
  23536. var options = arguments.length > 1 ? arguments[1] : {},
  23537. peg$FAILED = {},
  23538. peg$startRuleFunctions = { start: peg$parsestart },
  23539. peg$startRuleFunction = peg$parsestart,
  23540. peg$c0 = [],
  23541. peg$c1 = peg$FAILED,
  23542. peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  23543. peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" },
  23544. peg$c4 = "\"",
  23545. peg$c5 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  23546. peg$c6 = /^[^"]/,
  23547. peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" },
  23548. peg$c8 = /^[a-zA-Z]/,
  23549. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  23550. peg$c10 = /^[a-zA-Z0-9]/,
  23551. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  23552. peg$c12 = function(first, others) {return first + others.join("");},
  23553. peg$c13 = ":",
  23554. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  23555. peg$c15 = function(first, last) {return first + last;},
  23556. peg$c16 = /^[a-zA-Z0-9:]/,
  23557. peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" },
  23558. peg$c18 = /^[A-Z]/,
  23559. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  23560. peg$c20 = "'",
  23561. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  23562. peg$c22 = "''",
  23563. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  23564. peg$c24 = function() {return "'";},
  23565. peg$c25 = /^[^']/,
  23566. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  23567. peg$c27 = function(val) {
  23568. return $globals.ValueNode._new()
  23569. ._position_((line()).__at(column()))
  23570. ._source_(text())
  23571. ._value_(val.join(""));
  23572. },
  23573. peg$c28 = "$",
  23574. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  23575. peg$c30 = { type: "any", description: "any character" },
  23576. peg$c31 = function(char) {
  23577. return $globals.ValueNode._new()
  23578. ._position_((line()).__at(column()))
  23579. ._source_(text())
  23580. ._value_(char);
  23581. },
  23582. peg$c32 = "#",
  23583. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  23584. peg$c34 = function(rest) {return rest;},
  23585. peg$c35 = function(node) {return node._value();},
  23586. peg$c36 = function(val) {
  23587. return $globals.ValueNode._new()
  23588. ._position_((line()).__at(column()))
  23589. ._source_(text())
  23590. ._value_(val);
  23591. },
  23592. peg$c37 = function(n) {
  23593. return $globals.ValueNode._new()
  23594. ._position_((line()).__at(column()))
  23595. ._source_(text())
  23596. ._value_(n);
  23597. },
  23598. peg$c38 = "e",
  23599. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  23600. peg$c40 = function(n) {return parseFloat(n.join(""));},
  23601. peg$c41 = null,
  23602. peg$c42 = "-",
  23603. peg$c43 = { type: "literal", value: "-", description: "\"-\"" },
  23604. peg$c44 = "16r",
  23605. peg$c45 = { type: "literal", value: "16r", description: "\"16r\"" },
  23606. peg$c46 = /^[0-9a-fA-F]/,
  23607. peg$c47 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  23608. peg$c48 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  23609. peg$c49 = /^[0-9]/,
  23610. peg$c50 = { type: "class", value: "[0-9]", description: "[0-9]" },
  23611. peg$c51 = ".",
  23612. peg$c52 = { type: "literal", value: ".", description: "\".\"" },
  23613. peg$c53 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  23614. peg$c54 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  23615. peg$c55 = "#(",
  23616. peg$c56 = { type: "literal", value: "#(", description: "\"#(\"" },
  23617. peg$c57 = "(",
  23618. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  23619. peg$c59 = function(lit) {return lit._value();},
  23620. peg$c60 = ")",
  23621. peg$c61 = { type: "literal", value: ")", description: "\")\"" },
  23622. peg$c62 = function(lits) {
  23623. return $globals.ValueNode._new()
  23624. ._position_((line()).__at(column()))
  23625. ._source_(text())
  23626. ._value_(lits);
  23627. },
  23628. peg$c63 = "{",
  23629. peg$c64 = { type: "literal", value: "{", description: "\"{\"" },
  23630. peg$c65 = "}",
  23631. peg$c66 = { type: "literal", value: "}", description: "\"}\"" },
  23632. peg$c67 = function(expressions) {
  23633. return $globals.DynamicArrayNode._new()
  23634. ._position_((line()).__at(column()))
  23635. ._source_(text())
  23636. ._nodes_(expressions || []);
  23637. },
  23638. peg$c68 = "#{",
  23639. peg$c69 = { type: "literal", value: "#{", description: "\"#{\"" },
  23640. peg$c70 = function(expressions) {
  23641. return $globals.DynamicDictionaryNode._new()
  23642. ._position_((line()).__at(column()))
  23643. ._source_(text())
  23644. ._nodes_(expressions || []);
  23645. },
  23646. peg$c71 = "true",
  23647. peg$c72 = { type: "literal", value: "true", description: "\"true\"" },
  23648. peg$c73 = function() {return true;},
  23649. peg$c74 = "false",
  23650. peg$c75 = { type: "literal", value: "false", description: "\"false\"" },
  23651. peg$c76 = function() {return false;},
  23652. peg$c77 = "nil",
  23653. peg$c78 = { type: "literal", value: "nil", description: "\"nil\"" },
  23654. peg$c79 = function() {return nil;},
  23655. peg$c80 = function(val) {
  23656. return $globals.ValueNode._new()
  23657. ._position_((line()).__at(column()))
  23658. ._source_(text())
  23659. ._value_(val);
  23660. },
  23661. peg$c81 = function(identifier) {
  23662. return $globals.VariableNode._new()
  23663. ._position_((line()).__at(column()))
  23664. ._source_(text())
  23665. ._value_(identifier);
  23666. },
  23667. peg$c82 = function(key, arg) {return {key:key, arg:arg};},
  23668. peg$c83 = /^[\\+*\/=><,@%~|&\-]/,
  23669. peg$c84 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" },
  23670. peg$c85 = function(bin) {return bin.join("");},
  23671. peg$c86 = function(pairs) {
  23672. var keywords = [];
  23673. var params = [];
  23674. var i = 0;
  23675. for(i = 0; i < pairs.length; i++){
  23676. keywords.push(pairs[i].key);
  23677. }
  23678. for(i = 0; i < pairs.length; i++){
  23679. params.push(pairs[i].arg);
  23680. }
  23681. return [keywords.join(""), params];
  23682. },
  23683. peg$c87 = function(selector, arg) {return [selector, [arg]];},
  23684. peg$c88 = function(selector) {return [selector, []];},
  23685. peg$c89 = function(expression) {return expression;},
  23686. peg$c90 = function(first, others) { return [first].concat(others); },
  23687. peg$c91 = ":=",
  23688. peg$c92 = { type: "literal", value: ":=", description: "\":=\"" },
  23689. peg$c93 = function(variable, expression) {
  23690. return $globals.AssignmentNode._new()
  23691. ._position_((line()).__at(column()))
  23692. ._source_(text())
  23693. ._left_(variable)
  23694. ._right_(expression);
  23695. },
  23696. peg$c94 = "^",
  23697. peg$c95 = { type: "literal", value: "^", description: "\"^\"" },
  23698. peg$c96 = function(expression) {
  23699. return $globals.ReturnNode._new()
  23700. ._position_((line()).__at(column()))
  23701. ._source_(text())
  23702. ._nodes_([expression]);
  23703. },
  23704. peg$c97 = "|",
  23705. peg$c98 = { type: "literal", value: "|", description: "\"|\"" },
  23706. peg$c99 = function(variable) {return variable;},
  23707. peg$c100 = function(vars) {return vars;},
  23708. peg$c101 = function(param) {return param;},
  23709. peg$c102 = function(params) {return params;},
  23710. peg$c103 = function(ret) {return [ret];},
  23711. peg$c104 = function(exps, ret) {
  23712. var expressions = exps;
  23713. expressions.push(ret);
  23714. return expressions;
  23715. },
  23716. peg$c105 = function(expressions) {
  23717. return expressions || [];
  23718. },
  23719. peg$c106 = function(temps, statements) {
  23720. return $globals.SequenceNode._new()
  23721. ._position_((line()).__at(column()))
  23722. ._source_(text())
  23723. ._temps_(temps || [])
  23724. ._nodes_(statements || []);
  23725. },
  23726. peg$c107 = "[",
  23727. peg$c108 = { type: "literal", value: "[", description: "\"[\"" },
  23728. peg$c109 = "]",
  23729. peg$c110 = { type: "literal", value: "]", description: "\"]\"" },
  23730. peg$c111 = function(params, sequence) {
  23731. return $globals.BlockNode._new()
  23732. ._position_((line()).__at(column()))
  23733. ._source_(text())
  23734. ._parameters_(params || [])
  23735. ._nodes_([sequence._asBlockSequenceNode()]);
  23736. },
  23737. peg$c112 = void 0,
  23738. peg$c113 = function(selector) {
  23739. return $globals.SendNode._new()
  23740. ._position_((line()).__at(column()))
  23741. ._source_(text())
  23742. ._selector_(selector);
  23743. },
  23744. peg$c114 = function(message, tail) {
  23745. if(tail) {
  23746. return tail._valueForReceiver_(message);
  23747. }
  23748. else {
  23749. return message;
  23750. }
  23751. },
  23752. peg$c115 = function(receiver, tail) {
  23753. if(tail) {
  23754. return tail._valueForReceiver_(receiver);
  23755. }
  23756. else {
  23757. return receiver;
  23758. }
  23759. },
  23760. peg$c116 = function(selector, arg) {
  23761. return $globals.SendNode._new()
  23762. ._position_((line()).__at(column()))
  23763. ._source_(text())
  23764. ._selector_(selector)
  23765. ._arguments_([arg]);
  23766. },
  23767. peg$c117 = function(message, tail) {
  23768. if(tail) {
  23769. return tail._valueForReceiver_(message);
  23770. }
  23771. else {
  23772. return message;
  23773. }
  23774. },
  23775. peg$c118 = function(pairs) {
  23776. var selector = [];
  23777. var args = [];
  23778. for(var i = 0; i < pairs.length; i++) {
  23779. selector.push(pairs[i].key);
  23780. args.push(pairs[i].arg);
  23781. }
  23782. return $globals.SendNode._new()
  23783. ._position_((line()).__at(column()))
  23784. ._source_(text())
  23785. ._selector_(selector.join(""))
  23786. ._arguments_(args);
  23787. },
  23788. peg$c119 = function(receiver, tail) {
  23789. return tail._valueForReceiver_(receiver);
  23790. },
  23791. peg$c120 = ";",
  23792. peg$c121 = { type: "literal", value: ";", description: "\";\"" },
  23793. peg$c122 = function(mess) {return mess;},
  23794. peg$c123 = function(send, messages) {
  23795. var cascade = [];
  23796. cascade.push(send);
  23797. for(var i = 0; i < messages.length; i++) {
  23798. cascade.push(messages[i]);
  23799. }
  23800. return $globals.CascadeNode._new()
  23801. ._position_((line()).__at(column()))
  23802. ._source_(text())
  23803. ._receiver_(send._receiver())
  23804. ._nodes_(cascade);
  23805. },
  23806. peg$c124 = "<",
  23807. peg$c125 = { type: "literal", value: "<", description: "\"<\"" },
  23808. peg$c126 = ">>",
  23809. peg$c127 = { type: "literal", value: ">>", description: "\">>\"" },
  23810. peg$c128 = function() {return ">";},
  23811. peg$c129 = /^[^>]/,
  23812. peg$c130 = { type: "class", value: "[^>]", description: "[^>]" },
  23813. peg$c131 = ">",
  23814. peg$c132 = { type: "literal", value: ">", description: "\">\"" },
  23815. peg$c133 = function(val) {
  23816. return $globals.JSStatementNode._new()
  23817. ._position_((line()).__at(column()))
  23818. ._source_(val.join(""))
  23819. },
  23820. peg$c134 = function(pattern, sequence) {
  23821. return $globals.MethodNode._new()
  23822. ._position_((line()).__at(column()))
  23823. ._source_(text())
  23824. ._selector_(pattern[0])
  23825. ._arguments_(pattern[1])
  23826. ._nodes_([sequence]);
  23827. },
  23828. peg$c135 = function(send) { return send._selector() === "->" },
  23829. peg$c136 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  23830. peg$c137 = function(first, others) { return first.concat.apply(first, others); },
  23831. peg$currPos = 0,
  23832. peg$reportedPos = 0,
  23833. peg$cachedPos = 0,
  23834. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
  23835. peg$maxFailPos = 0,
  23836. peg$maxFailExpected = [],
  23837. peg$silentFails = 0,
  23838. peg$cache = {},
  23839. peg$result;
  23840. if ("startRule" in options) {
  23841. if (!(options.startRule in peg$startRuleFunctions)) {
  23842. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  23843. }
  23844. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  23845. }
  23846. function text() {
  23847. return input.substring(peg$reportedPos, peg$currPos);
  23848. }
  23849. function offset() {
  23850. return peg$reportedPos;
  23851. }
  23852. function line() {
  23853. return peg$computePosDetails(peg$reportedPos).line;
  23854. }
  23855. function column() {
  23856. return peg$computePosDetails(peg$reportedPos).column;
  23857. }
  23858. function expected(description) {
  23859. throw peg$buildException(
  23860. null,
  23861. [{ type: "other", description: description }],
  23862. peg$reportedPos
  23863. );
  23864. }
  23865. function error(message) {
  23866. throw peg$buildException(message, null, peg$reportedPos);
  23867. }
  23868. function peg$computePosDetails(pos) {
  23869. function advance(details, startPos, endPos) {
  23870. var p, ch;
  23871. for (p = startPos; p < endPos; p++) {
  23872. ch = input.charAt(p);
  23873. if (ch === "\n") {
  23874. if (!details.seenCR) { details.line++; }
  23875. details.column = 1;
  23876. details.seenCR = false;
  23877. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  23878. details.line++;
  23879. details.column = 1;
  23880. details.seenCR = true;
  23881. } else {
  23882. details.column++;
  23883. details.seenCR = false;
  23884. }
  23885. }
  23886. }
  23887. if (peg$cachedPos !== pos) {
  23888. if (peg$cachedPos > pos) {
  23889. peg$cachedPos = 0;
  23890. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
  23891. }
  23892. advance(peg$cachedPosDetails, peg$cachedPos, pos);
  23893. peg$cachedPos = pos;
  23894. }
  23895. return peg$cachedPosDetails;
  23896. }
  23897. function peg$fail(expected) {
  23898. if (peg$currPos < peg$maxFailPos) { return; }
  23899. if (peg$currPos > peg$maxFailPos) {
  23900. peg$maxFailPos = peg$currPos;
  23901. peg$maxFailExpected = [];
  23902. }
  23903. peg$maxFailExpected.push(expected);
  23904. }
  23905. function peg$buildException(message, expected, pos) {
  23906. function cleanupExpected(expected) {
  23907. var i = 1;
  23908. expected.sort(function(a, b) {
  23909. if (a.description < b.description) {
  23910. return -1;
  23911. } else if (a.description > b.description) {
  23912. return 1;
  23913. } else {
  23914. return 0;
  23915. }
  23916. });
  23917. while (i < expected.length) {
  23918. if (expected[i - 1] === expected[i]) {
  23919. expected.splice(i, 1);
  23920. } else {
  23921. i++;
  23922. }
  23923. }
  23924. }
  23925. function buildMessage(expected, found) {
  23926. function stringEscape(s) {
  23927. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  23928. return s
  23929. .replace(/\\/g, '\\\\')
  23930. .replace(/"/g, '\\"')
  23931. .replace(/\x08/g, '\\b')
  23932. .replace(/\t/g, '\\t')
  23933. .replace(/\n/g, '\\n')
  23934. .replace(/\f/g, '\\f')
  23935. .replace(/\r/g, '\\r')
  23936. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  23937. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  23938. .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  23939. .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  23940. }
  23941. var expectedDescs = new Array(expected.length),
  23942. expectedDesc, foundDesc, i;
  23943. for (i = 0; i < expected.length; i++) {
  23944. expectedDescs[i] = expected[i].description;
  23945. }
  23946. expectedDesc = expected.length > 1
  23947. ? expectedDescs.slice(0, -1).join(", ")
  23948. + " or "
  23949. + expectedDescs[expected.length - 1]
  23950. : expectedDescs[0];
  23951. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  23952. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  23953. }
  23954. var posDetails = peg$computePosDetails(pos),
  23955. found = pos < input.length ? input.charAt(pos) : null;
  23956. if (expected !== null) {
  23957. cleanupExpected(expected);
  23958. }
  23959. return new SyntaxError(
  23960. message !== null ? message : buildMessage(expected, found),
  23961. expected,
  23962. found,
  23963. pos,
  23964. posDetails.line,
  23965. posDetails.column
  23966. );
  23967. }
  23968. function peg$parsestart() {
  23969. var s0;
  23970. var key = peg$currPos * 60 + 0,
  23971. cached = peg$cache[key];
  23972. if (cached) {
  23973. peg$currPos = cached.nextPos;
  23974. return cached.result;
  23975. }
  23976. s0 = peg$parsemethod();
  23977. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  23978. return s0;
  23979. }
  23980. function peg$parseseparator() {
  23981. var s0, s1;
  23982. var key = peg$currPos * 60 + 1,
  23983. cached = peg$cache[key];
  23984. if (cached) {
  23985. peg$currPos = cached.nextPos;
  23986. return cached.result;
  23987. }
  23988. s0 = [];
  23989. if (peg$c2.test(input.charAt(peg$currPos))) {
  23990. s1 = input.charAt(peg$currPos);
  23991. peg$currPos++;
  23992. } else {
  23993. s1 = peg$FAILED;
  23994. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23995. }
  23996. if (s1 !== peg$FAILED) {
  23997. while (s1 !== peg$FAILED) {
  23998. s0.push(s1);
  23999. if (peg$c2.test(input.charAt(peg$currPos))) {
  24000. s1 = input.charAt(peg$currPos);
  24001. peg$currPos++;
  24002. } else {
  24003. s1 = peg$FAILED;
  24004. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24005. }
  24006. }
  24007. } else {
  24008. s0 = peg$c1;
  24009. }
  24010. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24011. return s0;
  24012. }
  24013. function peg$parsecomments() {
  24014. var s0, s1, s2, s3, s4;
  24015. var key = peg$currPos * 60 + 2,
  24016. cached = peg$cache[key];
  24017. if (cached) {
  24018. peg$currPos = cached.nextPos;
  24019. return cached.result;
  24020. }
  24021. s0 = [];
  24022. s1 = peg$currPos;
  24023. if (input.charCodeAt(peg$currPos) === 34) {
  24024. s2 = peg$c4;
  24025. peg$currPos++;
  24026. } else {
  24027. s2 = peg$FAILED;
  24028. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24029. }
  24030. if (s2 !== peg$FAILED) {
  24031. s3 = [];
  24032. if (peg$c6.test(input.charAt(peg$currPos))) {
  24033. s4 = input.charAt(peg$currPos);
  24034. peg$currPos++;
  24035. } else {
  24036. s4 = peg$FAILED;
  24037. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24038. }
  24039. while (s4 !== peg$FAILED) {
  24040. s3.push(s4);
  24041. if (peg$c6.test(input.charAt(peg$currPos))) {
  24042. s4 = input.charAt(peg$currPos);
  24043. peg$currPos++;
  24044. } else {
  24045. s4 = peg$FAILED;
  24046. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24047. }
  24048. }
  24049. if (s3 !== peg$FAILED) {
  24050. if (input.charCodeAt(peg$currPos) === 34) {
  24051. s4 = peg$c4;
  24052. peg$currPos++;
  24053. } else {
  24054. s4 = peg$FAILED;
  24055. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24056. }
  24057. if (s4 !== peg$FAILED) {
  24058. s2 = [s2, s3, s4];
  24059. s1 = s2;
  24060. } else {
  24061. peg$currPos = s1;
  24062. s1 = peg$c1;
  24063. }
  24064. } else {
  24065. peg$currPos = s1;
  24066. s1 = peg$c1;
  24067. }
  24068. } else {
  24069. peg$currPos = s1;
  24070. s1 = peg$c1;
  24071. }
  24072. if (s1 !== peg$FAILED) {
  24073. while (s1 !== peg$FAILED) {
  24074. s0.push(s1);
  24075. s1 = peg$currPos;
  24076. if (input.charCodeAt(peg$currPos) === 34) {
  24077. s2 = peg$c4;
  24078. peg$currPos++;
  24079. } else {
  24080. s2 = peg$FAILED;
  24081. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24082. }
  24083. if (s2 !== peg$FAILED) {
  24084. s3 = [];
  24085. if (peg$c6.test(input.charAt(peg$currPos))) {
  24086. s4 = input.charAt(peg$currPos);
  24087. peg$currPos++;
  24088. } else {
  24089. s4 = peg$FAILED;
  24090. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24091. }
  24092. while (s4 !== peg$FAILED) {
  24093. s3.push(s4);
  24094. if (peg$c6.test(input.charAt(peg$currPos))) {
  24095. s4 = input.charAt(peg$currPos);
  24096. peg$currPos++;
  24097. } else {
  24098. s4 = peg$FAILED;
  24099. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24100. }
  24101. }
  24102. if (s3 !== peg$FAILED) {
  24103. if (input.charCodeAt(peg$currPos) === 34) {
  24104. s4 = peg$c4;
  24105. peg$currPos++;
  24106. } else {
  24107. s4 = peg$FAILED;
  24108. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24109. }
  24110. if (s4 !== peg$FAILED) {
  24111. s2 = [s2, s3, s4];
  24112. s1 = s2;
  24113. } else {
  24114. peg$currPos = s1;
  24115. s1 = peg$c1;
  24116. }
  24117. } else {
  24118. peg$currPos = s1;
  24119. s1 = peg$c1;
  24120. }
  24121. } else {
  24122. peg$currPos = s1;
  24123. s1 = peg$c1;
  24124. }
  24125. }
  24126. } else {
  24127. s0 = peg$c1;
  24128. }
  24129. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24130. return s0;
  24131. }
  24132. function peg$parsews() {
  24133. var s0, s1;
  24134. var key = peg$currPos * 60 + 3,
  24135. cached = peg$cache[key];
  24136. if (cached) {
  24137. peg$currPos = cached.nextPos;
  24138. return cached.result;
  24139. }
  24140. s0 = [];
  24141. s1 = peg$parseseparator();
  24142. if (s1 === peg$FAILED) {
  24143. s1 = peg$parsecomments();
  24144. }
  24145. while (s1 !== peg$FAILED) {
  24146. s0.push(s1);
  24147. s1 = peg$parseseparator();
  24148. if (s1 === peg$FAILED) {
  24149. s1 = peg$parsecomments();
  24150. }
  24151. }
  24152. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24153. return s0;
  24154. }
  24155. function peg$parseidentifier() {
  24156. var s0, s1, s2, s3;
  24157. var key = peg$currPos * 60 + 4,
  24158. cached = peg$cache[key];
  24159. if (cached) {
  24160. peg$currPos = cached.nextPos;
  24161. return cached.result;
  24162. }
  24163. s0 = peg$currPos;
  24164. if (peg$c8.test(input.charAt(peg$currPos))) {
  24165. s1 = input.charAt(peg$currPos);
  24166. peg$currPos++;
  24167. } else {
  24168. s1 = peg$FAILED;
  24169. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24170. }
  24171. if (s1 !== peg$FAILED) {
  24172. s2 = [];
  24173. if (peg$c10.test(input.charAt(peg$currPos))) {
  24174. s3 = input.charAt(peg$currPos);
  24175. peg$currPos++;
  24176. } else {
  24177. s3 = peg$FAILED;
  24178. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24179. }
  24180. while (s3 !== peg$FAILED) {
  24181. s2.push(s3);
  24182. if (peg$c10.test(input.charAt(peg$currPos))) {
  24183. s3 = input.charAt(peg$currPos);
  24184. peg$currPos++;
  24185. } else {
  24186. s3 = peg$FAILED;
  24187. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24188. }
  24189. }
  24190. if (s2 !== peg$FAILED) {
  24191. peg$reportedPos = s0;
  24192. s1 = peg$c12(s1, s2);
  24193. s0 = s1;
  24194. } else {
  24195. peg$currPos = s0;
  24196. s0 = peg$c1;
  24197. }
  24198. } else {
  24199. peg$currPos = s0;
  24200. s0 = peg$c1;
  24201. }
  24202. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24203. return s0;
  24204. }
  24205. function peg$parsekeyword() {
  24206. var s0, s1, s2;
  24207. var key = peg$currPos * 60 + 5,
  24208. cached = peg$cache[key];
  24209. if (cached) {
  24210. peg$currPos = cached.nextPos;
  24211. return cached.result;
  24212. }
  24213. s0 = peg$currPos;
  24214. s1 = peg$parseidentifier();
  24215. if (s1 !== peg$FAILED) {
  24216. if (input.charCodeAt(peg$currPos) === 58) {
  24217. s2 = peg$c13;
  24218. peg$currPos++;
  24219. } else {
  24220. s2 = peg$FAILED;
  24221. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  24222. }
  24223. if (s2 !== peg$FAILED) {
  24224. peg$reportedPos = s0;
  24225. s1 = peg$c15(s1, s2);
  24226. s0 = s1;
  24227. } else {
  24228. peg$currPos = s0;
  24229. s0 = peg$c1;
  24230. }
  24231. } else {
  24232. peg$currPos = s0;
  24233. s0 = peg$c1;
  24234. }
  24235. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24236. return s0;
  24237. }
  24238. function peg$parseselector() {
  24239. var s0, s1, s2, s3;
  24240. var key = peg$currPos * 60 + 6,
  24241. cached = peg$cache[key];
  24242. if (cached) {
  24243. peg$currPos = cached.nextPos;
  24244. return cached.result;
  24245. }
  24246. s0 = peg$currPos;
  24247. if (peg$c8.test(input.charAt(peg$currPos))) {
  24248. s1 = input.charAt(peg$currPos);
  24249. peg$currPos++;
  24250. } else {
  24251. s1 = peg$FAILED;
  24252. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24253. }
  24254. if (s1 !== peg$FAILED) {
  24255. s2 = [];
  24256. if (peg$c16.test(input.charAt(peg$currPos))) {
  24257. s3 = input.charAt(peg$currPos);
  24258. peg$currPos++;
  24259. } else {
  24260. s3 = peg$FAILED;
  24261. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24262. }
  24263. while (s3 !== peg$FAILED) {
  24264. s2.push(s3);
  24265. if (peg$c16.test(input.charAt(peg$currPos))) {
  24266. s3 = input.charAt(peg$currPos);
  24267. peg$currPos++;
  24268. } else {
  24269. s3 = peg$FAILED;
  24270. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24271. }
  24272. }
  24273. if (s2 !== peg$FAILED) {
  24274. peg$reportedPos = s0;
  24275. s1 = peg$c12(s1, s2);
  24276. s0 = s1;
  24277. } else {
  24278. peg$currPos = s0;
  24279. s0 = peg$c1;
  24280. }
  24281. } else {
  24282. peg$currPos = s0;
  24283. s0 = peg$c1;
  24284. }
  24285. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24286. return s0;
  24287. }
  24288. function peg$parseclassName() {
  24289. var s0, s1, s2, s3;
  24290. var key = peg$currPos * 60 + 7,
  24291. cached = peg$cache[key];
  24292. if (cached) {
  24293. peg$currPos = cached.nextPos;
  24294. return cached.result;
  24295. }
  24296. s0 = peg$currPos;
  24297. if (peg$c18.test(input.charAt(peg$currPos))) {
  24298. s1 = input.charAt(peg$currPos);
  24299. peg$currPos++;
  24300. } else {
  24301. s1 = peg$FAILED;
  24302. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  24303. }
  24304. if (s1 !== peg$FAILED) {
  24305. s2 = [];
  24306. if (peg$c10.test(input.charAt(peg$currPos))) {
  24307. s3 = input.charAt(peg$currPos);
  24308. peg$currPos++;
  24309. } else {
  24310. s3 = peg$FAILED;
  24311. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24312. }
  24313. while (s3 !== peg$FAILED) {
  24314. s2.push(s3);
  24315. if (peg$c10.test(input.charAt(peg$currPos))) {
  24316. s3 = input.charAt(peg$currPos);
  24317. peg$currPos++;
  24318. } else {
  24319. s3 = peg$FAILED;
  24320. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24321. }
  24322. }
  24323. if (s2 !== peg$FAILED) {
  24324. peg$reportedPos = s0;
  24325. s1 = peg$c12(s1, s2);
  24326. s0 = s1;
  24327. } else {
  24328. peg$currPos = s0;
  24329. s0 = peg$c1;
  24330. }
  24331. } else {
  24332. peg$currPos = s0;
  24333. s0 = peg$c1;
  24334. }
  24335. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24336. return s0;
  24337. }
  24338. function peg$parsestring() {
  24339. var s0, s1, s2, s3, s4;
  24340. var key = peg$currPos * 60 + 8,
  24341. cached = peg$cache[key];
  24342. if (cached) {
  24343. peg$currPos = cached.nextPos;
  24344. return cached.result;
  24345. }
  24346. s0 = peg$currPos;
  24347. if (input.charCodeAt(peg$currPos) === 39) {
  24348. s1 = peg$c20;
  24349. peg$currPos++;
  24350. } else {
  24351. s1 = peg$FAILED;
  24352. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24353. }
  24354. if (s1 !== peg$FAILED) {
  24355. s2 = [];
  24356. s3 = peg$currPos;
  24357. if (input.substr(peg$currPos, 2) === peg$c22) {
  24358. s4 = peg$c22;
  24359. peg$currPos += 2;
  24360. } else {
  24361. s4 = peg$FAILED;
  24362. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24363. }
  24364. if (s4 !== peg$FAILED) {
  24365. peg$reportedPos = s3;
  24366. s4 = peg$c24();
  24367. }
  24368. s3 = s4;
  24369. if (s3 === peg$FAILED) {
  24370. if (peg$c25.test(input.charAt(peg$currPos))) {
  24371. s3 = input.charAt(peg$currPos);
  24372. peg$currPos++;
  24373. } else {
  24374. s3 = peg$FAILED;
  24375. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24376. }
  24377. }
  24378. while (s3 !== peg$FAILED) {
  24379. s2.push(s3);
  24380. s3 = peg$currPos;
  24381. if (input.substr(peg$currPos, 2) === peg$c22) {
  24382. s4 = peg$c22;
  24383. peg$currPos += 2;
  24384. } else {
  24385. s4 = peg$FAILED;
  24386. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24387. }
  24388. if (s4 !== peg$FAILED) {
  24389. peg$reportedPos = s3;
  24390. s4 = peg$c24();
  24391. }
  24392. s3 = s4;
  24393. if (s3 === peg$FAILED) {
  24394. if (peg$c25.test(input.charAt(peg$currPos))) {
  24395. s3 = input.charAt(peg$currPos);
  24396. peg$currPos++;
  24397. } else {
  24398. s3 = peg$FAILED;
  24399. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24400. }
  24401. }
  24402. }
  24403. if (s2 !== peg$FAILED) {
  24404. if (input.charCodeAt(peg$currPos) === 39) {
  24405. s3 = peg$c20;
  24406. peg$currPos++;
  24407. } else {
  24408. s3 = peg$FAILED;
  24409. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24410. }
  24411. if (s3 !== peg$FAILED) {
  24412. peg$reportedPos = s0;
  24413. s1 = peg$c27(s2);
  24414. s0 = s1;
  24415. } else {
  24416. peg$currPos = s0;
  24417. s0 = peg$c1;
  24418. }
  24419. } else {
  24420. peg$currPos = s0;
  24421. s0 = peg$c1;
  24422. }
  24423. } else {
  24424. peg$currPos = s0;
  24425. s0 = peg$c1;
  24426. }
  24427. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24428. return s0;
  24429. }
  24430. function peg$parsecharacter() {
  24431. var s0, s1, s2;
  24432. var key = peg$currPos * 60 + 9,
  24433. cached = peg$cache[key];
  24434. if (cached) {
  24435. peg$currPos = cached.nextPos;
  24436. return cached.result;
  24437. }
  24438. s0 = peg$currPos;
  24439. if (input.charCodeAt(peg$currPos) === 36) {
  24440. s1 = peg$c28;
  24441. peg$currPos++;
  24442. } else {
  24443. s1 = peg$FAILED;
  24444. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  24445. }
  24446. if (s1 !== peg$FAILED) {
  24447. if (input.length > peg$currPos) {
  24448. s2 = input.charAt(peg$currPos);
  24449. peg$currPos++;
  24450. } else {
  24451. s2 = peg$FAILED;
  24452. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  24453. }
  24454. if (s2 !== peg$FAILED) {
  24455. peg$reportedPos = s0;
  24456. s1 = peg$c31(s2);
  24457. s0 = s1;
  24458. } else {
  24459. peg$currPos = s0;
  24460. s0 = peg$c1;
  24461. }
  24462. } else {
  24463. peg$currPos = s0;
  24464. s0 = peg$c1;
  24465. }
  24466. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24467. return s0;
  24468. }
  24469. function peg$parsesymbol() {
  24470. var s0, s1, s2;
  24471. var key = peg$currPos * 60 + 10,
  24472. cached = peg$cache[key];
  24473. if (cached) {
  24474. peg$currPos = cached.nextPos;
  24475. return cached.result;
  24476. }
  24477. s0 = peg$currPos;
  24478. if (input.charCodeAt(peg$currPos) === 35) {
  24479. s1 = peg$c32;
  24480. peg$currPos++;
  24481. } else {
  24482. s1 = peg$FAILED;
  24483. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  24484. }
  24485. if (s1 !== peg$FAILED) {
  24486. s2 = peg$parsebareSymbol();
  24487. if (s2 !== peg$FAILED) {
  24488. peg$reportedPos = s0;
  24489. s1 = peg$c34(s2);
  24490. s0 = s1;
  24491. } else {
  24492. peg$currPos = s0;
  24493. s0 = peg$c1;
  24494. }
  24495. } else {
  24496. peg$currPos = s0;
  24497. s0 = peg$c1;
  24498. }
  24499. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24500. return s0;
  24501. }
  24502. function peg$parsebareSymbol() {
  24503. var s0, s1, s2;
  24504. var key = peg$currPos * 60 + 11,
  24505. cached = peg$cache[key];
  24506. if (cached) {
  24507. peg$currPos = cached.nextPos;
  24508. return cached.result;
  24509. }
  24510. s0 = peg$currPos;
  24511. s1 = peg$parseselector();
  24512. if (s1 === peg$FAILED) {
  24513. s1 = peg$parsebinarySelector();
  24514. if (s1 === peg$FAILED) {
  24515. s1 = peg$currPos;
  24516. s2 = peg$parsestring();
  24517. if (s2 !== peg$FAILED) {
  24518. peg$reportedPos = s1;
  24519. s2 = peg$c35(s2);
  24520. }
  24521. s1 = s2;
  24522. }
  24523. }
  24524. if (s1 !== peg$FAILED) {
  24525. peg$reportedPos = s0;
  24526. s1 = peg$c36(s1);
  24527. }
  24528. s0 = s1;
  24529. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24530. return s0;
  24531. }
  24532. function peg$parsenumber() {
  24533. var s0, s1;
  24534. var key = peg$currPos * 60 + 12,
  24535. cached = peg$cache[key];
  24536. if (cached) {
  24537. peg$currPos = cached.nextPos;
  24538. return cached.result;
  24539. }
  24540. s0 = peg$currPos;
  24541. s1 = peg$parsenumberExp();
  24542. if (s1 === peg$FAILED) {
  24543. s1 = peg$parsehex();
  24544. if (s1 === peg$FAILED) {
  24545. s1 = peg$parsefloat();
  24546. if (s1 === peg$FAILED) {
  24547. s1 = peg$parseinteger();
  24548. }
  24549. }
  24550. }
  24551. if (s1 !== peg$FAILED) {
  24552. peg$reportedPos = s0;
  24553. s1 = peg$c37(s1);
  24554. }
  24555. s0 = s1;
  24556. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24557. return s0;
  24558. }
  24559. function peg$parsenumberExp() {
  24560. var s0, s1, s2, s3, s4;
  24561. var key = peg$currPos * 60 + 13,
  24562. cached = peg$cache[key];
  24563. if (cached) {
  24564. peg$currPos = cached.nextPos;
  24565. return cached.result;
  24566. }
  24567. s0 = peg$currPos;
  24568. s1 = peg$currPos;
  24569. s2 = peg$parsefloat();
  24570. if (s2 === peg$FAILED) {
  24571. s2 = peg$parseinteger();
  24572. }
  24573. if (s2 !== peg$FAILED) {
  24574. if (input.charCodeAt(peg$currPos) === 101) {
  24575. s3 = peg$c38;
  24576. peg$currPos++;
  24577. } else {
  24578. s3 = peg$FAILED;
  24579. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  24580. }
  24581. if (s3 !== peg$FAILED) {
  24582. s4 = peg$parseinteger();
  24583. if (s4 !== peg$FAILED) {
  24584. s2 = [s2, s3, s4];
  24585. s1 = s2;
  24586. } else {
  24587. peg$currPos = s1;
  24588. s1 = peg$c1;
  24589. }
  24590. } else {
  24591. peg$currPos = s1;
  24592. s1 = peg$c1;
  24593. }
  24594. } else {
  24595. peg$currPos = s1;
  24596. s1 = peg$c1;
  24597. }
  24598. if (s1 !== peg$FAILED) {
  24599. peg$reportedPos = s0;
  24600. s1 = peg$c40(s1);
  24601. }
  24602. s0 = s1;
  24603. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24604. return s0;
  24605. }
  24606. function peg$parsehex() {
  24607. var s0, s1, s2, s3, s4;
  24608. var key = peg$currPos * 60 + 14,
  24609. cached = peg$cache[key];
  24610. if (cached) {
  24611. peg$currPos = cached.nextPos;
  24612. return cached.result;
  24613. }
  24614. s0 = peg$currPos;
  24615. if (input.charCodeAt(peg$currPos) === 45) {
  24616. s1 = peg$c42;
  24617. peg$currPos++;
  24618. } else {
  24619. s1 = peg$FAILED;
  24620. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24621. }
  24622. if (s1 === peg$FAILED) {
  24623. s1 = peg$c41;
  24624. }
  24625. if (s1 !== peg$FAILED) {
  24626. if (input.substr(peg$currPos, 3) === peg$c44) {
  24627. s2 = peg$c44;
  24628. peg$currPos += 3;
  24629. } else {
  24630. s2 = peg$FAILED;
  24631. if (peg$silentFails === 0) { peg$fail(peg$c45); }
  24632. }
  24633. if (s2 !== peg$FAILED) {
  24634. s3 = [];
  24635. if (peg$c46.test(input.charAt(peg$currPos))) {
  24636. s4 = input.charAt(peg$currPos);
  24637. peg$currPos++;
  24638. } else {
  24639. s4 = peg$FAILED;
  24640. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  24641. }
  24642. if (s4 !== peg$FAILED) {
  24643. while (s4 !== peg$FAILED) {
  24644. s3.push(s4);
  24645. if (peg$c46.test(input.charAt(peg$currPos))) {
  24646. s4 = input.charAt(peg$currPos);
  24647. peg$currPos++;
  24648. } else {
  24649. s4 = peg$FAILED;
  24650. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  24651. }
  24652. }
  24653. } else {
  24654. s3 = peg$c1;
  24655. }
  24656. if (s3 !== peg$FAILED) {
  24657. peg$reportedPos = s0;
  24658. s1 = peg$c48(s1, s3);
  24659. s0 = s1;
  24660. } else {
  24661. peg$currPos = s0;
  24662. s0 = peg$c1;
  24663. }
  24664. } else {
  24665. peg$currPos = s0;
  24666. s0 = peg$c1;
  24667. }
  24668. } else {
  24669. peg$currPos = s0;
  24670. s0 = peg$c1;
  24671. }
  24672. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24673. return s0;
  24674. }
  24675. function peg$parsefloat() {
  24676. var s0, s1, s2, s3, s4, s5;
  24677. var key = peg$currPos * 60 + 15,
  24678. cached = peg$cache[key];
  24679. if (cached) {
  24680. peg$currPos = cached.nextPos;
  24681. return cached.result;
  24682. }
  24683. s0 = peg$currPos;
  24684. if (input.charCodeAt(peg$currPos) === 45) {
  24685. s1 = peg$c42;
  24686. peg$currPos++;
  24687. } else {
  24688. s1 = peg$FAILED;
  24689. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24690. }
  24691. if (s1 === peg$FAILED) {
  24692. s1 = peg$c41;
  24693. }
  24694. if (s1 !== peg$FAILED) {
  24695. s2 = [];
  24696. if (peg$c49.test(input.charAt(peg$currPos))) {
  24697. s3 = input.charAt(peg$currPos);
  24698. peg$currPos++;
  24699. } else {
  24700. s3 = peg$FAILED;
  24701. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24702. }
  24703. if (s3 !== peg$FAILED) {
  24704. while (s3 !== peg$FAILED) {
  24705. s2.push(s3);
  24706. if (peg$c49.test(input.charAt(peg$currPos))) {
  24707. s3 = input.charAt(peg$currPos);
  24708. peg$currPos++;
  24709. } else {
  24710. s3 = peg$FAILED;
  24711. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24712. }
  24713. }
  24714. } else {
  24715. s2 = peg$c1;
  24716. }
  24717. if (s2 !== peg$FAILED) {
  24718. if (input.charCodeAt(peg$currPos) === 46) {
  24719. s3 = peg$c51;
  24720. peg$currPos++;
  24721. } else {
  24722. s3 = peg$FAILED;
  24723. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  24724. }
  24725. if (s3 !== peg$FAILED) {
  24726. s4 = [];
  24727. if (peg$c49.test(input.charAt(peg$currPos))) {
  24728. s5 = input.charAt(peg$currPos);
  24729. peg$currPos++;
  24730. } else {
  24731. s5 = peg$FAILED;
  24732. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24733. }
  24734. if (s5 !== peg$FAILED) {
  24735. while (s5 !== peg$FAILED) {
  24736. s4.push(s5);
  24737. if (peg$c49.test(input.charAt(peg$currPos))) {
  24738. s5 = input.charAt(peg$currPos);
  24739. peg$currPos++;
  24740. } else {
  24741. s5 = peg$FAILED;
  24742. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24743. }
  24744. }
  24745. } else {
  24746. s4 = peg$c1;
  24747. }
  24748. if (s4 !== peg$FAILED) {
  24749. peg$reportedPos = s0;
  24750. s1 = peg$c53(s1, s2, s4);
  24751. s0 = s1;
  24752. } else {
  24753. peg$currPos = s0;
  24754. s0 = peg$c1;
  24755. }
  24756. } else {
  24757. peg$currPos = s0;
  24758. s0 = peg$c1;
  24759. }
  24760. } else {
  24761. peg$currPos = s0;
  24762. s0 = peg$c1;
  24763. }
  24764. } else {
  24765. peg$currPos = s0;
  24766. s0 = peg$c1;
  24767. }
  24768. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24769. return s0;
  24770. }
  24771. function peg$parseinteger() {
  24772. var s0, s1, s2, s3;
  24773. var key = peg$currPos * 60 + 16,
  24774. cached = peg$cache[key];
  24775. if (cached) {
  24776. peg$currPos = cached.nextPos;
  24777. return cached.result;
  24778. }
  24779. s0 = peg$currPos;
  24780. if (input.charCodeAt(peg$currPos) === 45) {
  24781. s1 = peg$c42;
  24782. peg$currPos++;
  24783. } else {
  24784. s1 = peg$FAILED;
  24785. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24786. }
  24787. if (s1 === peg$FAILED) {
  24788. s1 = peg$c41;
  24789. }
  24790. if (s1 !== peg$FAILED) {
  24791. s2 = [];
  24792. if (peg$c49.test(input.charAt(peg$currPos))) {
  24793. s3 = input.charAt(peg$currPos);
  24794. peg$currPos++;
  24795. } else {
  24796. s3 = peg$FAILED;
  24797. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24798. }
  24799. if (s3 !== peg$FAILED) {
  24800. while (s3 !== peg$FAILED) {
  24801. s2.push(s3);
  24802. if (peg$c49.test(input.charAt(peg$currPos))) {
  24803. s3 = input.charAt(peg$currPos);
  24804. peg$currPos++;
  24805. } else {
  24806. s3 = peg$FAILED;
  24807. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24808. }
  24809. }
  24810. } else {
  24811. s2 = peg$c1;
  24812. }
  24813. if (s2 !== peg$FAILED) {
  24814. peg$reportedPos = s0;
  24815. s1 = peg$c54(s1, s2);
  24816. s0 = s1;
  24817. } else {
  24818. peg$currPos = s0;
  24819. s0 = peg$c1;
  24820. }
  24821. } else {
  24822. peg$currPos = s0;
  24823. s0 = peg$c1;
  24824. }
  24825. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24826. return s0;
  24827. }
  24828. function peg$parseliteralArray() {
  24829. var s0, s1, s2;
  24830. var key = peg$currPos * 60 + 17,
  24831. cached = peg$cache[key];
  24832. if (cached) {
  24833. peg$currPos = cached.nextPos;
  24834. return cached.result;
  24835. }
  24836. s0 = peg$currPos;
  24837. if (input.substr(peg$currPos, 2) === peg$c55) {
  24838. s1 = peg$c55;
  24839. peg$currPos += 2;
  24840. } else {
  24841. s1 = peg$FAILED;
  24842. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  24843. }
  24844. if (s1 !== peg$FAILED) {
  24845. s2 = peg$parseliteralArrayRest();
  24846. if (s2 !== peg$FAILED) {
  24847. peg$reportedPos = s0;
  24848. s1 = peg$c34(s2);
  24849. s0 = s1;
  24850. } else {
  24851. peg$currPos = s0;
  24852. s0 = peg$c1;
  24853. }
  24854. } else {
  24855. peg$currPos = s0;
  24856. s0 = peg$c1;
  24857. }
  24858. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24859. return s0;
  24860. }
  24861. function peg$parsebareLiteralArray() {
  24862. var s0, s1, s2;
  24863. var key = peg$currPos * 60 + 18,
  24864. cached = peg$cache[key];
  24865. if (cached) {
  24866. peg$currPos = cached.nextPos;
  24867. return cached.result;
  24868. }
  24869. s0 = peg$currPos;
  24870. if (input.charCodeAt(peg$currPos) === 40) {
  24871. s1 = peg$c57;
  24872. peg$currPos++;
  24873. } else {
  24874. s1 = peg$FAILED;
  24875. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  24876. }
  24877. if (s1 !== peg$FAILED) {
  24878. s2 = peg$parseliteralArrayRest();
  24879. if (s2 !== peg$FAILED) {
  24880. peg$reportedPos = s0;
  24881. s1 = peg$c34(s2);
  24882. s0 = s1;
  24883. } else {
  24884. peg$currPos = s0;
  24885. s0 = peg$c1;
  24886. }
  24887. } else {
  24888. peg$currPos = s0;
  24889. s0 = peg$c1;
  24890. }
  24891. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24892. return s0;
  24893. }
  24894. function peg$parseliteralArrayRest() {
  24895. var s0, s1, s2, s3, s4;
  24896. var key = peg$currPos * 60 + 19,
  24897. cached = peg$cache[key];
  24898. if (cached) {
  24899. peg$currPos = cached.nextPos;
  24900. return cached.result;
  24901. }
  24902. s0 = peg$currPos;
  24903. s1 = [];
  24904. s2 = peg$currPos;
  24905. s3 = peg$parsews();
  24906. if (s3 !== peg$FAILED) {
  24907. s4 = peg$parseparseTimeLiteral();
  24908. if (s4 === peg$FAILED) {
  24909. s4 = peg$parsebareLiteralArray();
  24910. if (s4 === peg$FAILED) {
  24911. s4 = peg$parsebareSymbol();
  24912. }
  24913. }
  24914. if (s4 !== peg$FAILED) {
  24915. peg$reportedPos = s2;
  24916. s3 = peg$c59(s4);
  24917. s2 = s3;
  24918. } else {
  24919. peg$currPos = s2;
  24920. s2 = peg$c1;
  24921. }
  24922. } else {
  24923. peg$currPos = s2;
  24924. s2 = peg$c1;
  24925. }
  24926. while (s2 !== peg$FAILED) {
  24927. s1.push(s2);
  24928. s2 = peg$currPos;
  24929. s3 = peg$parsews();
  24930. if (s3 !== peg$FAILED) {
  24931. s4 = peg$parseparseTimeLiteral();
  24932. if (s4 === peg$FAILED) {
  24933. s4 = peg$parsebareLiteralArray();
  24934. if (s4 === peg$FAILED) {
  24935. s4 = peg$parsebareSymbol();
  24936. }
  24937. }
  24938. if (s4 !== peg$FAILED) {
  24939. peg$reportedPos = s2;
  24940. s3 = peg$c59(s4);
  24941. s2 = s3;
  24942. } else {
  24943. peg$currPos = s2;
  24944. s2 = peg$c1;
  24945. }
  24946. } else {
  24947. peg$currPos = s2;
  24948. s2 = peg$c1;
  24949. }
  24950. }
  24951. if (s1 !== peg$FAILED) {
  24952. s2 = peg$parsews();
  24953. if (s2 !== peg$FAILED) {
  24954. if (input.charCodeAt(peg$currPos) === 41) {
  24955. s3 = peg$c60;
  24956. peg$currPos++;
  24957. } else {
  24958. s3 = peg$FAILED;
  24959. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  24960. }
  24961. if (s3 !== peg$FAILED) {
  24962. peg$reportedPos = s0;
  24963. s1 = peg$c62(s1);
  24964. s0 = s1;
  24965. } else {
  24966. peg$currPos = s0;
  24967. s0 = peg$c1;
  24968. }
  24969. } else {
  24970. peg$currPos = s0;
  24971. s0 = peg$c1;
  24972. }
  24973. } else {
  24974. peg$currPos = s0;
  24975. s0 = peg$c1;
  24976. }
  24977. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24978. return s0;
  24979. }
  24980. function peg$parsedynamicArray() {
  24981. var s0, s1, s2, s3, s4, s5, s6;
  24982. var key = peg$currPos * 60 + 20,
  24983. cached = peg$cache[key];
  24984. if (cached) {
  24985. peg$currPos = cached.nextPos;
  24986. return cached.result;
  24987. }
  24988. s0 = peg$currPos;
  24989. if (input.charCodeAt(peg$currPos) === 123) {
  24990. s1 = peg$c63;
  24991. peg$currPos++;
  24992. } else {
  24993. s1 = peg$FAILED;
  24994. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  24995. }
  24996. if (s1 !== peg$FAILED) {
  24997. s2 = peg$parsews();
  24998. if (s2 !== peg$FAILED) {
  24999. s3 = peg$parseexpressions();
  25000. if (s3 === peg$FAILED) {
  25001. s3 = peg$c41;
  25002. }
  25003. if (s3 !== peg$FAILED) {
  25004. s4 = peg$parsews();
  25005. if (s4 !== peg$FAILED) {
  25006. if (input.charCodeAt(peg$currPos) === 46) {
  25007. s5 = peg$c51;
  25008. peg$currPos++;
  25009. } else {
  25010. s5 = peg$FAILED;
  25011. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25012. }
  25013. if (s5 === peg$FAILED) {
  25014. s5 = peg$c41;
  25015. }
  25016. if (s5 !== peg$FAILED) {
  25017. if (input.charCodeAt(peg$currPos) === 125) {
  25018. s6 = peg$c65;
  25019. peg$currPos++;
  25020. } else {
  25021. s6 = peg$FAILED;
  25022. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  25023. }
  25024. if (s6 !== peg$FAILED) {
  25025. peg$reportedPos = s0;
  25026. s1 = peg$c67(s3);
  25027. s0 = s1;
  25028. } else {
  25029. peg$currPos = s0;
  25030. s0 = peg$c1;
  25031. }
  25032. } else {
  25033. peg$currPos = s0;
  25034. s0 = peg$c1;
  25035. }
  25036. } else {
  25037. peg$currPos = s0;
  25038. s0 = peg$c1;
  25039. }
  25040. } else {
  25041. peg$currPos = s0;
  25042. s0 = peg$c1;
  25043. }
  25044. } else {
  25045. peg$currPos = s0;
  25046. s0 = peg$c1;
  25047. }
  25048. } else {
  25049. peg$currPos = s0;
  25050. s0 = peg$c1;
  25051. }
  25052. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25053. return s0;
  25054. }
  25055. function peg$parsedynamicDictionary() {
  25056. var s0, s1, s2, s3, s4, s5;
  25057. var key = peg$currPos * 60 + 21,
  25058. cached = peg$cache[key];
  25059. if (cached) {
  25060. peg$currPos = cached.nextPos;
  25061. return cached.result;
  25062. }
  25063. s0 = peg$currPos;
  25064. if (input.substr(peg$currPos, 2) === peg$c68) {
  25065. s1 = peg$c68;
  25066. peg$currPos += 2;
  25067. } else {
  25068. s1 = peg$FAILED;
  25069. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  25070. }
  25071. if (s1 !== peg$FAILED) {
  25072. s2 = peg$parsews();
  25073. if (s2 !== peg$FAILED) {
  25074. s3 = peg$parseassociations();
  25075. if (s3 === peg$FAILED) {
  25076. s3 = peg$c41;
  25077. }
  25078. if (s3 !== peg$FAILED) {
  25079. s4 = peg$parsews();
  25080. if (s4 !== peg$FAILED) {
  25081. if (input.charCodeAt(peg$currPos) === 125) {
  25082. s5 = peg$c65;
  25083. peg$currPos++;
  25084. } else {
  25085. s5 = peg$FAILED;
  25086. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  25087. }
  25088. if (s5 !== peg$FAILED) {
  25089. peg$reportedPos = s0;
  25090. s1 = peg$c70(s3);
  25091. s0 = s1;
  25092. } else {
  25093. peg$currPos = s0;
  25094. s0 = peg$c1;
  25095. }
  25096. } else {
  25097. peg$currPos = s0;
  25098. s0 = peg$c1;
  25099. }
  25100. } else {
  25101. peg$currPos = s0;
  25102. s0 = peg$c1;
  25103. }
  25104. } else {
  25105. peg$currPos = s0;
  25106. s0 = peg$c1;
  25107. }
  25108. } else {
  25109. peg$currPos = s0;
  25110. s0 = peg$c1;
  25111. }
  25112. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25113. return s0;
  25114. }
  25115. function peg$parsepseudoVariable() {
  25116. var s0, s1, s2;
  25117. var key = peg$currPos * 60 + 22,
  25118. cached = peg$cache[key];
  25119. if (cached) {
  25120. peg$currPos = cached.nextPos;
  25121. return cached.result;
  25122. }
  25123. s0 = peg$currPos;
  25124. s1 = peg$currPos;
  25125. if (input.substr(peg$currPos, 4) === peg$c71) {
  25126. s2 = peg$c71;
  25127. peg$currPos += 4;
  25128. } else {
  25129. s2 = peg$FAILED;
  25130. if (peg$silentFails === 0) { peg$fail(peg$c72); }
  25131. }
  25132. if (s2 !== peg$FAILED) {
  25133. peg$reportedPos = s1;
  25134. s2 = peg$c73();
  25135. }
  25136. s1 = s2;
  25137. if (s1 === peg$FAILED) {
  25138. s1 = peg$currPos;
  25139. if (input.substr(peg$currPos, 5) === peg$c74) {
  25140. s2 = peg$c74;
  25141. peg$currPos += 5;
  25142. } else {
  25143. s2 = peg$FAILED;
  25144. if (peg$silentFails === 0) { peg$fail(peg$c75); }
  25145. }
  25146. if (s2 !== peg$FAILED) {
  25147. peg$reportedPos = s1;
  25148. s2 = peg$c76();
  25149. }
  25150. s1 = s2;
  25151. if (s1 === peg$FAILED) {
  25152. s1 = peg$currPos;
  25153. if (input.substr(peg$currPos, 3) === peg$c77) {
  25154. s2 = peg$c77;
  25155. peg$currPos += 3;
  25156. } else {
  25157. s2 = peg$FAILED;
  25158. if (peg$silentFails === 0) { peg$fail(peg$c78); }
  25159. }
  25160. if (s2 !== peg$FAILED) {
  25161. peg$reportedPos = s1;
  25162. s2 = peg$c79();
  25163. }
  25164. s1 = s2;
  25165. }
  25166. }
  25167. if (s1 !== peg$FAILED) {
  25168. peg$reportedPos = s0;
  25169. s1 = peg$c80(s1);
  25170. }
  25171. s0 = s1;
  25172. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25173. return s0;
  25174. }
  25175. function peg$parseparseTimeLiteral() {
  25176. var s0;
  25177. var key = peg$currPos * 60 + 23,
  25178. cached = peg$cache[key];
  25179. if (cached) {
  25180. peg$currPos = cached.nextPos;
  25181. return cached.result;
  25182. }
  25183. s0 = peg$parsepseudoVariable();
  25184. if (s0 === peg$FAILED) {
  25185. s0 = peg$parsenumber();
  25186. if (s0 === peg$FAILED) {
  25187. s0 = peg$parseliteralArray();
  25188. if (s0 === peg$FAILED) {
  25189. s0 = peg$parsestring();
  25190. if (s0 === peg$FAILED) {
  25191. s0 = peg$parsesymbol();
  25192. if (s0 === peg$FAILED) {
  25193. s0 = peg$parsecharacter();
  25194. }
  25195. }
  25196. }
  25197. }
  25198. }
  25199. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25200. return s0;
  25201. }
  25202. function peg$parseruntimeLiteral() {
  25203. var s0;
  25204. var key = peg$currPos * 60 + 24,
  25205. cached = peg$cache[key];
  25206. if (cached) {
  25207. peg$currPos = cached.nextPos;
  25208. return cached.result;
  25209. }
  25210. s0 = peg$parsedynamicDictionary();
  25211. if (s0 === peg$FAILED) {
  25212. s0 = peg$parsedynamicArray();
  25213. if (s0 === peg$FAILED) {
  25214. s0 = peg$parseblock();
  25215. }
  25216. }
  25217. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25218. return s0;
  25219. }
  25220. function peg$parseliteral() {
  25221. var s0;
  25222. var key = peg$currPos * 60 + 25,
  25223. cached = peg$cache[key];
  25224. if (cached) {
  25225. peg$currPos = cached.nextPos;
  25226. return cached.result;
  25227. }
  25228. s0 = peg$parseruntimeLiteral();
  25229. if (s0 === peg$FAILED) {
  25230. s0 = peg$parseparseTimeLiteral();
  25231. }
  25232. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25233. return s0;
  25234. }
  25235. function peg$parsevariable() {
  25236. var s0, s1;
  25237. var key = peg$currPos * 60 + 26,
  25238. cached = peg$cache[key];
  25239. if (cached) {
  25240. peg$currPos = cached.nextPos;
  25241. return cached.result;
  25242. }
  25243. s0 = peg$currPos;
  25244. s1 = peg$parseidentifier();
  25245. if (s1 !== peg$FAILED) {
  25246. peg$reportedPos = s0;
  25247. s1 = peg$c81(s1);
  25248. }
  25249. s0 = s1;
  25250. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25251. return s0;
  25252. }
  25253. function peg$parsekeywordPair() {
  25254. var s0, s1, s2, s3, s4;
  25255. var key = peg$currPos * 60 + 27,
  25256. cached = peg$cache[key];
  25257. if (cached) {
  25258. peg$currPos = cached.nextPos;
  25259. return cached.result;
  25260. }
  25261. s0 = peg$currPos;
  25262. s1 = peg$parsews();
  25263. if (s1 !== peg$FAILED) {
  25264. s2 = peg$parsekeyword();
  25265. if (s2 !== peg$FAILED) {
  25266. s3 = peg$parsews();
  25267. if (s3 !== peg$FAILED) {
  25268. s4 = peg$parsebinarySend();
  25269. if (s4 !== peg$FAILED) {
  25270. peg$reportedPos = s0;
  25271. s1 = peg$c82(s2, s4);
  25272. s0 = s1;
  25273. } else {
  25274. peg$currPos = s0;
  25275. s0 = peg$c1;
  25276. }
  25277. } else {
  25278. peg$currPos = s0;
  25279. s0 = peg$c1;
  25280. }
  25281. } else {
  25282. peg$currPos = s0;
  25283. s0 = peg$c1;
  25284. }
  25285. } else {
  25286. peg$currPos = s0;
  25287. s0 = peg$c1;
  25288. }
  25289. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25290. return s0;
  25291. }
  25292. function peg$parsebinarySelector() {
  25293. var s0, s1, s2;
  25294. var key = peg$currPos * 60 + 28,
  25295. cached = peg$cache[key];
  25296. if (cached) {
  25297. peg$currPos = cached.nextPos;
  25298. return cached.result;
  25299. }
  25300. s0 = peg$currPos;
  25301. s1 = [];
  25302. if (peg$c83.test(input.charAt(peg$currPos))) {
  25303. s2 = input.charAt(peg$currPos);
  25304. peg$currPos++;
  25305. } else {
  25306. s2 = peg$FAILED;
  25307. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  25308. }
  25309. if (s2 !== peg$FAILED) {
  25310. while (s2 !== peg$FAILED) {
  25311. s1.push(s2);
  25312. if (peg$c83.test(input.charAt(peg$currPos))) {
  25313. s2 = input.charAt(peg$currPos);
  25314. peg$currPos++;
  25315. } else {
  25316. s2 = peg$FAILED;
  25317. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  25318. }
  25319. }
  25320. } else {
  25321. s1 = peg$c1;
  25322. }
  25323. if (s1 !== peg$FAILED) {
  25324. peg$reportedPos = s0;
  25325. s1 = peg$c85(s1);
  25326. }
  25327. s0 = s1;
  25328. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25329. return s0;
  25330. }
  25331. function peg$parsekeywordPattern() {
  25332. var s0, s1, s2, s3, s4, s5, s6;
  25333. var key = peg$currPos * 60 + 29,
  25334. cached = peg$cache[key];
  25335. if (cached) {
  25336. peg$currPos = cached.nextPos;
  25337. return cached.result;
  25338. }
  25339. s0 = peg$currPos;
  25340. s1 = [];
  25341. s2 = peg$currPos;
  25342. s3 = peg$parsews();
  25343. if (s3 !== peg$FAILED) {
  25344. s4 = peg$parsekeyword();
  25345. if (s4 !== peg$FAILED) {
  25346. s5 = peg$parsews();
  25347. if (s5 !== peg$FAILED) {
  25348. s6 = peg$parseidentifier();
  25349. if (s6 !== peg$FAILED) {
  25350. peg$reportedPos = s2;
  25351. s3 = peg$c82(s4, s6);
  25352. s2 = s3;
  25353. } else {
  25354. peg$currPos = s2;
  25355. s2 = peg$c1;
  25356. }
  25357. } else {
  25358. peg$currPos = s2;
  25359. s2 = peg$c1;
  25360. }
  25361. } else {
  25362. peg$currPos = s2;
  25363. s2 = peg$c1;
  25364. }
  25365. } else {
  25366. peg$currPos = s2;
  25367. s2 = peg$c1;
  25368. }
  25369. if (s2 !== peg$FAILED) {
  25370. while (s2 !== peg$FAILED) {
  25371. s1.push(s2);
  25372. s2 = peg$currPos;
  25373. s3 = peg$parsews();
  25374. if (s3 !== peg$FAILED) {
  25375. s4 = peg$parsekeyword();
  25376. if (s4 !== peg$FAILED) {
  25377. s5 = peg$parsews();
  25378. if (s5 !== peg$FAILED) {
  25379. s6 = peg$parseidentifier();
  25380. if (s6 !== peg$FAILED) {
  25381. peg$reportedPos = s2;
  25382. s3 = peg$c82(s4, s6);
  25383. s2 = s3;
  25384. } else {
  25385. peg$currPos = s2;
  25386. s2 = peg$c1;
  25387. }
  25388. } else {
  25389. peg$currPos = s2;
  25390. s2 = peg$c1;
  25391. }
  25392. } else {
  25393. peg$currPos = s2;
  25394. s2 = peg$c1;
  25395. }
  25396. } else {
  25397. peg$currPos = s2;
  25398. s2 = peg$c1;
  25399. }
  25400. }
  25401. } else {
  25402. s1 = peg$c1;
  25403. }
  25404. if (s1 !== peg$FAILED) {
  25405. peg$reportedPos = s0;
  25406. s1 = peg$c86(s1);
  25407. }
  25408. s0 = s1;
  25409. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25410. return s0;
  25411. }
  25412. function peg$parsebinaryPattern() {
  25413. var s0, s1, s2, s3, s4;
  25414. var key = peg$currPos * 60 + 30,
  25415. cached = peg$cache[key];
  25416. if (cached) {
  25417. peg$currPos = cached.nextPos;
  25418. return cached.result;
  25419. }
  25420. s0 = peg$currPos;
  25421. s1 = peg$parsews();
  25422. if (s1 !== peg$FAILED) {
  25423. s2 = peg$parsebinarySelector();
  25424. if (s2 !== peg$FAILED) {
  25425. s3 = peg$parsews();
  25426. if (s3 !== peg$FAILED) {
  25427. s4 = peg$parseidentifier();
  25428. if (s4 !== peg$FAILED) {
  25429. peg$reportedPos = s0;
  25430. s1 = peg$c87(s2, s4);
  25431. s0 = s1;
  25432. } else {
  25433. peg$currPos = s0;
  25434. s0 = peg$c1;
  25435. }
  25436. } else {
  25437. peg$currPos = s0;
  25438. s0 = peg$c1;
  25439. }
  25440. } else {
  25441. peg$currPos = s0;
  25442. s0 = peg$c1;
  25443. }
  25444. } else {
  25445. peg$currPos = s0;
  25446. s0 = peg$c1;
  25447. }
  25448. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25449. return s0;
  25450. }
  25451. function peg$parseunaryPattern() {
  25452. var s0, s1, s2;
  25453. var key = peg$currPos * 60 + 31,
  25454. cached = peg$cache[key];
  25455. if (cached) {
  25456. peg$currPos = cached.nextPos;
  25457. return cached.result;
  25458. }
  25459. s0 = peg$currPos;
  25460. s1 = peg$parsews();
  25461. if (s1 !== peg$FAILED) {
  25462. s2 = peg$parseidentifier();
  25463. if (s2 !== peg$FAILED) {
  25464. peg$reportedPos = s0;
  25465. s1 = peg$c88(s2);
  25466. s0 = s1;
  25467. } else {
  25468. peg$currPos = s0;
  25469. s0 = peg$c1;
  25470. }
  25471. } else {
  25472. peg$currPos = s0;
  25473. s0 = peg$c1;
  25474. }
  25475. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25476. return s0;
  25477. }
  25478. function peg$parseexpression() {
  25479. var s0;
  25480. var key = peg$currPos * 60 + 32,
  25481. cached = peg$cache[key];
  25482. if (cached) {
  25483. peg$currPos = cached.nextPos;
  25484. return cached.result;
  25485. }
  25486. s0 = peg$parseassignment();
  25487. if (s0 === peg$FAILED) {
  25488. s0 = peg$parsecascade();
  25489. if (s0 === peg$FAILED) {
  25490. s0 = peg$parsekeywordSend();
  25491. if (s0 === peg$FAILED) {
  25492. s0 = peg$parsebinarySend();
  25493. }
  25494. }
  25495. }
  25496. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25497. return s0;
  25498. }
  25499. function peg$parseexpressionList() {
  25500. var s0, s1, s2, s3, s4;
  25501. var key = peg$currPos * 60 + 33,
  25502. cached = peg$cache[key];
  25503. if (cached) {
  25504. peg$currPos = cached.nextPos;
  25505. return cached.result;
  25506. }
  25507. s0 = peg$currPos;
  25508. s1 = peg$parsews();
  25509. if (s1 !== peg$FAILED) {
  25510. if (input.charCodeAt(peg$currPos) === 46) {
  25511. s2 = peg$c51;
  25512. peg$currPos++;
  25513. } else {
  25514. s2 = peg$FAILED;
  25515. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25516. }
  25517. if (s2 !== peg$FAILED) {
  25518. s3 = peg$parsews();
  25519. if (s3 !== peg$FAILED) {
  25520. s4 = peg$parseexpression();
  25521. if (s4 !== peg$FAILED) {
  25522. peg$reportedPos = s0;
  25523. s1 = peg$c89(s4);
  25524. s0 = s1;
  25525. } else {
  25526. peg$currPos = s0;
  25527. s0 = peg$c1;
  25528. }
  25529. } else {
  25530. peg$currPos = s0;
  25531. s0 = peg$c1;
  25532. }
  25533. } else {
  25534. peg$currPos = s0;
  25535. s0 = peg$c1;
  25536. }
  25537. } else {
  25538. peg$currPos = s0;
  25539. s0 = peg$c1;
  25540. }
  25541. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25542. return s0;
  25543. }
  25544. function peg$parseexpressions() {
  25545. var s0, s1, s2, s3;
  25546. var key = peg$currPos * 60 + 34,
  25547. cached = peg$cache[key];
  25548. if (cached) {
  25549. peg$currPos = cached.nextPos;
  25550. return cached.result;
  25551. }
  25552. s0 = peg$currPos;
  25553. s1 = peg$parseexpression();
  25554. if (s1 !== peg$FAILED) {
  25555. s2 = [];
  25556. s3 = peg$parseexpressionList();
  25557. while (s3 !== peg$FAILED) {
  25558. s2.push(s3);
  25559. s3 = peg$parseexpressionList();
  25560. }
  25561. if (s2 !== peg$FAILED) {
  25562. peg$reportedPos = s0;
  25563. s1 = peg$c90(s1, s2);
  25564. s0 = s1;
  25565. } else {
  25566. peg$currPos = s0;
  25567. s0 = peg$c1;
  25568. }
  25569. } else {
  25570. peg$currPos = s0;
  25571. s0 = peg$c1;
  25572. }
  25573. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25574. return s0;
  25575. }
  25576. function peg$parseassignment() {
  25577. var s0, s1, s2, s3, s4, s5;
  25578. var key = peg$currPos * 60 + 35,
  25579. cached = peg$cache[key];
  25580. if (cached) {
  25581. peg$currPos = cached.nextPos;
  25582. return cached.result;
  25583. }
  25584. s0 = peg$currPos;
  25585. s1 = peg$parsevariable();
  25586. if (s1 !== peg$FAILED) {
  25587. s2 = peg$parsews();
  25588. if (s2 !== peg$FAILED) {
  25589. if (input.substr(peg$currPos, 2) === peg$c91) {
  25590. s3 = peg$c91;
  25591. peg$currPos += 2;
  25592. } else {
  25593. s3 = peg$FAILED;
  25594. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  25595. }
  25596. if (s3 !== peg$FAILED) {
  25597. s4 = peg$parsews();
  25598. if (s4 !== peg$FAILED) {
  25599. s5 = peg$parseexpression();
  25600. if (s5 !== peg$FAILED) {
  25601. peg$reportedPos = s0;
  25602. s1 = peg$c93(s1, s5);
  25603. s0 = s1;
  25604. } else {
  25605. peg$currPos = s0;
  25606. s0 = peg$c1;
  25607. }
  25608. } else {
  25609. peg$currPos = s0;
  25610. s0 = peg$c1;
  25611. }
  25612. } else {
  25613. peg$currPos = s0;
  25614. s0 = peg$c1;
  25615. }
  25616. } else {
  25617. peg$currPos = s0;
  25618. s0 = peg$c1;
  25619. }
  25620. } else {
  25621. peg$currPos = s0;
  25622. s0 = peg$c1;
  25623. }
  25624. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25625. return s0;
  25626. }
  25627. function peg$parseret() {
  25628. var s0, s1, s2, s3, s4, s5;
  25629. var key = peg$currPos * 60 + 36,
  25630. cached = peg$cache[key];
  25631. if (cached) {
  25632. peg$currPos = cached.nextPos;
  25633. return cached.result;
  25634. }
  25635. s0 = peg$currPos;
  25636. if (input.charCodeAt(peg$currPos) === 94) {
  25637. s1 = peg$c94;
  25638. peg$currPos++;
  25639. } else {
  25640. s1 = peg$FAILED;
  25641. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  25642. }
  25643. if (s1 !== peg$FAILED) {
  25644. s2 = peg$parsews();
  25645. if (s2 !== peg$FAILED) {
  25646. s3 = peg$parseexpression();
  25647. if (s3 !== peg$FAILED) {
  25648. s4 = peg$parsews();
  25649. if (s4 !== peg$FAILED) {
  25650. if (input.charCodeAt(peg$currPos) === 46) {
  25651. s5 = peg$c51;
  25652. peg$currPos++;
  25653. } else {
  25654. s5 = peg$FAILED;
  25655. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25656. }
  25657. if (s5 === peg$FAILED) {
  25658. s5 = peg$c41;
  25659. }
  25660. if (s5 !== peg$FAILED) {
  25661. peg$reportedPos = s0;
  25662. s1 = peg$c96(s3);
  25663. s0 = s1;
  25664. } else {
  25665. peg$currPos = s0;
  25666. s0 = peg$c1;
  25667. }
  25668. } else {
  25669. peg$currPos = s0;
  25670. s0 = peg$c1;
  25671. }
  25672. } else {
  25673. peg$currPos = s0;
  25674. s0 = peg$c1;
  25675. }
  25676. } else {
  25677. peg$currPos = s0;
  25678. s0 = peg$c1;
  25679. }
  25680. } else {
  25681. peg$currPos = s0;
  25682. s0 = peg$c1;
  25683. }
  25684. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25685. return s0;
  25686. }
  25687. function peg$parsetemps() {
  25688. var s0, s1, s2, s3, s4, s5;
  25689. var key = peg$currPos * 60 + 37,
  25690. cached = peg$cache[key];
  25691. if (cached) {
  25692. peg$currPos = cached.nextPos;
  25693. return cached.result;
  25694. }
  25695. s0 = peg$currPos;
  25696. if (input.charCodeAt(peg$currPos) === 124) {
  25697. s1 = peg$c97;
  25698. peg$currPos++;
  25699. } else {
  25700. s1 = peg$FAILED;
  25701. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25702. }
  25703. if (s1 !== peg$FAILED) {
  25704. s2 = [];
  25705. s3 = peg$currPos;
  25706. s4 = peg$parsews();
  25707. if (s4 !== peg$FAILED) {
  25708. s5 = peg$parseidentifier();
  25709. if (s5 !== peg$FAILED) {
  25710. peg$reportedPos = s3;
  25711. s4 = peg$c99(s5);
  25712. s3 = s4;
  25713. } else {
  25714. peg$currPos = s3;
  25715. s3 = peg$c1;
  25716. }
  25717. } else {
  25718. peg$currPos = s3;
  25719. s3 = peg$c1;
  25720. }
  25721. while (s3 !== peg$FAILED) {
  25722. s2.push(s3);
  25723. s3 = peg$currPos;
  25724. s4 = peg$parsews();
  25725. if (s4 !== peg$FAILED) {
  25726. s5 = peg$parseidentifier();
  25727. if (s5 !== peg$FAILED) {
  25728. peg$reportedPos = s3;
  25729. s4 = peg$c99(s5);
  25730. s3 = s4;
  25731. } else {
  25732. peg$currPos = s3;
  25733. s3 = peg$c1;
  25734. }
  25735. } else {
  25736. peg$currPos = s3;
  25737. s3 = peg$c1;
  25738. }
  25739. }
  25740. if (s2 !== peg$FAILED) {
  25741. s3 = peg$parsews();
  25742. if (s3 !== peg$FAILED) {
  25743. if (input.charCodeAt(peg$currPos) === 124) {
  25744. s4 = peg$c97;
  25745. peg$currPos++;
  25746. } else {
  25747. s4 = peg$FAILED;
  25748. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25749. }
  25750. if (s4 !== peg$FAILED) {
  25751. peg$reportedPos = s0;
  25752. s1 = peg$c100(s2);
  25753. s0 = s1;
  25754. } else {
  25755. peg$currPos = s0;
  25756. s0 = peg$c1;
  25757. }
  25758. } else {
  25759. peg$currPos = s0;
  25760. s0 = peg$c1;
  25761. }
  25762. } else {
  25763. peg$currPos = s0;
  25764. s0 = peg$c1;
  25765. }
  25766. } else {
  25767. peg$currPos = s0;
  25768. s0 = peg$c1;
  25769. }
  25770. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25771. return s0;
  25772. }
  25773. function peg$parseblockParamList() {
  25774. var s0, s1, s2, s3, s4, s5, s6;
  25775. var key = peg$currPos * 60 + 38,
  25776. cached = peg$cache[key];
  25777. if (cached) {
  25778. peg$currPos = cached.nextPos;
  25779. return cached.result;
  25780. }
  25781. s0 = peg$currPos;
  25782. s1 = [];
  25783. s2 = peg$currPos;
  25784. s3 = peg$parsews();
  25785. if (s3 !== peg$FAILED) {
  25786. if (input.charCodeAt(peg$currPos) === 58) {
  25787. s4 = peg$c13;
  25788. peg$currPos++;
  25789. } else {
  25790. s4 = peg$FAILED;
  25791. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25792. }
  25793. if (s4 !== peg$FAILED) {
  25794. s5 = peg$parsews();
  25795. if (s5 !== peg$FAILED) {
  25796. s6 = peg$parseidentifier();
  25797. if (s6 !== peg$FAILED) {
  25798. peg$reportedPos = s2;
  25799. s3 = peg$c101(s6);
  25800. s2 = s3;
  25801. } else {
  25802. peg$currPos = s2;
  25803. s2 = peg$c1;
  25804. }
  25805. } else {
  25806. peg$currPos = s2;
  25807. s2 = peg$c1;
  25808. }
  25809. } else {
  25810. peg$currPos = s2;
  25811. s2 = peg$c1;
  25812. }
  25813. } else {
  25814. peg$currPos = s2;
  25815. s2 = peg$c1;
  25816. }
  25817. if (s2 !== peg$FAILED) {
  25818. while (s2 !== peg$FAILED) {
  25819. s1.push(s2);
  25820. s2 = peg$currPos;
  25821. s3 = peg$parsews();
  25822. if (s3 !== peg$FAILED) {
  25823. if (input.charCodeAt(peg$currPos) === 58) {
  25824. s4 = peg$c13;
  25825. peg$currPos++;
  25826. } else {
  25827. s4 = peg$FAILED;
  25828. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25829. }
  25830. if (s4 !== peg$FAILED) {
  25831. s5 = peg$parsews();
  25832. if (s5 !== peg$FAILED) {
  25833. s6 = peg$parseidentifier();
  25834. if (s6 !== peg$FAILED) {
  25835. peg$reportedPos = s2;
  25836. s3 = peg$c101(s6);
  25837. s2 = s3;
  25838. } else {
  25839. peg$currPos = s2;
  25840. s2 = peg$c1;
  25841. }
  25842. } else {
  25843. peg$currPos = s2;
  25844. s2 = peg$c1;
  25845. }
  25846. } else {
  25847. peg$currPos = s2;
  25848. s2 = peg$c1;
  25849. }
  25850. } else {
  25851. peg$currPos = s2;
  25852. s2 = peg$c1;
  25853. }
  25854. }
  25855. } else {
  25856. s1 = peg$c1;
  25857. }
  25858. if (s1 !== peg$FAILED) {
  25859. s2 = peg$parsews();
  25860. if (s2 !== peg$FAILED) {
  25861. if (input.charCodeAt(peg$currPos) === 124) {
  25862. s3 = peg$c97;
  25863. peg$currPos++;
  25864. } else {
  25865. s3 = peg$FAILED;
  25866. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25867. }
  25868. if (s3 !== peg$FAILED) {
  25869. peg$reportedPos = s0;
  25870. s1 = peg$c102(s1);
  25871. s0 = s1;
  25872. } else {
  25873. peg$currPos = s0;
  25874. s0 = peg$c1;
  25875. }
  25876. } else {
  25877. peg$currPos = s0;
  25878. s0 = peg$c1;
  25879. }
  25880. } else {
  25881. peg$currPos = s0;
  25882. s0 = peg$c1;
  25883. }
  25884. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25885. return s0;
  25886. }
  25887. function peg$parsesubexpression() {
  25888. var s0, s1, s2, s3, s4, s5;
  25889. var key = peg$currPos * 60 + 39,
  25890. cached = peg$cache[key];
  25891. if (cached) {
  25892. peg$currPos = cached.nextPos;
  25893. return cached.result;
  25894. }
  25895. s0 = peg$currPos;
  25896. if (input.charCodeAt(peg$currPos) === 40) {
  25897. s1 = peg$c57;
  25898. peg$currPos++;
  25899. } else {
  25900. s1 = peg$FAILED;
  25901. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25902. }
  25903. if (s1 !== peg$FAILED) {
  25904. s2 = peg$parsews();
  25905. if (s2 !== peg$FAILED) {
  25906. s3 = peg$parseexpression();
  25907. if (s3 !== peg$FAILED) {
  25908. s4 = peg$parsews();
  25909. if (s4 !== peg$FAILED) {
  25910. if (input.charCodeAt(peg$currPos) === 41) {
  25911. s5 = peg$c60;
  25912. peg$currPos++;
  25913. } else {
  25914. s5 = peg$FAILED;
  25915. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  25916. }
  25917. if (s5 !== peg$FAILED) {
  25918. peg$reportedPos = s0;
  25919. s1 = peg$c89(s3);
  25920. s0 = s1;
  25921. } else {
  25922. peg$currPos = s0;
  25923. s0 = peg$c1;
  25924. }
  25925. } else {
  25926. peg$currPos = s0;
  25927. s0 = peg$c1;
  25928. }
  25929. } else {
  25930. peg$currPos = s0;
  25931. s0 = peg$c1;
  25932. }
  25933. } else {
  25934. peg$currPos = s0;
  25935. s0 = peg$c1;
  25936. }
  25937. } else {
  25938. peg$currPos = s0;
  25939. s0 = peg$c1;
  25940. }
  25941. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25942. return s0;
  25943. }
  25944. function peg$parsestatements() {
  25945. var s0, s1, s2, s3, s4, s5, s6, s7;
  25946. var key = peg$currPos * 60 + 40,
  25947. cached = peg$cache[key];
  25948. if (cached) {
  25949. peg$currPos = cached.nextPos;
  25950. return cached.result;
  25951. }
  25952. s0 = peg$currPos;
  25953. s1 = peg$parseret();
  25954. if (s1 !== peg$FAILED) {
  25955. s2 = [];
  25956. if (input.charCodeAt(peg$currPos) === 46) {
  25957. s3 = peg$c51;
  25958. peg$currPos++;
  25959. } else {
  25960. s3 = peg$FAILED;
  25961. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25962. }
  25963. while (s3 !== peg$FAILED) {
  25964. s2.push(s3);
  25965. if (input.charCodeAt(peg$currPos) === 46) {
  25966. s3 = peg$c51;
  25967. peg$currPos++;
  25968. } else {
  25969. s3 = peg$FAILED;
  25970. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25971. }
  25972. }
  25973. if (s2 !== peg$FAILED) {
  25974. peg$reportedPos = s0;
  25975. s1 = peg$c103(s1);
  25976. s0 = s1;
  25977. } else {
  25978. peg$currPos = s0;
  25979. s0 = peg$c1;
  25980. }
  25981. } else {
  25982. peg$currPos = s0;
  25983. s0 = peg$c1;
  25984. }
  25985. if (s0 === peg$FAILED) {
  25986. s0 = peg$currPos;
  25987. s1 = peg$parseexpressions();
  25988. if (s1 !== peg$FAILED) {
  25989. s2 = peg$parsews();
  25990. if (s2 !== peg$FAILED) {
  25991. s3 = [];
  25992. if (input.charCodeAt(peg$currPos) === 46) {
  25993. s4 = peg$c51;
  25994. peg$currPos++;
  25995. } else {
  25996. s4 = peg$FAILED;
  25997. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25998. }
  25999. if (s4 !== peg$FAILED) {
  26000. while (s4 !== peg$FAILED) {
  26001. s3.push(s4);
  26002. if (input.charCodeAt(peg$currPos) === 46) {
  26003. s4 = peg$c51;
  26004. peg$currPos++;
  26005. } else {
  26006. s4 = peg$FAILED;
  26007. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26008. }
  26009. }
  26010. } else {
  26011. s3 = peg$c1;
  26012. }
  26013. if (s3 !== peg$FAILED) {
  26014. s4 = peg$parsews();
  26015. if (s4 !== peg$FAILED) {
  26016. s5 = peg$parseret();
  26017. if (s5 !== peg$FAILED) {
  26018. s6 = [];
  26019. if (input.charCodeAt(peg$currPos) === 46) {
  26020. s7 = peg$c51;
  26021. peg$currPos++;
  26022. } else {
  26023. s7 = peg$FAILED;
  26024. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26025. }
  26026. while (s7 !== peg$FAILED) {
  26027. s6.push(s7);
  26028. if (input.charCodeAt(peg$currPos) === 46) {
  26029. s7 = peg$c51;
  26030. peg$currPos++;
  26031. } else {
  26032. s7 = peg$FAILED;
  26033. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26034. }
  26035. }
  26036. if (s6 !== peg$FAILED) {
  26037. peg$reportedPos = s0;
  26038. s1 = peg$c104(s1, s5);
  26039. s0 = s1;
  26040. } else {
  26041. peg$currPos = s0;
  26042. s0 = peg$c1;
  26043. }
  26044. } else {
  26045. peg$currPos = s0;
  26046. s0 = peg$c1;
  26047. }
  26048. } else {
  26049. peg$currPos = s0;
  26050. s0 = peg$c1;
  26051. }
  26052. } else {
  26053. peg$currPos = s0;
  26054. s0 = peg$c1;
  26055. }
  26056. } else {
  26057. peg$currPos = s0;
  26058. s0 = peg$c1;
  26059. }
  26060. } else {
  26061. peg$currPos = s0;
  26062. s0 = peg$c1;
  26063. }
  26064. if (s0 === peg$FAILED) {
  26065. s0 = peg$currPos;
  26066. s1 = peg$parseexpressions();
  26067. if (s1 === peg$FAILED) {
  26068. s1 = peg$c41;
  26069. }
  26070. if (s1 !== peg$FAILED) {
  26071. s2 = [];
  26072. if (input.charCodeAt(peg$currPos) === 46) {
  26073. s3 = peg$c51;
  26074. peg$currPos++;
  26075. } else {
  26076. s3 = peg$FAILED;
  26077. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26078. }
  26079. while (s3 !== peg$FAILED) {
  26080. s2.push(s3);
  26081. if (input.charCodeAt(peg$currPos) === 46) {
  26082. s3 = peg$c51;
  26083. peg$currPos++;
  26084. } else {
  26085. s3 = peg$FAILED;
  26086. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26087. }
  26088. }
  26089. if (s2 !== peg$FAILED) {
  26090. peg$reportedPos = s0;
  26091. s1 = peg$c105(s1);
  26092. s0 = s1;
  26093. } else {
  26094. peg$currPos = s0;
  26095. s0 = peg$c1;
  26096. }
  26097. } else {
  26098. peg$currPos = s0;
  26099. s0 = peg$c1;
  26100. }
  26101. }
  26102. }
  26103. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26104. return s0;
  26105. }
  26106. function peg$parsesequence() {
  26107. var s0;
  26108. var key = peg$currPos * 60 + 41,
  26109. cached = peg$cache[key];
  26110. if (cached) {
  26111. peg$currPos = cached.nextPos;
  26112. return cached.result;
  26113. }
  26114. s0 = peg$parsejsStatement();
  26115. if (s0 === peg$FAILED) {
  26116. s0 = peg$parsestSequence();
  26117. }
  26118. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26119. return s0;
  26120. }
  26121. function peg$parsestSequence() {
  26122. var s0, s1, s2, s3, s4;
  26123. var key = peg$currPos * 60 + 42,
  26124. cached = peg$cache[key];
  26125. if (cached) {
  26126. peg$currPos = cached.nextPos;
  26127. return cached.result;
  26128. }
  26129. s0 = peg$currPos;
  26130. s1 = peg$parsetemps();
  26131. if (s1 === peg$FAILED) {
  26132. s1 = peg$c41;
  26133. }
  26134. if (s1 !== peg$FAILED) {
  26135. s2 = peg$parsews();
  26136. if (s2 !== peg$FAILED) {
  26137. s3 = peg$parsestatements();
  26138. if (s3 === peg$FAILED) {
  26139. s3 = peg$c41;
  26140. }
  26141. if (s3 !== peg$FAILED) {
  26142. s4 = peg$parsews();
  26143. if (s4 !== peg$FAILED) {
  26144. peg$reportedPos = s0;
  26145. s1 = peg$c106(s1, s3);
  26146. s0 = s1;
  26147. } else {
  26148. peg$currPos = s0;
  26149. s0 = peg$c1;
  26150. }
  26151. } else {
  26152. peg$currPos = s0;
  26153. s0 = peg$c1;
  26154. }
  26155. } else {
  26156. peg$currPos = s0;
  26157. s0 = peg$c1;
  26158. }
  26159. } else {
  26160. peg$currPos = s0;
  26161. s0 = peg$c1;
  26162. }
  26163. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26164. return s0;
  26165. }
  26166. function peg$parseblock() {
  26167. var s0, s1, s2, s3, s4, s5, s6;
  26168. var key = peg$currPos * 60 + 43,
  26169. cached = peg$cache[key];
  26170. if (cached) {
  26171. peg$currPos = cached.nextPos;
  26172. return cached.result;
  26173. }
  26174. s0 = peg$currPos;
  26175. if (input.charCodeAt(peg$currPos) === 91) {
  26176. s1 = peg$c107;
  26177. peg$currPos++;
  26178. } else {
  26179. s1 = peg$FAILED;
  26180. if (peg$silentFails === 0) { peg$fail(peg$c108); }
  26181. }
  26182. if (s1 !== peg$FAILED) {
  26183. s2 = peg$parseblockParamList();
  26184. if (s2 === peg$FAILED) {
  26185. s2 = peg$c41;
  26186. }
  26187. if (s2 !== peg$FAILED) {
  26188. s3 = peg$parsews();
  26189. if (s3 !== peg$FAILED) {
  26190. s4 = peg$parsesequence();
  26191. if (s4 === peg$FAILED) {
  26192. s4 = peg$c41;
  26193. }
  26194. if (s4 !== peg$FAILED) {
  26195. s5 = peg$parsews();
  26196. if (s5 !== peg$FAILED) {
  26197. if (input.charCodeAt(peg$currPos) === 93) {
  26198. s6 = peg$c109;
  26199. peg$currPos++;
  26200. } else {
  26201. s6 = peg$FAILED;
  26202. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  26203. }
  26204. if (s6 !== peg$FAILED) {
  26205. peg$reportedPos = s0;
  26206. s1 = peg$c111(s2, s4);
  26207. s0 = s1;
  26208. } else {
  26209. peg$currPos = s0;
  26210. s0 = peg$c1;
  26211. }
  26212. } else {
  26213. peg$currPos = s0;
  26214. s0 = peg$c1;
  26215. }
  26216. } else {
  26217. peg$currPos = s0;
  26218. s0 = peg$c1;
  26219. }
  26220. } else {
  26221. peg$currPos = s0;
  26222. s0 = peg$c1;
  26223. }
  26224. } else {
  26225. peg$currPos = s0;
  26226. s0 = peg$c1;
  26227. }
  26228. } else {
  26229. peg$currPos = s0;
  26230. s0 = peg$c1;
  26231. }
  26232. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26233. return s0;
  26234. }
  26235. function peg$parseoperand() {
  26236. var s0;
  26237. var key = peg$currPos * 60 + 44,
  26238. cached = peg$cache[key];
  26239. if (cached) {
  26240. peg$currPos = cached.nextPos;
  26241. return cached.result;
  26242. }
  26243. s0 = peg$parseliteral();
  26244. if (s0 === peg$FAILED) {
  26245. s0 = peg$parsevariable();
  26246. if (s0 === peg$FAILED) {
  26247. s0 = peg$parsesubexpression();
  26248. }
  26249. }
  26250. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26251. return s0;
  26252. }
  26253. function peg$parseunaryMessage() {
  26254. var s0, s1, s2, s3, s4;
  26255. var key = peg$currPos * 60 + 45,
  26256. cached = peg$cache[key];
  26257. if (cached) {
  26258. peg$currPos = cached.nextPos;
  26259. return cached.result;
  26260. }
  26261. s0 = peg$currPos;
  26262. s1 = peg$parsews();
  26263. if (s1 !== peg$FAILED) {
  26264. s2 = peg$parseidentifier();
  26265. if (s2 !== peg$FAILED) {
  26266. s3 = peg$currPos;
  26267. peg$silentFails++;
  26268. if (input.charCodeAt(peg$currPos) === 58) {
  26269. s4 = peg$c13;
  26270. peg$currPos++;
  26271. } else {
  26272. s4 = peg$FAILED;
  26273. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26274. }
  26275. peg$silentFails--;
  26276. if (s4 === peg$FAILED) {
  26277. s3 = peg$c112;
  26278. } else {
  26279. peg$currPos = s3;
  26280. s3 = peg$c1;
  26281. }
  26282. if (s3 !== peg$FAILED) {
  26283. peg$reportedPos = s0;
  26284. s1 = peg$c113(s2);
  26285. s0 = s1;
  26286. } else {
  26287. peg$currPos = s0;
  26288. s0 = peg$c1;
  26289. }
  26290. } else {
  26291. peg$currPos = s0;
  26292. s0 = peg$c1;
  26293. }
  26294. } else {
  26295. peg$currPos = s0;
  26296. s0 = peg$c1;
  26297. }
  26298. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26299. return s0;
  26300. }
  26301. function peg$parseunaryTail() {
  26302. var s0, s1, s2, s3, s4;
  26303. var key = peg$currPos * 60 + 46,
  26304. cached = peg$cache[key];
  26305. if (cached) {
  26306. peg$currPos = cached.nextPos;
  26307. return cached.result;
  26308. }
  26309. s0 = peg$currPos;
  26310. s1 = peg$parseunaryMessage();
  26311. if (s1 !== peg$FAILED) {
  26312. s2 = peg$parsews();
  26313. if (s2 !== peg$FAILED) {
  26314. s3 = peg$parseunaryTail();
  26315. if (s3 === peg$FAILED) {
  26316. s3 = peg$c41;
  26317. }
  26318. if (s3 !== peg$FAILED) {
  26319. s4 = peg$parsews();
  26320. if (s4 !== peg$FAILED) {
  26321. peg$reportedPos = s0;
  26322. s1 = peg$c114(s1, s3);
  26323. s0 = s1;
  26324. } else {
  26325. peg$currPos = s0;
  26326. s0 = peg$c1;
  26327. }
  26328. } else {
  26329. peg$currPos = s0;
  26330. s0 = peg$c1;
  26331. }
  26332. } else {
  26333. peg$currPos = s0;
  26334. s0 = peg$c1;
  26335. }
  26336. } else {
  26337. peg$currPos = s0;
  26338. s0 = peg$c1;
  26339. }
  26340. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26341. return s0;
  26342. }
  26343. function peg$parseunarySend() {
  26344. var s0, s1, s2, s3;
  26345. var key = peg$currPos * 60 + 47,
  26346. cached = peg$cache[key];
  26347. if (cached) {
  26348. peg$currPos = cached.nextPos;
  26349. return cached.result;
  26350. }
  26351. s0 = peg$currPos;
  26352. s1 = peg$parseoperand();
  26353. if (s1 !== peg$FAILED) {
  26354. s2 = peg$parsews();
  26355. if (s2 !== peg$FAILED) {
  26356. s3 = peg$parseunaryTail();
  26357. if (s3 === peg$FAILED) {
  26358. s3 = peg$c41;
  26359. }
  26360. if (s3 !== peg$FAILED) {
  26361. peg$reportedPos = s0;
  26362. s1 = peg$c115(s1, s3);
  26363. s0 = s1;
  26364. } else {
  26365. peg$currPos = s0;
  26366. s0 = peg$c1;
  26367. }
  26368. } else {
  26369. peg$currPos = s0;
  26370. s0 = peg$c1;
  26371. }
  26372. } else {
  26373. peg$currPos = s0;
  26374. s0 = peg$c1;
  26375. }
  26376. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26377. return s0;
  26378. }
  26379. function peg$parsebinaryMessage() {
  26380. var s0, s1, s2, s3, s4;
  26381. var key = peg$currPos * 60 + 48,
  26382. cached = peg$cache[key];
  26383. if (cached) {
  26384. peg$currPos = cached.nextPos;
  26385. return cached.result;
  26386. }
  26387. s0 = peg$currPos;
  26388. s1 = peg$parsews();
  26389. if (s1 !== peg$FAILED) {
  26390. s2 = peg$parsebinarySelector();
  26391. if (s2 !== peg$FAILED) {
  26392. s3 = peg$parsews();
  26393. if (s3 !== peg$FAILED) {
  26394. s4 = peg$parseunarySend();
  26395. if (s4 === peg$FAILED) {
  26396. s4 = peg$parseoperand();
  26397. }
  26398. if (s4 !== peg$FAILED) {
  26399. peg$reportedPos = s0;
  26400. s1 = peg$c116(s2, s4);
  26401. s0 = s1;
  26402. } else {
  26403. peg$currPos = s0;
  26404. s0 = peg$c1;
  26405. }
  26406. } else {
  26407. peg$currPos = s0;
  26408. s0 = peg$c1;
  26409. }
  26410. } else {
  26411. peg$currPos = s0;
  26412. s0 = peg$c1;
  26413. }
  26414. } else {
  26415. peg$currPos = s0;
  26416. s0 = peg$c1;
  26417. }
  26418. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26419. return s0;
  26420. }
  26421. function peg$parsebinaryTail() {
  26422. var s0, s1, s2;
  26423. var key = peg$currPos * 60 + 49,
  26424. cached = peg$cache[key];
  26425. if (cached) {
  26426. peg$currPos = cached.nextPos;
  26427. return cached.result;
  26428. }
  26429. s0 = peg$currPos;
  26430. s1 = peg$parsebinaryMessage();
  26431. if (s1 !== peg$FAILED) {
  26432. s2 = peg$parsebinaryTail();
  26433. if (s2 === peg$FAILED) {
  26434. s2 = peg$c41;
  26435. }
  26436. if (s2 !== peg$FAILED) {
  26437. peg$reportedPos = s0;
  26438. s1 = peg$c117(s1, s2);
  26439. s0 = s1;
  26440. } else {
  26441. peg$currPos = s0;
  26442. s0 = peg$c1;
  26443. }
  26444. } else {
  26445. peg$currPos = s0;
  26446. s0 = peg$c1;
  26447. }
  26448. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26449. return s0;
  26450. }
  26451. function peg$parsebinarySend() {
  26452. var s0, s1, s2;
  26453. var key = peg$currPos * 60 + 50,
  26454. cached = peg$cache[key];
  26455. if (cached) {
  26456. peg$currPos = cached.nextPos;
  26457. return cached.result;
  26458. }
  26459. s0 = peg$currPos;
  26460. s1 = peg$parseunarySend();
  26461. if (s1 !== peg$FAILED) {
  26462. s2 = peg$parsebinaryTail();
  26463. if (s2 === peg$FAILED) {
  26464. s2 = peg$c41;
  26465. }
  26466. if (s2 !== peg$FAILED) {
  26467. peg$reportedPos = s0;
  26468. s1 = peg$c115(s1, s2);
  26469. s0 = s1;
  26470. } else {
  26471. peg$currPos = s0;
  26472. s0 = peg$c1;
  26473. }
  26474. } else {
  26475. peg$currPos = s0;
  26476. s0 = peg$c1;
  26477. }
  26478. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26479. return s0;
  26480. }
  26481. function peg$parsekeywordMessage() {
  26482. var s0, s1, s2;
  26483. var key = peg$currPos * 60 + 51,
  26484. cached = peg$cache[key];
  26485. if (cached) {
  26486. peg$currPos = cached.nextPos;
  26487. return cached.result;
  26488. }
  26489. s0 = peg$currPos;
  26490. s1 = [];
  26491. s2 = peg$parsekeywordPair();
  26492. if (s2 !== peg$FAILED) {
  26493. while (s2 !== peg$FAILED) {
  26494. s1.push(s2);
  26495. s2 = peg$parsekeywordPair();
  26496. }
  26497. } else {
  26498. s1 = peg$c1;
  26499. }
  26500. if (s1 !== peg$FAILED) {
  26501. peg$reportedPos = s0;
  26502. s1 = peg$c118(s1);
  26503. }
  26504. s0 = s1;
  26505. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26506. return s0;
  26507. }
  26508. function peg$parsekeywordSend() {
  26509. var s0, s1, s2;
  26510. var key = peg$currPos * 60 + 52,
  26511. cached = peg$cache[key];
  26512. if (cached) {
  26513. peg$currPos = cached.nextPos;
  26514. return cached.result;
  26515. }
  26516. s0 = peg$currPos;
  26517. s1 = peg$parsebinarySend();
  26518. if (s1 !== peg$FAILED) {
  26519. s2 = peg$parsekeywordMessage();
  26520. if (s2 !== peg$FAILED) {
  26521. peg$reportedPos = s0;
  26522. s1 = peg$c119(s1, s2);
  26523. s0 = s1;
  26524. } else {
  26525. peg$currPos = s0;
  26526. s0 = peg$c1;
  26527. }
  26528. } else {
  26529. peg$currPos = s0;
  26530. s0 = peg$c1;
  26531. }
  26532. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26533. return s0;
  26534. }
  26535. function peg$parsemessage() {
  26536. var s0;
  26537. var key = peg$currPos * 60 + 53,
  26538. cached = peg$cache[key];
  26539. if (cached) {
  26540. peg$currPos = cached.nextPos;
  26541. return cached.result;
  26542. }
  26543. s0 = peg$parsebinaryMessage();
  26544. if (s0 === peg$FAILED) {
  26545. s0 = peg$parseunaryMessage();
  26546. if (s0 === peg$FAILED) {
  26547. s0 = peg$parsekeywordMessage();
  26548. }
  26549. }
  26550. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26551. return s0;
  26552. }
  26553. function peg$parsecascade() {
  26554. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  26555. var key = peg$currPos * 60 + 54,
  26556. cached = peg$cache[key];
  26557. if (cached) {
  26558. peg$currPos = cached.nextPos;
  26559. return cached.result;
  26560. }
  26561. s0 = peg$currPos;
  26562. s1 = peg$parsews();
  26563. if (s1 !== peg$FAILED) {
  26564. s2 = peg$parsekeywordSend();
  26565. if (s2 === peg$FAILED) {
  26566. s2 = peg$parsebinarySend();
  26567. }
  26568. if (s2 !== peg$FAILED) {
  26569. s3 = [];
  26570. s4 = peg$currPos;
  26571. s5 = peg$parsews();
  26572. if (s5 !== peg$FAILED) {
  26573. if (input.charCodeAt(peg$currPos) === 59) {
  26574. s6 = peg$c120;
  26575. peg$currPos++;
  26576. } else {
  26577. s6 = peg$FAILED;
  26578. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  26579. }
  26580. if (s6 !== peg$FAILED) {
  26581. s7 = peg$parsews();
  26582. if (s7 !== peg$FAILED) {
  26583. s8 = peg$parsemessage();
  26584. if (s8 !== peg$FAILED) {
  26585. peg$reportedPos = s4;
  26586. s5 = peg$c122(s8);
  26587. s4 = s5;
  26588. } else {
  26589. peg$currPos = s4;
  26590. s4 = peg$c1;
  26591. }
  26592. } else {
  26593. peg$currPos = s4;
  26594. s4 = peg$c1;
  26595. }
  26596. } else {
  26597. peg$currPos = s4;
  26598. s4 = peg$c1;
  26599. }
  26600. } else {
  26601. peg$currPos = s4;
  26602. s4 = peg$c1;
  26603. }
  26604. if (s4 !== peg$FAILED) {
  26605. while (s4 !== peg$FAILED) {
  26606. s3.push(s4);
  26607. s4 = peg$currPos;
  26608. s5 = peg$parsews();
  26609. if (s5 !== peg$FAILED) {
  26610. if (input.charCodeAt(peg$currPos) === 59) {
  26611. s6 = peg$c120;
  26612. peg$currPos++;
  26613. } else {
  26614. s6 = peg$FAILED;
  26615. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  26616. }
  26617. if (s6 !== peg$FAILED) {
  26618. s7 = peg$parsews();
  26619. if (s7 !== peg$FAILED) {
  26620. s8 = peg$parsemessage();
  26621. if (s8 !== peg$FAILED) {
  26622. peg$reportedPos = s4;
  26623. s5 = peg$c122(s8);
  26624. s4 = s5;
  26625. } else {
  26626. peg$currPos = s4;
  26627. s4 = peg$c1;
  26628. }
  26629. } else {
  26630. peg$currPos = s4;
  26631. s4 = peg$c1;
  26632. }
  26633. } else {
  26634. peg$currPos = s4;
  26635. s4 = peg$c1;
  26636. }
  26637. } else {
  26638. peg$currPos = s4;
  26639. s4 = peg$c1;
  26640. }
  26641. }
  26642. } else {
  26643. s3 = peg$c1;
  26644. }
  26645. if (s3 !== peg$FAILED) {
  26646. peg$reportedPos = s0;
  26647. s1 = peg$c123(s2, s3);
  26648. s0 = s1;
  26649. } else {
  26650. peg$currPos = s0;
  26651. s0 = peg$c1;
  26652. }
  26653. } else {
  26654. peg$currPos = s0;
  26655. s0 = peg$c1;
  26656. }
  26657. } else {
  26658. peg$currPos = s0;
  26659. s0 = peg$c1;
  26660. }
  26661. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26662. return s0;
  26663. }
  26664. function peg$parsejsStatement() {
  26665. var s0, s1, s2, s3, s4;
  26666. var key = peg$currPos * 60 + 55,
  26667. cached = peg$cache[key];
  26668. if (cached) {
  26669. peg$currPos = cached.nextPos;
  26670. return cached.result;
  26671. }
  26672. s0 = peg$currPos;
  26673. if (input.charCodeAt(peg$currPos) === 60) {
  26674. s1 = peg$c124;
  26675. peg$currPos++;
  26676. } else {
  26677. s1 = peg$FAILED;
  26678. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26679. }
  26680. if (s1 !== peg$FAILED) {
  26681. s2 = [];
  26682. s3 = peg$currPos;
  26683. if (input.substr(peg$currPos, 2) === peg$c126) {
  26684. s4 = peg$c126;
  26685. peg$currPos += 2;
  26686. } else {
  26687. s4 = peg$FAILED;
  26688. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26689. }
  26690. if (s4 !== peg$FAILED) {
  26691. peg$reportedPos = s3;
  26692. s4 = peg$c128();
  26693. }
  26694. s3 = s4;
  26695. if (s3 === peg$FAILED) {
  26696. if (peg$c129.test(input.charAt(peg$currPos))) {
  26697. s3 = input.charAt(peg$currPos);
  26698. peg$currPos++;
  26699. } else {
  26700. s3 = peg$FAILED;
  26701. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26702. }
  26703. }
  26704. while (s3 !== peg$FAILED) {
  26705. s2.push(s3);
  26706. s3 = peg$currPos;
  26707. if (input.substr(peg$currPos, 2) === peg$c126) {
  26708. s4 = peg$c126;
  26709. peg$currPos += 2;
  26710. } else {
  26711. s4 = peg$FAILED;
  26712. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26713. }
  26714. if (s4 !== peg$FAILED) {
  26715. peg$reportedPos = s3;
  26716. s4 = peg$c128();
  26717. }
  26718. s3 = s4;
  26719. if (s3 === peg$FAILED) {
  26720. if (peg$c129.test(input.charAt(peg$currPos))) {
  26721. s3 = input.charAt(peg$currPos);
  26722. peg$currPos++;
  26723. } else {
  26724. s3 = peg$FAILED;
  26725. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26726. }
  26727. }
  26728. }
  26729. if (s2 !== peg$FAILED) {
  26730. if (input.charCodeAt(peg$currPos) === 62) {
  26731. s3 = peg$c131;
  26732. peg$currPos++;
  26733. } else {
  26734. s3 = peg$FAILED;
  26735. if (peg$silentFails === 0) { peg$fail(peg$c132); }
  26736. }
  26737. if (s3 !== peg$FAILED) {
  26738. peg$reportedPos = s0;
  26739. s1 = peg$c133(s2);
  26740. s0 = s1;
  26741. } else {
  26742. peg$currPos = s0;
  26743. s0 = peg$c1;
  26744. }
  26745. } else {
  26746. peg$currPos = s0;
  26747. s0 = peg$c1;
  26748. }
  26749. } else {
  26750. peg$currPos = s0;
  26751. s0 = peg$c1;
  26752. }
  26753. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26754. return s0;
  26755. }
  26756. function peg$parsemethod() {
  26757. var s0, s1, s2, s3, s4;
  26758. var key = peg$currPos * 60 + 56,
  26759. cached = peg$cache[key];
  26760. if (cached) {
  26761. peg$currPos = cached.nextPos;
  26762. return cached.result;
  26763. }
  26764. s0 = peg$currPos;
  26765. s1 = peg$parsekeywordPattern();
  26766. if (s1 === peg$FAILED) {
  26767. s1 = peg$parsebinaryPattern();
  26768. if (s1 === peg$FAILED) {
  26769. s1 = peg$parseunaryPattern();
  26770. }
  26771. }
  26772. if (s1 !== peg$FAILED) {
  26773. s2 = peg$parsews();
  26774. if (s2 !== peg$FAILED) {
  26775. s3 = peg$parsesequence();
  26776. if (s3 === peg$FAILED) {
  26777. s3 = peg$c41;
  26778. }
  26779. if (s3 !== peg$FAILED) {
  26780. s4 = peg$parsews();
  26781. if (s4 !== peg$FAILED) {
  26782. peg$reportedPos = s0;
  26783. s1 = peg$c134(s1, s3);
  26784. s0 = s1;
  26785. } else {
  26786. peg$currPos = s0;
  26787. s0 = peg$c1;
  26788. }
  26789. } else {
  26790. peg$currPos = s0;
  26791. s0 = peg$c1;
  26792. }
  26793. } else {
  26794. peg$currPos = s0;
  26795. s0 = peg$c1;
  26796. }
  26797. } else {
  26798. peg$currPos = s0;
  26799. s0 = peg$c1;
  26800. }
  26801. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26802. return s0;
  26803. }
  26804. function peg$parseassociationSend() {
  26805. var s0, s1, s2;
  26806. var key = peg$currPos * 60 + 57,
  26807. cached = peg$cache[key];
  26808. if (cached) {
  26809. peg$currPos = cached.nextPos;
  26810. return cached.result;
  26811. }
  26812. s0 = peg$currPos;
  26813. s1 = peg$parsebinarySend();
  26814. if (s1 !== peg$FAILED) {
  26815. peg$reportedPos = peg$currPos;
  26816. s2 = peg$c135(s1);
  26817. if (s2) {
  26818. s2 = peg$c112;
  26819. } else {
  26820. s2 = peg$c1;
  26821. }
  26822. if (s2 !== peg$FAILED) {
  26823. peg$reportedPos = s0;
  26824. s1 = peg$c136(s1);
  26825. s0 = s1;
  26826. } else {
  26827. peg$currPos = s0;
  26828. s0 = peg$c1;
  26829. }
  26830. } else {
  26831. peg$currPos = s0;
  26832. s0 = peg$c1;
  26833. }
  26834. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26835. return s0;
  26836. }
  26837. function peg$parseassociationList() {
  26838. var s0, s1, s2, s3, s4;
  26839. var key = peg$currPos * 60 + 58,
  26840. cached = peg$cache[key];
  26841. if (cached) {
  26842. peg$currPos = cached.nextPos;
  26843. return cached.result;
  26844. }
  26845. s0 = peg$currPos;
  26846. s1 = peg$parsews();
  26847. if (s1 !== peg$FAILED) {
  26848. if (input.charCodeAt(peg$currPos) === 46) {
  26849. s2 = peg$c51;
  26850. peg$currPos++;
  26851. } else {
  26852. s2 = peg$FAILED;
  26853. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26854. }
  26855. if (s2 !== peg$FAILED) {
  26856. s3 = peg$parsews();
  26857. if (s3 !== peg$FAILED) {
  26858. s4 = peg$parseassociationSend();
  26859. if (s4 !== peg$FAILED) {
  26860. peg$reportedPos = s0;
  26861. s1 = peg$c89(s4);
  26862. s0 = s1;
  26863. } else {
  26864. peg$currPos = s0;
  26865. s0 = peg$c1;
  26866. }
  26867. } else {
  26868. peg$currPos = s0;
  26869. s0 = peg$c1;
  26870. }
  26871. } else {
  26872. peg$currPos = s0;
  26873. s0 = peg$c1;
  26874. }
  26875. } else {
  26876. peg$currPos = s0;
  26877. s0 = peg$c1;
  26878. }
  26879. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26880. return s0;
  26881. }
  26882. function peg$parseassociations() {
  26883. var s0, s1, s2, s3;
  26884. var key = peg$currPos * 60 + 59,
  26885. cached = peg$cache[key];
  26886. if (cached) {
  26887. peg$currPos = cached.nextPos;
  26888. return cached.result;
  26889. }
  26890. s0 = peg$currPos;
  26891. s1 = peg$parseassociationSend();
  26892. if (s1 !== peg$FAILED) {
  26893. s2 = [];
  26894. s3 = peg$parseassociationList();
  26895. while (s3 !== peg$FAILED) {
  26896. s2.push(s3);
  26897. s3 = peg$parseassociationList();
  26898. }
  26899. if (s2 !== peg$FAILED) {
  26900. peg$reportedPos = s0;
  26901. s1 = peg$c137(s1, s2);
  26902. s0 = s1;
  26903. } else {
  26904. peg$currPos = s0;
  26905. s0 = peg$c1;
  26906. }
  26907. } else {
  26908. peg$currPos = s0;
  26909. s0 = peg$c1;
  26910. }
  26911. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26912. return s0;
  26913. }
  26914. peg$result = peg$startRuleFunction();
  26915. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  26916. return peg$result;
  26917. } else {
  26918. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  26919. peg$fail({ type: "end", description: "end of input" });
  26920. }
  26921. throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
  26922. }
  26923. }
  26924. return {
  26925. SyntaxError: SyntaxError,
  26926. parse: parse
  26927. };
  26928. })();
  26929. });
  26930. 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";
  26931. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  26932. $core.addPackage('Platform-ImportExport');
  26933. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  26934. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  26935. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  26936. $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.";
  26937. $core.addMethod(
  26938. $core.method({
  26939. selector: "classNameFor:",
  26940. protocol: 'convenience',
  26941. fn: function (aClass){
  26942. var self=this;
  26943. return $core.withContext(function($ctx1) {
  26944. var $2,$3,$4,$1;
  26945. $2=$recv(aClass)._isMetaclass();
  26946. if($core.assert($2)){
  26947. $3=$recv($recv(aClass)._instanceClass())._name();
  26948. $ctx1.sendIdx["name"]=1;
  26949. $1=$recv($3).__comma(" class");
  26950. } else {
  26951. $4=$recv(aClass)._isNil();
  26952. if($core.assert($4)){
  26953. $1="nil";
  26954. } else {
  26955. $1=$recv(aClass)._name();
  26956. };
  26957. };
  26958. return $1;
  26959. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  26960. },
  26961. args: ["aClass"],
  26962. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]",
  26963. referencedClasses: [],
  26964. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  26965. }),
  26966. $globals.AbstractExporter);
  26967. $core.addMethod(
  26968. $core.method({
  26969. selector: "exportPackage:on:",
  26970. protocol: 'output',
  26971. fn: function (aPackage,aStream){
  26972. var self=this;
  26973. return $core.withContext(function($ctx1) {
  26974. self._subclassResponsibility();
  26975. return self;
  26976. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  26977. },
  26978. args: ["aPackage", "aStream"],
  26979. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  26980. referencedClasses: [],
  26981. messageSends: ["subclassResponsibility"]
  26982. }),
  26983. $globals.AbstractExporter);
  26984. $core.addMethod(
  26985. $core.method({
  26986. selector: "extensionMethodsOfPackage:",
  26987. protocol: 'accessing',
  26988. fn: function (aPackage){
  26989. var self=this;
  26990. var result;
  26991. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  26992. return $core.withContext(function($ctx1) {
  26993. var $1;
  26994. result=$recv($OrderedCollection())._new();
  26995. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  26996. return $core.withContext(function($ctx2) {
  26997. return $recv(result)._addAll_($recv(each)._methods());
  26998. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26999. }));
  27000. $1=result;
  27001. return $1;
  27002. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  27003. },
  27004. args: ["aPackage"],
  27005. 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",
  27006. referencedClasses: ["OrderedCollection"],
  27007. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  27008. }),
  27009. $globals.AbstractExporter);
  27010. $core.addMethod(
  27011. $core.method({
  27012. selector: "extensionProtocolsOfPackage:",
  27013. protocol: 'accessing',
  27014. fn: function (aPackage){
  27015. var self=this;
  27016. var extensionName,result;
  27017. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27018. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27019. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  27020. return $core.withContext(function($ctx1) {
  27021. var $1,$2,$3,$4;
  27022. $1=$recv(aPackage)._name();
  27023. $ctx1.sendIdx["name"]=1;
  27024. extensionName="*".__comma($1);
  27025. result=$recv($OrderedCollection())._new();
  27026. $recv($recv($recv($recv($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
  27027. return $core.withContext(function($ctx2) {
  27028. $2=$recv(a)._name();
  27029. $ctx2.sendIdx["name"]=2;
  27030. return $recv($2).__lt($recv(b)._name());
  27031. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27032. })))._do_((function(each){
  27033. return $core.withContext(function($ctx2) {
  27034. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  27035. return $core.withContext(function($ctx3) {
  27036. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  27037. if($core.assert($3)){
  27038. return $recv(result)._add_($recv($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  27039. };
  27040. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  27041. }));
  27042. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27043. }));
  27044. $ctx1.sendIdx["do:"]=1;
  27045. $4=result;
  27046. return $4;
  27047. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  27048. },
  27049. args: ["aPackage"],
  27050. 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",
  27051. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  27052. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  27053. }),
  27054. $globals.AbstractExporter);
  27055. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27056. $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.";
  27057. $core.addMethod(
  27058. $core.method({
  27059. selector: "chunkEscape:",
  27060. protocol: 'convenience',
  27061. fn: function (aString){
  27062. var self=this;
  27063. return $core.withContext(function($ctx1) {
  27064. var $1;
  27065. $1=$recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  27066. return $1;
  27067. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  27068. },
  27069. args: ["aString"],
  27070. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  27071. referencedClasses: [],
  27072. messageSends: ["trimBoth", "replace:with:"]
  27073. }),
  27074. $globals.ChunkExporter);
  27075. $core.addMethod(
  27076. $core.method({
  27077. selector: "exportCategoryEpilogueOf:on:",
  27078. protocol: 'output',
  27079. fn: function (aCategory,aStream){
  27080. var self=this;
  27081. return $core.withContext(function($ctx1) {
  27082. var $1;
  27083. $recv(aStream)._nextPutAll_(" !");
  27084. $recv(aStream)._lf();
  27085. $ctx1.sendIdx["lf"]=1;
  27086. $1=$recv(aStream)._lf();
  27087. return self;
  27088. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27089. },
  27090. args: ["aCategory", "aStream"],
  27091. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27092. referencedClasses: [],
  27093. messageSends: ["nextPutAll:", "lf"]
  27094. }),
  27095. $globals.ChunkExporter);
  27096. $core.addMethod(
  27097. $core.method({
  27098. selector: "exportCategoryPrologueOf:on:",
  27099. protocol: 'output',
  27100. fn: function (aCategory,aStream){
  27101. var self=this;
  27102. return $core.withContext(function($ctx1) {
  27103. var $1,$3,$2;
  27104. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  27105. $ctx1.sendIdx[","]=1;
  27106. $recv(aStream)._nextPutAll_($1);
  27107. $ctx1.sendIdx["nextPutAll:"]=1;
  27108. $3=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  27109. $ctx1.sendIdx[","]=2;
  27110. $2=$recv(aStream)._nextPutAll_($3);
  27111. return self;
  27112. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27113. },
  27114. args: ["aCategory", "aStream"],
  27115. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  27116. referencedClasses: [],
  27117. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27118. }),
  27119. $globals.ChunkExporter);
  27120. $core.addMethod(
  27121. $core.method({
  27122. selector: "exportDefinitionOf:on:",
  27123. protocol: 'output',
  27124. fn: function (aClass,aStream){
  27125. var self=this;
  27126. return $core.withContext(function($ctx1) {
  27127. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  27128. $1=self._classNameFor_($recv(aClass)._superclass());
  27129. $ctx1.sendIdx["classNameFor:"]=1;
  27130. $recv(aStream)._nextPutAll_($1);
  27131. $ctx1.sendIdx["nextPutAll:"]=1;
  27132. $3=self._classNameFor_(aClass);
  27133. $ctx1.sendIdx["classNameFor:"]=2;
  27134. $2=" subclass: #".__comma($3);
  27135. $ctx1.sendIdx[","]=1;
  27136. $recv(aStream)._nextPutAll_($2);
  27137. $ctx1.sendIdx["nextPutAll:"]=2;
  27138. $recv(aStream)._lf();
  27139. $ctx1.sendIdx["lf"]=1;
  27140. $recv(aStream)._tab();
  27141. $ctx1.sendIdx["tab"]=1;
  27142. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  27143. $ctx1.sendIdx["nextPutAll:"]=3;
  27144. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27145. return $core.withContext(function($ctx2) {
  27146. return $recv(aStream)._nextPutAll_(each);
  27147. $ctx2.sendIdx["nextPutAll:"]=4;
  27148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27149. }),(function(){
  27150. return $core.withContext(function($ctx2) {
  27151. return $recv(aStream)._nextPutAll_(" ");
  27152. $ctx2.sendIdx["nextPutAll:"]=5;
  27153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27154. }));
  27155. $recv(aStream)._nextPutAll_("'");
  27156. $ctx1.sendIdx["nextPutAll:"]=6;
  27157. $recv(aStream)._lf();
  27158. $ctx1.sendIdx["lf"]=2;
  27159. $recv(aStream)._tab();
  27160. $6="package: '".__comma($recv(aClass)._category());
  27161. $ctx1.sendIdx[","]=3;
  27162. $5=$recv($6).__comma("'!");
  27163. $ctx1.sendIdx[","]=2;
  27164. $recv(aStream)._nextPutAll_($5);
  27165. $ctx1.sendIdx["nextPutAll:"]=7;
  27166. $7=$recv(aStream)._lf();
  27167. $ctx1.sendIdx["lf"]=3;
  27168. $9=$recv(aClass)._comment();
  27169. $ctx1.sendIdx["comment"]=1;
  27170. $8=$recv($9)._notEmpty();
  27171. if($core.assert($8)){
  27172. $11="!".__comma(self._classNameFor_(aClass));
  27173. $ctx1.sendIdx[","]=5;
  27174. $10=$recv($11).__comma(" commentStamp!");
  27175. $ctx1.sendIdx[","]=4;
  27176. $recv(aStream)._nextPutAll_($10);
  27177. $ctx1.sendIdx["nextPutAll:"]=8;
  27178. $recv(aStream)._lf();
  27179. $ctx1.sendIdx["lf"]=4;
  27180. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  27181. $12=$recv(aStream)._lf();
  27182. $ctx1.sendIdx["lf"]=5;
  27183. $12;
  27184. };
  27185. $recv(aStream)._lf();
  27186. return self;
  27187. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27188. },
  27189. args: ["aClass", "aStream"],
  27190. 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",
  27191. referencedClasses: [],
  27192. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
  27193. }),
  27194. $globals.ChunkExporter);
  27195. $core.addMethod(
  27196. $core.method({
  27197. selector: "exportMetaDefinitionOf:on:",
  27198. protocol: 'output',
  27199. fn: function (aClass,aStream){
  27200. var self=this;
  27201. return $core.withContext(function($ctx1) {
  27202. var $3,$2,$1,$5,$4,$6,$7;
  27203. $3=$recv(aClass)._class();
  27204. $ctx1.sendIdx["class"]=1;
  27205. $2=$recv($3)._instanceVariableNames();
  27206. $ctx1.sendIdx["instanceVariableNames"]=1;
  27207. $1=$recv($2)._isEmpty();
  27208. if(!$core.assert($1)){
  27209. $5=$recv(aClass)._class();
  27210. $ctx1.sendIdx["class"]=2;
  27211. $4=self._classNameFor_($5);
  27212. $recv(aStream)._nextPutAll_($4);
  27213. $ctx1.sendIdx["nextPutAll:"]=1;
  27214. $6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  27215. $ctx1.sendIdx["nextPutAll:"]=2;
  27216. $6;
  27217. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27218. return $core.withContext(function($ctx2) {
  27219. return $recv(aStream)._nextPutAll_(each);
  27220. $ctx2.sendIdx["nextPutAll:"]=3;
  27221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27222. }),(function(){
  27223. return $core.withContext(function($ctx2) {
  27224. return $recv(aStream)._nextPutAll_(" ");
  27225. $ctx2.sendIdx["nextPutAll:"]=4;
  27226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27227. }));
  27228. $recv(aStream)._nextPutAll_("'!");
  27229. $recv(aStream)._lf();
  27230. $ctx1.sendIdx["lf"]=1;
  27231. $7=$recv(aStream)._lf();
  27232. $7;
  27233. };
  27234. return self;
  27235. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27236. },
  27237. args: ["aClass", "aStream"],
  27238. 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 ]",
  27239. referencedClasses: [],
  27240. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  27241. }),
  27242. $globals.ChunkExporter);
  27243. $core.addMethod(
  27244. $core.method({
  27245. selector: "exportMethod:on:",
  27246. protocol: 'output',
  27247. fn: function (aMethod,aStream){
  27248. var self=this;
  27249. return $core.withContext(function($ctx1) {
  27250. var $1;
  27251. $recv(aStream)._lf();
  27252. $ctx1.sendIdx["lf"]=1;
  27253. $recv(aStream)._lf();
  27254. $ctx1.sendIdx["lf"]=2;
  27255. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  27256. $ctx1.sendIdx["nextPutAll:"]=1;
  27257. $recv(aStream)._lf();
  27258. $1=$recv(aStream)._nextPutAll_("!");
  27259. return self;
  27260. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  27261. },
  27262. args: ["aMethod", "aStream"],
  27263. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  27264. referencedClasses: [],
  27265. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  27266. }),
  27267. $globals.ChunkExporter);
  27268. $core.addMethod(
  27269. $core.method({
  27270. selector: "exportPackage:on:",
  27271. protocol: 'output',
  27272. fn: function (aPackage,aStream){
  27273. var self=this;
  27274. return $core.withContext(function($ctx1) {
  27275. var $1,$2;
  27276. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27277. $1=self._exportPackageImportsOf_on_(aPackage,aStream);
  27278. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27279. return $core.withContext(function($ctx2) {
  27280. self._exportDefinitionOf_on_(each,aStream);
  27281. $2=self._ownMethodProtocolsOfClass_(each);
  27282. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  27283. self._exportProtocols_on_($2,aStream);
  27284. $ctx2.sendIdx["exportProtocols:on:"]=1;
  27285. self._exportMetaDefinitionOf_on_(each,aStream);
  27286. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  27287. $ctx2.sendIdx["exportProtocols:on:"]=2;
  27288. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27289. }));
  27290. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  27291. return self;
  27292. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27293. },
  27294. args: ["aPackage", "aStream"],
  27295. 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",
  27296. referencedClasses: [],
  27297. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  27298. }),
  27299. $globals.ChunkExporter);
  27300. $core.addMethod(
  27301. $core.method({
  27302. selector: "exportPackageDefinitionOf:on:",
  27303. protocol: 'output',
  27304. fn: function (aPackage,aStream){
  27305. var self=this;
  27306. return $core.withContext(function($ctx1) {
  27307. var $1,$2;
  27308. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  27309. $ctx1.sendIdx[","]=1;
  27310. $recv(aStream)._nextPutAll_($1);
  27311. $2=$recv(aStream)._lf();
  27312. return self;
  27313. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27314. },
  27315. args: ["aPackage", "aStream"],
  27316. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  27317. referencedClasses: [],
  27318. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27319. }),
  27320. $globals.ChunkExporter);
  27321. $core.addMethod(
  27322. $core.method({
  27323. selector: "exportPackageImportsOf:on:",
  27324. protocol: 'output',
  27325. fn: function (aPackage,aStream){
  27326. var self=this;
  27327. return $core.withContext(function($ctx1) {
  27328. var $1;
  27329. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  27330. return $core.withContext(function($ctx2) {
  27331. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  27332. $ctx2.sendIdx["nextPutAll:"]=1;
  27333. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27334. $ctx2.sendIdx["nextPutAll:"]=2;
  27335. $recv(aStream)._nextPutAll_("') imports: ");
  27336. $ctx2.sendIdx["nextPutAll:"]=3;
  27337. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  27338. $ctx2.sendIdx["nextPutAll:"]=4;
  27339. $recv(aStream)._nextPutAll_("!");
  27340. $1=$recv(aStream)._lf();
  27341. return $1;
  27342. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27343. }));
  27344. return self;
  27345. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27346. },
  27347. args: ["aPackage", "aStream"],
  27348. 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 ]",
  27349. referencedClasses: [],
  27350. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  27351. }),
  27352. $globals.ChunkExporter);
  27353. $core.addMethod(
  27354. $core.method({
  27355. selector: "exportProtocol:on:",
  27356. protocol: 'output',
  27357. fn: function (aProtocol,aStream){
  27358. var self=this;
  27359. return $core.withContext(function($ctx1) {
  27360. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  27361. $recv($recv(aProtocol)._methods())._do_((function(method){
  27362. return $core.withContext(function($ctx2) {
  27363. return self._exportMethod_on_(method,aStream);
  27364. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  27365. }));
  27366. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  27367. return self;
  27368. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27369. },
  27370. args: ["aProtocol", "aStream"],
  27371. 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",
  27372. referencedClasses: [],
  27373. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  27374. }),
  27375. $globals.ChunkExporter);
  27376. $core.addMethod(
  27377. $core.method({
  27378. selector: "exportProtocolEpilogueOf:on:",
  27379. protocol: 'output',
  27380. fn: function (aProtocol,aStream){
  27381. var self=this;
  27382. return $core.withContext(function($ctx1) {
  27383. var $1;
  27384. $recv(aStream)._nextPutAll_(" !");
  27385. $recv(aStream)._lf();
  27386. $ctx1.sendIdx["lf"]=1;
  27387. $1=$recv(aStream)._lf();
  27388. return self;
  27389. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27390. },
  27391. args: ["aProtocol", "aStream"],
  27392. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27393. referencedClasses: [],
  27394. messageSends: ["nextPutAll:", "lf"]
  27395. }),
  27396. $globals.ChunkExporter);
  27397. $core.addMethod(
  27398. $core.method({
  27399. selector: "exportProtocolPrologueOf:on:",
  27400. protocol: 'output',
  27401. fn: function (aProtocol,aStream){
  27402. var self=this;
  27403. return $core.withContext(function($ctx1) {
  27404. var $1,$3,$2;
  27405. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  27406. $ctx1.sendIdx[","]=1;
  27407. $recv(aStream)._nextPutAll_($1);
  27408. $ctx1.sendIdx["nextPutAll:"]=1;
  27409. $3=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  27410. $ctx1.sendIdx[","]=2;
  27411. $2=$recv(aStream)._nextPutAll_($3);
  27412. return self;
  27413. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27414. },
  27415. args: ["aProtocol", "aStream"],
  27416. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  27417. referencedClasses: [],
  27418. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27419. }),
  27420. $globals.ChunkExporter);
  27421. $core.addMethod(
  27422. $core.method({
  27423. selector: "exportProtocols:on:",
  27424. protocol: 'output',
  27425. fn: function (aCollection,aStream){
  27426. var self=this;
  27427. return $core.withContext(function($ctx1) {
  27428. $recv(aCollection)._do_((function(each){
  27429. return $core.withContext(function($ctx2) {
  27430. return self._exportProtocol_on_(each,aStream);
  27431. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27432. }));
  27433. return self;
  27434. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  27435. },
  27436. args: ["aCollection", "aStream"],
  27437. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  27438. referencedClasses: [],
  27439. messageSends: ["do:", "exportProtocol:on:"]
  27440. }),
  27441. $globals.ChunkExporter);
  27442. $core.addMethod(
  27443. $core.method({
  27444. selector: "extensionCategoriesOfPackage:",
  27445. protocol: 'accessing',
  27446. fn: function (aPackage){
  27447. var self=this;
  27448. var name,map,result;
  27449. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27450. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  27451. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27452. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27453. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  27454. return $core.withContext(function($ctx1) {
  27455. var $1,$2;
  27456. name=$recv(aPackage)._name();
  27457. result=$recv($OrderedCollection())._new();
  27458. $ctx1.sendIdx["new"]=1;
  27459. $recv($recv($Package())._sortedClasses_($recv($Smalltalk())._classes()))._do_((function(each){
  27460. return $core.withContext(function($ctx2) {
  27461. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  27462. return $core.withContext(function($ctx3) {
  27463. map=$recv($Dictionary())._new();
  27464. map;
  27465. $recv(aClass)._protocolsDo_((function(category,methods){
  27466. return $core.withContext(function($ctx4) {
  27467. $1=$recv(category).__eq("*".__comma(name));
  27468. if($core.assert($1)){
  27469. return $recv(map)._at_put_(category,methods);
  27470. };
  27471. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  27472. }));
  27473. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27474. return $core.withContext(function($ctx4) {
  27475. return $recv(a).__lt_eq(b);
  27476. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  27477. })))._collect_((function(category){
  27478. return $core.withContext(function($ctx4) {
  27479. return $recv($MethodCategory())._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  27480. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  27481. })));
  27482. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  27483. }));
  27484. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27485. }));
  27486. $ctx1.sendIdx["do:"]=1;
  27487. $2=result;
  27488. return $2;
  27489. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  27490. },
  27491. args: ["aPackage"],
  27492. 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",
  27493. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  27494. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27495. }),
  27496. $globals.ChunkExporter);
  27497. $core.addMethod(
  27498. $core.method({
  27499. selector: "ownCategoriesOfClass:",
  27500. protocol: 'accessing',
  27501. fn: function (aClass){
  27502. var self=this;
  27503. var map;
  27504. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27505. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  27506. return $core.withContext(function($ctx1) {
  27507. var $1,$2;
  27508. map=$recv($Dictionary())._new();
  27509. $recv(aClass)._protocolsDo_((function(each,methods){
  27510. return $core.withContext(function($ctx2) {
  27511. $1=$recv(each)._match_("^\x5c*");
  27512. if(!$core.assert($1)){
  27513. return $recv(map)._at_put_(each,methods);
  27514. };
  27515. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  27516. }));
  27517. $2=$recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27518. return $core.withContext(function($ctx2) {
  27519. return $recv(a).__lt_eq(b);
  27520. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  27521. })))._collect_((function(each){
  27522. return $core.withContext(function($ctx2) {
  27523. return $recv($MethodCategory())._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  27524. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27525. }));
  27526. return $2;
  27527. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  27528. },
  27529. args: ["aClass"],
  27530. 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) ]",
  27531. referencedClasses: ["Dictionary", "MethodCategory"],
  27532. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27533. }),
  27534. $globals.ChunkExporter);
  27535. $core.addMethod(
  27536. $core.method({
  27537. selector: "ownCategoriesOfMetaClass:",
  27538. protocol: 'accessing',
  27539. fn: function (aClass){
  27540. var self=this;
  27541. return $core.withContext(function($ctx1) {
  27542. var $1;
  27543. $1=self._ownCategoriesOfClass_($recv(aClass)._class());
  27544. return $1;
  27545. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  27546. },
  27547. args: ["aClass"],
  27548. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  27549. referencedClasses: [],
  27550. messageSends: ["ownCategoriesOfClass:", "class"]
  27551. }),
  27552. $globals.ChunkExporter);
  27553. $core.addMethod(
  27554. $core.method({
  27555. selector: "ownMethodProtocolsOfClass:",
  27556. protocol: 'accessing',
  27557. fn: function (aClass){
  27558. var self=this;
  27559. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  27560. return $core.withContext(function($ctx1) {
  27561. var $1;
  27562. $1=$recv($recv(aClass)._ownProtocols())._collect_((function(each){
  27563. return $core.withContext(function($ctx2) {
  27564. return $recv($ExportMethodProtocol())._name_theClass_(each,aClass);
  27565. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27566. }));
  27567. return $1;
  27568. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  27569. },
  27570. args: ["aClass"],
  27571. 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 ]",
  27572. referencedClasses: ["ExportMethodProtocol"],
  27573. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  27574. }),
  27575. $globals.ChunkExporter);
  27576. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27577. $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.).";
  27578. $core.addMethod(
  27579. $core.method({
  27580. selector: "exportDefinitionOf:on:",
  27581. protocol: 'output',
  27582. fn: function (aClass,aStream){
  27583. var self=this;
  27584. return $core.withContext(function($ctx1) {
  27585. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10;
  27586. $recv(aStream)._lf();
  27587. $ctx1.sendIdx["lf"]=1;
  27588. $recv(aStream)._nextPutAll_("$core.addClass(");
  27589. $ctx1.sendIdx["nextPutAll:"]=1;
  27590. $2="'".__comma(self._classNameFor_(aClass));
  27591. $ctx1.sendIdx[","]=2;
  27592. $1=$recv($2).__comma("', ");
  27593. $ctx1.sendIdx[","]=1;
  27594. $recv(aStream)._nextPutAll_($1);
  27595. $ctx1.sendIdx["nextPutAll:"]=2;
  27596. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  27597. $ctx1.sendIdx["jsClassNameFor:"]=1;
  27598. $recv(aStream)._nextPutAll_($3);
  27599. $ctx1.sendIdx["nextPutAll:"]=3;
  27600. $4=$recv(aStream)._nextPutAll_(", [");
  27601. $ctx1.sendIdx["nextPutAll:"]=4;
  27602. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27603. return $core.withContext(function($ctx2) {
  27604. $6="'".__comma(each);
  27605. $ctx2.sendIdx[","]=4;
  27606. $5=$recv($6).__comma("'");
  27607. $ctx2.sendIdx[","]=3;
  27608. return $recv(aStream)._nextPutAll_($5);
  27609. $ctx2.sendIdx["nextPutAll:"]=5;
  27610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27611. }),(function(){
  27612. return $core.withContext(function($ctx2) {
  27613. return $recv(aStream)._nextPutAll_(", ");
  27614. $ctx2.sendIdx["nextPutAll:"]=6;
  27615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27616. }));
  27617. $recv(aStream)._nextPutAll_("], '");
  27618. $ctx1.sendIdx["nextPutAll:"]=7;
  27619. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  27620. $ctx1.sendIdx["nextPutAll:"]=8;
  27621. $7=$recv(aStream)._nextPutAll_(");");
  27622. $ctx1.sendIdx["nextPutAll:"]=9;
  27623. $9=$recv(aClass)._comment();
  27624. $ctx1.sendIdx["comment"]=1;
  27625. $8=$recv($9)._notEmpty();
  27626. if($core.assert($8)){
  27627. $recv(aStream)._lf();
  27628. $ctx1.sendIdx["lf"]=2;
  27629. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27630. $ctx1.sendIdx["nextPutAll:"]=10;
  27631. $recv(aStream)._lf();
  27632. $ctx1.sendIdx["lf"]=3;
  27633. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  27634. $ctx1.sendIdx["nextPutAll:"]=11;
  27635. $recv(aStream)._nextPutAll_(".comment=");
  27636. $ctx1.sendIdx["nextPutAll:"]=12;
  27637. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  27638. $ctx1.sendIdx["nextPutAll:"]=13;
  27639. $recv(aStream)._nextPutAll_(";");
  27640. $ctx1.sendIdx["nextPutAll:"]=14;
  27641. $recv(aStream)._lf();
  27642. $ctx1.sendIdx["lf"]=4;
  27643. $10=$recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27644. $10;
  27645. };
  27646. $recv(aStream)._lf();
  27647. return self;
  27648. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27649. },
  27650. args: ["aClass", "aStream"],
  27651. 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",
  27652. referencedClasses: [],
  27653. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"]
  27654. }),
  27655. $globals.Exporter);
  27656. $core.addMethod(
  27657. $core.method({
  27658. selector: "exportMetaDefinitionOf:on:",
  27659. protocol: 'output',
  27660. fn: function (aClass,aStream){
  27661. var self=this;
  27662. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  27663. return $core.withContext(function($ctx1) {
  27664. var $3,$2,$1,$5,$4,$6,$8,$7;
  27665. $recv(aStream)._lf();
  27666. $ctx1.sendIdx["lf"]=1;
  27667. $3=$recv(aClass)._class();
  27668. $ctx1.sendIdx["class"]=1;
  27669. $2=$recv($3)._instanceVariableNames();
  27670. $ctx1.sendIdx["instanceVariableNames"]=1;
  27671. $1=$recv($2)._isEmpty();
  27672. if(!$core.assert($1)){
  27673. $5=$recv(aClass)._class();
  27674. $ctx1.sendIdx["class"]=2;
  27675. $4=self._jsClassNameFor_($5);
  27676. $recv(aStream)._nextPutAll_($4);
  27677. $ctx1.sendIdx["nextPutAll:"]=1;
  27678. $6=$recv(aStream)._nextPutAll_(".iVarNames = [");
  27679. $ctx1.sendIdx["nextPutAll:"]=2;
  27680. $6;
  27681. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27682. return $core.withContext(function($ctx2) {
  27683. $8="'".__comma(each);
  27684. $ctx2.sendIdx[","]=2;
  27685. $7=$recv($8).__comma("'");
  27686. $ctx2.sendIdx[","]=1;
  27687. return $recv(aStream)._nextPutAll_($7);
  27688. $ctx2.sendIdx["nextPutAll:"]=3;
  27689. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27690. }),(function(){
  27691. return $core.withContext(function($ctx2) {
  27692. return $recv(aStream)._nextPutAll_(",");
  27693. $ctx2.sendIdx["nextPutAll:"]=4;
  27694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27695. }));
  27696. $recv(aStream)._nextPutAll_("];".__comma($recv($String())._lf()));
  27697. };
  27698. return self;
  27699. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27700. },
  27701. args: ["aClass", "aStream"],
  27702. 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 ]",
  27703. referencedClasses: ["String"],
  27704. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  27705. }),
  27706. $globals.Exporter);
  27707. $core.addMethod(
  27708. $core.method({
  27709. selector: "exportMethod:on:",
  27710. protocol: 'output',
  27711. fn: function (aMethod,aStream){
  27712. var self=this;
  27713. return $core.withContext(function($ctx1) {
  27714. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$17;
  27715. $recv(aStream)._nextPutAll_("$core.addMethod(");
  27716. $ctx1.sendIdx["nextPutAll:"]=1;
  27717. $recv(aStream)._lf();
  27718. $ctx1.sendIdx["lf"]=1;
  27719. $recv(aStream)._nextPutAll_("$core.method({");
  27720. $ctx1.sendIdx["nextPutAll:"]=2;
  27721. $recv(aStream)._lf();
  27722. $ctx1.sendIdx["lf"]=2;
  27723. $3=$recv($recv(aMethod)._selector())._asJavascript();
  27724. $ctx1.sendIdx["asJavascript"]=1;
  27725. $2="selector: ".__comma($3);
  27726. $ctx1.sendIdx[","]=2;
  27727. $1=$recv($2).__comma(",");
  27728. $ctx1.sendIdx[","]=1;
  27729. $recv(aStream)._nextPutAll_($1);
  27730. $ctx1.sendIdx["nextPutAll:"]=3;
  27731. $recv(aStream)._lf();
  27732. $ctx1.sendIdx["lf"]=3;
  27733. $5="protocol: '".__comma($recv(aMethod)._protocol());
  27734. $ctx1.sendIdx[","]=4;
  27735. $4=$recv($5).__comma("',");
  27736. $ctx1.sendIdx[","]=3;
  27737. $recv(aStream)._nextPutAll_($4);
  27738. $ctx1.sendIdx["nextPutAll:"]=4;
  27739. $recv(aStream)._lf();
  27740. $ctx1.sendIdx["lf"]=4;
  27741. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  27742. $ctx1.sendIdx[","]=6;
  27743. $6=$recv($7).__comma(",");
  27744. $ctx1.sendIdx[","]=5;
  27745. $recv(aStream)._nextPutAll_($6);
  27746. $ctx1.sendIdx["nextPutAll:"]=5;
  27747. $recv(aStream)._lf();
  27748. $ctx1.sendIdx["lf"]=5;
  27749. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27750. $ctx1.sendIdx["nextPutAll:"]=6;
  27751. $recv(aStream)._lf();
  27752. $ctx1.sendIdx["lf"]=6;
  27753. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  27754. $ctx1.sendIdx["asJavascript"]=2;
  27755. $9="args: ".__comma($10);
  27756. $ctx1.sendIdx[","]=8;
  27757. $8=$recv($9).__comma(",");
  27758. $ctx1.sendIdx[","]=7;
  27759. $recv(aStream)._nextPutAll_($8);
  27760. $ctx1.sendIdx["nextPutAll:"]=7;
  27761. $recv(aStream)._lf();
  27762. $ctx1.sendIdx["lf"]=7;
  27763. $13=$recv($recv(aMethod)._source())._asJavascript();
  27764. $ctx1.sendIdx["asJavascript"]=3;
  27765. $12="source: ".__comma($13);
  27766. $ctx1.sendIdx[","]=10;
  27767. $11=$recv($12).__comma(",");
  27768. $ctx1.sendIdx[","]=9;
  27769. $recv(aStream)._nextPutAll_($11);
  27770. $ctx1.sendIdx["nextPutAll:"]=8;
  27771. $recv(aStream)._lf();
  27772. $ctx1.sendIdx["lf"]=8;
  27773. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  27774. $ctx1.sendIdx["asJavascript"]=4;
  27775. $15="referencedClasses: ".__comma($16);
  27776. $ctx1.sendIdx[","]=12;
  27777. $14=$recv($15).__comma(",");
  27778. $ctx1.sendIdx[","]=11;
  27779. $recv(aStream)._nextPutAll_($14);
  27780. $ctx1.sendIdx["nextPutAll:"]=9;
  27781. $recv(aStream)._lf();
  27782. $ctx1.sendIdx["lf"]=9;
  27783. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27784. $ctx1.sendIdx["nextPutAll:"]=10;
  27785. $recv(aStream)._lf();
  27786. $ctx1.sendIdx["lf"]=10;
  27787. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  27788. $ctx1.sendIdx["nextPutAll:"]=11;
  27789. $recv(aStream)._lf();
  27790. $ctx1.sendIdx["lf"]=11;
  27791. $recv(aStream)._nextPutAll_("}),");
  27792. $ctx1.sendIdx["nextPutAll:"]=12;
  27793. $recv(aStream)._lf();
  27794. $ctx1.sendIdx["lf"]=12;
  27795. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  27796. $ctx1.sendIdx["nextPutAll:"]=13;
  27797. $recv(aStream)._nextPutAll_(");");
  27798. $recv(aStream)._lf();
  27799. $ctx1.sendIdx["lf"]=13;
  27800. $17=$recv(aStream)._lf();
  27801. return self;
  27802. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  27803. },
  27804. args: ["aMethod", "aStream"],
  27805. 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",
  27806. referencedClasses: [],
  27807. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  27808. }),
  27809. $globals.Exporter);
  27810. $core.addMethod(
  27811. $core.method({
  27812. selector: "exportPackage:on:",
  27813. protocol: 'output',
  27814. fn: function (aPackage,aStream){
  27815. var self=this;
  27816. return $core.withContext(function($ctx1) {
  27817. var $1,$2;
  27818. self._exportPackagePrologueOf_on_(aPackage,aStream);
  27819. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27820. self._exportPackageContextOf_on_(aPackage,aStream);
  27821. self._exportPackageImportsOf_on_(aPackage,aStream);
  27822. $1=self._exportPackageTransportOf_on_(aPackage,aStream);
  27823. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27824. return $core.withContext(function($ctx2) {
  27825. self._exportDefinitionOf_on_(each,aStream);
  27826. $2=$recv(each)._ownMethods();
  27827. $ctx2.sendIdx["ownMethods"]=1;
  27828. $recv($2)._do_((function(method){
  27829. return $core.withContext(function($ctx3) {
  27830. return self._exportMethod_on_(method,aStream);
  27831. $ctx3.sendIdx["exportMethod:on:"]=1;
  27832. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  27833. }));
  27834. $ctx2.sendIdx["do:"]=2;
  27835. self._exportMetaDefinitionOf_on_(each,aStream);
  27836. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  27837. return $core.withContext(function($ctx3) {
  27838. return self._exportMethod_on_(method,aStream);
  27839. $ctx3.sendIdx["exportMethod:on:"]=2;
  27840. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  27841. }));
  27842. $ctx2.sendIdx["do:"]=3;
  27843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27844. }));
  27845. $ctx1.sendIdx["do:"]=1;
  27846. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  27847. return $core.withContext(function($ctx2) {
  27848. return self._exportMethod_on_(each,aStream);
  27849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27850. }));
  27851. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  27852. return self;
  27853. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27854. },
  27855. args: ["aPackage", "aStream"],
  27856. 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",
  27857. referencedClasses: [],
  27858. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  27859. }),
  27860. $globals.Exporter);
  27861. $core.addMethod(
  27862. $core.method({
  27863. selector: "exportPackageContextOf:on:",
  27864. protocol: 'output',
  27865. fn: function (aPackage,aStream){
  27866. var self=this;
  27867. return $core.withContext(function($ctx1) {
  27868. var $1;
  27869. $recv(aStream)._nextPutAll_("$core.packages[");
  27870. $ctx1.sendIdx["nextPutAll:"]=1;
  27871. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27872. $ctx1.sendIdx["nextPutAll:"]=2;
  27873. $recv(aStream)._nextPutAll_("].innerEval = ");
  27874. $ctx1.sendIdx["nextPutAll:"]=3;
  27875. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  27876. $ctx1.sendIdx["nextPutAll:"]=4;
  27877. $recv(aStream)._nextPutAll_(";");
  27878. $1=$recv(aStream)._lf();
  27879. return self;
  27880. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27881. },
  27882. args: ["aPackage", "aStream"],
  27883. 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",
  27884. referencedClasses: [],
  27885. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  27886. }),
  27887. $globals.Exporter);
  27888. $core.addMethod(
  27889. $core.method({
  27890. selector: "exportPackageDefinitionOf:on:",
  27891. protocol: 'output',
  27892. fn: function (aPackage,aStream){
  27893. var self=this;
  27894. return $core.withContext(function($ctx1) {
  27895. var $1,$2;
  27896. $recv(aStream)._nextPutAll_("$core.addPackage(");
  27897. $ctx1.sendIdx["nextPutAll:"]=1;
  27898. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  27899. $ctx1.sendIdx[","]=1;
  27900. $recv(aStream)._nextPutAll_($1);
  27901. $2=$recv(aStream)._lf();
  27902. return self;
  27903. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27904. },
  27905. args: ["aPackage", "aStream"],
  27906. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  27907. referencedClasses: [],
  27908. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27909. }),
  27910. $globals.Exporter);
  27911. $core.addMethod(
  27912. $core.method({
  27913. selector: "exportPackageEpilogueOf:on:",
  27914. protocol: 'output',
  27915. fn: function (aPackage,aStream){
  27916. var self=this;
  27917. return $core.withContext(function($ctx1) {
  27918. self._subclassResponsibility();
  27919. return self;
  27920. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27921. },
  27922. args: ["aPackage", "aStream"],
  27923. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27924. referencedClasses: [],
  27925. messageSends: ["subclassResponsibility"]
  27926. }),
  27927. $globals.Exporter);
  27928. $core.addMethod(
  27929. $core.method({
  27930. selector: "exportPackageImportsOf:on:",
  27931. protocol: 'output',
  27932. fn: function (aPackage,aStream){
  27933. var self=this;
  27934. return $core.withContext(function($ctx1) {
  27935. var $1,$2;
  27936. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  27937. return $core.withContext(function($ctx2) {
  27938. $recv(aStream)._nextPutAll_("$core.packages[");
  27939. $ctx2.sendIdx["nextPutAll:"]=1;
  27940. $1=$recv($recv(aPackage)._name())._asJavascript();
  27941. $ctx2.sendIdx["asJavascript"]=1;
  27942. $recv(aStream)._nextPutAll_($1);
  27943. $ctx2.sendIdx["nextPutAll:"]=2;
  27944. $recv(aStream)._nextPutAll_("].imports = ");
  27945. $ctx2.sendIdx["nextPutAll:"]=3;
  27946. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  27947. $ctx2.sendIdx["nextPutAll:"]=4;
  27948. $recv(aStream)._nextPutAll_(";");
  27949. $2=$recv(aStream)._lf();
  27950. return $2;
  27951. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27952. }));
  27953. return self;
  27954. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27955. },
  27956. args: ["aPackage", "aStream"],
  27957. 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 ]",
  27958. referencedClasses: [],
  27959. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  27960. }),
  27961. $globals.Exporter);
  27962. $core.addMethod(
  27963. $core.method({
  27964. selector: "exportPackagePrologueOf:on:",
  27965. protocol: 'output',
  27966. fn: function (aPackage,aStream){
  27967. var self=this;
  27968. return $core.withContext(function($ctx1) {
  27969. self._subclassResponsibility();
  27970. return self;
  27971. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27972. },
  27973. args: ["aPackage", "aStream"],
  27974. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27975. referencedClasses: [],
  27976. messageSends: ["subclassResponsibility"]
  27977. }),
  27978. $globals.Exporter);
  27979. $core.addMethod(
  27980. $core.method({
  27981. selector: "exportPackageTransportOf:on:",
  27982. protocol: 'output',
  27983. fn: function (aPackage,aStream){
  27984. var self=this;
  27985. return $core.withContext(function($ctx1) {
  27986. var $1;
  27987. $recv(aStream)._nextPutAll_("$core.packages[");
  27988. $ctx1.sendIdx["nextPutAll:"]=1;
  27989. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27990. $ctx1.sendIdx["nextPutAll:"]=2;
  27991. $recv(aStream)._nextPutAll_("].transport = ");
  27992. $ctx1.sendIdx["nextPutAll:"]=3;
  27993. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  27994. $ctx1.sendIdx["nextPutAll:"]=4;
  27995. $recv(aStream)._nextPutAll_(";");
  27996. $1=$recv(aStream)._lf();
  27997. return self;
  27998. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27999. },
  28000. args: ["aPackage", "aStream"],
  28001. 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",
  28002. referencedClasses: [],
  28003. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  28004. }),
  28005. $globals.Exporter);
  28006. $core.addMethod(
  28007. $core.method({
  28008. selector: "jsClassNameFor:",
  28009. protocol: 'convenience',
  28010. fn: function (aClass){
  28011. var self=this;
  28012. return $core.withContext(function($ctx1) {
  28013. var $2,$1,$receiver;
  28014. $2=$recv(aClass)._isMetaclass();
  28015. if($core.assert($2)){
  28016. $1=$recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  28017. $ctx1.sendIdx[","]=1;
  28018. } else {
  28019. if(($receiver = aClass) == null || $receiver.isNil){
  28020. $1="null";
  28021. } else {
  28022. $1="$globals.".__comma($recv(aClass)._name());
  28023. };
  28024. };
  28025. return $1;
  28026. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  28027. },
  28028. args: ["aClass"],
  28029. 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 ] ]",
  28030. referencedClasses: [],
  28031. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  28032. }),
  28033. $globals.Exporter);
  28034. $core.addMethod(
  28035. $core.method({
  28036. selector: "ownMethodsOfClass:",
  28037. protocol: 'accessing',
  28038. fn: function (aClass){
  28039. var self=this;
  28040. return $core.withContext(function($ctx1) {
  28041. var $2,$1;
  28042. $1=$recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  28043. return $core.withContext(function($ctx2) {
  28044. $2=$recv(a)._selector();
  28045. $ctx2.sendIdx["selector"]=1;
  28046. return $recv($2).__lt_eq($recv(b)._selector());
  28047. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28048. })))._reject_((function(each){
  28049. return $core.withContext(function($ctx2) {
  28050. return $recv($recv(each)._protocol())._match_("^\x5c*");
  28051. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28052. }));
  28053. return $1;
  28054. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  28055. },
  28056. args: ["aClass"],
  28057. 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*') ]",
  28058. referencedClasses: [],
  28059. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  28060. }),
  28061. $globals.Exporter);
  28062. $core.addMethod(
  28063. $core.method({
  28064. selector: "ownMethodsOfMetaClass:",
  28065. protocol: 'accessing',
  28066. fn: function (aClass){
  28067. var self=this;
  28068. return $core.withContext(function($ctx1) {
  28069. var $1;
  28070. $1=self._ownMethodsOfClass_($recv(aClass)._class());
  28071. return $1;
  28072. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  28073. },
  28074. args: ["aClass"],
  28075. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  28076. referencedClasses: [],
  28077. messageSends: ["ownMethodsOfClass:", "class"]
  28078. }),
  28079. $globals.Exporter);
  28080. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  28081. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  28082. $core.addMethod(
  28083. $core.method({
  28084. selector: "amdNamesOfPackages:",
  28085. protocol: 'private',
  28086. fn: function (anArray){
  28087. var self=this;
  28088. return $core.withContext(function($ctx1) {
  28089. var $2,$1;
  28090. $1=$recv($recv(anArray)._select_((function(each){
  28091. return $core.withContext(function($ctx2) {
  28092. $2=self._amdNamespaceOfPackage_(each);
  28093. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  28094. return $recv($2)._notNil();
  28095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28096. })))._collect_((function(each){
  28097. return $core.withContext(function($ctx2) {
  28098. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  28099. $ctx2.sendIdx[","]=1;
  28100. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28101. }));
  28102. return $1;
  28103. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  28104. },
  28105. args: ["anArray"],
  28106. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  28107. referencedClasses: [],
  28108. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  28109. }),
  28110. $globals.AmdExporter);
  28111. $core.addMethod(
  28112. $core.method({
  28113. selector: "amdNamespaceOfPackage:",
  28114. protocol: 'private',
  28115. fn: function (aPackage){
  28116. var self=this;
  28117. return $core.withContext(function($ctx1) {
  28118. var $4,$3,$2,$1;
  28119. $4=$recv(aPackage)._transport();
  28120. $ctx1.sendIdx["transport"]=1;
  28121. $3=$recv($4)._type();
  28122. $2=$recv($3).__eq("amd");
  28123. if($core.assert($2)){
  28124. $1=$recv($recv(aPackage)._transport())._namespace();
  28125. } else {
  28126. $1=nil;
  28127. };
  28128. return $1;
  28129. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  28130. },
  28131. args: ["aPackage"],
  28132. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  28133. referencedClasses: [],
  28134. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  28135. }),
  28136. $globals.AmdExporter);
  28137. $core.addMethod(
  28138. $core.method({
  28139. selector: "exportPackageEpilogueOf:on:",
  28140. protocol: 'output',
  28141. fn: function (aPackage,aStream){
  28142. var self=this;
  28143. return $core.withContext(function($ctx1) {
  28144. var $1;
  28145. $recv(aStream)._nextPutAll_("});");
  28146. $1=$recv(aStream)._lf();
  28147. return self;
  28148. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  28149. },
  28150. args: ["aPackage", "aStream"],
  28151. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  28152. referencedClasses: [],
  28153. messageSends: ["nextPutAll:", "lf"]
  28154. }),
  28155. $globals.AmdExporter);
  28156. $core.addMethod(
  28157. $core.method({
  28158. selector: "exportPackagePrologueOf:on:",
  28159. protocol: 'output',
  28160. fn: function (aPackage,aStream){
  28161. var self=this;
  28162. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  28163. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28164. return $core.withContext(function($ctx1) {
  28165. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14,$18;
  28166. pragmaStart="";
  28167. pragmaEnd="";
  28168. importsForOutput=self._importsForOutput_(aPackage);
  28169. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  28170. $1=$recv(importsForOutput)._value();
  28171. $ctx1.sendIdx["value"]=1;
  28172. $recv($1)._ifNotEmpty_((function(){
  28173. return $core.withContext(function($ctx2) {
  28174. $3=$recv($String())._lf();
  28175. $ctx2.sendIdx["lf"]=1;
  28176. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  28177. $ctx2.sendIdx[","]=2;
  28178. $4=$recv($String())._lf();
  28179. $ctx2.sendIdx["lf"]=2;
  28180. pragmaStart=$recv($2).__comma($4);
  28181. $ctx2.sendIdx[","]=1;
  28182. pragmaStart;
  28183. $6=$recv($String())._lf();
  28184. $ctx2.sendIdx["lf"]=3;
  28185. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  28186. $ctx2.sendIdx[","]=4;
  28187. $7=$recv($String())._lf();
  28188. $ctx2.sendIdx["lf"]=4;
  28189. pragmaEnd=$recv($5).__comma($7);
  28190. $ctx2.sendIdx[","]=3;
  28191. return pragmaEnd;
  28192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28193. }));
  28194. $recv(aStream)._nextPutAll_("define(\x22");
  28195. $ctx1.sendIdx["nextPutAll:"]=1;
  28196. $recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  28197. $ctx1.sendIdx["nextPutAll:"]=2;
  28198. $recv(aStream)._nextPutAll_("/");
  28199. $ctx1.sendIdx["nextPutAll:"]=3;
  28200. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  28201. $ctx1.sendIdx["nextPutAll:"]=4;
  28202. $recv(aStream)._nextPutAll_("\x22, ");
  28203. $ctx1.sendIdx["nextPutAll:"]=5;
  28204. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  28205. $ctx1.sendIdx[","]=7;
  28206. $12=$recv($13).__comma([":2:"]);
  28207. $ctx1.sendIdx[","]=6;
  28208. $11=$recv($12).__comma(loadDependencies);
  28209. $ctx1.sendIdx[","]=5;
  28210. $10=$recv($11)._asJavascript();
  28211. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  28212. $ctx1.sendIdx["replace:with:"]=2;
  28213. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  28214. $ctx1.sendIdx["replace:with:"]=1;
  28215. $recv(aStream)._nextPutAll_($8);
  28216. $ctx1.sendIdx["nextPutAll:"]=6;
  28217. $recv(aStream)._nextPutAll_(", function(");
  28218. $ctx1.sendIdx["nextPutAll:"]=7;
  28219. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  28220. $ctx1.sendIdx[","]=8;
  28221. $16=$recv($17)._join_(",");
  28222. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  28223. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  28224. $ctx1.sendIdx["replace:with:"]=3;
  28225. $recv(aStream)._nextPutAll_($14);
  28226. $ctx1.sendIdx["nextPutAll:"]=8;
  28227. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  28228. $ctx1.sendIdx["nextPutAll:"]=9;
  28229. $recv(aStream)._lf();
  28230. $ctx1.sendIdx["lf"]=5;
  28231. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;");
  28232. $18=$recv(aStream)._lf();
  28233. return self;
  28234. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  28235. },
  28236. args: ["aPackage", "aStream"],
  28237. 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",
  28238. referencedClasses: ["String"],
  28239. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"]
  28240. }),
  28241. $globals.AmdExporter);
  28242. $core.addMethod(
  28243. $core.method({
  28244. selector: "importsForOutput:",
  28245. protocol: 'private',
  28246. fn: function (aPackage){
  28247. var self=this;
  28248. var namedImports,anonImports,importVarNames;
  28249. return $core.withContext(function($ctx1) {
  28250. var $1,$2;
  28251. namedImports=[];
  28252. anonImports=[];
  28253. importVarNames=[];
  28254. $recv($recv(aPackage)._imports())._do_((function(each){
  28255. return $core.withContext(function($ctx2) {
  28256. $1=$recv(each)._isString();
  28257. if($core.assert($1)){
  28258. return $recv(anonImports)._add_(each);
  28259. $ctx2.sendIdx["add:"]=1;
  28260. } else {
  28261. $recv(namedImports)._add_($recv(each)._value());
  28262. $ctx2.sendIdx["add:"]=2;
  28263. return $recv(importVarNames)._add_($recv(each)._key());
  28264. };
  28265. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28266. }));
  28267. $2=$recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  28268. return $2;
  28269. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  28270. },
  28271. args: ["aPackage"],
  28272. 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)",
  28273. referencedClasses: [],
  28274. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  28275. }),
  28276. $globals.AmdExporter);
  28277. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  28278. $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";
  28279. $core.addMethod(
  28280. $core.method({
  28281. selector: "last",
  28282. protocol: 'accessing',
  28283. fn: function (){
  28284. var self=this;
  28285. var $1;
  28286. $1=self["@last"];
  28287. return $1;
  28288. },
  28289. args: [],
  28290. source: "last\x0a\x09^ last",
  28291. referencedClasses: [],
  28292. messageSends: []
  28293. }),
  28294. $globals.ChunkParser);
  28295. $core.addMethod(
  28296. $core.method({
  28297. selector: "nextChunk",
  28298. protocol: 'reading',
  28299. fn: function (){
  28300. var self=this;
  28301. var char,result,chunk;
  28302. return $core.withContext(function($ctx1) {
  28303. var $1,$2,$3,$4;
  28304. var $early={};
  28305. try {
  28306. result=""._writeStream();
  28307. $recv((function(){
  28308. return $core.withContext(function($ctx2) {
  28309. char=$recv(self["@stream"])._next();
  28310. $ctx2.sendIdx["next"]=1;
  28311. char;
  28312. return $recv(char)._notNil();
  28313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28314. }))._whileTrue_((function(){
  28315. return $core.withContext(function($ctx2) {
  28316. $1=$recv(char).__eq("!");
  28317. $ctx2.sendIdx["="]=1;
  28318. if($core.assert($1)){
  28319. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  28320. if($core.assert($2)){
  28321. $recv(self["@stream"])._next();
  28322. } else {
  28323. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  28324. $3=self["@last"];
  28325. throw $early=[$3];
  28326. };
  28327. };
  28328. return $recv(result)._nextPut_(char);
  28329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28330. }));
  28331. self["@last"]=nil;
  28332. $4=self["@last"];
  28333. return $4;
  28334. }
  28335. catch(e) {if(e===$early)return e[0]; throw e}
  28336. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  28337. },
  28338. args: [],
  28339. 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",
  28340. referencedClasses: [],
  28341. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  28342. }),
  28343. $globals.ChunkParser);
  28344. $core.addMethod(
  28345. $core.method({
  28346. selector: "stream:",
  28347. protocol: 'accessing',
  28348. fn: function (aStream){
  28349. var self=this;
  28350. self["@stream"]=aStream;
  28351. return self;
  28352. },
  28353. args: ["aStream"],
  28354. source: "stream: aStream\x0a\x09stream := aStream",
  28355. referencedClasses: [],
  28356. messageSends: []
  28357. }),
  28358. $globals.ChunkParser);
  28359. $core.addMethod(
  28360. $core.method({
  28361. selector: "on:",
  28362. protocol: 'instance creation',
  28363. fn: function (aStream){
  28364. var self=this;
  28365. return $core.withContext(function($ctx1) {
  28366. var $1;
  28367. $1=$recv(self._new())._stream_(aStream);
  28368. return $1;
  28369. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  28370. },
  28371. args: ["aStream"],
  28372. source: "on: aStream\x0a\x09^ self new stream: aStream",
  28373. referencedClasses: [],
  28374. messageSends: ["stream:", "new"]
  28375. }),
  28376. $globals.ChunkParser.klass);
  28377. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  28378. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  28379. $core.addMethod(
  28380. $core.method({
  28381. selector: "class:",
  28382. protocol: 'accessing',
  28383. fn: function (aClass){
  28384. var self=this;
  28385. self["@class"]=aClass;
  28386. return self;
  28387. },
  28388. args: ["aClass"],
  28389. source: "class: aClass\x0a\x09class := aClass",
  28390. referencedClasses: [],
  28391. messageSends: []
  28392. }),
  28393. $globals.ClassCommentReader);
  28394. $core.addMethod(
  28395. $core.method({
  28396. selector: "initialize",
  28397. protocol: 'initialization',
  28398. fn: function (){
  28399. var self=this;
  28400. return $core.withContext(function($ctx1) {
  28401. (
  28402. $ctx1.supercall = true,
  28403. $globals.ClassCommentReader.superclass.fn.prototype._initialize.apply($recv(self), []));
  28404. $ctx1.supercall = false;
  28405. return self;
  28406. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  28407. },
  28408. args: [],
  28409. source: "initialize\x0a\x09super initialize.",
  28410. referencedClasses: [],
  28411. messageSends: ["initialize"]
  28412. }),
  28413. $globals.ClassCommentReader);
  28414. $core.addMethod(
  28415. $core.method({
  28416. selector: "scanFrom:",
  28417. protocol: 'fileIn',
  28418. fn: function (aChunkParser){
  28419. var self=this;
  28420. var chunk;
  28421. return $core.withContext(function($ctx1) {
  28422. var $1;
  28423. chunk=$recv(aChunkParser)._nextChunk();
  28424. $1=$recv(chunk)._isEmpty();
  28425. if(!$core.assert($1)){
  28426. self._setComment_(chunk);
  28427. };
  28428. return self;
  28429. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  28430. },
  28431. args: ["aChunkParser"],
  28432. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  28433. referencedClasses: [],
  28434. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
  28435. }),
  28436. $globals.ClassCommentReader);
  28437. $core.addMethod(
  28438. $core.method({
  28439. selector: "setComment:",
  28440. protocol: 'private',
  28441. fn: function (aString){
  28442. var self=this;
  28443. return $core.withContext(function($ctx1) {
  28444. $recv(self["@class"])._comment_(aString);
  28445. return self;
  28446. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  28447. },
  28448. args: ["aString"],
  28449. source: "setComment: aString\x0a\x09class comment: aString",
  28450. referencedClasses: [],
  28451. messageSends: ["comment:"]
  28452. }),
  28453. $globals.ClassCommentReader);
  28454. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  28455. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  28456. $core.addMethod(
  28457. $core.method({
  28458. selector: "class:category:",
  28459. protocol: 'accessing',
  28460. fn: function (aClass,aString){
  28461. var self=this;
  28462. self["@class"]=aClass;
  28463. self["@category"]=aString;
  28464. return self;
  28465. },
  28466. args: ["aClass", "aString"],
  28467. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  28468. referencedClasses: [],
  28469. messageSends: []
  28470. }),
  28471. $globals.ClassProtocolReader);
  28472. $core.addMethod(
  28473. $core.method({
  28474. selector: "compileMethod:",
  28475. protocol: 'private',
  28476. fn: function (aString){
  28477. var self=this;
  28478. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  28479. return $core.withContext(function($ctx1) {
  28480. $recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  28481. return self;
  28482. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  28483. },
  28484. args: ["aString"],
  28485. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  28486. referencedClasses: ["Compiler"],
  28487. messageSends: ["install:forClass:protocol:", "new"]
  28488. }),
  28489. $globals.ClassProtocolReader);
  28490. $core.addMethod(
  28491. $core.method({
  28492. selector: "initialize",
  28493. protocol: 'initialization',
  28494. fn: function (){
  28495. var self=this;
  28496. return $core.withContext(function($ctx1) {
  28497. (
  28498. $ctx1.supercall = true,
  28499. $globals.ClassProtocolReader.superclass.fn.prototype._initialize.apply($recv(self), []));
  28500. $ctx1.supercall = false;
  28501. return self;
  28502. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  28503. },
  28504. args: [],
  28505. source: "initialize\x0a\x09super initialize.",
  28506. referencedClasses: [],
  28507. messageSends: ["initialize"]
  28508. }),
  28509. $globals.ClassProtocolReader);
  28510. $core.addMethod(
  28511. $core.method({
  28512. selector: "scanFrom:",
  28513. protocol: 'fileIn',
  28514. fn: function (aChunkParser){
  28515. var self=this;
  28516. var chunk;
  28517. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  28518. return $core.withContext(function($ctx1) {
  28519. $recv((function(){
  28520. return $core.withContext(function($ctx2) {
  28521. chunk=$recv(aChunkParser)._nextChunk();
  28522. chunk;
  28523. return $recv(chunk)._isEmpty();
  28524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28525. }))._whileFalse_((function(){
  28526. return $core.withContext(function($ctx2) {
  28527. return self._compileMethod_(chunk);
  28528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28529. }));
  28530. $recv($recv($ClassBuilder())._new())._setupClass_(self["@class"]);
  28531. return self;
  28532. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  28533. },
  28534. args: ["aChunkParser"],
  28535. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ].\x0a\x09ClassBuilder new setupClass: class",
  28536. referencedClasses: ["ClassBuilder"],
  28537. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
  28538. }),
  28539. $globals.ClassProtocolReader);
  28540. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  28541. $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.";
  28542. $core.addMethod(
  28543. $core.method({
  28544. selector: "methods",
  28545. protocol: 'accessing',
  28546. fn: function (){
  28547. var self=this;
  28548. return $core.withContext(function($ctx1) {
  28549. var $2,$1;
  28550. $1=$recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  28551. return $core.withContext(function($ctx2) {
  28552. $2=$recv(a)._selector();
  28553. $ctx2.sendIdx["selector"]=1;
  28554. return $recv($2).__lt_eq($recv(b)._selector());
  28555. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28556. }));
  28557. return $1;
  28558. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  28559. },
  28560. args: [],
  28561. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  28562. referencedClasses: [],
  28563. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  28564. }),
  28565. $globals.ExportMethodProtocol);
  28566. $core.addMethod(
  28567. $core.method({
  28568. selector: "name",
  28569. protocol: 'accessing',
  28570. fn: function (){
  28571. var self=this;
  28572. var $1;
  28573. $1=self["@name"];
  28574. return $1;
  28575. },
  28576. args: [],
  28577. source: "name\x0a\x09^ name",
  28578. referencedClasses: [],
  28579. messageSends: []
  28580. }),
  28581. $globals.ExportMethodProtocol);
  28582. $core.addMethod(
  28583. $core.method({
  28584. selector: "name:",
  28585. protocol: 'accessing',
  28586. fn: function (aString){
  28587. var self=this;
  28588. self["@name"]=aString;
  28589. return self;
  28590. },
  28591. args: ["aString"],
  28592. source: "name: aString\x0a\x09name := aString",
  28593. referencedClasses: [],
  28594. messageSends: []
  28595. }),
  28596. $globals.ExportMethodProtocol);
  28597. $core.addMethod(
  28598. $core.method({
  28599. selector: "theClass",
  28600. protocol: 'accessing',
  28601. fn: function (){
  28602. var self=this;
  28603. var $1;
  28604. $1=self["@theClass"];
  28605. return $1;
  28606. },
  28607. args: [],
  28608. source: "theClass\x0a\x09^ theClass",
  28609. referencedClasses: [],
  28610. messageSends: []
  28611. }),
  28612. $globals.ExportMethodProtocol);
  28613. $core.addMethod(
  28614. $core.method({
  28615. selector: "theClass:",
  28616. protocol: 'accessing',
  28617. fn: function (aClass){
  28618. var self=this;
  28619. self["@theClass"]=aClass;
  28620. return self;
  28621. },
  28622. args: ["aClass"],
  28623. source: "theClass: aClass\x0a\x09theClass := aClass",
  28624. referencedClasses: [],
  28625. messageSends: []
  28626. }),
  28627. $globals.ExportMethodProtocol);
  28628. $core.addMethod(
  28629. $core.method({
  28630. selector: "name:theClass:",
  28631. protocol: 'instance creation',
  28632. fn: function (aString,aClass){
  28633. var self=this;
  28634. return $core.withContext(function($ctx1) {
  28635. var $2,$3,$1;
  28636. $2=self._new();
  28637. $recv($2)._name_(aString);
  28638. $recv($2)._theClass_(aClass);
  28639. $3=$recv($2)._yourself();
  28640. $1=$3;
  28641. return $1;
  28642. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  28643. },
  28644. args: ["aString", "aClass"],
  28645. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  28646. referencedClasses: [],
  28647. messageSends: ["name:", "new", "theClass:", "yourself"]
  28648. }),
  28649. $globals.ExportMethodProtocol.klass);
  28650. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  28651. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  28652. $core.addMethod(
  28653. $core.method({
  28654. selector: "import:",
  28655. protocol: 'fileIn',
  28656. fn: function (aStream){
  28657. var self=this;
  28658. var chunk,result,parser,lastEmpty;
  28659. function $ChunkParser(){return $globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  28660. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  28661. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  28662. return $core.withContext(function($ctx1) {
  28663. var $1,$2;
  28664. parser=$recv($ChunkParser())._on_(aStream);
  28665. lastEmpty=false;
  28666. self["@lastSection"]="n/a, not started";
  28667. self["@lastChunk"]=nil;
  28668. $recv((function(){
  28669. return $core.withContext(function($ctx2) {
  28670. $recv((function(){
  28671. return $core.withContext(function($ctx3) {
  28672. chunk=$recv(parser)._nextChunk();
  28673. chunk;
  28674. return $recv(chunk)._isNil();
  28675. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28676. }))._whileFalse_((function(){
  28677. return $core.withContext(function($ctx3) {
  28678. $1=$recv(chunk)._isEmpty();
  28679. if($core.assert($1)){
  28680. lastEmpty=true;
  28681. return lastEmpty;
  28682. } else {
  28683. self["@lastSection"]=chunk;
  28684. self["@lastSection"];
  28685. result=$recv($recv($Compiler())._new())._evaluateExpression_(chunk);
  28686. result;
  28687. $2=lastEmpty;
  28688. if($core.assert($2)){
  28689. lastEmpty=false;
  28690. lastEmpty;
  28691. return $recv(result)._scanFrom_(parser);
  28692. };
  28693. };
  28694. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28695. }));
  28696. self["@lastSection"]="n/a, finished";
  28697. return self["@lastSection"];
  28698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28699. }))._on_do_($Error(),(function(e){
  28700. return $core.withContext(function($ctx2) {
  28701. self["@lastChunk"]=$recv(parser)._last();
  28702. self["@lastChunk"];
  28703. return $recv(e)._resignal();
  28704. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  28705. }));
  28706. return self;
  28707. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  28708. },
  28709. args: ["aStream"],
  28710. 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 ].",
  28711. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  28712. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  28713. }),
  28714. $globals.Importer);
  28715. $core.addMethod(
  28716. $core.method({
  28717. selector: "lastChunk",
  28718. protocol: 'accessing',
  28719. fn: function (){
  28720. var self=this;
  28721. var $1;
  28722. $1=self["@lastChunk"];
  28723. return $1;
  28724. },
  28725. args: [],
  28726. source: "lastChunk\x0a\x09^ lastChunk",
  28727. referencedClasses: [],
  28728. messageSends: []
  28729. }),
  28730. $globals.Importer);
  28731. $core.addMethod(
  28732. $core.method({
  28733. selector: "lastSection",
  28734. protocol: 'accessing',
  28735. fn: function (){
  28736. var self=this;
  28737. var $1;
  28738. $1=self["@lastSection"];
  28739. return $1;
  28740. },
  28741. args: [],
  28742. source: "lastSection\x0a\x09^ lastSection",
  28743. referencedClasses: [],
  28744. messageSends: []
  28745. }),
  28746. $globals.Importer);
  28747. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  28748. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  28749. $core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport');
  28750. $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.";
  28751. $core.addMethod(
  28752. $core.method({
  28753. selector: "ajaxPutAt:data:onSuccess:onError:",
  28754. protocol: 'private',
  28755. fn: function (aURL,aString,aBlock,anotherBlock){
  28756. var self=this;
  28757. var xhr;
  28758. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  28759. return $core.withContext(function($ctx1) {
  28760. var $1,$4,$3,$2;
  28761. xhr=$recv($Platform())._newXhr();
  28762. $recv(xhr)._open_url_async_("PUT",aURL,true);
  28763. $recv(xhr)._onreadystatechange_((function(){
  28764. return $core.withContext(function($ctx2) {
  28765. $1=$recv($recv(xhr)._readyState()).__eq((4));
  28766. if($core.assert($1)){
  28767. $4=$recv(xhr)._status();
  28768. $ctx2.sendIdx["status"]=1;
  28769. $3=$recv($4).__gt_eq((200));
  28770. $2=$recv($3)._and_((function(){
  28771. return $core.withContext(function($ctx3) {
  28772. return $recv($recv(xhr)._status()).__lt((300));
  28773. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28774. }));
  28775. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  28776. };
  28777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28778. }));
  28779. $recv(xhr)._send_(aString);
  28780. return self;
  28781. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  28782. },
  28783. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  28784. 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",
  28785. referencedClasses: ["Platform"],
  28786. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  28787. }),
  28788. $globals.PackageHandler);
  28789. $core.addMethod(
  28790. $core.method({
  28791. selector: "chunkContentsFor:",
  28792. protocol: 'accessing',
  28793. fn: function (aPackage){
  28794. var self=this;
  28795. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28796. return $core.withContext(function($ctx1) {
  28797. var $1;
  28798. $1=$recv($String())._streamContents_((function(str){
  28799. return $core.withContext(function($ctx2) {
  28800. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  28801. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28802. }));
  28803. return $1;
  28804. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28805. },
  28806. args: ["aPackage"],
  28807. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  28808. referencedClasses: ["String"],
  28809. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  28810. }),
  28811. $globals.PackageHandler);
  28812. $core.addMethod(
  28813. $core.method({
  28814. selector: "chunkExporter",
  28815. protocol: 'factory',
  28816. fn: function (){
  28817. var self=this;
  28818. return $core.withContext(function($ctx1) {
  28819. var $1;
  28820. $1=$recv(self._chunkExporterClass())._new();
  28821. return $1;
  28822. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  28823. },
  28824. args: [],
  28825. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  28826. referencedClasses: [],
  28827. messageSends: ["new", "chunkExporterClass"]
  28828. }),
  28829. $globals.PackageHandler);
  28830. $core.addMethod(
  28831. $core.method({
  28832. selector: "chunkExporterClass",
  28833. protocol: 'accessing',
  28834. fn: function (){
  28835. var self=this;
  28836. function $ChunkExporter(){return $globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  28837. return $ChunkExporter();
  28838. },
  28839. args: [],
  28840. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  28841. referencedClasses: ["ChunkExporter"],
  28842. messageSends: []
  28843. }),
  28844. $globals.PackageHandler);
  28845. $core.addMethod(
  28846. $core.method({
  28847. selector: "commit:",
  28848. protocol: 'committing',
  28849. fn: function (aPackage){
  28850. var self=this;
  28851. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  28852. return $core.withContext(function($ctx1) {
  28853. var $1,$2,$3,$4;
  28854. self._commit_onSuccess_onError_(aPackage,(function(){
  28855. }),(function(error){
  28856. return $core.withContext(function($ctx2) {
  28857. $1=$recv($PackageCommitError())._new();
  28858. $2=$1;
  28859. $3=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  28860. $ctx2.sendIdx[","]=1;
  28861. $recv($2)._messageText_($3);
  28862. $4=$recv($1)._signal();
  28863. return $4;
  28864. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  28865. }));
  28866. return self;
  28867. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  28868. },
  28869. args: ["aPackage"],
  28870. 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 ]",
  28871. referencedClasses: ["PackageCommitError"],
  28872. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  28873. }),
  28874. $globals.PackageHandler);
  28875. $core.addMethod(
  28876. $core.method({
  28877. selector: "commit:onSuccess:onError:",
  28878. protocol: 'committing',
  28879. fn: function (aPackage,aBlock,anotherBlock){
  28880. var self=this;
  28881. return $core.withContext(function($ctx1) {
  28882. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  28883. return $core.withContext(function($ctx2) {
  28884. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  28885. return $core.withContext(function($ctx3) {
  28886. $recv(aPackage)._beClean();
  28887. return $recv(aBlock)._value();
  28888. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28889. }),anotherBlock);
  28890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28891. }),anotherBlock);
  28892. return self;
  28893. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28894. },
  28895. args: ["aPackage", "aBlock", "anotherBlock"],
  28896. 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",
  28897. referencedClasses: [],
  28898. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  28899. }),
  28900. $globals.PackageHandler);
  28901. $core.addMethod(
  28902. $core.method({
  28903. selector: "commitJsFileFor:onSuccess:onError:",
  28904. protocol: 'committing',
  28905. fn: function (aPackage,aBlock,anotherBlock){
  28906. var self=this;
  28907. return $core.withContext(function($ctx1) {
  28908. var $2,$1;
  28909. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28910. $ctx1.sendIdx[","]=2;
  28911. $1=$recv($2).__comma(".js");
  28912. $ctx1.sendIdx[","]=1;
  28913. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  28914. return self;
  28915. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28916. },
  28917. args: ["aPackage", "aBlock", "anotherBlock"],
  28918. 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",
  28919. referencedClasses: [],
  28920. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  28921. }),
  28922. $globals.PackageHandler);
  28923. $core.addMethod(
  28924. $core.method({
  28925. selector: "commitPathJsFor:",
  28926. protocol: 'accessing',
  28927. fn: function (aPackage){
  28928. var self=this;
  28929. return $core.withContext(function($ctx1) {
  28930. self._subclassResponsibility();
  28931. return self;
  28932. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28933. },
  28934. args: ["aPackage"],
  28935. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  28936. referencedClasses: [],
  28937. messageSends: ["subclassResponsibility"]
  28938. }),
  28939. $globals.PackageHandler);
  28940. $core.addMethod(
  28941. $core.method({
  28942. selector: "commitPathStFor:",
  28943. protocol: 'accessing',
  28944. fn: function (aPackage){
  28945. var self=this;
  28946. return $core.withContext(function($ctx1) {
  28947. self._subclassResponsibility();
  28948. return self;
  28949. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28950. },
  28951. args: ["aPackage"],
  28952. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  28953. referencedClasses: [],
  28954. messageSends: ["subclassResponsibility"]
  28955. }),
  28956. $globals.PackageHandler);
  28957. $core.addMethod(
  28958. $core.method({
  28959. selector: "commitStFileFor:onSuccess:onError:",
  28960. protocol: 'committing',
  28961. fn: function (aPackage,aBlock,anotherBlock){
  28962. var self=this;
  28963. return $core.withContext(function($ctx1) {
  28964. var $2,$1;
  28965. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28966. $ctx1.sendIdx[","]=2;
  28967. $1=$recv($2).__comma(".st");
  28968. $ctx1.sendIdx[","]=1;
  28969. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  28970. return self;
  28971. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28972. },
  28973. args: ["aPackage", "aBlock", "anotherBlock"],
  28974. 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",
  28975. referencedClasses: [],
  28976. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  28977. }),
  28978. $globals.PackageHandler);
  28979. $core.addMethod(
  28980. $core.method({
  28981. selector: "contentsFor:",
  28982. protocol: 'accessing',
  28983. fn: function (aPackage){
  28984. var self=this;
  28985. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28986. return $core.withContext(function($ctx1) {
  28987. var $1;
  28988. $1=$recv($String())._streamContents_((function(str){
  28989. return $core.withContext(function($ctx2) {
  28990. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  28991. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28992. }));
  28993. return $1;
  28994. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28995. },
  28996. args: ["aPackage"],
  28997. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  28998. referencedClasses: ["String"],
  28999. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  29000. }),
  29001. $globals.PackageHandler);
  29002. $core.addMethod(
  29003. $core.method({
  29004. selector: "exporter",
  29005. protocol: 'factory',
  29006. fn: function (){
  29007. var self=this;
  29008. return $core.withContext(function($ctx1) {
  29009. var $1;
  29010. $1=$recv(self._exporterClass())._new();
  29011. return $1;
  29012. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  29013. },
  29014. args: [],
  29015. source: "exporter\x0a\x09^ self exporterClass new",
  29016. referencedClasses: [],
  29017. messageSends: ["new", "exporterClass"]
  29018. }),
  29019. $globals.PackageHandler);
  29020. $core.addMethod(
  29021. $core.method({
  29022. selector: "exporterClass",
  29023. protocol: 'accessing',
  29024. fn: function (){
  29025. var self=this;
  29026. return $core.withContext(function($ctx1) {
  29027. self._subclassResponsibility();
  29028. return self;
  29029. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  29030. },
  29031. args: [],
  29032. source: "exporterClass\x0a\x09self subclassResponsibility",
  29033. referencedClasses: [],
  29034. messageSends: ["subclassResponsibility"]
  29035. }),
  29036. $globals.PackageHandler);
  29037. $core.addMethod(
  29038. $core.method({
  29039. selector: "load:",
  29040. protocol: 'loading',
  29041. fn: function (aPackage){
  29042. var self=this;
  29043. return $core.withContext(function($ctx1) {
  29044. self._subclassResponsibility();
  29045. return self;
  29046. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  29047. },
  29048. args: ["aPackage"],
  29049. source: "load: aPackage\x0a\x09self subclassResponsibility",
  29050. referencedClasses: [],
  29051. messageSends: ["subclassResponsibility"]
  29052. }),
  29053. $globals.PackageHandler);
  29054. $core.addMethod(
  29055. $core.method({
  29056. selector: "onCommitError:",
  29057. protocol: 'error handling',
  29058. fn: function (anError){
  29059. var self=this;
  29060. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  29061. return $core.withContext(function($ctx1) {
  29062. var $1,$2,$3,$4;
  29063. $1=$recv($PackageCommitError())._new();
  29064. $2=$1;
  29065. $3=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  29066. $ctx1.sendIdx[","]=1;
  29067. $recv($2)._messageText_($3);
  29068. $4=$recv($1)._signal();
  29069. return self;
  29070. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  29071. },
  29072. args: ["anError"],
  29073. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  29074. referencedClasses: ["PackageCommitError"],
  29075. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  29076. }),
  29077. $globals.PackageHandler);
  29078. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  29079. $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.";
  29080. $core.addMethod(
  29081. $core.method({
  29082. selector: "commitPathJsFor:",
  29083. protocol: 'accessing',
  29084. fn: function (aPackage){
  29085. var self=this;
  29086. return $core.withContext(function($ctx1) {
  29087. var $1;
  29088. $1=self._toUrl_(self._namespaceFor_(aPackage));
  29089. return $1;
  29090. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29091. },
  29092. args: ["aPackage"],
  29093. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  29094. referencedClasses: [],
  29095. messageSends: ["toUrl:", "namespaceFor:"]
  29096. }),
  29097. $globals.AmdPackageHandler);
  29098. $core.addMethod(
  29099. $core.method({
  29100. selector: "commitPathStFor:",
  29101. protocol: 'accessing',
  29102. fn: function (aPackage){
  29103. var self=this;
  29104. var path,pathWithout;
  29105. return $core.withContext(function($ctx1) {
  29106. var $1,$3,$2;
  29107. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  29108. $ctx1.sendIdx[","]=1;
  29109. path=self._toUrl_($1);
  29110. pathWithout=self._commitPathJsFor_(aPackage);
  29111. $3=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  29112. if($core.assert($3)){
  29113. $2=pathWithout;
  29114. } else {
  29115. $2=path;
  29116. };
  29117. return $2;
  29118. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  29119. },
  29120. args: ["aPackage"],
  29121. 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 ]",
  29122. referencedClasses: [],
  29123. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  29124. }),
  29125. $globals.AmdPackageHandler);
  29126. $core.addMethod(
  29127. $core.method({
  29128. selector: "exporterClass",
  29129. protocol: 'accessing',
  29130. fn: function (){
  29131. var self=this;
  29132. function $AmdExporter(){return $globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  29133. return $AmdExporter();
  29134. },
  29135. args: [],
  29136. source: "exporterClass\x0a\x09^ AmdExporter",
  29137. referencedClasses: ["AmdExporter"],
  29138. messageSends: []
  29139. }),
  29140. $globals.AmdPackageHandler);
  29141. $core.addMethod(
  29142. $core.method({
  29143. selector: "load:",
  29144. protocol: 'loading',
  29145. fn: function (aPackage){
  29146. var self=this;
  29147. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29148. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  29149. return $core.withContext(function($ctx1) {
  29150. var $1,$3,$2,$receiver;
  29151. $1=$recv($Smalltalk())._amdRequire();
  29152. if(($receiver = $1) == null || $receiver.isNil){
  29153. self._error_("AMD loader not present");
  29154. } else {
  29155. var require;
  29156. require=$receiver;
  29157. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29158. $ctx1.sendIdx[","]=1;
  29159. $2=$recv($Array())._with_($3);
  29160. $recv(require)._value_($2);
  29161. };
  29162. return self;
  29163. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29164. },
  29165. args: ["aPackage"],
  29166. 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 ) ]",
  29167. referencedClasses: ["Smalltalk", "Array"],
  29168. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  29169. }),
  29170. $globals.AmdPackageHandler);
  29171. $core.addMethod(
  29172. $core.method({
  29173. selector: "namespaceFor:",
  29174. protocol: 'committing',
  29175. fn: function (aPackage){
  29176. var self=this;
  29177. return $core.withContext(function($ctx1) {
  29178. var $1;
  29179. $1=$recv($recv(aPackage)._transport())._namespace();
  29180. return $1;
  29181. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29182. },
  29183. args: ["aPackage"],
  29184. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  29185. referencedClasses: [],
  29186. messageSends: ["namespace", "transport"]
  29187. }),
  29188. $globals.AmdPackageHandler);
  29189. $core.addMethod(
  29190. $core.method({
  29191. selector: "toUrl:",
  29192. protocol: 'private',
  29193. fn: function (aString){
  29194. var self=this;
  29195. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29196. return $core.withContext(function($ctx1) {
  29197. var $2,$1,$receiver;
  29198. $2=$recv($Smalltalk())._amdRequire();
  29199. if(($receiver = $2) == null || $receiver.isNil){
  29200. $1=self._error_("AMD loader not present");
  29201. } else {
  29202. var require;
  29203. require=$receiver;
  29204. $1=$recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  29205. };
  29206. return $1;
  29207. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  29208. },
  29209. args: ["aString"],
  29210. 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 ]",
  29211. referencedClasses: ["Smalltalk"],
  29212. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  29213. }),
  29214. $globals.AmdPackageHandler);
  29215. $core.addMethod(
  29216. $core.method({
  29217. selector: "defaultNamespace",
  29218. protocol: 'commit paths',
  29219. fn: function (){
  29220. var self=this;
  29221. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29222. return $core.withContext(function($ctx1) {
  29223. var $1;
  29224. $1=$recv($Smalltalk())._defaultAmdNamespace();
  29225. return $1;
  29226. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  29227. },
  29228. args: [],
  29229. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29230. referencedClasses: ["Smalltalk"],
  29231. messageSends: ["defaultAmdNamespace"]
  29232. }),
  29233. $globals.AmdPackageHandler.klass);
  29234. $core.addMethod(
  29235. $core.method({
  29236. selector: "defaultNamespace:",
  29237. protocol: 'commit paths',
  29238. fn: function (aString){
  29239. var self=this;
  29240. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29241. return $core.withContext(function($ctx1) {
  29242. $recv($Smalltalk())._defaultAmdNamespace_(aString);
  29243. return self;
  29244. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  29245. },
  29246. args: ["aString"],
  29247. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  29248. referencedClasses: ["Smalltalk"],
  29249. messageSends: ["defaultAmdNamespace:"]
  29250. }),
  29251. $globals.AmdPackageHandler.klass);
  29252. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  29253. $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.";
  29254. $core.addMethod(
  29255. $core.method({
  29256. selector: "asJSON",
  29257. protocol: 'converting',
  29258. fn: function (){
  29259. var self=this;
  29260. return $core.withContext(function($ctx1) {
  29261. var $1;
  29262. $1=$globals.HashedCollection._newFromPairs_(["type",self._type()]);
  29263. return $1;
  29264. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  29265. },
  29266. args: [],
  29267. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  29268. referencedClasses: [],
  29269. messageSends: ["type"]
  29270. }),
  29271. $globals.PackageTransport);
  29272. $core.addMethod(
  29273. $core.method({
  29274. selector: "commit",
  29275. protocol: 'committing',
  29276. fn: function (){
  29277. var self=this;
  29278. return $core.withContext(function($ctx1) {
  29279. $recv(self._commitHandler())._commit_(self._package());
  29280. return self;
  29281. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  29282. },
  29283. args: [],
  29284. source: "commit\x0a\x09self commitHandler commit: self package",
  29285. referencedClasses: [],
  29286. messageSends: ["commit:", "commitHandler", "package"]
  29287. }),
  29288. $globals.PackageTransport);
  29289. $core.addMethod(
  29290. $core.method({
  29291. selector: "commitHandler",
  29292. protocol: 'factory',
  29293. fn: function (){
  29294. var self=this;
  29295. return $core.withContext(function($ctx1) {
  29296. var $1;
  29297. $1=$recv(self._commitHandlerClass())._new();
  29298. return $1;
  29299. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  29300. },
  29301. args: [],
  29302. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  29303. referencedClasses: [],
  29304. messageSends: ["new", "commitHandlerClass"]
  29305. }),
  29306. $globals.PackageTransport);
  29307. $core.addMethod(
  29308. $core.method({
  29309. selector: "commitHandlerClass",
  29310. protocol: 'accessing',
  29311. fn: function (){
  29312. var self=this;
  29313. return $core.withContext(function($ctx1) {
  29314. self._subclassResponsibility();
  29315. return self;
  29316. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  29317. },
  29318. args: [],
  29319. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  29320. referencedClasses: [],
  29321. messageSends: ["subclassResponsibility"]
  29322. }),
  29323. $globals.PackageTransport);
  29324. $core.addMethod(
  29325. $core.method({
  29326. selector: "commitOnSuccess:onError:",
  29327. protocol: 'committing',
  29328. fn: function (aBlock,anotherBlock){
  29329. var self=this;
  29330. return $core.withContext(function($ctx1) {
  29331. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  29332. return self;
  29333. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  29334. },
  29335. args: ["aBlock", "anotherBlock"],
  29336. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  29337. referencedClasses: [],
  29338. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  29339. }),
  29340. $globals.PackageTransport);
  29341. $core.addMethod(
  29342. $core.method({
  29343. selector: "definition",
  29344. protocol: 'accessing',
  29345. fn: function (){
  29346. var self=this;
  29347. return "";
  29348. },
  29349. args: [],
  29350. source: "definition\x0a\x09^ ''",
  29351. referencedClasses: [],
  29352. messageSends: []
  29353. }),
  29354. $globals.PackageTransport);
  29355. $core.addMethod(
  29356. $core.method({
  29357. selector: "load",
  29358. protocol: 'loading',
  29359. fn: function (){
  29360. var self=this;
  29361. return $core.withContext(function($ctx1) {
  29362. $recv(self._commitHandler())._load_(self._package());
  29363. return self;
  29364. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  29365. },
  29366. args: [],
  29367. source: "load\x0a\x09self commitHandler load: self package",
  29368. referencedClasses: [],
  29369. messageSends: ["load:", "commitHandler", "package"]
  29370. }),
  29371. $globals.PackageTransport);
  29372. $core.addMethod(
  29373. $core.method({
  29374. selector: "package",
  29375. protocol: 'accessing',
  29376. fn: function (){
  29377. var self=this;
  29378. var $1;
  29379. $1=self["@package"];
  29380. return $1;
  29381. },
  29382. args: [],
  29383. source: "package\x0a\x09^ package",
  29384. referencedClasses: [],
  29385. messageSends: []
  29386. }),
  29387. $globals.PackageTransport);
  29388. $core.addMethod(
  29389. $core.method({
  29390. selector: "package:",
  29391. protocol: 'accessing',
  29392. fn: function (aPackage){
  29393. var self=this;
  29394. self["@package"]=aPackage;
  29395. return self;
  29396. },
  29397. args: ["aPackage"],
  29398. source: "package: aPackage\x0a\x09package := aPackage",
  29399. referencedClasses: [],
  29400. messageSends: []
  29401. }),
  29402. $globals.PackageTransport);
  29403. $core.addMethod(
  29404. $core.method({
  29405. selector: "setupFromJson:",
  29406. protocol: 'initialization',
  29407. fn: function (anObject){
  29408. var self=this;
  29409. return self;
  29410. },
  29411. args: ["anObject"],
  29412. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  29413. referencedClasses: [],
  29414. messageSends: []
  29415. }),
  29416. $globals.PackageTransport);
  29417. $core.addMethod(
  29418. $core.method({
  29419. selector: "type",
  29420. protocol: 'accessing',
  29421. fn: function (){
  29422. var self=this;
  29423. return $core.withContext(function($ctx1) {
  29424. var $1;
  29425. $1=$recv(self._class())._type();
  29426. return $1;
  29427. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  29428. },
  29429. args: [],
  29430. source: "type\x0a\x09^ self class type",
  29431. referencedClasses: [],
  29432. messageSends: ["type", "class"]
  29433. }),
  29434. $globals.PackageTransport);
  29435. $globals.PackageTransport.klass.iVarNames = ['registry'];
  29436. $core.addMethod(
  29437. $core.method({
  29438. selector: "classRegisteredFor:",
  29439. protocol: 'accessing',
  29440. fn: function (aString){
  29441. var self=this;
  29442. return $core.withContext(function($ctx1) {
  29443. var $1;
  29444. $1=$recv(self["@registry"])._at_(aString);
  29445. return $1;
  29446. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  29447. },
  29448. args: ["aString"],
  29449. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  29450. referencedClasses: [],
  29451. messageSends: ["at:"]
  29452. }),
  29453. $globals.PackageTransport.klass);
  29454. $core.addMethod(
  29455. $core.method({
  29456. selector: "defaultType",
  29457. protocol: 'accessing',
  29458. fn: function (){
  29459. var self=this;
  29460. function $AmdPackageTransport(){return $globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  29461. return $core.withContext(function($ctx1) {
  29462. var $1;
  29463. $1=$recv($AmdPackageTransport())._type();
  29464. return $1;
  29465. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  29466. },
  29467. args: [],
  29468. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  29469. referencedClasses: ["AmdPackageTransport"],
  29470. messageSends: ["type"]
  29471. }),
  29472. $globals.PackageTransport.klass);
  29473. $core.addMethod(
  29474. $core.method({
  29475. selector: "for:",
  29476. protocol: 'instance creation',
  29477. fn: function (aString){
  29478. var self=this;
  29479. return $core.withContext(function($ctx1) {
  29480. var $1;
  29481. $1=$recv(self._classRegisteredFor_(aString))._new();
  29482. return $1;
  29483. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  29484. },
  29485. args: ["aString"],
  29486. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  29487. referencedClasses: [],
  29488. messageSends: ["new", "classRegisteredFor:"]
  29489. }),
  29490. $globals.PackageTransport.klass);
  29491. $core.addMethod(
  29492. $core.method({
  29493. selector: "fromJson:",
  29494. protocol: 'instance creation',
  29495. fn: function (anObject){
  29496. var self=this;
  29497. return $core.withContext(function($ctx1) {
  29498. var $1,$3,$4,$2,$receiver;
  29499. if(($receiver = anObject) == null || $receiver.isNil){
  29500. $1=self._for_(self._defaultType());
  29501. $ctx1.sendIdx["for:"]=1;
  29502. return $1;
  29503. } else {
  29504. anObject;
  29505. };
  29506. $3=self._for_($recv(anObject)._type());
  29507. $recv($3)._setupFromJson_(anObject);
  29508. $4=$recv($3)._yourself();
  29509. $2=$4;
  29510. return $2;
  29511. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  29512. },
  29513. args: ["anObject"],
  29514. 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",
  29515. referencedClasses: [],
  29516. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  29517. }),
  29518. $globals.PackageTransport.klass);
  29519. $core.addMethod(
  29520. $core.method({
  29521. selector: "initialize",
  29522. protocol: 'initialization',
  29523. fn: function (){
  29524. var self=this;
  29525. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  29526. return $core.withContext(function($ctx1) {
  29527. var $1;
  29528. (
  29529. $ctx1.supercall = true,
  29530. $globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply($recv(self), []));
  29531. $ctx1.supercall = false;
  29532. $1=self.__eq_eq($PackageTransport());
  29533. if($core.assert($1)){
  29534. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  29535. self["@registry"];
  29536. } else {
  29537. self._register();
  29538. };
  29539. return self;
  29540. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  29541. },
  29542. args: [],
  29543. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  29544. referencedClasses: ["PackageTransport"],
  29545. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  29546. }),
  29547. $globals.PackageTransport.klass);
  29548. $core.addMethod(
  29549. $core.method({
  29550. selector: "register",
  29551. protocol: 'registration',
  29552. fn: function (){
  29553. var self=this;
  29554. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  29555. return $core.withContext(function($ctx1) {
  29556. $recv($PackageTransport())._register_(self);
  29557. return self;
  29558. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  29559. },
  29560. args: [],
  29561. source: "register\x0a\x09PackageTransport register: self",
  29562. referencedClasses: ["PackageTransport"],
  29563. messageSends: ["register:"]
  29564. }),
  29565. $globals.PackageTransport.klass);
  29566. $core.addMethod(
  29567. $core.method({
  29568. selector: "register:",
  29569. protocol: 'registration',
  29570. fn: function (aClass){
  29571. var self=this;
  29572. return $core.withContext(function($ctx1) {
  29573. var $1,$receiver;
  29574. $1=$recv(aClass)._type();
  29575. $ctx1.sendIdx["type"]=1;
  29576. if(($receiver = $1) == null || $receiver.isNil){
  29577. $1;
  29578. } else {
  29579. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  29580. };
  29581. return self;
  29582. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  29583. },
  29584. args: ["aClass"],
  29585. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  29586. referencedClasses: [],
  29587. messageSends: ["ifNotNil:", "type", "at:put:"]
  29588. }),
  29589. $globals.PackageTransport.klass);
  29590. $core.addMethod(
  29591. $core.method({
  29592. selector: "type",
  29593. protocol: 'accessing',
  29594. fn: function (){
  29595. var self=this;
  29596. return nil;
  29597. },
  29598. args: [],
  29599. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  29600. referencedClasses: [],
  29601. messageSends: []
  29602. }),
  29603. $globals.PackageTransport.klass);
  29604. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  29605. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  29606. $core.addMethod(
  29607. $core.method({
  29608. selector: "asJSON",
  29609. protocol: 'converting',
  29610. fn: function (){
  29611. var self=this;
  29612. return $core.withContext(function($ctx1) {
  29613. var $2,$3,$1;
  29614. $2=(
  29615. $ctx1.supercall = true,
  29616. $globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply($recv(self), []));
  29617. $ctx1.supercall = false;
  29618. $recv($2)._at_put_("amdNamespace",self._namespace());
  29619. $3=$recv($2)._yourself();
  29620. $1=$3;
  29621. return $1;
  29622. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  29623. },
  29624. args: [],
  29625. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  29626. referencedClasses: [],
  29627. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  29628. }),
  29629. $globals.AmdPackageTransport);
  29630. $core.addMethod(
  29631. $core.method({
  29632. selector: "commitHandlerClass",
  29633. protocol: 'accessing',
  29634. fn: function (){
  29635. var self=this;
  29636. function $AmdPackageHandler(){return $globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  29637. return $AmdPackageHandler();
  29638. },
  29639. args: [],
  29640. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  29641. referencedClasses: ["AmdPackageHandler"],
  29642. messageSends: []
  29643. }),
  29644. $globals.AmdPackageTransport);
  29645. $core.addMethod(
  29646. $core.method({
  29647. selector: "defaultNamespace",
  29648. protocol: 'defaults',
  29649. fn: function (){
  29650. var self=this;
  29651. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29652. return $core.withContext(function($ctx1) {
  29653. var $1;
  29654. $1=$recv($Smalltalk())._defaultAmdNamespace();
  29655. return $1;
  29656. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  29657. },
  29658. args: [],
  29659. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29660. referencedClasses: ["Smalltalk"],
  29661. messageSends: ["defaultAmdNamespace"]
  29662. }),
  29663. $globals.AmdPackageTransport);
  29664. $core.addMethod(
  29665. $core.method({
  29666. selector: "definition",
  29667. protocol: 'accessing',
  29668. fn: function (){
  29669. var self=this;
  29670. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  29671. return $core.withContext(function($ctx1) {
  29672. var $3,$2,$1;
  29673. $1=$recv($String())._streamContents_((function(stream){
  29674. return $core.withContext(function($ctx2) {
  29675. $recv(stream)._nextPutAll_($recv(self._class())._name());
  29676. $ctx2.sendIdx["nextPutAll:"]=1;
  29677. $recv(stream)._nextPutAll_(" namespace: ");
  29678. $ctx2.sendIdx["nextPutAll:"]=2;
  29679. $3=$recv("'".__comma(self._namespace())).__comma("'");
  29680. $ctx2.sendIdx[","]=1;
  29681. $2=$recv(stream)._nextPutAll_($3);
  29682. return $2;
  29683. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  29684. }));
  29685. return $1;
  29686. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  29687. },
  29688. args: [],
  29689. 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, '''' ]",
  29690. referencedClasses: ["String"],
  29691. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  29692. }),
  29693. $globals.AmdPackageTransport);
  29694. $core.addMethod(
  29695. $core.method({
  29696. selector: "namespace",
  29697. protocol: 'accessing',
  29698. fn: function (){
  29699. var self=this;
  29700. return $core.withContext(function($ctx1) {
  29701. var $2,$1,$receiver;
  29702. $2=self["@namespace"];
  29703. if(($receiver = $2) == null || $receiver.isNil){
  29704. $1=self._defaultNamespace();
  29705. } else {
  29706. $1=$2;
  29707. };
  29708. return $1;
  29709. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  29710. },
  29711. args: [],
  29712. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  29713. referencedClasses: [],
  29714. messageSends: ["ifNil:", "defaultNamespace"]
  29715. }),
  29716. $globals.AmdPackageTransport);
  29717. $core.addMethod(
  29718. $core.method({
  29719. selector: "namespace:",
  29720. protocol: 'accessing',
  29721. fn: function (aString){
  29722. var self=this;
  29723. self["@namespace"]=aString;
  29724. return self;
  29725. },
  29726. args: ["aString"],
  29727. source: "namespace: aString\x0a\x09namespace := aString",
  29728. referencedClasses: [],
  29729. messageSends: []
  29730. }),
  29731. $globals.AmdPackageTransport);
  29732. $core.addMethod(
  29733. $core.method({
  29734. selector: "printOn:",
  29735. protocol: 'printing',
  29736. fn: function (aStream){
  29737. var self=this;
  29738. return $core.withContext(function($ctx1) {
  29739. var $1;
  29740. (
  29741. $ctx1.supercall = true,
  29742. $globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  29743. $ctx1.supercall = false;
  29744. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  29745. $ctx1.sendIdx["nextPutAll:"]=1;
  29746. $recv(aStream)._nextPutAll_(self._namespace());
  29747. $ctx1.sendIdx["nextPutAll:"]=2;
  29748. $1=$recv(aStream)._nextPutAll_(")");
  29749. return self;
  29750. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  29751. },
  29752. args: ["aStream"],
  29753. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  29754. referencedClasses: [],
  29755. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  29756. }),
  29757. $globals.AmdPackageTransport);
  29758. $core.addMethod(
  29759. $core.method({
  29760. selector: "setPath:",
  29761. protocol: 'actions',
  29762. fn: function (aString){
  29763. var self=this;
  29764. return $core.withContext(function($ctx1) {
  29765. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  29766. return self;
  29767. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  29768. },
  29769. args: ["aString"],
  29770. 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}.",
  29771. referencedClasses: [],
  29772. messageSends: ["value:", "basicAt:", "namespace"]
  29773. }),
  29774. $globals.AmdPackageTransport);
  29775. $core.addMethod(
  29776. $core.method({
  29777. selector: "setupFromJson:",
  29778. protocol: 'initialization',
  29779. fn: function (anObject){
  29780. var self=this;
  29781. return $core.withContext(function($ctx1) {
  29782. self._namespace_($recv(anObject)._at_("amdNamespace"));
  29783. return self;
  29784. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  29785. },
  29786. args: ["anObject"],
  29787. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  29788. referencedClasses: [],
  29789. messageSends: ["namespace:", "at:"]
  29790. }),
  29791. $globals.AmdPackageTransport);
  29792. $core.addMethod(
  29793. $core.method({
  29794. selector: "namespace:",
  29795. protocol: 'instance creation',
  29796. fn: function (aString){
  29797. var self=this;
  29798. return $core.withContext(function($ctx1) {
  29799. var $2,$3,$1;
  29800. $2=self._new();
  29801. $recv($2)._namespace_(aString);
  29802. $3=$recv($2)._yourself();
  29803. $1=$3;
  29804. return $1;
  29805. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  29806. },
  29807. args: ["aString"],
  29808. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  29809. referencedClasses: [],
  29810. messageSends: ["namespace:", "new", "yourself"]
  29811. }),
  29812. $globals.AmdPackageTransport.klass);
  29813. $core.addMethod(
  29814. $core.method({
  29815. selector: "type",
  29816. protocol: 'accessing',
  29817. fn: function (){
  29818. var self=this;
  29819. return "amd";
  29820. },
  29821. args: [],
  29822. source: "type\x0a\x09^ 'amd'",
  29823. referencedClasses: [],
  29824. messageSends: []
  29825. }),
  29826. $globals.AmdPackageTransport.klass);
  29827. $core.addMethod(
  29828. $core.method({
  29829. selector: "commentStamp",
  29830. protocol: '*Platform-ImportExport',
  29831. fn: function (){
  29832. var self=this;
  29833. function $ClassCommentReader(){return $globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  29834. return $core.withContext(function($ctx1) {
  29835. var $2,$3,$1;
  29836. $2=$recv($ClassCommentReader())._new();
  29837. $recv($2)._class_(self);
  29838. $3=$recv($2)._yourself();
  29839. $1=$3;
  29840. return $1;
  29841. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  29842. },
  29843. args: [],
  29844. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  29845. referencedClasses: ["ClassCommentReader"],
  29846. messageSends: ["class:", "new", "yourself"]
  29847. }),
  29848. $globals.Behavior);
  29849. $core.addMethod(
  29850. $core.method({
  29851. selector: "commentStamp:prior:",
  29852. protocol: '*Platform-ImportExport',
  29853. fn: function (aStamp,prior){
  29854. var self=this;
  29855. return $core.withContext(function($ctx1) {
  29856. var $1;
  29857. $1=self._commentStamp();
  29858. return $1;
  29859. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  29860. },
  29861. args: ["aStamp", "prior"],
  29862. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  29863. referencedClasses: [],
  29864. messageSends: ["commentStamp"]
  29865. }),
  29866. $globals.Behavior);
  29867. $core.addMethod(
  29868. $core.method({
  29869. selector: "methodsFor:",
  29870. protocol: '*Platform-ImportExport',
  29871. fn: function (aString){
  29872. var self=this;
  29873. function $ClassProtocolReader(){return $globals.ClassProtocolReader||(typeof ClassProtocolReader=="undefined"?nil:ClassProtocolReader)}
  29874. return $core.withContext(function($ctx1) {
  29875. var $2,$3,$1;
  29876. $2=$recv($ClassProtocolReader())._new();
  29877. $recv($2)._class_category_(self,aString);
  29878. $3=$recv($2)._yourself();
  29879. $1=$3;
  29880. return $1;
  29881. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  29882. },
  29883. args: ["aString"],
  29884. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  29885. referencedClasses: ["ClassProtocolReader"],
  29886. messageSends: ["class:category:", "new", "yourself"]
  29887. }),
  29888. $globals.Behavior);
  29889. $core.addMethod(
  29890. $core.method({
  29891. selector: "methodsFor:stamp:",
  29892. protocol: '*Platform-ImportExport',
  29893. fn: function (aString,aStamp){
  29894. var self=this;
  29895. return $core.withContext(function($ctx1) {
  29896. var $1;
  29897. $1=self._methodsFor_(aString);
  29898. return $1;
  29899. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  29900. },
  29901. args: ["aString", "aStamp"],
  29902. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  29903. referencedClasses: [],
  29904. messageSends: ["methodsFor:"]
  29905. }),
  29906. $globals.Behavior);
  29907. $core.addMethod(
  29908. $core.method({
  29909. selector: "commit",
  29910. protocol: '*Platform-ImportExport',
  29911. fn: function (){
  29912. var self=this;
  29913. return $core.withContext(function($ctx1) {
  29914. var $1;
  29915. $1=$recv(self._transport())._commit();
  29916. return $1;
  29917. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  29918. },
  29919. args: [],
  29920. source: "commit\x0a\x09^ self transport commit",
  29921. referencedClasses: [],
  29922. messageSends: ["commit", "transport"]
  29923. }),
  29924. $globals.Package);
  29925. $core.addMethod(
  29926. $core.method({
  29927. selector: "load",
  29928. protocol: '*Platform-ImportExport',
  29929. fn: function (){
  29930. var self=this;
  29931. return $core.withContext(function($ctx1) {
  29932. var $1;
  29933. $1=$recv(self._transport())._load();
  29934. return $1;
  29935. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  29936. },
  29937. args: [],
  29938. source: "load\x0a\x09^ self transport load",
  29939. referencedClasses: [],
  29940. messageSends: ["load", "transport"]
  29941. }),
  29942. $globals.Package);
  29943. $core.addMethod(
  29944. $core.method({
  29945. selector: "loadFromNamespace:",
  29946. protocol: '*Platform-ImportExport',
  29947. fn: function (aString){
  29948. var self=this;
  29949. return $core.withContext(function($ctx1) {
  29950. var $2,$3,$1;
  29951. $2=self._transport();
  29952. $recv($2)._namespace_(aString);
  29953. $3=$recv($2)._load();
  29954. $1=$3;
  29955. return $1;
  29956. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  29957. },
  29958. args: ["aString"],
  29959. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  29960. referencedClasses: [],
  29961. messageSends: ["namespace:", "transport", "load"]
  29962. }),
  29963. $globals.Package);
  29964. $core.addMethod(
  29965. $core.method({
  29966. selector: "load:",
  29967. protocol: '*Platform-ImportExport',
  29968. fn: function (aPackageName){
  29969. var self=this;
  29970. return $core.withContext(function($ctx1) {
  29971. $recv(self._named_(aPackageName))._load();
  29972. return self;
  29973. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  29974. },
  29975. args: ["aPackageName"],
  29976. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  29977. referencedClasses: [],
  29978. messageSends: ["load", "named:"]
  29979. }),
  29980. $globals.Package.klass);
  29981. $core.addMethod(
  29982. $core.method({
  29983. selector: "load:fromNamespace:",
  29984. protocol: '*Platform-ImportExport',
  29985. fn: function (aPackageName,aString){
  29986. var self=this;
  29987. return $core.withContext(function($ctx1) {
  29988. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  29989. return self;
  29990. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  29991. },
  29992. args: ["aPackageName", "aString"],
  29993. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  29994. referencedClasses: [],
  29995. messageSends: ["loadFromNamespace:", "named:"]
  29996. }),
  29997. $globals.Package.klass);
  29998. });
  29999. define("amber_core/Compiler-Exceptions", ["amber/boot", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  30000. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30001. $core.addPackage('Compiler-Exceptions');
  30002. $core.packages["Compiler-Exceptions"].innerEval = function (expr) { return eval(expr); };
  30003. $core.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30004. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Exceptions');
  30005. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  30006. $core.addClass('ParseError', $globals.CompilerError, [], 'Compiler-Exceptions');
  30007. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  30008. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Exceptions');
  30009. $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";
  30010. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Exceptions');
  30011. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  30012. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30013. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  30014. $core.addMethod(
  30015. $core.method({
  30016. selector: "messageText",
  30017. protocol: 'accessing',
  30018. fn: function (){
  30019. var self=this;
  30020. return $core.withContext(function($ctx1) {
  30021. var $1;
  30022. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  30023. return $1;
  30024. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  30025. },
  30026. args: [],
  30027. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  30028. referencedClasses: [],
  30029. messageSends: [",", "variableName"]
  30030. }),
  30031. $globals.InvalidAssignmentError);
  30032. $core.addMethod(
  30033. $core.method({
  30034. selector: "variableName",
  30035. protocol: 'accessing',
  30036. fn: function (){
  30037. var self=this;
  30038. var $1;
  30039. $1=self["@variableName"];
  30040. return $1;
  30041. },
  30042. args: [],
  30043. source: "variableName\x0a\x09^ variableName",
  30044. referencedClasses: [],
  30045. messageSends: []
  30046. }),
  30047. $globals.InvalidAssignmentError);
  30048. $core.addMethod(
  30049. $core.method({
  30050. selector: "variableName:",
  30051. protocol: 'accessing',
  30052. fn: function (aString){
  30053. var self=this;
  30054. self["@variableName"]=aString;
  30055. return self;
  30056. },
  30057. args: ["aString"],
  30058. source: "variableName: aString\x0a\x09variableName := aString",
  30059. referencedClasses: [],
  30060. messageSends: []
  30061. }),
  30062. $globals.InvalidAssignmentError);
  30063. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30064. $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.";
  30065. $core.addMethod(
  30066. $core.method({
  30067. selector: "messageText",
  30068. protocol: 'accessing',
  30069. fn: function (){
  30070. var self=this;
  30071. return $core.withContext(function($ctx1) {
  30072. var $1;
  30073. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  30074. $ctx1.sendIdx[","]=1;
  30075. return $1;
  30076. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  30077. },
  30078. args: [],
  30079. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  30080. referencedClasses: [],
  30081. messageSends: [",", "variableName"]
  30082. }),
  30083. $globals.ShadowingVariableError);
  30084. $core.addMethod(
  30085. $core.method({
  30086. selector: "variableName",
  30087. protocol: 'accessing',
  30088. fn: function (){
  30089. var self=this;
  30090. var $1;
  30091. $1=self["@variableName"];
  30092. return $1;
  30093. },
  30094. args: [],
  30095. source: "variableName\x0a\x09^ variableName",
  30096. referencedClasses: [],
  30097. messageSends: []
  30098. }),
  30099. $globals.ShadowingVariableError);
  30100. $core.addMethod(
  30101. $core.method({
  30102. selector: "variableName:",
  30103. protocol: 'accessing',
  30104. fn: function (aString){
  30105. var self=this;
  30106. self["@variableName"]=aString;
  30107. return self;
  30108. },
  30109. args: ["aString"],
  30110. source: "variableName: aString\x0a\x09variableName := aString",
  30111. referencedClasses: [],
  30112. messageSends: []
  30113. }),
  30114. $globals.ShadowingVariableError);
  30115. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30116. $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.";
  30117. $core.addMethod(
  30118. $core.method({
  30119. selector: "messageText",
  30120. protocol: 'accessing',
  30121. fn: function (){
  30122. var self=this;
  30123. return $core.withContext(function($ctx1) {
  30124. var $1;
  30125. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  30126. $ctx1.sendIdx[","]=1;
  30127. return $1;
  30128. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  30129. },
  30130. args: [],
  30131. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  30132. referencedClasses: [],
  30133. messageSends: [",", "variableName"]
  30134. }),
  30135. $globals.UnknownVariableError);
  30136. $core.addMethod(
  30137. $core.method({
  30138. selector: "variableName",
  30139. protocol: 'accessing',
  30140. fn: function (){
  30141. var self=this;
  30142. var $1;
  30143. $1=self["@variableName"];
  30144. return $1;
  30145. },
  30146. args: [],
  30147. source: "variableName\x0a\x09^ variableName",
  30148. referencedClasses: [],
  30149. messageSends: []
  30150. }),
  30151. $globals.UnknownVariableError);
  30152. $core.addMethod(
  30153. $core.method({
  30154. selector: "variableName:",
  30155. protocol: 'accessing',
  30156. fn: function (aString){
  30157. var self=this;
  30158. self["@variableName"]=aString;
  30159. return self;
  30160. },
  30161. args: ["aString"],
  30162. source: "variableName: aString\x0a\x09variableName := aString",
  30163. referencedClasses: [],
  30164. messageSends: []
  30165. }),
  30166. $globals.UnknownVariableError);
  30167. $core.addClass('RethrowErrorHandler', $globals.Object, [], 'Compiler-Exceptions');
  30168. $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.";
  30169. $core.addMethod(
  30170. $core.method({
  30171. selector: "basicSignal:",
  30172. protocol: 'error handling',
  30173. fn: function (anError){
  30174. var self=this;
  30175. return $core.withContext(function($ctx1) {
  30176. throw anError;
  30177. return self;
  30178. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
  30179. },
  30180. args: ["anError"],
  30181. source: "basicSignal: anError\x0a <throw anError>",
  30182. referencedClasses: [],
  30183. messageSends: []
  30184. }),
  30185. $globals.RethrowErrorHandler);
  30186. $core.addMethod(
  30187. $core.method({
  30188. selector: "handleError:",
  30189. protocol: 'error handling',
  30190. fn: function (anError){
  30191. var self=this;
  30192. return $core.withContext(function($ctx1) {
  30193. self._basicSignal_(anError);
  30194. return self;
  30195. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
  30196. },
  30197. args: ["anError"],
  30198. source: "handleError: anError\x0a self basicSignal: anError",
  30199. referencedClasses: [],
  30200. messageSends: ["basicSignal:"]
  30201. }),
  30202. $globals.RethrowErrorHandler);
  30203. });
  30204. define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Platform-Services", "amber_core/Kernel-Collections"], function($boot){"use strict";
  30205. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30206. $core.addPackage('Compiler-Core');
  30207. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  30208. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30209. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  30210. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  30211. $core.addMethod(
  30212. $core.method({
  30213. selector: "classNameFor:",
  30214. protocol: 'accessing',
  30215. fn: function (aClass){
  30216. var self=this;
  30217. return $core.withContext(function($ctx1) {
  30218. var $2,$3,$4,$1;
  30219. $2=$recv(aClass)._isMetaclass();
  30220. if($core.assert($2)){
  30221. $3=$recv($recv(aClass)._instanceClass())._name();
  30222. $ctx1.sendIdx["name"]=1;
  30223. $1=$recv($3).__comma(".klass");
  30224. } else {
  30225. $4=$recv(aClass)._isNil();
  30226. if($core.assert($4)){
  30227. $1="nil";
  30228. } else {
  30229. $1=$recv(aClass)._name();
  30230. };
  30231. };
  30232. return $1;
  30233. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractCodeGenerator)});
  30234. },
  30235. args: ["aClass"],
  30236. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09ifFalse: [ aClass name ]]",
  30237. referencedClasses: [],
  30238. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  30239. }),
  30240. $globals.AbstractCodeGenerator);
  30241. $core.addMethod(
  30242. $core.method({
  30243. selector: "compileNode:",
  30244. protocol: 'compiling',
  30245. fn: function (aNode){
  30246. var self=this;
  30247. return $core.withContext(function($ctx1) {
  30248. self._subclassResponsibility();
  30249. return self;
  30250. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  30251. },
  30252. args: ["aNode"],
  30253. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  30254. referencedClasses: [],
  30255. messageSends: ["subclassResponsibility"]
  30256. }),
  30257. $globals.AbstractCodeGenerator);
  30258. $core.addMethod(
  30259. $core.method({
  30260. selector: "currentClass",
  30261. protocol: 'accessing',
  30262. fn: function (){
  30263. var self=this;
  30264. var $1;
  30265. $1=self["@currentClass"];
  30266. return $1;
  30267. },
  30268. args: [],
  30269. source: "currentClass\x0a\x09^ currentClass",
  30270. referencedClasses: [],
  30271. messageSends: []
  30272. }),
  30273. $globals.AbstractCodeGenerator);
  30274. $core.addMethod(
  30275. $core.method({
  30276. selector: "currentClass:",
  30277. protocol: 'accessing',
  30278. fn: function (aClass){
  30279. var self=this;
  30280. self["@currentClass"]=aClass;
  30281. return self;
  30282. },
  30283. args: ["aClass"],
  30284. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30285. referencedClasses: [],
  30286. messageSends: []
  30287. }),
  30288. $globals.AbstractCodeGenerator);
  30289. $core.addMethod(
  30290. $core.method({
  30291. selector: "currentPackage",
  30292. protocol: 'accessing',
  30293. fn: function (){
  30294. var self=this;
  30295. var $1;
  30296. $1=self["@currentPackage"];
  30297. return $1;
  30298. },
  30299. args: [],
  30300. source: "currentPackage\x0a\x09^ currentPackage",
  30301. referencedClasses: [],
  30302. messageSends: []
  30303. }),
  30304. $globals.AbstractCodeGenerator);
  30305. $core.addMethod(
  30306. $core.method({
  30307. selector: "currentPackage:",
  30308. protocol: 'accessing',
  30309. fn: function (anObject){
  30310. var self=this;
  30311. self["@currentPackage"]=anObject;
  30312. return self;
  30313. },
  30314. args: ["anObject"],
  30315. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30316. referencedClasses: [],
  30317. messageSends: []
  30318. }),
  30319. $globals.AbstractCodeGenerator);
  30320. $core.addMethod(
  30321. $core.method({
  30322. selector: "pseudoVariables",
  30323. protocol: 'accessing',
  30324. fn: function (){
  30325. var self=this;
  30326. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30327. return $core.withContext(function($ctx1) {
  30328. var $1;
  30329. $1=$recv($Smalltalk())._pseudoVariableNames();
  30330. return $1;
  30331. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  30332. },
  30333. args: [],
  30334. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  30335. referencedClasses: ["Smalltalk"],
  30336. messageSends: ["pseudoVariableNames"]
  30337. }),
  30338. $globals.AbstractCodeGenerator);
  30339. $core.addMethod(
  30340. $core.method({
  30341. selector: "source",
  30342. protocol: 'accessing',
  30343. fn: function (){
  30344. var self=this;
  30345. return $core.withContext(function($ctx1) {
  30346. var $2,$1,$receiver;
  30347. $2=self["@source"];
  30348. if(($receiver = $2) == null || $receiver.isNil){
  30349. $1="";
  30350. } else {
  30351. $1=$2;
  30352. };
  30353. return $1;
  30354. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  30355. },
  30356. args: [],
  30357. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30358. referencedClasses: [],
  30359. messageSends: ["ifNil:"]
  30360. }),
  30361. $globals.AbstractCodeGenerator);
  30362. $core.addMethod(
  30363. $core.method({
  30364. selector: "source:",
  30365. protocol: 'accessing',
  30366. fn: function (aString){
  30367. var self=this;
  30368. self["@source"]=aString;
  30369. return self;
  30370. },
  30371. args: ["aString"],
  30372. source: "source: aString\x0a\x09source := aString",
  30373. referencedClasses: [],
  30374. messageSends: []
  30375. }),
  30376. $globals.AbstractCodeGenerator);
  30377. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  30378. $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.";
  30379. $core.addMethod(
  30380. $core.method({
  30381. selector: "compileNode:",
  30382. protocol: 'compiling',
  30383. fn: function (aNode){
  30384. var self=this;
  30385. var ir,stream;
  30386. return $core.withContext(function($ctx1) {
  30387. var $2,$3,$1;
  30388. $recv(self._semanticAnalyzer())._visit_(aNode);
  30389. $ctx1.sendIdx["visit:"]=1;
  30390. ir=$recv(self._translator())._visit_(aNode);
  30391. $ctx1.sendIdx["visit:"]=2;
  30392. $2=self._irTranslator();
  30393. $recv($2)._currentClass_(self._currentClass());
  30394. $recv($2)._visit_(ir);
  30395. $3=$recv($2)._contents();
  30396. $1=$3;
  30397. return $1;
  30398. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
  30399. },
  30400. args: ["aNode"],
  30401. 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",
  30402. referencedClasses: [],
  30403. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  30404. }),
  30405. $globals.CodeGenerator);
  30406. $core.addMethod(
  30407. $core.method({
  30408. selector: "irTranslator",
  30409. protocol: 'compiling',
  30410. fn: function (){
  30411. var self=this;
  30412. function $IRJSTranslator(){return $globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  30413. return $core.withContext(function($ctx1) {
  30414. var $1;
  30415. $1=$recv($IRJSTranslator())._new();
  30416. return $1;
  30417. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  30418. },
  30419. args: [],
  30420. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  30421. referencedClasses: ["IRJSTranslator"],
  30422. messageSends: ["new"]
  30423. }),
  30424. $globals.CodeGenerator);
  30425. $core.addMethod(
  30426. $core.method({
  30427. selector: "semanticAnalyzer",
  30428. protocol: 'compiling',
  30429. fn: function (){
  30430. var self=this;
  30431. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  30432. return $core.withContext(function($ctx1) {
  30433. var $2,$3,$1;
  30434. $2=$recv($SemanticAnalyzer())._on_(self._currentClass());
  30435. $recv($2)._thePackage_(self._currentPackage());
  30436. $3=$recv($2)._yourself();
  30437. $1=$3;
  30438. return $1;
  30439. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  30440. },
  30441. args: [],
  30442. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  30443. referencedClasses: ["SemanticAnalyzer"],
  30444. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  30445. }),
  30446. $globals.CodeGenerator);
  30447. $core.addMethod(
  30448. $core.method({
  30449. selector: "translator",
  30450. protocol: 'compiling',
  30451. fn: function (){
  30452. var self=this;
  30453. function $IRASTTranslator(){return $globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  30454. return $core.withContext(function($ctx1) {
  30455. var $2,$3,$1;
  30456. $2=$recv($IRASTTranslator())._new();
  30457. $recv($2)._source_(self._source());
  30458. $recv($2)._theClass_(self._currentClass());
  30459. $3=$recv($2)._yourself();
  30460. $1=$3;
  30461. return $1;
  30462. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  30463. },
  30464. args: [],
  30465. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  30466. referencedClasses: ["IRASTTranslator"],
  30467. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  30468. }),
  30469. $globals.CodeGenerator);
  30470. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  30471. $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`";
  30472. $core.addMethod(
  30473. $core.method({
  30474. selector: "codeGeneratorClass",
  30475. protocol: 'accessing',
  30476. fn: function (){
  30477. var self=this;
  30478. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  30479. return $core.withContext(function($ctx1) {
  30480. var $2,$1,$receiver;
  30481. $2=self["@codeGeneratorClass"];
  30482. if(($receiver = $2) == null || $receiver.isNil){
  30483. $1=$InliningCodeGenerator();
  30484. } else {
  30485. $1=$2;
  30486. };
  30487. return $1;
  30488. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  30489. },
  30490. args: [],
  30491. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  30492. referencedClasses: ["InliningCodeGenerator"],
  30493. messageSends: ["ifNil:"]
  30494. }),
  30495. $globals.Compiler);
  30496. $core.addMethod(
  30497. $core.method({
  30498. selector: "codeGeneratorClass:",
  30499. protocol: 'accessing',
  30500. fn: function (aClass){
  30501. var self=this;
  30502. self["@codeGeneratorClass"]=aClass;
  30503. return self;
  30504. },
  30505. args: ["aClass"],
  30506. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30507. referencedClasses: [],
  30508. messageSends: []
  30509. }),
  30510. $globals.Compiler);
  30511. $core.addMethod(
  30512. $core.method({
  30513. selector: "compile:forClass:protocol:",
  30514. protocol: 'compiling',
  30515. fn: function (aString,aClass,anotherString){
  30516. var self=this;
  30517. return $core.withContext(function($ctx1) {
  30518. var $2,$1;
  30519. self._source_(aString);
  30520. $2=self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  30521. $1=$2;
  30522. return $1;
  30523. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  30524. },
  30525. args: ["aString", "aClass", "anotherString"],
  30526. 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)",
  30527. referencedClasses: [],
  30528. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  30529. }),
  30530. $globals.Compiler);
  30531. $core.addMethod(
  30532. $core.method({
  30533. selector: "compileExpression:on:",
  30534. protocol: 'compiling',
  30535. fn: function (aString,anObject){
  30536. var self=this;
  30537. return $core.withContext(function($ctx1) {
  30538. var $2,$1;
  30539. $2=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30540. $ctx1.sendIdx[","]=1;
  30541. $1=self._compile_forClass_protocol_($2,$recv(anObject)._class(),"**xxxDoIt");
  30542. return $1;
  30543. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  30544. },
  30545. args: ["aString", "anObject"],
  30546. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  30547. referencedClasses: [],
  30548. messageSends: ["compile:forClass:protocol:", ",", "class"]
  30549. }),
  30550. $globals.Compiler);
  30551. $core.addMethod(
  30552. $core.method({
  30553. selector: "compileNode:",
  30554. protocol: 'compiling',
  30555. fn: function (aNode){
  30556. var self=this;
  30557. var generator,result;
  30558. return $core.withContext(function($ctx1) {
  30559. var $1,$2,$3;
  30560. generator=$recv(self._codeGeneratorClass())._new();
  30561. $1=generator;
  30562. $recv($1)._source_(self._source());
  30563. $recv($1)._currentClass_(self._currentClass());
  30564. $2=$recv($1)._currentPackage_(self._currentPackage());
  30565. result=$recv(generator)._compileNode_(aNode);
  30566. self._unknownVariables_([]);
  30567. $3=result;
  30568. return $3;
  30569. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  30570. },
  30571. args: ["aNode"],
  30572. 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",
  30573. referencedClasses: [],
  30574. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  30575. }),
  30576. $globals.Compiler);
  30577. $core.addMethod(
  30578. $core.method({
  30579. selector: "compileNode:forClass:package:",
  30580. protocol: 'compiling',
  30581. fn: function (aNode,aClass,aPackage){
  30582. var self=this;
  30583. return $core.withContext(function($ctx1) {
  30584. var $2,$1;
  30585. self._currentClass_(aClass);
  30586. self._currentPackage_(aPackage);
  30587. $2=self._compileNode_(aNode);
  30588. $1=$2;
  30589. return $1;
  30590. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  30591. },
  30592. args: ["aNode", "aClass", "aPackage"],
  30593. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  30594. referencedClasses: [],
  30595. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  30596. }),
  30597. $globals.Compiler);
  30598. $core.addMethod(
  30599. $core.method({
  30600. selector: "currentClass",
  30601. protocol: 'accessing',
  30602. fn: function (){
  30603. var self=this;
  30604. var $1;
  30605. $1=self["@currentClass"];
  30606. return $1;
  30607. },
  30608. args: [],
  30609. source: "currentClass\x0a\x09^ currentClass",
  30610. referencedClasses: [],
  30611. messageSends: []
  30612. }),
  30613. $globals.Compiler);
  30614. $core.addMethod(
  30615. $core.method({
  30616. selector: "currentClass:",
  30617. protocol: 'accessing',
  30618. fn: function (aClass){
  30619. var self=this;
  30620. self["@currentClass"]=aClass;
  30621. return self;
  30622. },
  30623. args: ["aClass"],
  30624. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30625. referencedClasses: [],
  30626. messageSends: []
  30627. }),
  30628. $globals.Compiler);
  30629. $core.addMethod(
  30630. $core.method({
  30631. selector: "currentPackage",
  30632. protocol: 'accessing',
  30633. fn: function (){
  30634. var self=this;
  30635. var $1;
  30636. $1=self["@currentPackage"];
  30637. return $1;
  30638. },
  30639. args: [],
  30640. source: "currentPackage\x0a\x09^ currentPackage",
  30641. referencedClasses: [],
  30642. messageSends: []
  30643. }),
  30644. $globals.Compiler);
  30645. $core.addMethod(
  30646. $core.method({
  30647. selector: "currentPackage:",
  30648. protocol: 'accessing',
  30649. fn: function (anObject){
  30650. var self=this;
  30651. self["@currentPackage"]=anObject;
  30652. return self;
  30653. },
  30654. args: ["anObject"],
  30655. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30656. referencedClasses: [],
  30657. messageSends: []
  30658. }),
  30659. $globals.Compiler);
  30660. $core.addMethod(
  30661. $core.method({
  30662. selector: "eval:",
  30663. protocol: 'compiling',
  30664. fn: function (aString){
  30665. var self=this;
  30666. return $core.withContext(function($ctx1) {
  30667. return eval(aString);
  30668. return self;
  30669. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  30670. },
  30671. args: ["aString"],
  30672. source: "eval: aString\x0a\x09<return eval(aString)>",
  30673. referencedClasses: [],
  30674. messageSends: []
  30675. }),
  30676. $globals.Compiler);
  30677. $core.addMethod(
  30678. $core.method({
  30679. selector: "eval:forPackage:",
  30680. protocol: 'compiling',
  30681. fn: function (aString,aPackage){
  30682. var self=this;
  30683. return $core.withContext(function($ctx1) {
  30684. return aPackage && aPackage.innerEval
  30685. ? aPackage.innerEval(aString)
  30686. : eval(aString);
  30687. return self;
  30688. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  30689. },
  30690. args: ["aString", "aPackage"],
  30691. source: "eval: aString forPackage: aPackage\x0a\x09<return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)>",
  30692. referencedClasses: [],
  30693. messageSends: []
  30694. }),
  30695. $globals.Compiler);
  30696. $core.addMethod(
  30697. $core.method({
  30698. selector: "evaluateExpression:",
  30699. protocol: 'compiling',
  30700. fn: function (aString){
  30701. var self=this;
  30702. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  30703. return $core.withContext(function($ctx1) {
  30704. var $1;
  30705. $1=self._evaluateExpression_on_(aString,$recv($DoIt())._new());
  30706. return $1;
  30707. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  30708. },
  30709. args: ["aString"],
  30710. 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",
  30711. referencedClasses: ["DoIt"],
  30712. messageSends: ["evaluateExpression:on:", "new"]
  30713. }),
  30714. $globals.Compiler);
  30715. $core.addMethod(
  30716. $core.method({
  30717. selector: "evaluateExpression:on:",
  30718. protocol: 'compiling',
  30719. fn: function (aString,anObject){
  30720. var self=this;
  30721. var result,method;
  30722. return $core.withContext(function($ctx1) {
  30723. var $1,$2;
  30724. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30725. $recv(method)._protocol_("**xxxDoIt");
  30726. $1=$recv(anObject)._class();
  30727. $ctx1.sendIdx["class"]=1;
  30728. $recv($1)._addCompiledMethod_(method);
  30729. result=$recv(anObject)._xxxDoIt();
  30730. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  30731. $2=result;
  30732. return $2;
  30733. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  30734. },
  30735. args: ["aString", "anObject"],
  30736. 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",
  30737. referencedClasses: [],
  30738. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30739. }),
  30740. $globals.Compiler);
  30741. $core.addMethod(
  30742. $core.method({
  30743. selector: "install:forClass:protocol:",
  30744. protocol: 'compiling',
  30745. fn: function (aString,aBehavior,anotherString){
  30746. var self=this;
  30747. var compiledMethod;
  30748. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  30749. return $core.withContext(function($ctx1) {
  30750. var $1;
  30751. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  30752. $1=$recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  30753. return $1;
  30754. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  30755. },
  30756. args: ["aString", "aBehavior", "anotherString"],
  30757. 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",
  30758. referencedClasses: ["ClassBuilder"],
  30759. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  30760. }),
  30761. $globals.Compiler);
  30762. $core.addMethod(
  30763. $core.method({
  30764. selector: "parse:",
  30765. protocol: 'compiling',
  30766. fn: function (aString){
  30767. var self=this;
  30768. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30769. return $core.withContext(function($ctx1) {
  30770. var $1;
  30771. $1=$recv($Smalltalk())._parse_(aString);
  30772. return $1;
  30773. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  30774. },
  30775. args: ["aString"],
  30776. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30777. referencedClasses: ["Smalltalk"],
  30778. messageSends: ["parse:"]
  30779. }),
  30780. $globals.Compiler);
  30781. $core.addMethod(
  30782. $core.method({
  30783. selector: "parseExpression:",
  30784. protocol: 'compiling',
  30785. fn: function (aString){
  30786. var self=this;
  30787. return $core.withContext(function($ctx1) {
  30788. var $2,$1;
  30789. $2=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30790. $ctx1.sendIdx[","]=1;
  30791. $1=self._parse_($2);
  30792. return $1;
  30793. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  30794. },
  30795. args: ["aString"],
  30796. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30797. referencedClasses: [],
  30798. messageSends: ["parse:", ","]
  30799. }),
  30800. $globals.Compiler);
  30801. $core.addMethod(
  30802. $core.method({
  30803. selector: "recompile:",
  30804. protocol: 'compiling',
  30805. fn: function (aClass){
  30806. var self=this;
  30807. return $core.withContext(function($ctx1) {
  30808. var $1;
  30809. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30810. return $core.withContext(function($ctx2) {
  30811. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  30812. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30813. }),"Recompiling ".__comma($recv(aClass)._name()));
  30814. $1=$recv(aClass)._isMetaclass();
  30815. if(!$core.assert($1)){
  30816. self._recompile_($recv(aClass)._class());
  30817. };
  30818. return self;
  30819. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  30820. },
  30821. args: ["aClass"],
  30822. 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 ]",
  30823. referencedClasses: [],
  30824. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30825. }),
  30826. $globals.Compiler);
  30827. $core.addMethod(
  30828. $core.method({
  30829. selector: "recompileAll",
  30830. protocol: 'compiling',
  30831. fn: function (){
  30832. var self=this;
  30833. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30834. return $core.withContext(function($ctx1) {
  30835. $recv($recv($Smalltalk())._classes())._do_displayingProgress_((function(each){
  30836. return $core.withContext(function($ctx2) {
  30837. return self._recompile_(each);
  30838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30839. }),"Compiling all classes...");
  30840. return self;
  30841. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  30842. },
  30843. args: [],
  30844. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30845. referencedClasses: ["Smalltalk"],
  30846. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30847. }),
  30848. $globals.Compiler);
  30849. $core.addMethod(
  30850. $core.method({
  30851. selector: "source",
  30852. protocol: 'accessing',
  30853. fn: function (){
  30854. var self=this;
  30855. return $core.withContext(function($ctx1) {
  30856. var $2,$1,$receiver;
  30857. $2=self["@source"];
  30858. if(($receiver = $2) == null || $receiver.isNil){
  30859. $1="";
  30860. } else {
  30861. $1=$2;
  30862. };
  30863. return $1;
  30864. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  30865. },
  30866. args: [],
  30867. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30868. referencedClasses: [],
  30869. messageSends: ["ifNil:"]
  30870. }),
  30871. $globals.Compiler);
  30872. $core.addMethod(
  30873. $core.method({
  30874. selector: "source:",
  30875. protocol: 'accessing',
  30876. fn: function (aString){
  30877. var self=this;
  30878. self["@source"]=aString;
  30879. return self;
  30880. },
  30881. args: ["aString"],
  30882. source: "source: aString\x0a\x09source := aString",
  30883. referencedClasses: [],
  30884. messageSends: []
  30885. }),
  30886. $globals.Compiler);
  30887. $core.addMethod(
  30888. $core.method({
  30889. selector: "unknownVariables",
  30890. protocol: 'accessing',
  30891. fn: function (){
  30892. var self=this;
  30893. var $1;
  30894. $1=self["@unknownVariables"];
  30895. return $1;
  30896. },
  30897. args: [],
  30898. source: "unknownVariables\x0a\x09^ unknownVariables",
  30899. referencedClasses: [],
  30900. messageSends: []
  30901. }),
  30902. $globals.Compiler);
  30903. $core.addMethod(
  30904. $core.method({
  30905. selector: "unknownVariables:",
  30906. protocol: 'accessing',
  30907. fn: function (aCollection){
  30908. var self=this;
  30909. self["@unknownVariables"]=aCollection;
  30910. return self;
  30911. },
  30912. args: ["aCollection"],
  30913. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  30914. referencedClasses: [],
  30915. messageSends: []
  30916. }),
  30917. $globals.Compiler);
  30918. $core.addMethod(
  30919. $core.method({
  30920. selector: "recompile:",
  30921. protocol: 'compiling',
  30922. fn: function (aClass){
  30923. var self=this;
  30924. return $core.withContext(function($ctx1) {
  30925. $recv(self._new())._recompile_(aClass);
  30926. return self;
  30927. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  30928. },
  30929. args: ["aClass"],
  30930. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  30931. referencedClasses: [],
  30932. messageSends: ["recompile:", "new"]
  30933. }),
  30934. $globals.Compiler.klass);
  30935. $core.addMethod(
  30936. $core.method({
  30937. selector: "recompileAll",
  30938. protocol: 'compiling',
  30939. fn: function (){
  30940. var self=this;
  30941. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30942. return $core.withContext(function($ctx1) {
  30943. $recv($recv($Smalltalk())._classes())._do_((function(each){
  30944. return $core.withContext(function($ctx2) {
  30945. return self._recompile_(each);
  30946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30947. }));
  30948. return self;
  30949. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  30950. },
  30951. args: [],
  30952. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  30953. referencedClasses: ["Smalltalk"],
  30954. messageSends: ["do:", "classes", "recompile:"]
  30955. }),
  30956. $globals.Compiler.klass);
  30957. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  30958. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  30959. $core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core');
  30960. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  30961. $core.addMethod(
  30962. $core.method({
  30963. selector: "evaluate:context:",
  30964. protocol: 'evaluating',
  30965. fn: function (aString,aContext){
  30966. var self=this;
  30967. var compiler,ast;
  30968. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  30969. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  30970. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  30971. return $core.withContext(function($ctx1) {
  30972. var $1,$2,$3,$4;
  30973. var $early={};
  30974. try {
  30975. compiler=$recv($Compiler())._new();
  30976. $recv((function(){
  30977. return $core.withContext(function($ctx2) {
  30978. ast=$recv(compiler)._parseExpression_(aString);
  30979. return ast;
  30980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30981. }))._on_do_($Error(),(function(ex){
  30982. return $core.withContext(function($ctx2) {
  30983. $1=self._alert_($recv(ex)._messageText());
  30984. throw $early=[$1];
  30985. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30986. }));
  30987. $2=$recv($AISemanticAnalyzer())._on_($recv($recv(aContext)._receiver())._class());
  30988. $recv($2)._context_(aContext);
  30989. $3=$recv($2)._visit_(ast);
  30990. $4=$recv(aContext)._evaluateNode_(ast);
  30991. return $4;
  30992. }
  30993. catch(e) {if(e===$early)return e[0]; throw e}
  30994. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  30995. },
  30996. args: ["aString", "aContext"],
  30997. 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",
  30998. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
  30999. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  31000. }),
  31001. $globals.Evaluator);
  31002. $core.addMethod(
  31003. $core.method({
  31004. selector: "evaluate:for:",
  31005. protocol: 'evaluating',
  31006. fn: function (aString,anObject){
  31007. var self=this;
  31008. return $core.withContext(function($ctx1) {
  31009. var $1;
  31010. $1=$recv(anObject)._evaluate_on_(aString,self);
  31011. return $1;
  31012. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  31013. },
  31014. args: ["aString", "anObject"],
  31015. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  31016. referencedClasses: [],
  31017. messageSends: ["evaluate:on:"]
  31018. }),
  31019. $globals.Evaluator);
  31020. $core.addMethod(
  31021. $core.method({
  31022. selector: "evaluate:receiver:",
  31023. protocol: 'evaluating',
  31024. fn: function (aString,anObject){
  31025. var self=this;
  31026. var compiler;
  31027. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  31028. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  31029. return $core.withContext(function($ctx1) {
  31030. var $1,$2;
  31031. var $early={};
  31032. try {
  31033. compiler=$recv($Compiler())._new();
  31034. $recv((function(){
  31035. return $core.withContext(function($ctx2) {
  31036. return $recv(compiler)._parseExpression_(aString);
  31037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31038. }))._on_do_($Error(),(function(ex){
  31039. return $core.withContext(function($ctx2) {
  31040. $1=self._alert_($recv(ex)._messageText());
  31041. throw $early=[$1];
  31042. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  31043. }));
  31044. $2=$recv(compiler)._evaluateExpression_on_(aString,anObject);
  31045. return $2;
  31046. }
  31047. catch(e) {if(e===$early)return e[0]; throw e}
  31048. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  31049. },
  31050. args: ["aString", "anObject"],
  31051. 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",
  31052. referencedClasses: ["Compiler", "Error"],
  31053. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  31054. }),
  31055. $globals.Evaluator);
  31056. $core.addMethod(
  31057. $core.method({
  31058. selector: "evaluate:for:",
  31059. protocol: 'instance creation',
  31060. fn: function (aString,anObject){
  31061. var self=this;
  31062. return $core.withContext(function($ctx1) {
  31063. var $1;
  31064. $1=$recv(self._new())._evaluate_for_(aString,anObject);
  31065. return $1;
  31066. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  31067. },
  31068. args: ["aString", "anObject"],
  31069. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  31070. referencedClasses: [],
  31071. messageSends: ["evaluate:for:", "new"]
  31072. }),
  31073. $globals.Evaluator.klass);
  31074. $core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-Core');
  31075. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  31076. $core.addMethod(
  31077. $core.method({
  31078. selector: "visit:",
  31079. protocol: 'visiting',
  31080. fn: function (aNode){
  31081. var self=this;
  31082. return $core.withContext(function($ctx1) {
  31083. var $1;
  31084. $1=$recv(aNode)._accept_(self);
  31085. return $1;
  31086. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
  31087. },
  31088. args: ["aNode"],
  31089. source: "visit: aNode\x0a\x09^ aNode accept: self",
  31090. referencedClasses: [],
  31091. messageSends: ["accept:"]
  31092. }),
  31093. $globals.NodeVisitor);
  31094. $core.addMethod(
  31095. $core.method({
  31096. selector: "visitAll:",
  31097. protocol: 'visiting',
  31098. fn: function (aCollection){
  31099. var self=this;
  31100. return $core.withContext(function($ctx1) {
  31101. var $1;
  31102. $1=$recv(aCollection)._collect_((function(each){
  31103. return $core.withContext(function($ctx2) {
  31104. return self._visit_(each);
  31105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31106. }));
  31107. return $1;
  31108. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
  31109. },
  31110. args: ["aCollection"],
  31111. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  31112. referencedClasses: [],
  31113. messageSends: ["collect:", "visit:"]
  31114. }),
  31115. $globals.NodeVisitor);
  31116. $core.addMethod(
  31117. $core.method({
  31118. selector: "visitAssignmentNode:",
  31119. protocol: 'visiting',
  31120. fn: function (aNode){
  31121. var self=this;
  31122. return $core.withContext(function($ctx1) {
  31123. var $1;
  31124. $1=self._visitNode_(aNode);
  31125. return $1;
  31126. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  31127. },
  31128. args: ["aNode"],
  31129. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  31130. referencedClasses: [],
  31131. messageSends: ["visitNode:"]
  31132. }),
  31133. $globals.NodeVisitor);
  31134. $core.addMethod(
  31135. $core.method({
  31136. selector: "visitBlockNode:",
  31137. protocol: 'visiting',
  31138. fn: function (aNode){
  31139. var self=this;
  31140. return $core.withContext(function($ctx1) {
  31141. var $1;
  31142. $1=self._visitNode_(aNode);
  31143. return $1;
  31144. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  31145. },
  31146. args: ["aNode"],
  31147. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  31148. referencedClasses: [],
  31149. messageSends: ["visitNode:"]
  31150. }),
  31151. $globals.NodeVisitor);
  31152. $core.addMethod(
  31153. $core.method({
  31154. selector: "visitBlockSequenceNode:",
  31155. protocol: 'visiting',
  31156. fn: function (aNode){
  31157. var self=this;
  31158. return $core.withContext(function($ctx1) {
  31159. var $1;
  31160. $1=self._visitSequenceNode_(aNode);
  31161. return $1;
  31162. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  31163. },
  31164. args: ["aNode"],
  31165. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  31166. referencedClasses: [],
  31167. messageSends: ["visitSequenceNode:"]
  31168. }),
  31169. $globals.NodeVisitor);
  31170. $core.addMethod(
  31171. $core.method({
  31172. selector: "visitCascadeNode:",
  31173. protocol: 'visiting',
  31174. fn: function (aNode){
  31175. var self=this;
  31176. return $core.withContext(function($ctx1) {
  31177. var $1;
  31178. $1=self._visitNode_(aNode);
  31179. return $1;
  31180. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  31181. },
  31182. args: ["aNode"],
  31183. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  31184. referencedClasses: [],
  31185. messageSends: ["visitNode:"]
  31186. }),
  31187. $globals.NodeVisitor);
  31188. $core.addMethod(
  31189. $core.method({
  31190. selector: "visitDynamicArrayNode:",
  31191. protocol: 'visiting',
  31192. fn: function (aNode){
  31193. var self=this;
  31194. return $core.withContext(function($ctx1) {
  31195. var $1;
  31196. $1=self._visitNode_(aNode);
  31197. return $1;
  31198. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  31199. },
  31200. args: ["aNode"],
  31201. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  31202. referencedClasses: [],
  31203. messageSends: ["visitNode:"]
  31204. }),
  31205. $globals.NodeVisitor);
  31206. $core.addMethod(
  31207. $core.method({
  31208. selector: "visitDynamicDictionaryNode:",
  31209. protocol: 'visiting',
  31210. fn: function (aNode){
  31211. var self=this;
  31212. return $core.withContext(function($ctx1) {
  31213. var $1;
  31214. $1=self._visitNode_(aNode);
  31215. return $1;
  31216. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  31217. },
  31218. args: ["aNode"],
  31219. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  31220. referencedClasses: [],
  31221. messageSends: ["visitNode:"]
  31222. }),
  31223. $globals.NodeVisitor);
  31224. $core.addMethod(
  31225. $core.method({
  31226. selector: "visitJSStatementNode:",
  31227. protocol: 'visiting',
  31228. fn: function (aNode){
  31229. var self=this;
  31230. return $core.withContext(function($ctx1) {
  31231. var $1;
  31232. $1=self._visitNode_(aNode);
  31233. return $1;
  31234. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  31235. },
  31236. args: ["aNode"],
  31237. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  31238. referencedClasses: [],
  31239. messageSends: ["visitNode:"]
  31240. }),
  31241. $globals.NodeVisitor);
  31242. $core.addMethod(
  31243. $core.method({
  31244. selector: "visitMethodNode:",
  31245. protocol: 'visiting',
  31246. fn: function (aNode){
  31247. var self=this;
  31248. return $core.withContext(function($ctx1) {
  31249. var $1;
  31250. $1=self._visitNode_(aNode);
  31251. return $1;
  31252. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  31253. },
  31254. args: ["aNode"],
  31255. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  31256. referencedClasses: [],
  31257. messageSends: ["visitNode:"]
  31258. }),
  31259. $globals.NodeVisitor);
  31260. $core.addMethod(
  31261. $core.method({
  31262. selector: "visitNode:",
  31263. protocol: 'visiting',
  31264. fn: function (aNode){
  31265. var self=this;
  31266. return $core.withContext(function($ctx1) {
  31267. var $1;
  31268. $1=self._visitAll_($recv(aNode)._nodes());
  31269. return $1;
  31270. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
  31271. },
  31272. args: ["aNode"],
  31273. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  31274. referencedClasses: [],
  31275. messageSends: ["visitAll:", "nodes"]
  31276. }),
  31277. $globals.NodeVisitor);
  31278. $core.addMethod(
  31279. $core.method({
  31280. selector: "visitReturnNode:",
  31281. protocol: 'visiting',
  31282. fn: function (aNode){
  31283. var self=this;
  31284. return $core.withContext(function($ctx1) {
  31285. var $1;
  31286. $1=self._visitNode_(aNode);
  31287. return $1;
  31288. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  31289. },
  31290. args: ["aNode"],
  31291. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  31292. referencedClasses: [],
  31293. messageSends: ["visitNode:"]
  31294. }),
  31295. $globals.NodeVisitor);
  31296. $core.addMethod(
  31297. $core.method({
  31298. selector: "visitSendNode:",
  31299. protocol: 'visiting',
  31300. fn: function (aNode){
  31301. var self=this;
  31302. return $core.withContext(function($ctx1) {
  31303. var $1;
  31304. $1=self._visitNode_(aNode);
  31305. return $1;
  31306. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  31307. },
  31308. args: ["aNode"],
  31309. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  31310. referencedClasses: [],
  31311. messageSends: ["visitNode:"]
  31312. }),
  31313. $globals.NodeVisitor);
  31314. $core.addMethod(
  31315. $core.method({
  31316. selector: "visitSequenceNode:",
  31317. protocol: 'visiting',
  31318. fn: function (aNode){
  31319. var self=this;
  31320. return $core.withContext(function($ctx1) {
  31321. var $1;
  31322. $1=self._visitNode_(aNode);
  31323. return $1;
  31324. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  31325. },
  31326. args: ["aNode"],
  31327. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  31328. referencedClasses: [],
  31329. messageSends: ["visitNode:"]
  31330. }),
  31331. $globals.NodeVisitor);
  31332. $core.addMethod(
  31333. $core.method({
  31334. selector: "visitValueNode:",
  31335. protocol: 'visiting',
  31336. fn: function (aNode){
  31337. var self=this;
  31338. return $core.withContext(function($ctx1) {
  31339. var $1;
  31340. $1=self._visitNode_(aNode);
  31341. return $1;
  31342. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  31343. },
  31344. args: ["aNode"],
  31345. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  31346. referencedClasses: [],
  31347. messageSends: ["visitNode:"]
  31348. }),
  31349. $globals.NodeVisitor);
  31350. $core.addMethod(
  31351. $core.method({
  31352. selector: "visitVariableNode:",
  31353. protocol: 'visiting',
  31354. fn: function (aNode){
  31355. var self=this;
  31356. return $core.withContext(function($ctx1) {
  31357. var $1;
  31358. $1=self._visitNode_(aNode);
  31359. return $1;
  31360. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  31361. },
  31362. args: ["aNode"],
  31363. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  31364. referencedClasses: [],
  31365. messageSends: ["visitNode:"]
  31366. }),
  31367. $globals.NodeVisitor);
  31368. $core.addMethod(
  31369. $core.method({
  31370. selector: "asVariableName",
  31371. protocol: '*Compiler-Core',
  31372. fn: function (){
  31373. var self=this;
  31374. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  31375. return $core.withContext(function($ctx1) {
  31376. var $2,$1;
  31377. $2=$recv($recv($Smalltalk())._reservedWords())._includes_(self);
  31378. if($core.assert($2)){
  31379. $1=self.__comma("_");
  31380. } else {
  31381. $1=self;
  31382. };
  31383. return $1;
  31384. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  31385. },
  31386. args: [],
  31387. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  31388. referencedClasses: ["Smalltalk"],
  31389. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  31390. }),
  31391. $globals.String);
  31392. });
  31393. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  31394. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  31395. $core.addPackage('Compiler-AST');
  31396. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  31397. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  31398. $core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  31399. $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.";
  31400. $core.addMethod(
  31401. $core.method({
  31402. selector: "accept:",
  31403. protocol: 'visiting',
  31404. fn: function (aVisitor){
  31405. var self=this;
  31406. return $core.withContext(function($ctx1) {
  31407. var $1;
  31408. $1=$recv(aVisitor)._visitNode_(self);
  31409. return $1;
  31410. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)});
  31411. },
  31412. args: ["aVisitor"],
  31413. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  31414. referencedClasses: [],
  31415. messageSends: ["visitNode:"]
  31416. }),
  31417. $globals.Node);
  31418. $core.addMethod(
  31419. $core.method({
  31420. selector: "addNode:",
  31421. protocol: 'accessing',
  31422. fn: function (aNode){
  31423. var self=this;
  31424. return $core.withContext(function($ctx1) {
  31425. $recv(self._nodes())._add_(aNode);
  31426. $recv(aNode)._parent_(self);
  31427. return self;
  31428. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)});
  31429. },
  31430. args: ["aNode"],
  31431. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  31432. referencedClasses: [],
  31433. messageSends: ["add:", "nodes", "parent:"]
  31434. }),
  31435. $globals.Node);
  31436. $core.addMethod(
  31437. $core.method({
  31438. selector: "allNodes",
  31439. protocol: 'accessing',
  31440. fn: function (){
  31441. var self=this;
  31442. var allNodes;
  31443. return $core.withContext(function($ctx1) {
  31444. var $1,$2;
  31445. $1=self._nodes();
  31446. $ctx1.sendIdx["nodes"]=1;
  31447. allNodes=$recv($1)._asSet();
  31448. $recv(self._nodes())._do_((function(each){
  31449. return $core.withContext(function($ctx2) {
  31450. return $recv(allNodes)._addAll_($recv(each)._allNodes());
  31451. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31452. }));
  31453. $2=allNodes;
  31454. return $2;
  31455. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)});
  31456. },
  31457. args: [],
  31458. 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",
  31459. referencedClasses: [],
  31460. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  31461. }),
  31462. $globals.Node);
  31463. $core.addMethod(
  31464. $core.method({
  31465. selector: "inPosition:",
  31466. protocol: 'testing',
  31467. fn: function (aPoint){
  31468. var self=this;
  31469. return $core.withContext(function($ctx1) {
  31470. var $1;
  31471. $1=$recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  31472. return $core.withContext(function($ctx2) {
  31473. return $recv(self._positionEnd()).__gt_eq(aPoint);
  31474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31475. }));
  31476. return $1;
  31477. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)});
  31478. },
  31479. args: ["aPoint"],
  31480. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  31481. referencedClasses: [],
  31482. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  31483. }),
  31484. $globals.Node);
  31485. $core.addMethod(
  31486. $core.method({
  31487. selector: "isAssignmentNode",
  31488. protocol: 'testing',
  31489. fn: function (){
  31490. var self=this;
  31491. return false;
  31492. },
  31493. args: [],
  31494. source: "isAssignmentNode\x0a\x09^ false",
  31495. referencedClasses: [],
  31496. messageSends: []
  31497. }),
  31498. $globals.Node);
  31499. $core.addMethod(
  31500. $core.method({
  31501. selector: "isBlockNode",
  31502. protocol: 'testing',
  31503. fn: function (){
  31504. var self=this;
  31505. return false;
  31506. },
  31507. args: [],
  31508. source: "isBlockNode\x0a\x09^ false",
  31509. referencedClasses: [],
  31510. messageSends: []
  31511. }),
  31512. $globals.Node);
  31513. $core.addMethod(
  31514. $core.method({
  31515. selector: "isBlockSequenceNode",
  31516. protocol: 'testing',
  31517. fn: function (){
  31518. var self=this;
  31519. return false;
  31520. },
  31521. args: [],
  31522. source: "isBlockSequenceNode\x0a\x09^ false",
  31523. referencedClasses: [],
  31524. messageSends: []
  31525. }),
  31526. $globals.Node);
  31527. $core.addMethod(
  31528. $core.method({
  31529. selector: "isCascadeNode",
  31530. protocol: 'testing',
  31531. fn: function (){
  31532. var self=this;
  31533. return false;
  31534. },
  31535. args: [],
  31536. source: "isCascadeNode\x0a\x09^ false",
  31537. referencedClasses: [],
  31538. messageSends: []
  31539. }),
  31540. $globals.Node);
  31541. $core.addMethod(
  31542. $core.method({
  31543. selector: "isImmutable",
  31544. protocol: 'testing',
  31545. fn: function (){
  31546. var self=this;
  31547. return false;
  31548. },
  31549. args: [],
  31550. source: "isImmutable\x0a\x09^ false",
  31551. referencedClasses: [],
  31552. messageSends: []
  31553. }),
  31554. $globals.Node);
  31555. $core.addMethod(
  31556. $core.method({
  31557. selector: "isJSStatementNode",
  31558. protocol: 'testing',
  31559. fn: function (){
  31560. var self=this;
  31561. return false;
  31562. },
  31563. args: [],
  31564. source: "isJSStatementNode\x0a\x09^ false",
  31565. referencedClasses: [],
  31566. messageSends: []
  31567. }),
  31568. $globals.Node);
  31569. $core.addMethod(
  31570. $core.method({
  31571. selector: "isLastChild",
  31572. protocol: 'testing',
  31573. fn: function (){
  31574. var self=this;
  31575. return $core.withContext(function($ctx1) {
  31576. var $1;
  31577. $1=$recv($recv($recv(self._parent())._nodes())._last()).__eq(self);
  31578. return $1;
  31579. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)});
  31580. },
  31581. args: [],
  31582. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  31583. referencedClasses: [],
  31584. messageSends: ["=", "last", "nodes", "parent"]
  31585. }),
  31586. $globals.Node);
  31587. $core.addMethod(
  31588. $core.method({
  31589. selector: "isNavigationNode",
  31590. protocol: 'testing',
  31591. fn: function (){
  31592. var self=this;
  31593. return false;
  31594. },
  31595. args: [],
  31596. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  31597. referencedClasses: [],
  31598. messageSends: []
  31599. }),
  31600. $globals.Node);
  31601. $core.addMethod(
  31602. $core.method({
  31603. selector: "isNode",
  31604. protocol: 'testing',
  31605. fn: function (){
  31606. var self=this;
  31607. return true;
  31608. },
  31609. args: [],
  31610. source: "isNode\x0a\x09^ true",
  31611. referencedClasses: [],
  31612. messageSends: []
  31613. }),
  31614. $globals.Node);
  31615. $core.addMethod(
  31616. $core.method({
  31617. selector: "isReferenced",
  31618. protocol: 'testing',
  31619. fn: function (){
  31620. var self=this;
  31621. return $core.withContext(function($ctx1) {
  31622. var $4,$3,$2,$1;
  31623. $4=self._parent();
  31624. $ctx1.sendIdx["parent"]=1;
  31625. $3=$recv($4)._isSequenceNode();
  31626. $2=$recv($3)._or_((function(){
  31627. return $core.withContext(function($ctx2) {
  31628. return $recv(self._parent())._isAssignmentNode();
  31629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31630. }));
  31631. $1=$recv($2)._not();
  31632. return $1;
  31633. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)});
  31634. },
  31635. args: [],
  31636. 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",
  31637. referencedClasses: [],
  31638. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  31639. }),
  31640. $globals.Node);
  31641. $core.addMethod(
  31642. $core.method({
  31643. selector: "isReturnNode",
  31644. protocol: 'testing',
  31645. fn: function (){
  31646. var self=this;
  31647. return false;
  31648. },
  31649. args: [],
  31650. source: "isReturnNode\x0a\x09^ false",
  31651. referencedClasses: [],
  31652. messageSends: []
  31653. }),
  31654. $globals.Node);
  31655. $core.addMethod(
  31656. $core.method({
  31657. selector: "isSendNode",
  31658. protocol: 'testing',
  31659. fn: function (){
  31660. var self=this;
  31661. return false;
  31662. },
  31663. args: [],
  31664. source: "isSendNode\x0a\x09^ false",
  31665. referencedClasses: [],
  31666. messageSends: []
  31667. }),
  31668. $globals.Node);
  31669. $core.addMethod(
  31670. $core.method({
  31671. selector: "isSequenceNode",
  31672. protocol: 'testing',
  31673. fn: function (){
  31674. var self=this;
  31675. return false;
  31676. },
  31677. args: [],
  31678. source: "isSequenceNode\x0a\x09^ false",
  31679. referencedClasses: [],
  31680. messageSends: []
  31681. }),
  31682. $globals.Node);
  31683. $core.addMethod(
  31684. $core.method({
  31685. selector: "isValueNode",
  31686. protocol: 'testing',
  31687. fn: function (){
  31688. var self=this;
  31689. return false;
  31690. },
  31691. args: [],
  31692. source: "isValueNode\x0a\x09^ false",
  31693. referencedClasses: [],
  31694. messageSends: []
  31695. }),
  31696. $globals.Node);
  31697. $core.addMethod(
  31698. $core.method({
  31699. selector: "isVariableNode",
  31700. protocol: 'testing',
  31701. fn: function (){
  31702. var self=this;
  31703. return false;
  31704. },
  31705. args: [],
  31706. source: "isVariableNode\x0a\x09^ false",
  31707. referencedClasses: [],
  31708. messageSends: []
  31709. }),
  31710. $globals.Node);
  31711. $core.addMethod(
  31712. $core.method({
  31713. selector: "method",
  31714. protocol: 'accessing',
  31715. fn: function (){
  31716. var self=this;
  31717. return $core.withContext(function($ctx1) {
  31718. var $2,$1,$receiver;
  31719. $2=self._parent();
  31720. if(($receiver = $2) == null || $receiver.isNil){
  31721. $1=$2;
  31722. } else {
  31723. var node;
  31724. node=$receiver;
  31725. $1=$recv(node)._method();
  31726. };
  31727. return $1;
  31728. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)});
  31729. },
  31730. args: [],
  31731. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  31732. referencedClasses: [],
  31733. messageSends: ["ifNotNil:", "parent", "method"]
  31734. }),
  31735. $globals.Node);
  31736. $core.addMethod(
  31737. $core.method({
  31738. selector: "navigationNodeAt:ifAbsent:",
  31739. protocol: 'accessing',
  31740. fn: function (aPoint,aBlock){
  31741. var self=this;
  31742. var children;
  31743. return $core.withContext(function($ctx1) {
  31744. var $1,$4,$3,$2;
  31745. var $early={};
  31746. try {
  31747. children=$recv(self._allNodes())._select_((function(each){
  31748. return $core.withContext(function($ctx2) {
  31749. return $recv($recv(each)._isNavigationNode())._and_((function(){
  31750. return $core.withContext(function($ctx3) {
  31751. return $recv(each)._inPosition_(aPoint);
  31752. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31753. }));
  31754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31755. }));
  31756. $recv(children)._ifEmpty_((function(){
  31757. return $core.withContext(function($ctx2) {
  31758. $1=$recv(aBlock)._value();
  31759. throw $early=[$1];
  31760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31761. }));
  31762. $2=$recv($recv($recv(children)._asArray())._sort_((function(a,b){
  31763. return $core.withContext(function($ctx2) {
  31764. $4=$recv(a)._positionStart();
  31765. $ctx2.sendIdx["positionStart"]=1;
  31766. $3=$recv($4)._dist_(aPoint);
  31767. $ctx2.sendIdx["dist:"]=1;
  31768. return $recv($3).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  31769. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  31770. })))._first();
  31771. return $2;
  31772. }
  31773. catch(e) {if(e===$early)return e[0]; throw e}
  31774. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)});
  31775. },
  31776. args: ["aPoint", "aBlock"],
  31777. 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",
  31778. referencedClasses: [],
  31779. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  31780. }),
  31781. $globals.Node);
  31782. $core.addMethod(
  31783. $core.method({
  31784. selector: "nextChild",
  31785. protocol: 'accessing',
  31786. fn: function (){
  31787. var self=this;
  31788. return $core.withContext(function($ctx1) {
  31789. var $3,$2,$1;
  31790. $3=self._nodes();
  31791. $ctx1.sendIdx["nodes"]=1;
  31792. $2=$recv($3)._isEmpty();
  31793. if($core.assert($2)){
  31794. $1=self;
  31795. } else {
  31796. $1=$recv($recv(self._nodes())._first())._nextChild();
  31797. };
  31798. return $1;
  31799. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},$globals.Node)});
  31800. },
  31801. args: [],
  31802. source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
  31803. referencedClasses: [],
  31804. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"]
  31805. }),
  31806. $globals.Node);
  31807. $core.addMethod(
  31808. $core.method({
  31809. selector: "nextNode",
  31810. protocol: 'accessing',
  31811. fn: function (){
  31812. var self=this;
  31813. return $core.withContext(function($ctx1) {
  31814. var $2,$1,$receiver;
  31815. $2=self._parent();
  31816. if(($receiver = $2) == null || $receiver.isNil){
  31817. $1=$2;
  31818. } else {
  31819. var node;
  31820. node=$receiver;
  31821. $1=$recv(node)._nextNode_(self);
  31822. };
  31823. return $1;
  31824. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},$globals.Node)});
  31825. },
  31826. args: [],
  31827. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  31828. referencedClasses: [],
  31829. messageSends: ["ifNotNil:", "parent", "nextNode:"]
  31830. }),
  31831. $globals.Node);
  31832. $core.addMethod(
  31833. $core.method({
  31834. selector: "nextNode:",
  31835. protocol: 'accessing',
  31836. fn: function (aNode){
  31837. var self=this;
  31838. var next;
  31839. return $core.withContext(function($ctx1) {
  31840. var $1,$2;
  31841. var $early={};
  31842. try {
  31843. $1=self._nodes();
  31844. $ctx1.sendIdx["nodes"]=1;
  31845. next=$recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  31846. throw $early=[self];
  31847. }));
  31848. $2=$recv(next)._nextChild();
  31849. return $2;
  31850. }
  31851. catch(e) {if(e===$early)return e[0]; throw e}
  31852. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},$globals.Node)});
  31853. },
  31854. args: ["aNode"],
  31855. source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
  31856. referencedClasses: [],
  31857. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"]
  31858. }),
  31859. $globals.Node);
  31860. $core.addMethod(
  31861. $core.method({
  31862. selector: "nodes",
  31863. protocol: 'accessing',
  31864. fn: function (){
  31865. var self=this;
  31866. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  31867. return $core.withContext(function($ctx1) {
  31868. var $2,$1,$receiver;
  31869. $2=self["@nodes"];
  31870. if(($receiver = $2) == null || $receiver.isNil){
  31871. self["@nodes"]=$recv($Array())._new();
  31872. $1=self["@nodes"];
  31873. } else {
  31874. $1=$2;
  31875. };
  31876. return $1;
  31877. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)});
  31878. },
  31879. args: [],
  31880. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  31881. referencedClasses: ["Array"],
  31882. messageSends: ["ifNil:", "new"]
  31883. }),
  31884. $globals.Node);
  31885. $core.addMethod(
  31886. $core.method({
  31887. selector: "nodes:",
  31888. protocol: 'building',
  31889. fn: function (aCollection){
  31890. var self=this;
  31891. return $core.withContext(function($ctx1) {
  31892. self["@nodes"]=aCollection;
  31893. $recv(aCollection)._do_((function(each){
  31894. return $core.withContext(function($ctx2) {
  31895. return $recv(each)._parent_(self);
  31896. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31897. }));
  31898. return self;
  31899. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)});
  31900. },
  31901. args: ["aCollection"],
  31902. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  31903. referencedClasses: [],
  31904. messageSends: ["do:", "parent:"]
  31905. }),
  31906. $globals.Node);
  31907. $core.addMethod(
  31908. $core.method({
  31909. selector: "parent",
  31910. protocol: 'accessing',
  31911. fn: function (){
  31912. var self=this;
  31913. var $1;
  31914. $1=self["@parent"];
  31915. return $1;
  31916. },
  31917. args: [],
  31918. source: "parent\x0a\x09^ parent",
  31919. referencedClasses: [],
  31920. messageSends: []
  31921. }),
  31922. $globals.Node);
  31923. $core.addMethod(
  31924. $core.method({
  31925. selector: "parent:",
  31926. protocol: 'accessing',
  31927. fn: function (aNode){
  31928. var self=this;
  31929. self["@parent"]=aNode;
  31930. return self;
  31931. },
  31932. args: ["aNode"],
  31933. source: "parent: aNode\x0a\x09parent := aNode",
  31934. referencedClasses: [],
  31935. messageSends: []
  31936. }),
  31937. $globals.Node);
  31938. $core.addMethod(
  31939. $core.method({
  31940. selector: "position",
  31941. protocol: 'accessing',
  31942. fn: function (){
  31943. var self=this;
  31944. return $core.withContext(function($ctx1) {
  31945. var $2,$3,$1,$receiver;
  31946. $2=self["@position"];
  31947. if(($receiver = $2) == null || $receiver.isNil){
  31948. $3=self._parent();
  31949. if(($receiver = $3) == null || $receiver.isNil){
  31950. $1=$3;
  31951. } else {
  31952. var node;
  31953. node=$receiver;
  31954. $1=$recv(node)._position();
  31955. };
  31956. } else {
  31957. $1=$2;
  31958. };
  31959. return $1;
  31960. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)});
  31961. },
  31962. args: [],
  31963. 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 ] ]",
  31964. referencedClasses: [],
  31965. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  31966. }),
  31967. $globals.Node);
  31968. $core.addMethod(
  31969. $core.method({
  31970. selector: "position:",
  31971. protocol: 'accessing',
  31972. fn: function (aPosition){
  31973. var self=this;
  31974. self["@position"]=aPosition;
  31975. return self;
  31976. },
  31977. args: ["aPosition"],
  31978. source: "position: aPosition\x0a\x09position := aPosition",
  31979. referencedClasses: [],
  31980. messageSends: []
  31981. }),
  31982. $globals.Node);
  31983. $core.addMethod(
  31984. $core.method({
  31985. selector: "positionEnd",
  31986. protocol: 'accessing',
  31987. fn: function (){
  31988. var self=this;
  31989. return $core.withContext(function($ctx1) {
  31990. var $2,$7,$6,$5,$4,$3,$1;
  31991. $2=self._positionStart();
  31992. $7=self._source();
  31993. $ctx1.sendIdx["source"]=1;
  31994. $6=$recv($7)._lines();
  31995. $ctx1.sendIdx["lines"]=1;
  31996. $5=$recv($6)._size();
  31997. $ctx1.sendIdx["size"]=1;
  31998. $4=$recv($5).__minus((1));
  31999. $ctx1.sendIdx["-"]=1;
  32000. $3=$recv($4).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  32001. $1=$recv($2).__plus($3);
  32002. return $1;
  32003. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)});
  32004. },
  32005. args: [],
  32006. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  32007. referencedClasses: [],
  32008. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  32009. }),
  32010. $globals.Node);
  32011. $core.addMethod(
  32012. $core.method({
  32013. selector: "positionStart",
  32014. protocol: 'accessing',
  32015. fn: function (){
  32016. var self=this;
  32017. return $core.withContext(function($ctx1) {
  32018. var $1;
  32019. $1=self._position();
  32020. return $1;
  32021. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)});
  32022. },
  32023. args: [],
  32024. source: "positionStart\x0a\x09^ self position",
  32025. referencedClasses: [],
  32026. messageSends: ["position"]
  32027. }),
  32028. $globals.Node);
  32029. $core.addMethod(
  32030. $core.method({
  32031. selector: "postCopy",
  32032. protocol: 'copying',
  32033. fn: function (){
  32034. var self=this;
  32035. return $core.withContext(function($ctx1) {
  32036. (
  32037. $ctx1.supercall = true,
  32038. $globals.Node.superclass.fn.prototype._postCopy.apply($recv(self), []));
  32039. $ctx1.supercall = false;
  32040. $recv(self._nodes())._do_((function(each){
  32041. return $core.withContext(function($ctx2) {
  32042. return $recv(each)._parent_(self);
  32043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32044. }));
  32045. return self;
  32046. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)});
  32047. },
  32048. args: [],
  32049. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  32050. referencedClasses: [],
  32051. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  32052. }),
  32053. $globals.Node);
  32054. $core.addMethod(
  32055. $core.method({
  32056. selector: "requiresSmalltalkContext",
  32057. protocol: 'testing',
  32058. fn: function (){
  32059. var self=this;
  32060. return $core.withContext(function($ctx1) {
  32061. var $1;
  32062. $1=$recv($recv(self._nodes())._detect_ifNone_((function(each){
  32063. return $core.withContext(function($ctx2) {
  32064. return $recv(each)._requiresSmalltalkContext();
  32065. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32066. }),(function(){
  32067. return nil;
  32068. })))._notNil();
  32069. return $1;
  32070. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)});
  32071. },
  32072. args: [],
  32073. 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",
  32074. referencedClasses: [],
  32075. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  32076. }),
  32077. $globals.Node);
  32078. $core.addMethod(
  32079. $core.method({
  32080. selector: "shouldBeAliased",
  32081. protocol: 'accessing',
  32082. fn: function (){
  32083. var self=this;
  32084. return $core.withContext(function($ctx1) {
  32085. var $2,$1,$receiver;
  32086. $2=self["@shouldBeAliased"];
  32087. if(($receiver = $2) == null || $receiver.isNil){
  32088. $1=false;
  32089. } else {
  32090. $1=$2;
  32091. };
  32092. return $1;
  32093. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)});
  32094. },
  32095. args: [],
  32096. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  32097. referencedClasses: [],
  32098. messageSends: ["ifNil:"]
  32099. }),
  32100. $globals.Node);
  32101. $core.addMethod(
  32102. $core.method({
  32103. selector: "shouldBeAliased:",
  32104. protocol: 'accessing',
  32105. fn: function (aBoolean){
  32106. var self=this;
  32107. self["@shouldBeAliased"]=aBoolean;
  32108. return self;
  32109. },
  32110. args: ["aBoolean"],
  32111. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  32112. referencedClasses: [],
  32113. messageSends: []
  32114. }),
  32115. $globals.Node);
  32116. $core.addMethod(
  32117. $core.method({
  32118. selector: "shouldBeInlined",
  32119. protocol: 'accessing',
  32120. fn: function (){
  32121. var self=this;
  32122. return $core.withContext(function($ctx1) {
  32123. var $2,$1,$receiver;
  32124. $2=self["@shouldBeInlined"];
  32125. if(($receiver = $2) == null || $receiver.isNil){
  32126. $1=false;
  32127. } else {
  32128. $1=$2;
  32129. };
  32130. return $1;
  32131. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)});
  32132. },
  32133. args: [],
  32134. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  32135. referencedClasses: [],
  32136. messageSends: ["ifNil:"]
  32137. }),
  32138. $globals.Node);
  32139. $core.addMethod(
  32140. $core.method({
  32141. selector: "shouldBeInlined:",
  32142. protocol: 'accessing',
  32143. fn: function (aBoolean){
  32144. var self=this;
  32145. self["@shouldBeInlined"]=aBoolean;
  32146. return self;
  32147. },
  32148. args: ["aBoolean"],
  32149. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  32150. referencedClasses: [],
  32151. messageSends: []
  32152. }),
  32153. $globals.Node);
  32154. $core.addMethod(
  32155. $core.method({
  32156. selector: "size",
  32157. protocol: 'accessing',
  32158. fn: function (){
  32159. var self=this;
  32160. return $core.withContext(function($ctx1) {
  32161. var $1;
  32162. $1=$recv(self._source())._size();
  32163. return $1;
  32164. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)});
  32165. },
  32166. args: [],
  32167. source: "size\x0a\x09^ self source size",
  32168. referencedClasses: [],
  32169. messageSends: ["size", "source"]
  32170. }),
  32171. $globals.Node);
  32172. $core.addMethod(
  32173. $core.method({
  32174. selector: "source",
  32175. protocol: 'accessing',
  32176. fn: function (){
  32177. var self=this;
  32178. return $core.withContext(function($ctx1) {
  32179. var $2,$1,$receiver;
  32180. $2=self["@source"];
  32181. if(($receiver = $2) == null || $receiver.isNil){
  32182. $1="";
  32183. } else {
  32184. $1=$2;
  32185. };
  32186. return $1;
  32187. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)});
  32188. },
  32189. args: [],
  32190. source: "source\x0a\x09^ source ifNil: [ '' ]",
  32191. referencedClasses: [],
  32192. messageSends: ["ifNil:"]
  32193. }),
  32194. $globals.Node);
  32195. $core.addMethod(
  32196. $core.method({
  32197. selector: "source:",
  32198. protocol: 'accessing',
  32199. fn: function (aString){
  32200. var self=this;
  32201. self["@source"]=aString;
  32202. return self;
  32203. },
  32204. args: ["aString"],
  32205. source: "source: aString\x0a\x09source := aString",
  32206. referencedClasses: [],
  32207. messageSends: []
  32208. }),
  32209. $globals.Node);
  32210. $core.addMethod(
  32211. $core.method({
  32212. selector: "stopOnStepping",
  32213. protocol: 'testing',
  32214. fn: function (){
  32215. var self=this;
  32216. return false;
  32217. },
  32218. args: [],
  32219. source: "stopOnStepping\x0a\x09^ false",
  32220. referencedClasses: [],
  32221. messageSends: []
  32222. }),
  32223. $globals.Node);
  32224. $core.addMethod(
  32225. $core.method({
  32226. selector: "subtreeNeedsAliasing",
  32227. protocol: 'testing',
  32228. fn: function (){
  32229. var self=this;
  32230. return $core.withContext(function($ctx1) {
  32231. var $1;
  32232. $1=$recv($recv(self._shouldBeAliased())._or_((function(){
  32233. return $core.withContext(function($ctx2) {
  32234. return self._shouldBeInlined();
  32235. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32236. })))._or_((function(){
  32237. return $core.withContext(function($ctx2) {
  32238. return $recv(self._nodes())._anySatisfy_((function(each){
  32239. return $core.withContext(function($ctx3) {
  32240. return $recv(each)._subtreeNeedsAliasing();
  32241. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  32242. }));
  32243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  32244. }));
  32245. $ctx1.sendIdx["or:"]=1;
  32246. return $1;
  32247. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)});
  32248. },
  32249. args: [],
  32250. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  32251. referencedClasses: [],
  32252. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  32253. }),
  32254. $globals.Node);
  32255. $core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST');
  32256. $globals.AssignmentNode.comment="I represent an assignment node.";
  32257. $core.addMethod(
  32258. $core.method({
  32259. selector: "accept:",
  32260. protocol: 'visiting',
  32261. fn: function (aVisitor){
  32262. var self=this;
  32263. return $core.withContext(function($ctx1) {
  32264. var $1;
  32265. $1=$recv(aVisitor)._visitAssignmentNode_(self);
  32266. return $1;
  32267. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  32268. },
  32269. args: ["aVisitor"],
  32270. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  32271. referencedClasses: [],
  32272. messageSends: ["visitAssignmentNode:"]
  32273. }),
  32274. $globals.AssignmentNode);
  32275. $core.addMethod(
  32276. $core.method({
  32277. selector: "isAssignmentNode",
  32278. protocol: 'testing',
  32279. fn: function (){
  32280. var self=this;
  32281. return true;
  32282. },
  32283. args: [],
  32284. source: "isAssignmentNode\x0a\x09^ true",
  32285. referencedClasses: [],
  32286. messageSends: []
  32287. }),
  32288. $globals.AssignmentNode);
  32289. $core.addMethod(
  32290. $core.method({
  32291. selector: "left",
  32292. protocol: 'accessing',
  32293. fn: function (){
  32294. var self=this;
  32295. var $1;
  32296. $1=self["@left"];
  32297. return $1;
  32298. },
  32299. args: [],
  32300. source: "left\x0a\x09^ left",
  32301. referencedClasses: [],
  32302. messageSends: []
  32303. }),
  32304. $globals.AssignmentNode);
  32305. $core.addMethod(
  32306. $core.method({
  32307. selector: "left:",
  32308. protocol: 'accessing',
  32309. fn: function (aNode){
  32310. var self=this;
  32311. return $core.withContext(function($ctx1) {
  32312. self["@left"]=aNode;
  32313. $recv(aNode)._parent_(self);
  32314. return self;
  32315. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)});
  32316. },
  32317. args: ["aNode"],
  32318. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  32319. referencedClasses: [],
  32320. messageSends: ["parent:"]
  32321. }),
  32322. $globals.AssignmentNode);
  32323. $core.addMethod(
  32324. $core.method({
  32325. selector: "nodes",
  32326. protocol: 'accessing',
  32327. fn: function (){
  32328. var self=this;
  32329. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  32330. return $core.withContext(function($ctx1) {
  32331. var $1;
  32332. $1=$recv($Array())._with_with_(self._left(),self._right());
  32333. return $1;
  32334. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)});
  32335. },
  32336. args: [],
  32337. source: "nodes\x0a\x09^ Array with: self left with: self right",
  32338. referencedClasses: ["Array"],
  32339. messageSends: ["with:with:", "left", "right"]
  32340. }),
  32341. $globals.AssignmentNode);
  32342. $core.addMethod(
  32343. $core.method({
  32344. selector: "right",
  32345. protocol: 'accessing',
  32346. fn: function (){
  32347. var self=this;
  32348. var $1;
  32349. $1=self["@right"];
  32350. return $1;
  32351. },
  32352. args: [],
  32353. source: "right\x0a\x09^ right",
  32354. referencedClasses: [],
  32355. messageSends: []
  32356. }),
  32357. $globals.AssignmentNode);
  32358. $core.addMethod(
  32359. $core.method({
  32360. selector: "right:",
  32361. protocol: 'accessing',
  32362. fn: function (aNode){
  32363. var self=this;
  32364. return $core.withContext(function($ctx1) {
  32365. self["@right"]=aNode;
  32366. $recv(aNode)._parent_(self);
  32367. return self;
  32368. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)});
  32369. },
  32370. args: ["aNode"],
  32371. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  32372. referencedClasses: [],
  32373. messageSends: ["parent:"]
  32374. }),
  32375. $globals.AssignmentNode);
  32376. $core.addMethod(
  32377. $core.method({
  32378. selector: "shouldBeAliased",
  32379. protocol: 'testing',
  32380. fn: function (){
  32381. var self=this;
  32382. return $core.withContext(function($ctx1) {
  32383. var $2,$1;
  32384. $2=(
  32385. $ctx1.supercall = true,
  32386. $globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
  32387. $ctx1.supercall = false;
  32388. $1=$recv($2)._or_((function(){
  32389. return $core.withContext(function($ctx2) {
  32390. return self._isReferenced();
  32391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32392. }));
  32393. return $1;
  32394. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  32395. },
  32396. args: [],
  32397. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  32398. referencedClasses: [],
  32399. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  32400. }),
  32401. $globals.AssignmentNode);
  32402. $core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  32403. $globals.BlockNode.comment="I represent an block closure node.";
  32404. $core.addMethod(
  32405. $core.method({
  32406. selector: "accept:",
  32407. protocol: 'visiting',
  32408. fn: function (aVisitor){
  32409. var self=this;
  32410. return $core.withContext(function($ctx1) {
  32411. var $1;
  32412. $1=$recv(aVisitor)._visitBlockNode_(self);
  32413. return $1;
  32414. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)});
  32415. },
  32416. args: ["aVisitor"],
  32417. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  32418. referencedClasses: [],
  32419. messageSends: ["visitBlockNode:"]
  32420. }),
  32421. $globals.BlockNode);
  32422. $core.addMethod(
  32423. $core.method({
  32424. selector: "isBlockNode",
  32425. protocol: 'testing',
  32426. fn: function (){
  32427. var self=this;
  32428. return true;
  32429. },
  32430. args: [],
  32431. source: "isBlockNode\x0a\x09^ true",
  32432. referencedClasses: [],
  32433. messageSends: []
  32434. }),
  32435. $globals.BlockNode);
  32436. $core.addMethod(
  32437. $core.method({
  32438. selector: "nextChild",
  32439. protocol: 'accessing',
  32440. fn: function (){
  32441. var self=this;
  32442. return self;
  32443. },
  32444. args: [],
  32445. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  32446. referencedClasses: [],
  32447. messageSends: []
  32448. }),
  32449. $globals.BlockNode);
  32450. $core.addMethod(
  32451. $core.method({
  32452. selector: "nextNode:",
  32453. protocol: 'accessing',
  32454. fn: function (aNode){
  32455. var self=this;
  32456. return self;
  32457. },
  32458. args: ["aNode"],
  32459. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  32460. referencedClasses: [],
  32461. messageSends: []
  32462. }),
  32463. $globals.BlockNode);
  32464. $core.addMethod(
  32465. $core.method({
  32466. selector: "parameters",
  32467. protocol: 'accessing',
  32468. fn: function (){
  32469. var self=this;
  32470. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  32471. return $core.withContext(function($ctx1) {
  32472. var $2,$1,$receiver;
  32473. $2=self["@parameters"];
  32474. if(($receiver = $2) == null || $receiver.isNil){
  32475. self["@parameters"]=$recv($Array())._new();
  32476. $1=self["@parameters"];
  32477. } else {
  32478. $1=$2;
  32479. };
  32480. return $1;
  32481. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  32482. },
  32483. args: [],
  32484. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  32485. referencedClasses: ["Array"],
  32486. messageSends: ["ifNil:", "new"]
  32487. }),
  32488. $globals.BlockNode);
  32489. $core.addMethod(
  32490. $core.method({
  32491. selector: "parameters:",
  32492. protocol: 'accessing',
  32493. fn: function (aCollection){
  32494. var self=this;
  32495. self["@parameters"]=aCollection;
  32496. return self;
  32497. },
  32498. args: ["aCollection"],
  32499. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  32500. referencedClasses: [],
  32501. messageSends: []
  32502. }),
  32503. $globals.BlockNode);
  32504. $core.addMethod(
  32505. $core.method({
  32506. selector: "scope",
  32507. protocol: 'accessing',
  32508. fn: function (){
  32509. var self=this;
  32510. var $1;
  32511. $1=self["@scope"];
  32512. return $1;
  32513. },
  32514. args: [],
  32515. source: "scope\x0a\x09^ scope",
  32516. referencedClasses: [],
  32517. messageSends: []
  32518. }),
  32519. $globals.BlockNode);
  32520. $core.addMethod(
  32521. $core.method({
  32522. selector: "scope:",
  32523. protocol: 'accessing',
  32524. fn: function (aLexicalScope){
  32525. var self=this;
  32526. self["@scope"]=aLexicalScope;
  32527. return self;
  32528. },
  32529. args: ["aLexicalScope"],
  32530. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32531. referencedClasses: [],
  32532. messageSends: []
  32533. }),
  32534. $globals.BlockNode);
  32535. $core.addMethod(
  32536. $core.method({
  32537. selector: "subtreeNeedsAliasing",
  32538. protocol: 'testing',
  32539. fn: function (){
  32540. var self=this;
  32541. return $core.withContext(function($ctx1) {
  32542. var $1;
  32543. $1=$recv(self._shouldBeAliased())._or_((function(){
  32544. return $core.withContext(function($ctx2) {
  32545. return self._shouldBeInlined();
  32546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32547. }));
  32548. return $1;
  32549. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  32550. },
  32551. args: [],
  32552. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  32553. referencedClasses: [],
  32554. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  32555. }),
  32556. $globals.BlockNode);
  32557. $core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST');
  32558. $globals.CascadeNode.comment="I represent an cascade node.";
  32559. $core.addMethod(
  32560. $core.method({
  32561. selector: "accept:",
  32562. protocol: 'visiting',
  32563. fn: function (aVisitor){
  32564. var self=this;
  32565. return $core.withContext(function($ctx1) {
  32566. var $1;
  32567. $1=$recv(aVisitor)._visitCascadeNode_(self);
  32568. return $1;
  32569. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)});
  32570. },
  32571. args: ["aVisitor"],
  32572. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  32573. referencedClasses: [],
  32574. messageSends: ["visitCascadeNode:"]
  32575. }),
  32576. $globals.CascadeNode);
  32577. $core.addMethod(
  32578. $core.method({
  32579. selector: "isCascadeNode",
  32580. protocol: 'testing',
  32581. fn: function (){
  32582. var self=this;
  32583. return true;
  32584. },
  32585. args: [],
  32586. source: "isCascadeNode\x0a\x09^ true",
  32587. referencedClasses: [],
  32588. messageSends: []
  32589. }),
  32590. $globals.CascadeNode);
  32591. $core.addMethod(
  32592. $core.method({
  32593. selector: "receiver",
  32594. protocol: 'accessing',
  32595. fn: function (){
  32596. var self=this;
  32597. var $1;
  32598. $1=self["@receiver"];
  32599. return $1;
  32600. },
  32601. args: [],
  32602. source: "receiver\x0a\x09^ receiver",
  32603. referencedClasses: [],
  32604. messageSends: []
  32605. }),
  32606. $globals.CascadeNode);
  32607. $core.addMethod(
  32608. $core.method({
  32609. selector: "receiver:",
  32610. protocol: 'accessing',
  32611. fn: function (aNode){
  32612. var self=this;
  32613. self["@receiver"]=aNode;
  32614. return self;
  32615. },
  32616. args: ["aNode"],
  32617. source: "receiver: aNode\x0a\x09receiver := aNode",
  32618. referencedClasses: [],
  32619. messageSends: []
  32620. }),
  32621. $globals.CascadeNode);
  32622. $core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST');
  32623. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  32624. $core.addMethod(
  32625. $core.method({
  32626. selector: "accept:",
  32627. protocol: 'visiting',
  32628. fn: function (aVisitor){
  32629. var self=this;
  32630. return $core.withContext(function($ctx1) {
  32631. var $1;
  32632. $1=$recv(aVisitor)._visitDynamicArrayNode_(self);
  32633. return $1;
  32634. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  32635. },
  32636. args: ["aVisitor"],
  32637. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  32638. referencedClasses: [],
  32639. messageSends: ["visitDynamicArrayNode:"]
  32640. }),
  32641. $globals.DynamicArrayNode);
  32642. $core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST');
  32643. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  32644. $core.addMethod(
  32645. $core.method({
  32646. selector: "accept:",
  32647. protocol: 'visiting',
  32648. fn: function (aVisitor){
  32649. var self=this;
  32650. return $core.withContext(function($ctx1) {
  32651. var $1;
  32652. $1=$recv(aVisitor)._visitDynamicDictionaryNode_(self);
  32653. return $1;
  32654. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  32655. },
  32656. args: ["aVisitor"],
  32657. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  32658. referencedClasses: [],
  32659. messageSends: ["visitDynamicDictionaryNode:"]
  32660. }),
  32661. $globals.DynamicDictionaryNode);
  32662. $core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST');
  32663. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  32664. $core.addMethod(
  32665. $core.method({
  32666. selector: "accept:",
  32667. protocol: 'visiting',
  32668. fn: function (aVisitor){
  32669. var self=this;
  32670. return $core.withContext(function($ctx1) {
  32671. var $1;
  32672. $1=$recv(aVisitor)._visitJSStatementNode_(self);
  32673. return $1;
  32674. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  32675. },
  32676. args: ["aVisitor"],
  32677. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  32678. referencedClasses: [],
  32679. messageSends: ["visitJSStatementNode:"]
  32680. }),
  32681. $globals.JSStatementNode);
  32682. $core.addMethod(
  32683. $core.method({
  32684. selector: "isJSStatementNode",
  32685. protocol: 'testing',
  32686. fn: function (){
  32687. var self=this;
  32688. return true;
  32689. },
  32690. args: [],
  32691. source: "isJSStatementNode\x0a\x09^ true",
  32692. referencedClasses: [],
  32693. messageSends: []
  32694. }),
  32695. $globals.JSStatementNode);
  32696. $core.addMethod(
  32697. $core.method({
  32698. selector: "requiresSmalltalkContext",
  32699. protocol: 'testing',
  32700. fn: function (){
  32701. var self=this;
  32702. return true;
  32703. },
  32704. args: [],
  32705. source: "requiresSmalltalkContext\x0a\x09^ true",
  32706. referencedClasses: [],
  32707. messageSends: []
  32708. }),
  32709. $globals.JSStatementNode);
  32710. $core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
  32711. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  32712. $core.addMethod(
  32713. $core.method({
  32714. selector: "accept:",
  32715. protocol: 'visiting',
  32716. fn: function (aVisitor){
  32717. var self=this;
  32718. return $core.withContext(function($ctx1) {
  32719. var $1;
  32720. $1=$recv(aVisitor)._visitMethodNode_(self);
  32721. return $1;
  32722. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)});
  32723. },
  32724. args: ["aVisitor"],
  32725. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  32726. referencedClasses: [],
  32727. messageSends: ["visitMethodNode:"]
  32728. }),
  32729. $globals.MethodNode);
  32730. $core.addMethod(
  32731. $core.method({
  32732. selector: "arguments",
  32733. protocol: 'accessing',
  32734. fn: function (){
  32735. var self=this;
  32736. return $core.withContext(function($ctx1) {
  32737. var $2,$1,$receiver;
  32738. $2=self["@arguments"];
  32739. if(($receiver = $2) == null || $receiver.isNil){
  32740. $1=[];
  32741. } else {
  32742. $1=$2;
  32743. };
  32744. return $1;
  32745. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  32746. },
  32747. args: [],
  32748. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  32749. referencedClasses: [],
  32750. messageSends: ["ifNil:"]
  32751. }),
  32752. $globals.MethodNode);
  32753. $core.addMethod(
  32754. $core.method({
  32755. selector: "arguments:",
  32756. protocol: 'accessing',
  32757. fn: function (aCollection){
  32758. var self=this;
  32759. self["@arguments"]=aCollection;
  32760. return self;
  32761. },
  32762. args: ["aCollection"],
  32763. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  32764. referencedClasses: [],
  32765. messageSends: []
  32766. }),
  32767. $globals.MethodNode);
  32768. $core.addMethod(
  32769. $core.method({
  32770. selector: "classReferences",
  32771. protocol: 'accessing',
  32772. fn: function (){
  32773. var self=this;
  32774. var $1;
  32775. $1=self["@classReferences"];
  32776. return $1;
  32777. },
  32778. args: [],
  32779. source: "classReferences\x0a\x09^ classReferences",
  32780. referencedClasses: [],
  32781. messageSends: []
  32782. }),
  32783. $globals.MethodNode);
  32784. $core.addMethod(
  32785. $core.method({
  32786. selector: "classReferences:",
  32787. protocol: 'accessing',
  32788. fn: function (aCollection){
  32789. var self=this;
  32790. self["@classReferences"]=aCollection;
  32791. return self;
  32792. },
  32793. args: ["aCollection"],
  32794. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  32795. referencedClasses: [],
  32796. messageSends: []
  32797. }),
  32798. $globals.MethodNode);
  32799. $core.addMethod(
  32800. $core.method({
  32801. selector: "messageSends",
  32802. protocol: 'accessing',
  32803. fn: function (){
  32804. var self=this;
  32805. return $core.withContext(function($ctx1) {
  32806. var $1;
  32807. $1=$recv(self._sendIndexes())._keys();
  32808. return $1;
  32809. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  32810. },
  32811. args: [],
  32812. source: "messageSends\x0a\x09^ self sendIndexes keys",
  32813. referencedClasses: [],
  32814. messageSends: ["keys", "sendIndexes"]
  32815. }),
  32816. $globals.MethodNode);
  32817. $core.addMethod(
  32818. $core.method({
  32819. selector: "method",
  32820. protocol: 'accessing',
  32821. fn: function (){
  32822. var self=this;
  32823. return self;
  32824. },
  32825. args: [],
  32826. source: "method\x0a\x09^ self",
  32827. referencedClasses: [],
  32828. messageSends: []
  32829. }),
  32830. $globals.MethodNode);
  32831. $core.addMethod(
  32832. $core.method({
  32833. selector: "scope",
  32834. protocol: 'accessing',
  32835. fn: function (){
  32836. var self=this;
  32837. var $1;
  32838. $1=self["@scope"];
  32839. return $1;
  32840. },
  32841. args: [],
  32842. source: "scope\x0a\x09^ scope",
  32843. referencedClasses: [],
  32844. messageSends: []
  32845. }),
  32846. $globals.MethodNode);
  32847. $core.addMethod(
  32848. $core.method({
  32849. selector: "scope:",
  32850. protocol: 'accessing',
  32851. fn: function (aMethodScope){
  32852. var self=this;
  32853. self["@scope"]=aMethodScope;
  32854. return self;
  32855. },
  32856. args: ["aMethodScope"],
  32857. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  32858. referencedClasses: [],
  32859. messageSends: []
  32860. }),
  32861. $globals.MethodNode);
  32862. $core.addMethod(
  32863. $core.method({
  32864. selector: "selector",
  32865. protocol: 'accessing',
  32866. fn: function (){
  32867. var self=this;
  32868. var $1;
  32869. $1=self["@selector"];
  32870. return $1;
  32871. },
  32872. args: [],
  32873. source: "selector\x0a\x09^ selector",
  32874. referencedClasses: [],
  32875. messageSends: []
  32876. }),
  32877. $globals.MethodNode);
  32878. $core.addMethod(
  32879. $core.method({
  32880. selector: "selector:",
  32881. protocol: 'accessing',
  32882. fn: function (aString){
  32883. var self=this;
  32884. self["@selector"]=aString;
  32885. return self;
  32886. },
  32887. args: ["aString"],
  32888. source: "selector: aString\x0a\x09selector := aString",
  32889. referencedClasses: [],
  32890. messageSends: []
  32891. }),
  32892. $globals.MethodNode);
  32893. $core.addMethod(
  32894. $core.method({
  32895. selector: "sendIndexes",
  32896. protocol: 'accessing',
  32897. fn: function (){
  32898. var self=this;
  32899. var $1;
  32900. $1=self["@sendIndexes"];
  32901. return $1;
  32902. },
  32903. args: [],
  32904. source: "sendIndexes\x0a\x09^ sendIndexes",
  32905. referencedClasses: [],
  32906. messageSends: []
  32907. }),
  32908. $globals.MethodNode);
  32909. $core.addMethod(
  32910. $core.method({
  32911. selector: "sendIndexes:",
  32912. protocol: 'accessing',
  32913. fn: function (aDictionary){
  32914. var self=this;
  32915. self["@sendIndexes"]=aDictionary;
  32916. return self;
  32917. },
  32918. args: ["aDictionary"],
  32919. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  32920. referencedClasses: [],
  32921. messageSends: []
  32922. }),
  32923. $globals.MethodNode);
  32924. $core.addMethod(
  32925. $core.method({
  32926. selector: "sequenceNode",
  32927. protocol: 'accessing',
  32928. fn: function (){
  32929. var self=this;
  32930. return $core.withContext(function($ctx1) {
  32931. var $1;
  32932. var $early={};
  32933. try {
  32934. $recv(self._nodes())._do_((function(each){
  32935. return $core.withContext(function($ctx2) {
  32936. $1=$recv(each)._isSequenceNode();
  32937. if($core.assert($1)){
  32938. throw $early=[each];
  32939. };
  32940. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32941. }));
  32942. return nil;
  32943. }
  32944. catch(e) {if(e===$early)return e[0]; throw e}
  32945. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  32946. },
  32947. args: [],
  32948. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  32949. referencedClasses: [],
  32950. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  32951. }),
  32952. $globals.MethodNode);
  32953. $core.addMethod(
  32954. $core.method({
  32955. selector: "source",
  32956. protocol: 'accessing',
  32957. fn: function (){
  32958. var self=this;
  32959. var $1;
  32960. $1=self["@source"];
  32961. return $1;
  32962. },
  32963. args: [],
  32964. source: "source\x0a\x09^ source",
  32965. referencedClasses: [],
  32966. messageSends: []
  32967. }),
  32968. $globals.MethodNode);
  32969. $core.addMethod(
  32970. $core.method({
  32971. selector: "source:",
  32972. protocol: 'accessing',
  32973. fn: function (aString){
  32974. var self=this;
  32975. self["@source"]=aString;
  32976. return self;
  32977. },
  32978. args: ["aString"],
  32979. source: "source: aString\x0a\x09source := aString",
  32980. referencedClasses: [],
  32981. messageSends: []
  32982. }),
  32983. $globals.MethodNode);
  32984. $core.addMethod(
  32985. $core.method({
  32986. selector: "superSends",
  32987. protocol: 'accessing',
  32988. fn: function (){
  32989. var self=this;
  32990. var $1;
  32991. $1=self["@superSends"];
  32992. return $1;
  32993. },
  32994. args: [],
  32995. source: "superSends\x0a\x09^ superSends",
  32996. referencedClasses: [],
  32997. messageSends: []
  32998. }),
  32999. $globals.MethodNode);
  33000. $core.addMethod(
  33001. $core.method({
  33002. selector: "superSends:",
  33003. protocol: 'accessing',
  33004. fn: function (aCollection){
  33005. var self=this;
  33006. self["@superSends"]=aCollection;
  33007. return self;
  33008. },
  33009. args: ["aCollection"],
  33010. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  33011. referencedClasses: [],
  33012. messageSends: []
  33013. }),
  33014. $globals.MethodNode);
  33015. $core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST');
  33016. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  33017. $core.addMethod(
  33018. $core.method({
  33019. selector: "accept:",
  33020. protocol: 'visiting',
  33021. fn: function (aVisitor){
  33022. var self=this;
  33023. return $core.withContext(function($ctx1) {
  33024. var $1;
  33025. $1=$recv(aVisitor)._visitReturnNode_(self);
  33026. return $1;
  33027. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)});
  33028. },
  33029. args: ["aVisitor"],
  33030. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  33031. referencedClasses: [],
  33032. messageSends: ["visitReturnNode:"]
  33033. }),
  33034. $globals.ReturnNode);
  33035. $core.addMethod(
  33036. $core.method({
  33037. selector: "isReturnNode",
  33038. protocol: 'testing',
  33039. fn: function (){
  33040. var self=this;
  33041. return true;
  33042. },
  33043. args: [],
  33044. source: "isReturnNode\x0a\x09^ true",
  33045. referencedClasses: [],
  33046. messageSends: []
  33047. }),
  33048. $globals.ReturnNode);
  33049. $core.addMethod(
  33050. $core.method({
  33051. selector: "nonLocalReturn",
  33052. protocol: 'testing',
  33053. fn: function (){
  33054. var self=this;
  33055. return $core.withContext(function($ctx1) {
  33056. var $1;
  33057. $1=$recv($recv(self._scope())._isMethodScope())._not();
  33058. return $1;
  33059. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  33060. },
  33061. args: [],
  33062. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  33063. referencedClasses: [],
  33064. messageSends: ["not", "isMethodScope", "scope"]
  33065. }),
  33066. $globals.ReturnNode);
  33067. $core.addMethod(
  33068. $core.method({
  33069. selector: "scope",
  33070. protocol: 'accessing',
  33071. fn: function (){
  33072. var self=this;
  33073. var $1;
  33074. $1=self["@scope"];
  33075. return $1;
  33076. },
  33077. args: [],
  33078. source: "scope\x0a\x09^ scope",
  33079. referencedClasses: [],
  33080. messageSends: []
  33081. }),
  33082. $globals.ReturnNode);
  33083. $core.addMethod(
  33084. $core.method({
  33085. selector: "scope:",
  33086. protocol: 'accessing',
  33087. fn: function (aLexicalScope){
  33088. var self=this;
  33089. self["@scope"]=aLexicalScope;
  33090. return self;
  33091. },
  33092. args: ["aLexicalScope"],
  33093. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33094. referencedClasses: [],
  33095. messageSends: []
  33096. }),
  33097. $globals.ReturnNode);
  33098. $core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  33099. $globals.SendNode.comment="I represent an message send node.";
  33100. $core.addMethod(
  33101. $core.method({
  33102. selector: "accept:",
  33103. protocol: 'visiting',
  33104. fn: function (aVisitor){
  33105. var self=this;
  33106. return $core.withContext(function($ctx1) {
  33107. var $1;
  33108. $1=$recv(aVisitor)._visitSendNode_(self);
  33109. return $1;
  33110. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)});
  33111. },
  33112. args: ["aVisitor"],
  33113. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  33114. referencedClasses: [],
  33115. messageSends: ["visitSendNode:"]
  33116. }),
  33117. $globals.SendNode);
  33118. $core.addMethod(
  33119. $core.method({
  33120. selector: "arguments",
  33121. protocol: 'accessing',
  33122. fn: function (){
  33123. var self=this;
  33124. return $core.withContext(function($ctx1) {
  33125. var $2,$1,$receiver;
  33126. $2=self["@arguments"];
  33127. if(($receiver = $2) == null || $receiver.isNil){
  33128. self["@arguments"]=[];
  33129. $1=self["@arguments"];
  33130. } else {
  33131. $1=$2;
  33132. };
  33133. return $1;
  33134. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  33135. },
  33136. args: [],
  33137. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  33138. referencedClasses: [],
  33139. messageSends: ["ifNil:"]
  33140. }),
  33141. $globals.SendNode);
  33142. $core.addMethod(
  33143. $core.method({
  33144. selector: "arguments:",
  33145. protocol: 'accessing',
  33146. fn: function (aCollection){
  33147. var self=this;
  33148. return $core.withContext(function($ctx1) {
  33149. self["@arguments"]=aCollection;
  33150. $recv(aCollection)._do_((function(each){
  33151. return $core.withContext(function($ctx2) {
  33152. return $recv(each)._parent_(self);
  33153. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33154. }));
  33155. return self;
  33156. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)});
  33157. },
  33158. args: ["aCollection"],
  33159. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  33160. referencedClasses: [],
  33161. messageSends: ["do:", "parent:"]
  33162. }),
  33163. $globals.SendNode);
  33164. $core.addMethod(
  33165. $core.method({
  33166. selector: "cascadeNodeWithMessages:",
  33167. protocol: 'accessing',
  33168. fn: function (aCollection){
  33169. var self=this;
  33170. var first;
  33171. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  33172. function $CascadeNode(){return $globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  33173. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  33174. return $core.withContext(function($ctx1) {
  33175. var $1,$2,$4,$5,$3;
  33176. $1=$recv($SendNode())._new();
  33177. $ctx1.sendIdx["new"]=1;
  33178. $recv($1)._selector_(self._selector());
  33179. $recv($1)._arguments_(self._arguments());
  33180. $2=$recv($1)._yourself();
  33181. $ctx1.sendIdx["yourself"]=1;
  33182. first=$2;
  33183. $4=$recv($CascadeNode())._new();
  33184. $recv($4)._receiver_(self._receiver());
  33185. $recv($4)._nodes_($recv($recv($Array())._with_(first)).__comma(aCollection));
  33186. $5=$recv($4)._yourself();
  33187. $3=$5;
  33188. return $3;
  33189. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)});
  33190. },
  33191. args: ["aCollection"],
  33192. 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",
  33193. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  33194. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  33195. }),
  33196. $globals.SendNode);
  33197. $core.addMethod(
  33198. $core.method({
  33199. selector: "index",
  33200. protocol: 'accessing',
  33201. fn: function (){
  33202. var self=this;
  33203. var $1;
  33204. $1=self["@index"];
  33205. return $1;
  33206. },
  33207. args: [],
  33208. source: "index\x0a\x09^ index",
  33209. referencedClasses: [],
  33210. messageSends: []
  33211. }),
  33212. $globals.SendNode);
  33213. $core.addMethod(
  33214. $core.method({
  33215. selector: "index:",
  33216. protocol: 'accessing',
  33217. fn: function (anInteger){
  33218. var self=this;
  33219. self["@index"]=anInteger;
  33220. return self;
  33221. },
  33222. args: ["anInteger"],
  33223. source: "index: anInteger\x0a\x09index := anInteger",
  33224. referencedClasses: [],
  33225. messageSends: []
  33226. }),
  33227. $globals.SendNode);
  33228. $core.addMethod(
  33229. $core.method({
  33230. selector: "isCascadeSendNode",
  33231. protocol: 'testing',
  33232. fn: function (){
  33233. var self=this;
  33234. return $core.withContext(function($ctx1) {
  33235. var $1;
  33236. $1=$recv(self._parent())._isCascadeNode();
  33237. return $1;
  33238. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  33239. },
  33240. args: [],
  33241. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  33242. referencedClasses: [],
  33243. messageSends: ["isCascadeNode", "parent"]
  33244. }),
  33245. $globals.SendNode);
  33246. $core.addMethod(
  33247. $core.method({
  33248. selector: "isNavigationNode",
  33249. protocol: 'testing',
  33250. fn: function (){
  33251. var self=this;
  33252. return true;
  33253. },
  33254. args: [],
  33255. source: "isNavigationNode\x0a\x09^ true",
  33256. referencedClasses: [],
  33257. messageSends: []
  33258. }),
  33259. $globals.SendNode);
  33260. $core.addMethod(
  33261. $core.method({
  33262. selector: "isSendNode",
  33263. protocol: 'testing',
  33264. fn: function (){
  33265. var self=this;
  33266. return true;
  33267. },
  33268. args: [],
  33269. source: "isSendNode\x0a\x09^ true",
  33270. referencedClasses: [],
  33271. messageSends: []
  33272. }),
  33273. $globals.SendNode);
  33274. $core.addMethod(
  33275. $core.method({
  33276. selector: "navigationLink",
  33277. protocol: 'accessing',
  33278. fn: function (){
  33279. var self=this;
  33280. return $core.withContext(function($ctx1) {
  33281. var $1;
  33282. $1=self._selector();
  33283. return $1;
  33284. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  33285. },
  33286. args: [],
  33287. source: "navigationLink\x0a\x09^ self selector",
  33288. referencedClasses: [],
  33289. messageSends: ["selector"]
  33290. }),
  33291. $globals.SendNode);
  33292. $core.addMethod(
  33293. $core.method({
  33294. selector: "nodes",
  33295. protocol: 'accessing',
  33296. fn: function (){
  33297. var self=this;
  33298. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  33299. return $core.withContext(function($ctx1) {
  33300. var $1,$3,$2,$5,$6,$4,$receiver;
  33301. $1=self._receiver();
  33302. $ctx1.sendIdx["receiver"]=1;
  33303. if(($receiver = $1) == null || $receiver.isNil){
  33304. $3=self._arguments();
  33305. $ctx1.sendIdx["arguments"]=1;
  33306. $2=$recv($3)._copy();
  33307. return $2;
  33308. } else {
  33309. $1;
  33310. };
  33311. $5=$recv($Array())._with_(self._receiver());
  33312. $recv($5)._addAll_(self._arguments());
  33313. $6=$recv($5)._yourself();
  33314. $4=$6;
  33315. return $4;
  33316. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)});
  33317. },
  33318. args: [],
  33319. 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",
  33320. referencedClasses: ["Array"],
  33321. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  33322. }),
  33323. $globals.SendNode);
  33324. $core.addMethod(
  33325. $core.method({
  33326. selector: "receiver",
  33327. protocol: 'accessing',
  33328. fn: function (){
  33329. var self=this;
  33330. var $1;
  33331. $1=self["@receiver"];
  33332. return $1;
  33333. },
  33334. args: [],
  33335. source: "receiver\x0a\x09^ receiver",
  33336. referencedClasses: [],
  33337. messageSends: []
  33338. }),
  33339. $globals.SendNode);
  33340. $core.addMethod(
  33341. $core.method({
  33342. selector: "receiver:",
  33343. protocol: 'accessing',
  33344. fn: function (aNode){
  33345. var self=this;
  33346. return $core.withContext(function($ctx1) {
  33347. var $1;
  33348. self["@receiver"]=aNode;
  33349. $1=$recv(aNode)._isNode();
  33350. if($core.assert($1)){
  33351. $recv(aNode)._parent_(self);
  33352. };
  33353. return self;
  33354. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)});
  33355. },
  33356. args: ["aNode"],
  33357. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  33358. referencedClasses: [],
  33359. messageSends: ["ifTrue:", "isNode", "parent:"]
  33360. }),
  33361. $globals.SendNode);
  33362. $core.addMethod(
  33363. $core.method({
  33364. selector: "requiresSmalltalkContext",
  33365. protocol: 'testing',
  33366. fn: function (){
  33367. var self=this;
  33368. return true;
  33369. },
  33370. args: [],
  33371. source: "requiresSmalltalkContext\x0a\x09^ true",
  33372. referencedClasses: [],
  33373. messageSends: []
  33374. }),
  33375. $globals.SendNode);
  33376. $core.addMethod(
  33377. $core.method({
  33378. selector: "selector",
  33379. protocol: 'accessing',
  33380. fn: function (){
  33381. var self=this;
  33382. var $1;
  33383. $1=self["@selector"];
  33384. return $1;
  33385. },
  33386. args: [],
  33387. source: "selector\x0a\x09^ selector",
  33388. referencedClasses: [],
  33389. messageSends: []
  33390. }),
  33391. $globals.SendNode);
  33392. $core.addMethod(
  33393. $core.method({
  33394. selector: "selector:",
  33395. protocol: 'accessing',
  33396. fn: function (aString){
  33397. var self=this;
  33398. self["@selector"]=aString;
  33399. return self;
  33400. },
  33401. args: ["aString"],
  33402. source: "selector: aString\x0a\x09selector := aString",
  33403. referencedClasses: [],
  33404. messageSends: []
  33405. }),
  33406. $globals.SendNode);
  33407. $core.addMethod(
  33408. $core.method({
  33409. selector: "shouldBeAliased",
  33410. protocol: 'testing',
  33411. fn: function (){
  33412. var self=this;
  33413. var sends;
  33414. return $core.withContext(function($ctx1) {
  33415. var $2,$1;
  33416. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  33417. $2=(
  33418. $ctx1.supercall = true,
  33419. $globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
  33420. $ctx1.supercall = false;
  33421. $1=$recv($2)._or_((function(){
  33422. return $core.withContext(function($ctx2) {
  33423. return $recv(self._isReferenced())._and_((function(){
  33424. return $core.withContext(function($ctx3) {
  33425. return $recv($recv($recv(sends).__gt((1)))._and_((function(){
  33426. return $core.withContext(function($ctx4) {
  33427. return $recv(self._index()).__lt(sends);
  33428. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  33429. })))._or_((function(){
  33430. return $core.withContext(function($ctx4) {
  33431. return self._superSend();
  33432. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  33433. }));
  33434. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33435. }));
  33436. $ctx2.sendIdx["and:"]=1;
  33437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33438. }));
  33439. $ctx1.sendIdx["or:"]=1;
  33440. return $1;
  33441. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  33442. },
  33443. args: [],
  33444. 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 ] ] ])",
  33445. referencedClasses: [],
  33446. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
  33447. }),
  33448. $globals.SendNode);
  33449. $core.addMethod(
  33450. $core.method({
  33451. selector: "stopOnStepping",
  33452. protocol: 'testing',
  33453. fn: function (){
  33454. var self=this;
  33455. return true;
  33456. },
  33457. args: [],
  33458. source: "stopOnStepping\x0a\x09^ true",
  33459. referencedClasses: [],
  33460. messageSends: []
  33461. }),
  33462. $globals.SendNode);
  33463. $core.addMethod(
  33464. $core.method({
  33465. selector: "superSend",
  33466. protocol: 'accessing',
  33467. fn: function (){
  33468. var self=this;
  33469. return $core.withContext(function($ctx1) {
  33470. var $2,$1,$receiver;
  33471. $2=self["@superSend"];
  33472. if(($receiver = $2) == null || $receiver.isNil){
  33473. $1=false;
  33474. } else {
  33475. $1=$2;
  33476. };
  33477. return $1;
  33478. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  33479. },
  33480. args: [],
  33481. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  33482. referencedClasses: [],
  33483. messageSends: ["ifNil:"]
  33484. }),
  33485. $globals.SendNode);
  33486. $core.addMethod(
  33487. $core.method({
  33488. selector: "superSend:",
  33489. protocol: 'accessing',
  33490. fn: function (aBoolean){
  33491. var self=this;
  33492. self["@superSend"]=aBoolean;
  33493. return self;
  33494. },
  33495. args: ["aBoolean"],
  33496. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  33497. referencedClasses: [],
  33498. messageSends: []
  33499. }),
  33500. $globals.SendNode);
  33501. $core.addMethod(
  33502. $core.method({
  33503. selector: "valueForReceiver:",
  33504. protocol: 'accessing',
  33505. fn: function (anObject){
  33506. var self=this;
  33507. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  33508. return $core.withContext(function($ctx1) {
  33509. var $2,$3,$5,$4,$6,$1,$receiver;
  33510. $2=$recv($SendNode())._new();
  33511. $recv($2)._position_(self._position());
  33512. $recv($2)._source_(self._source());
  33513. $3=$2;
  33514. $5=self._receiver();
  33515. $ctx1.sendIdx["receiver"]=1;
  33516. if(($receiver = $5) == null || $receiver.isNil){
  33517. $4=anObject;
  33518. } else {
  33519. $4=$recv(self._receiver())._valueForReceiver_(anObject);
  33520. };
  33521. $recv($3)._receiver_($4);
  33522. $recv($2)._selector_(self._selector());
  33523. $recv($2)._arguments_(self._arguments());
  33524. $6=$recv($2)._yourself();
  33525. $1=$6;
  33526. return $1;
  33527. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
  33528. },
  33529. args: ["anObject"],
  33530. 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",
  33531. referencedClasses: ["SendNode"],
  33532. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33533. }),
  33534. $globals.SendNode);
  33535. $core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST');
  33536. $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).";
  33537. $core.addMethod(
  33538. $core.method({
  33539. selector: "accept:",
  33540. protocol: 'visiting',
  33541. fn: function (aVisitor){
  33542. var self=this;
  33543. return $core.withContext(function($ctx1) {
  33544. var $1;
  33545. $1=$recv(aVisitor)._visitSequenceNode_(self);
  33546. return $1;
  33547. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)});
  33548. },
  33549. args: ["aVisitor"],
  33550. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  33551. referencedClasses: [],
  33552. messageSends: ["visitSequenceNode:"]
  33553. }),
  33554. $globals.SequenceNode);
  33555. $core.addMethod(
  33556. $core.method({
  33557. selector: "asBlockSequenceNode",
  33558. protocol: 'converting',
  33559. fn: function (){
  33560. var self=this;
  33561. function $BlockSequenceNode(){return $globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  33562. return $core.withContext(function($ctx1) {
  33563. var $2,$3,$1;
  33564. $2=$recv($BlockSequenceNode())._new();
  33565. $recv($2)._position_(self._position());
  33566. $recv($2)._source_(self._source());
  33567. $recv($2)._nodes_(self._nodes());
  33568. $recv($2)._temps_(self._temps());
  33569. $3=$recv($2)._yourself();
  33570. $1=$3;
  33571. return $1;
  33572. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  33573. },
  33574. args: [],
  33575. 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",
  33576. referencedClasses: ["BlockSequenceNode"],
  33577. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  33578. }),
  33579. $globals.SequenceNode);
  33580. $core.addMethod(
  33581. $core.method({
  33582. selector: "isSequenceNode",
  33583. protocol: 'testing',
  33584. fn: function (){
  33585. var self=this;
  33586. return true;
  33587. },
  33588. args: [],
  33589. source: "isSequenceNode\x0a\x09^ true",
  33590. referencedClasses: [],
  33591. messageSends: []
  33592. }),
  33593. $globals.SequenceNode);
  33594. $core.addMethod(
  33595. $core.method({
  33596. selector: "scope",
  33597. protocol: 'accessing',
  33598. fn: function (){
  33599. var self=this;
  33600. var $1;
  33601. $1=self["@scope"];
  33602. return $1;
  33603. },
  33604. args: [],
  33605. source: "scope\x0a\x09^ scope",
  33606. referencedClasses: [],
  33607. messageSends: []
  33608. }),
  33609. $globals.SequenceNode);
  33610. $core.addMethod(
  33611. $core.method({
  33612. selector: "scope:",
  33613. protocol: 'accessing',
  33614. fn: function (aLexicalScope){
  33615. var self=this;
  33616. self["@scope"]=aLexicalScope;
  33617. return self;
  33618. },
  33619. args: ["aLexicalScope"],
  33620. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33621. referencedClasses: [],
  33622. messageSends: []
  33623. }),
  33624. $globals.SequenceNode);
  33625. $core.addMethod(
  33626. $core.method({
  33627. selector: "temps",
  33628. protocol: 'accessing',
  33629. fn: function (){
  33630. var self=this;
  33631. return $core.withContext(function($ctx1) {
  33632. var $2,$1,$receiver;
  33633. $2=self["@temps"];
  33634. if(($receiver = $2) == null || $receiver.isNil){
  33635. $1=[];
  33636. } else {
  33637. $1=$2;
  33638. };
  33639. return $1;
  33640. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  33641. },
  33642. args: [],
  33643. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  33644. referencedClasses: [],
  33645. messageSends: ["ifNil:"]
  33646. }),
  33647. $globals.SequenceNode);
  33648. $core.addMethod(
  33649. $core.method({
  33650. selector: "temps:",
  33651. protocol: 'accessing',
  33652. fn: function (aCollection){
  33653. var self=this;
  33654. self["@temps"]=aCollection;
  33655. return self;
  33656. },
  33657. args: ["aCollection"],
  33658. source: "temps: aCollection\x0a\x09temps := aCollection",
  33659. referencedClasses: [],
  33660. messageSends: []
  33661. }),
  33662. $globals.SequenceNode);
  33663. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  33664. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  33665. $core.addMethod(
  33666. $core.method({
  33667. selector: "accept:",
  33668. protocol: 'visiting',
  33669. fn: function (aVisitor){
  33670. var self=this;
  33671. return $core.withContext(function($ctx1) {
  33672. var $1;
  33673. $1=$recv(aVisitor)._visitBlockSequenceNode_(self);
  33674. return $1;
  33675. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  33676. },
  33677. args: ["aVisitor"],
  33678. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  33679. referencedClasses: [],
  33680. messageSends: ["visitBlockSequenceNode:"]
  33681. }),
  33682. $globals.BlockSequenceNode);
  33683. $core.addMethod(
  33684. $core.method({
  33685. selector: "isBlockSequenceNode",
  33686. protocol: 'testing',
  33687. fn: function (){
  33688. var self=this;
  33689. return true;
  33690. },
  33691. args: [],
  33692. source: "isBlockSequenceNode\x0a\x09^ true",
  33693. referencedClasses: [],
  33694. messageSends: []
  33695. }),
  33696. $globals.BlockSequenceNode);
  33697. $core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST');
  33698. $globals.ValueNode.comment="I represent a value node.";
  33699. $core.addMethod(
  33700. $core.method({
  33701. selector: "accept:",
  33702. protocol: 'visiting',
  33703. fn: function (aVisitor){
  33704. var self=this;
  33705. return $core.withContext(function($ctx1) {
  33706. var $1;
  33707. $1=$recv(aVisitor)._visitValueNode_(self);
  33708. return $1;
  33709. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)});
  33710. },
  33711. args: ["aVisitor"],
  33712. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  33713. referencedClasses: [],
  33714. messageSends: ["visitValueNode:"]
  33715. }),
  33716. $globals.ValueNode);
  33717. $core.addMethod(
  33718. $core.method({
  33719. selector: "isImmutable",
  33720. protocol: 'testing',
  33721. fn: function (){
  33722. var self=this;
  33723. return $core.withContext(function($ctx1) {
  33724. var $1;
  33725. $1=$recv(self._value())._isImmutable();
  33726. return $1;
  33727. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  33728. },
  33729. args: [],
  33730. source: "isImmutable\x0a\x09^ self value isImmutable",
  33731. referencedClasses: [],
  33732. messageSends: ["isImmutable", "value"]
  33733. }),
  33734. $globals.ValueNode);
  33735. $core.addMethod(
  33736. $core.method({
  33737. selector: "isValueNode",
  33738. protocol: 'testing',
  33739. fn: function (){
  33740. var self=this;
  33741. return true;
  33742. },
  33743. args: [],
  33744. source: "isValueNode\x0a\x09^ true",
  33745. referencedClasses: [],
  33746. messageSends: []
  33747. }),
  33748. $globals.ValueNode);
  33749. $core.addMethod(
  33750. $core.method({
  33751. selector: "value",
  33752. protocol: 'accessing',
  33753. fn: function (){
  33754. var self=this;
  33755. var $1;
  33756. $1=self["@value"];
  33757. return $1;
  33758. },
  33759. args: [],
  33760. source: "value\x0a\x09^ value",
  33761. referencedClasses: [],
  33762. messageSends: []
  33763. }),
  33764. $globals.ValueNode);
  33765. $core.addMethod(
  33766. $core.method({
  33767. selector: "value:",
  33768. protocol: 'accessing',
  33769. fn: function (anObject){
  33770. var self=this;
  33771. self["@value"]=anObject;
  33772. return self;
  33773. },
  33774. args: ["anObject"],
  33775. source: "value: anObject\x0a\x09value := anObject",
  33776. referencedClasses: [],
  33777. messageSends: []
  33778. }),
  33779. $globals.ValueNode);
  33780. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  33781. $globals.VariableNode.comment="I represent an variable node.";
  33782. $core.addMethod(
  33783. $core.method({
  33784. selector: "accept:",
  33785. protocol: 'visiting',
  33786. fn: function (aVisitor){
  33787. var self=this;
  33788. return $core.withContext(function($ctx1) {
  33789. var $1;
  33790. $1=$recv(aVisitor)._visitVariableNode_(self);
  33791. return $1;
  33792. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)});
  33793. },
  33794. args: ["aVisitor"],
  33795. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  33796. referencedClasses: [],
  33797. messageSends: ["visitVariableNode:"]
  33798. }),
  33799. $globals.VariableNode);
  33800. $core.addMethod(
  33801. $core.method({
  33802. selector: "alias",
  33803. protocol: 'accessing',
  33804. fn: function (){
  33805. var self=this;
  33806. return $core.withContext(function($ctx1) {
  33807. var $1;
  33808. $1=$recv(self._binding())._alias();
  33809. return $1;
  33810. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  33811. },
  33812. args: [],
  33813. source: "alias\x0a\x09^ self binding alias",
  33814. referencedClasses: [],
  33815. messageSends: ["alias", "binding"]
  33816. }),
  33817. $globals.VariableNode);
  33818. $core.addMethod(
  33819. $core.method({
  33820. selector: "assigned",
  33821. protocol: 'accessing',
  33822. fn: function (){
  33823. var self=this;
  33824. return $core.withContext(function($ctx1) {
  33825. var $2,$1,$receiver;
  33826. $2=self["@assigned"];
  33827. if(($receiver = $2) == null || $receiver.isNil){
  33828. $1=false;
  33829. } else {
  33830. $1=$2;
  33831. };
  33832. return $1;
  33833. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  33834. },
  33835. args: [],
  33836. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  33837. referencedClasses: [],
  33838. messageSends: ["ifNil:"]
  33839. }),
  33840. $globals.VariableNode);
  33841. $core.addMethod(
  33842. $core.method({
  33843. selector: "assigned:",
  33844. protocol: 'accessing',
  33845. fn: function (aBoolean){
  33846. var self=this;
  33847. self["@assigned"]=aBoolean;
  33848. return self;
  33849. },
  33850. args: ["aBoolean"],
  33851. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  33852. referencedClasses: [],
  33853. messageSends: []
  33854. }),
  33855. $globals.VariableNode);
  33856. $core.addMethod(
  33857. $core.method({
  33858. selector: "beAssigned",
  33859. protocol: 'accessing',
  33860. fn: function (){
  33861. var self=this;
  33862. return $core.withContext(function($ctx1) {
  33863. $recv(self._binding())._validateAssignment();
  33864. self["@assigned"]=true;
  33865. return self;
  33866. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  33867. },
  33868. args: [],
  33869. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  33870. referencedClasses: [],
  33871. messageSends: ["validateAssignment", "binding"]
  33872. }),
  33873. $globals.VariableNode);
  33874. $core.addMethod(
  33875. $core.method({
  33876. selector: "binding",
  33877. protocol: 'accessing',
  33878. fn: function (){
  33879. var self=this;
  33880. var $1;
  33881. $1=self["@binding"];
  33882. return $1;
  33883. },
  33884. args: [],
  33885. source: "binding\x0a\x09^ binding",
  33886. referencedClasses: [],
  33887. messageSends: []
  33888. }),
  33889. $globals.VariableNode);
  33890. $core.addMethod(
  33891. $core.method({
  33892. selector: "binding:",
  33893. protocol: 'accessing',
  33894. fn: function (aScopeVar){
  33895. var self=this;
  33896. self["@binding"]=aScopeVar;
  33897. return self;
  33898. },
  33899. args: ["aScopeVar"],
  33900. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  33901. referencedClasses: [],
  33902. messageSends: []
  33903. }),
  33904. $globals.VariableNode);
  33905. $core.addMethod(
  33906. $core.method({
  33907. selector: "isArgument",
  33908. protocol: 'testing',
  33909. fn: function (){
  33910. var self=this;
  33911. return $core.withContext(function($ctx1) {
  33912. var $1;
  33913. $1=$recv(self._binding())._isArgVar();
  33914. return $1;
  33915. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  33916. },
  33917. args: [],
  33918. source: "isArgument\x0a\x09^ self binding isArgVar",
  33919. referencedClasses: [],
  33920. messageSends: ["isArgVar", "binding"]
  33921. }),
  33922. $globals.VariableNode);
  33923. $core.addMethod(
  33924. $core.method({
  33925. selector: "isImmutable",
  33926. protocol: 'testing',
  33927. fn: function (){
  33928. var self=this;
  33929. return $core.withContext(function($ctx1) {
  33930. var $1;
  33931. $1=$recv(self._binding())._isImmutable();
  33932. return $1;
  33933. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  33934. },
  33935. args: [],
  33936. source: "isImmutable\x0a\x09^ self binding isImmutable",
  33937. referencedClasses: [],
  33938. messageSends: ["isImmutable", "binding"]
  33939. }),
  33940. $globals.VariableNode);
  33941. $core.addMethod(
  33942. $core.method({
  33943. selector: "isNavigationNode",
  33944. protocol: 'testing',
  33945. fn: function (){
  33946. var self=this;
  33947. return true;
  33948. },
  33949. args: [],
  33950. source: "isNavigationNode\x0a\x09^ true",
  33951. referencedClasses: [],
  33952. messageSends: []
  33953. }),
  33954. $globals.VariableNode);
  33955. $core.addMethod(
  33956. $core.method({
  33957. selector: "isVariableNode",
  33958. protocol: 'testing',
  33959. fn: function (){
  33960. var self=this;
  33961. return true;
  33962. },
  33963. args: [],
  33964. source: "isVariableNode\x0a\x09^ true",
  33965. referencedClasses: [],
  33966. messageSends: []
  33967. }),
  33968. $globals.VariableNode);
  33969. $core.addMethod(
  33970. $core.method({
  33971. selector: "navigationLink",
  33972. protocol: 'accessing',
  33973. fn: function (){
  33974. var self=this;
  33975. return $core.withContext(function($ctx1) {
  33976. var $1;
  33977. $1=self._value();
  33978. return $1;
  33979. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  33980. },
  33981. args: [],
  33982. source: "navigationLink\x0a\x09^ self value",
  33983. referencedClasses: [],
  33984. messageSends: ["value"]
  33985. }),
  33986. $globals.VariableNode);
  33987. $core.addMethod(
  33988. $core.method({
  33989. selector: "ast",
  33990. protocol: '*Compiler-AST',
  33991. fn: function (){
  33992. var self=this;
  33993. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  33994. return $core.withContext(function($ctx1) {
  33995. var $1,$2;
  33996. $1=self._source();
  33997. $ctx1.sendIdx["source"]=1;
  33998. $recv($1)._ifEmpty_((function(){
  33999. return $core.withContext(function($ctx2) {
  34000. return self._error_("Method source is empty");
  34001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34002. }));
  34003. $2=$recv($Smalltalk())._parse_(self._source());
  34004. return $2;
  34005. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  34006. },
  34007. args: [],
  34008. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  34009. referencedClasses: ["Smalltalk"],
  34010. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  34011. }),
  34012. $globals.CompiledMethod);
  34013. $core.addMethod(
  34014. $core.method({
  34015. selector: "isNode",
  34016. protocol: '*Compiler-AST',
  34017. fn: function (){
  34018. var self=this;
  34019. return false;
  34020. },
  34021. args: [],
  34022. source: "isNode\x0a\x09^ false",
  34023. referencedClasses: [],
  34024. messageSends: []
  34025. }),
  34026. $globals.Object);
  34027. });
  34028. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){"use strict";
  34029. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  34030. $core.addPackage('Compiler-Semantic');
  34031. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  34032. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  34033. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  34034. $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.";
  34035. $core.addMethod(
  34036. $core.method({
  34037. selector: "addArg:",
  34038. protocol: 'adding',
  34039. fn: function (aString){
  34040. var self=this;
  34041. function $ArgVar(){return $globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  34042. return $core.withContext(function($ctx1) {
  34043. var $1;
  34044. $1=self._args();
  34045. $ctx1.sendIdx["args"]=1;
  34046. $recv($1)._at_put_(aString,$recv($ArgVar())._on_(aString));
  34047. $recv($recv(self._args())._at_(aString))._scope_(self);
  34048. return self;
  34049. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  34050. },
  34051. args: ["aString"],
  34052. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  34053. referencedClasses: ["ArgVar"],
  34054. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  34055. }),
  34056. $globals.LexicalScope);
  34057. $core.addMethod(
  34058. $core.method({
  34059. selector: "addTemp:",
  34060. protocol: 'adding',
  34061. fn: function (aString){
  34062. var self=this;
  34063. function $TempVar(){return $globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  34064. return $core.withContext(function($ctx1) {
  34065. var $1;
  34066. $1=self._temps();
  34067. $ctx1.sendIdx["temps"]=1;
  34068. $recv($1)._at_put_(aString,$recv($TempVar())._on_(aString));
  34069. $recv($recv(self._temps())._at_(aString))._scope_(self);
  34070. return self;
  34071. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  34072. },
  34073. args: ["aString"],
  34074. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  34075. referencedClasses: ["TempVar"],
  34076. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  34077. }),
  34078. $globals.LexicalScope);
  34079. $core.addMethod(
  34080. $core.method({
  34081. selector: "alias",
  34082. protocol: 'accessing',
  34083. fn: function (){
  34084. var self=this;
  34085. return $core.withContext(function($ctx1) {
  34086. var $1;
  34087. $1="$ctx".__comma($recv(self._scopeLevel())._asString());
  34088. return $1;
  34089. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  34090. },
  34091. args: [],
  34092. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  34093. referencedClasses: [],
  34094. messageSends: [",", "asString", "scopeLevel"]
  34095. }),
  34096. $globals.LexicalScope);
  34097. $core.addMethod(
  34098. $core.method({
  34099. selector: "allVariableNames",
  34100. protocol: 'accessing',
  34101. fn: function (){
  34102. var self=this;
  34103. return $core.withContext(function($ctx1) {
  34104. var $2,$1;
  34105. $2=$recv(self._args())._keys();
  34106. $ctx1.sendIdx["keys"]=1;
  34107. $1=$recv($2).__comma($recv(self._temps())._keys());
  34108. return $1;
  34109. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  34110. },
  34111. args: [],
  34112. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  34113. referencedClasses: [],
  34114. messageSends: [",", "keys", "args", "temps"]
  34115. }),
  34116. $globals.LexicalScope);
  34117. $core.addMethod(
  34118. $core.method({
  34119. selector: "args",
  34120. protocol: 'accessing',
  34121. fn: function (){
  34122. var self=this;
  34123. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34124. return $core.withContext(function($ctx1) {
  34125. var $2,$1,$receiver;
  34126. $2=self["@args"];
  34127. if(($receiver = $2) == null || $receiver.isNil){
  34128. self["@args"]=$recv($Dictionary())._new();
  34129. $1=self["@args"];
  34130. } else {
  34131. $1=$2;
  34132. };
  34133. return $1;
  34134. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  34135. },
  34136. args: [],
  34137. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  34138. referencedClasses: ["Dictionary"],
  34139. messageSends: ["ifNil:", "new"]
  34140. }),
  34141. $globals.LexicalScope);
  34142. $core.addMethod(
  34143. $core.method({
  34144. selector: "bindingFor:",
  34145. protocol: 'accessing',
  34146. fn: function (aStringOrNode){
  34147. var self=this;
  34148. return $core.withContext(function($ctx1) {
  34149. var $2,$3,$4,$5,$1;
  34150. $2=self._pseudoVars();
  34151. $3=$recv(aStringOrNode)._value();
  34152. $ctx1.sendIdx["value"]=1;
  34153. $1=$recv($2)._at_ifAbsent_($3,(function(){
  34154. return $core.withContext(function($ctx2) {
  34155. $4=self._args();
  34156. $5=$recv(aStringOrNode)._value();
  34157. $ctx2.sendIdx["value"]=2;
  34158. return $recv($4)._at_ifAbsent_($5,(function(){
  34159. return $core.withContext(function($ctx3) {
  34160. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  34161. return nil;
  34162. }));
  34163. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  34164. }));
  34165. $ctx2.sendIdx["at:ifAbsent:"]=2;
  34166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34167. }));
  34168. $ctx1.sendIdx["at:ifAbsent:"]=1;
  34169. return $1;
  34170. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  34171. },
  34172. args: ["aStringOrNode"],
  34173. 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 ]]]",
  34174. referencedClasses: [],
  34175. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  34176. }),
  34177. $globals.LexicalScope);
  34178. $core.addMethod(
  34179. $core.method({
  34180. selector: "blockIndex",
  34181. protocol: 'accessing',
  34182. fn: function (){
  34183. var self=this;
  34184. return $core.withContext(function($ctx1) {
  34185. var $2,$1,$receiver;
  34186. $2=self["@blockIndex"];
  34187. if(($receiver = $2) == null || $receiver.isNil){
  34188. $1=(0);
  34189. } else {
  34190. $1=$2;
  34191. };
  34192. return $1;
  34193. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  34194. },
  34195. args: [],
  34196. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  34197. referencedClasses: [],
  34198. messageSends: ["ifNil:"]
  34199. }),
  34200. $globals.LexicalScope);
  34201. $core.addMethod(
  34202. $core.method({
  34203. selector: "blockIndex:",
  34204. protocol: 'accessing',
  34205. fn: function (anInteger){
  34206. var self=this;
  34207. self["@blockIndex"]=anInteger;
  34208. return self;
  34209. },
  34210. args: ["anInteger"],
  34211. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  34212. referencedClasses: [],
  34213. messageSends: []
  34214. }),
  34215. $globals.LexicalScope);
  34216. $core.addMethod(
  34217. $core.method({
  34218. selector: "canInlineNonLocalReturns",
  34219. protocol: 'testing',
  34220. fn: function (){
  34221. var self=this;
  34222. return $core.withContext(function($ctx1) {
  34223. var $1;
  34224. $1=$recv(self._isInlined())._and_((function(){
  34225. return $core.withContext(function($ctx2) {
  34226. return $recv(self._outerScope())._canInlineNonLocalReturns();
  34227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34228. }));
  34229. return $1;
  34230. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  34231. },
  34232. args: [],
  34233. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  34234. referencedClasses: [],
  34235. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  34236. }),
  34237. $globals.LexicalScope);
  34238. $core.addMethod(
  34239. $core.method({
  34240. selector: "instruction",
  34241. protocol: 'accessing',
  34242. fn: function (){
  34243. var self=this;
  34244. var $1;
  34245. $1=self["@instruction"];
  34246. return $1;
  34247. },
  34248. args: [],
  34249. source: "instruction\x0a\x09^ instruction",
  34250. referencedClasses: [],
  34251. messageSends: []
  34252. }),
  34253. $globals.LexicalScope);
  34254. $core.addMethod(
  34255. $core.method({
  34256. selector: "instruction:",
  34257. protocol: 'accessing',
  34258. fn: function (anIRInstruction){
  34259. var self=this;
  34260. self["@instruction"]=anIRInstruction;
  34261. return self;
  34262. },
  34263. args: ["anIRInstruction"],
  34264. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  34265. referencedClasses: [],
  34266. messageSends: []
  34267. }),
  34268. $globals.LexicalScope);
  34269. $core.addMethod(
  34270. $core.method({
  34271. selector: "isBlockScope",
  34272. protocol: 'testing',
  34273. fn: function (){
  34274. var self=this;
  34275. return $core.withContext(function($ctx1) {
  34276. var $1;
  34277. $1=$recv(self._isMethodScope())._not();
  34278. return $1;
  34279. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  34280. },
  34281. args: [],
  34282. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  34283. referencedClasses: [],
  34284. messageSends: ["not", "isMethodScope"]
  34285. }),
  34286. $globals.LexicalScope);
  34287. $core.addMethod(
  34288. $core.method({
  34289. selector: "isInlined",
  34290. protocol: 'testing',
  34291. fn: function (){
  34292. var self=this;
  34293. return $core.withContext(function($ctx1) {
  34294. var $3,$2,$1;
  34295. $3=self._instruction();
  34296. $ctx1.sendIdx["instruction"]=1;
  34297. $2=$recv($3)._notNil();
  34298. $1=$recv($2)._and_((function(){
  34299. return $core.withContext(function($ctx2) {
  34300. return $recv(self._instruction())._isInlined();
  34301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34302. }));
  34303. return $1;
  34304. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  34305. },
  34306. args: [],
  34307. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  34308. referencedClasses: [],
  34309. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  34310. }),
  34311. $globals.LexicalScope);
  34312. $core.addMethod(
  34313. $core.method({
  34314. selector: "isMethodScope",
  34315. protocol: 'testing',
  34316. fn: function (){
  34317. var self=this;
  34318. return false;
  34319. },
  34320. args: [],
  34321. source: "isMethodScope\x0a\x09^ false",
  34322. referencedClasses: [],
  34323. messageSends: []
  34324. }),
  34325. $globals.LexicalScope);
  34326. $core.addMethod(
  34327. $core.method({
  34328. selector: "lookupVariable:",
  34329. protocol: 'accessing',
  34330. fn: function (aNode){
  34331. var self=this;
  34332. var lookup;
  34333. return $core.withContext(function($ctx1) {
  34334. var $1,$2,$3,$receiver;
  34335. lookup=self._bindingFor_(aNode);
  34336. $1=lookup;
  34337. if(($receiver = $1) == null || $receiver.isNil){
  34338. $2=self._outerScope();
  34339. $ctx1.sendIdx["outerScope"]=1;
  34340. if(($receiver = $2) == null || $receiver.isNil){
  34341. lookup=$2;
  34342. } else {
  34343. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  34344. };
  34345. lookup;
  34346. } else {
  34347. $1;
  34348. };
  34349. $3=lookup;
  34350. return $3;
  34351. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  34352. },
  34353. args: ["aNode"],
  34354. 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",
  34355. referencedClasses: [],
  34356. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  34357. }),
  34358. $globals.LexicalScope);
  34359. $core.addMethod(
  34360. $core.method({
  34361. selector: "methodScope",
  34362. protocol: 'accessing',
  34363. fn: function (){
  34364. var self=this;
  34365. return $core.withContext(function($ctx1) {
  34366. var $2,$1,$receiver;
  34367. $2=self._outerScope();
  34368. $ctx1.sendIdx["outerScope"]=1;
  34369. if(($receiver = $2) == null || $receiver.isNil){
  34370. $1=$2;
  34371. } else {
  34372. $1=$recv(self._outerScope())._methodScope();
  34373. };
  34374. return $1;
  34375. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  34376. },
  34377. args: [],
  34378. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  34379. referencedClasses: [],
  34380. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  34381. }),
  34382. $globals.LexicalScope);
  34383. $core.addMethod(
  34384. $core.method({
  34385. selector: "node",
  34386. protocol: 'accessing',
  34387. fn: function (){
  34388. var self=this;
  34389. var $1;
  34390. $1=self["@node"];
  34391. return $1;
  34392. },
  34393. args: [],
  34394. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  34395. referencedClasses: [],
  34396. messageSends: []
  34397. }),
  34398. $globals.LexicalScope);
  34399. $core.addMethod(
  34400. $core.method({
  34401. selector: "node:",
  34402. protocol: 'accessing',
  34403. fn: function (aNode){
  34404. var self=this;
  34405. self["@node"]=aNode;
  34406. return self;
  34407. },
  34408. args: ["aNode"],
  34409. source: "node: aNode\x0a\x09node := aNode",
  34410. referencedClasses: [],
  34411. messageSends: []
  34412. }),
  34413. $globals.LexicalScope);
  34414. $core.addMethod(
  34415. $core.method({
  34416. selector: "outerScope",
  34417. protocol: 'accessing',
  34418. fn: function (){
  34419. var self=this;
  34420. var $1;
  34421. $1=self["@outerScope"];
  34422. return $1;
  34423. },
  34424. args: [],
  34425. source: "outerScope\x0a\x09^ outerScope",
  34426. referencedClasses: [],
  34427. messageSends: []
  34428. }),
  34429. $globals.LexicalScope);
  34430. $core.addMethod(
  34431. $core.method({
  34432. selector: "outerScope:",
  34433. protocol: 'accessing',
  34434. fn: function (aLexicalScope){
  34435. var self=this;
  34436. self["@outerScope"]=aLexicalScope;
  34437. return self;
  34438. },
  34439. args: ["aLexicalScope"],
  34440. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  34441. referencedClasses: [],
  34442. messageSends: []
  34443. }),
  34444. $globals.LexicalScope);
  34445. $core.addMethod(
  34446. $core.method({
  34447. selector: "pseudoVars",
  34448. protocol: 'accessing',
  34449. fn: function (){
  34450. var self=this;
  34451. return $core.withContext(function($ctx1) {
  34452. var $1;
  34453. $1=$recv(self._methodScope())._pseudoVars();
  34454. return $1;
  34455. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  34456. },
  34457. args: [],
  34458. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  34459. referencedClasses: [],
  34460. messageSends: ["pseudoVars", "methodScope"]
  34461. }),
  34462. $globals.LexicalScope);
  34463. $core.addMethod(
  34464. $core.method({
  34465. selector: "scopeLevel",
  34466. protocol: 'accessing',
  34467. fn: function (){
  34468. var self=this;
  34469. return $core.withContext(function($ctx1) {
  34470. var $1,$2,$4,$3,$5,$receiver;
  34471. $1=self._outerScope();
  34472. $ctx1.sendIdx["outerScope"]=1;
  34473. if(($receiver = $1) == null || $receiver.isNil){
  34474. return (1);
  34475. } else {
  34476. $1;
  34477. };
  34478. $2=self._isInlined();
  34479. if($core.assert($2)){
  34480. $4=self._outerScope();
  34481. $ctx1.sendIdx["outerScope"]=2;
  34482. $3=$recv($4)._scopeLevel();
  34483. $ctx1.sendIdx["scopeLevel"]=1;
  34484. return $3;
  34485. };
  34486. $5=$recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  34487. return $5;
  34488. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  34489. },
  34490. args: [],
  34491. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  34492. referencedClasses: [],
  34493. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  34494. }),
  34495. $globals.LexicalScope);
  34496. $core.addMethod(
  34497. $core.method({
  34498. selector: "temps",
  34499. protocol: 'accessing',
  34500. fn: function (){
  34501. var self=this;
  34502. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34503. return $core.withContext(function($ctx1) {
  34504. var $2,$1,$receiver;
  34505. $2=self["@temps"];
  34506. if(($receiver = $2) == null || $receiver.isNil){
  34507. self["@temps"]=$recv($Dictionary())._new();
  34508. $1=self["@temps"];
  34509. } else {
  34510. $1=$2;
  34511. };
  34512. return $1;
  34513. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  34514. },
  34515. args: [],
  34516. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  34517. referencedClasses: ["Dictionary"],
  34518. messageSends: ["ifNil:", "new"]
  34519. }),
  34520. $globals.LexicalScope);
  34521. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  34522. $globals.MethodLexicalScope.comment="I represent a method scope.";
  34523. $core.addMethod(
  34524. $core.method({
  34525. selector: "addIVar:",
  34526. protocol: 'adding',
  34527. fn: function (aString){
  34528. var self=this;
  34529. function $InstanceVar(){return $globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  34530. return $core.withContext(function($ctx1) {
  34531. var $1;
  34532. $1=self._iVars();
  34533. $ctx1.sendIdx["iVars"]=1;
  34534. $recv($1)._at_put_(aString,$recv($InstanceVar())._on_(aString));
  34535. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  34536. return self;
  34537. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  34538. },
  34539. args: ["aString"],
  34540. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  34541. referencedClasses: ["InstanceVar"],
  34542. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  34543. }),
  34544. $globals.MethodLexicalScope);
  34545. $core.addMethod(
  34546. $core.method({
  34547. selector: "addNonLocalReturn:",
  34548. protocol: 'adding',
  34549. fn: function (aScope){
  34550. var self=this;
  34551. return $core.withContext(function($ctx1) {
  34552. $recv(self._nonLocalReturns())._add_(aScope);
  34553. return self;
  34554. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34555. },
  34556. args: ["aScope"],
  34557. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  34558. referencedClasses: [],
  34559. messageSends: ["add:", "nonLocalReturns"]
  34560. }),
  34561. $globals.MethodLexicalScope);
  34562. $core.addMethod(
  34563. $core.method({
  34564. selector: "allVariableNames",
  34565. protocol: 'accessing',
  34566. fn: function (){
  34567. var self=this;
  34568. return $core.withContext(function($ctx1) {
  34569. var $2,$1;
  34570. $2=(
  34571. $ctx1.supercall = true,
  34572. $globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply($recv(self), []));
  34573. $ctx1.supercall = false;
  34574. $1=$recv($2).__comma($recv(self._iVars())._keys());
  34575. return $1;
  34576. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  34577. },
  34578. args: [],
  34579. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  34580. referencedClasses: [],
  34581. messageSends: [",", "allVariableNames", "keys", "iVars"]
  34582. }),
  34583. $globals.MethodLexicalScope);
  34584. $core.addMethod(
  34585. $core.method({
  34586. selector: "bindingFor:",
  34587. protocol: 'accessing',
  34588. fn: function (aNode){
  34589. var self=this;
  34590. return $core.withContext(function($ctx1) {
  34591. var $2,$1,$receiver;
  34592. $2=(
  34593. $ctx1.supercall = true,
  34594. $globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  34595. $ctx1.supercall = false;
  34596. if(($receiver = $2) == null || $receiver.isNil){
  34597. $1=$recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  34598. return nil;
  34599. }));
  34600. } else {
  34601. $1=$2;
  34602. };
  34603. return $1;
  34604. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  34605. },
  34606. args: ["aNode"],
  34607. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  34608. referencedClasses: [],
  34609. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  34610. }),
  34611. $globals.MethodLexicalScope);
  34612. $core.addMethod(
  34613. $core.method({
  34614. selector: "canInlineNonLocalReturns",
  34615. protocol: 'testing',
  34616. fn: function (){
  34617. var self=this;
  34618. return true;
  34619. },
  34620. args: [],
  34621. source: "canInlineNonLocalReturns\x0a\x09^ true",
  34622. referencedClasses: [],
  34623. messageSends: []
  34624. }),
  34625. $globals.MethodLexicalScope);
  34626. $core.addMethod(
  34627. $core.method({
  34628. selector: "hasLocalReturn",
  34629. protocol: 'testing',
  34630. fn: function (){
  34631. var self=this;
  34632. return $core.withContext(function($ctx1) {
  34633. var $1;
  34634. $1=self._localReturn();
  34635. return $1;
  34636. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  34637. },
  34638. args: [],
  34639. source: "hasLocalReturn\x0a\x09^ self localReturn",
  34640. referencedClasses: [],
  34641. messageSends: ["localReturn"]
  34642. }),
  34643. $globals.MethodLexicalScope);
  34644. $core.addMethod(
  34645. $core.method({
  34646. selector: "hasNonLocalReturn",
  34647. protocol: 'testing',
  34648. fn: function (){
  34649. var self=this;
  34650. return $core.withContext(function($ctx1) {
  34651. var $1;
  34652. $1=$recv(self._nonLocalReturns())._notEmpty();
  34653. return $1;
  34654. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  34655. },
  34656. args: [],
  34657. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  34658. referencedClasses: [],
  34659. messageSends: ["notEmpty", "nonLocalReturns"]
  34660. }),
  34661. $globals.MethodLexicalScope);
  34662. $core.addMethod(
  34663. $core.method({
  34664. selector: "iVars",
  34665. protocol: 'accessing',
  34666. fn: function (){
  34667. var self=this;
  34668. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34669. return $core.withContext(function($ctx1) {
  34670. var $2,$1,$receiver;
  34671. $2=self["@iVars"];
  34672. if(($receiver = $2) == null || $receiver.isNil){
  34673. self["@iVars"]=$recv($Dictionary())._new();
  34674. $1=self["@iVars"];
  34675. } else {
  34676. $1=$2;
  34677. };
  34678. return $1;
  34679. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  34680. },
  34681. args: [],
  34682. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  34683. referencedClasses: ["Dictionary"],
  34684. messageSends: ["ifNil:", "new"]
  34685. }),
  34686. $globals.MethodLexicalScope);
  34687. $core.addMethod(
  34688. $core.method({
  34689. selector: "isMethodScope",
  34690. protocol: 'testing',
  34691. fn: function (){
  34692. var self=this;
  34693. return true;
  34694. },
  34695. args: [],
  34696. source: "isMethodScope\x0a\x09^ true",
  34697. referencedClasses: [],
  34698. messageSends: []
  34699. }),
  34700. $globals.MethodLexicalScope);
  34701. $core.addMethod(
  34702. $core.method({
  34703. selector: "localReturn",
  34704. protocol: 'accessing',
  34705. fn: function (){
  34706. var self=this;
  34707. return $core.withContext(function($ctx1) {
  34708. var $2,$1,$receiver;
  34709. $2=self["@localReturn"];
  34710. if(($receiver = $2) == null || $receiver.isNil){
  34711. $1=false;
  34712. } else {
  34713. $1=$2;
  34714. };
  34715. return $1;
  34716. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  34717. },
  34718. args: [],
  34719. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  34720. referencedClasses: [],
  34721. messageSends: ["ifNil:"]
  34722. }),
  34723. $globals.MethodLexicalScope);
  34724. $core.addMethod(
  34725. $core.method({
  34726. selector: "localReturn:",
  34727. protocol: 'accessing',
  34728. fn: function (aBoolean){
  34729. var self=this;
  34730. self["@localReturn"]=aBoolean;
  34731. return self;
  34732. },
  34733. args: ["aBoolean"],
  34734. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  34735. referencedClasses: [],
  34736. messageSends: []
  34737. }),
  34738. $globals.MethodLexicalScope);
  34739. $core.addMethod(
  34740. $core.method({
  34741. selector: "methodScope",
  34742. protocol: 'accessing',
  34743. fn: function (){
  34744. var self=this;
  34745. return self;
  34746. },
  34747. args: [],
  34748. source: "methodScope\x0a\x09^ self",
  34749. referencedClasses: [],
  34750. messageSends: []
  34751. }),
  34752. $globals.MethodLexicalScope);
  34753. $core.addMethod(
  34754. $core.method({
  34755. selector: "nonLocalReturns",
  34756. protocol: 'accessing',
  34757. fn: function (){
  34758. var self=this;
  34759. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34760. return $core.withContext(function($ctx1) {
  34761. var $2,$1,$receiver;
  34762. $2=self["@nonLocalReturns"];
  34763. if(($receiver = $2) == null || $receiver.isNil){
  34764. self["@nonLocalReturns"]=$recv($OrderedCollection())._new();
  34765. $1=self["@nonLocalReturns"];
  34766. } else {
  34767. $1=$2;
  34768. };
  34769. return $1;
  34770. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  34771. },
  34772. args: [],
  34773. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  34774. referencedClasses: ["OrderedCollection"],
  34775. messageSends: ["ifNil:", "new"]
  34776. }),
  34777. $globals.MethodLexicalScope);
  34778. $core.addMethod(
  34779. $core.method({
  34780. selector: "pseudoVars",
  34781. protocol: 'accessing',
  34782. fn: function (){
  34783. var self=this;
  34784. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34785. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  34786. function $PseudoVar(){return $globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  34787. return $core.withContext(function($ctx1) {
  34788. var $1,$2,$3,$4,$receiver;
  34789. $1=self["@pseudoVars"];
  34790. if(($receiver = $1) == null || $receiver.isNil){
  34791. self["@pseudoVars"]=$recv($Dictionary())._new();
  34792. self["@pseudoVars"];
  34793. $recv($recv($Smalltalk())._pseudoVariableNames())._do_((function(each){
  34794. return $core.withContext(function($ctx2) {
  34795. $2=$recv($PseudoVar())._on_(each);
  34796. $recv($2)._scope_(self._methodScope());
  34797. $3=$recv($2)._yourself();
  34798. return $recv(self["@pseudoVars"])._at_put_(each,$3);
  34799. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34800. }));
  34801. } else {
  34802. $1;
  34803. };
  34804. $4=self["@pseudoVars"];
  34805. return $4;
  34806. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  34807. },
  34808. args: [],
  34809. 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",
  34810. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  34811. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  34812. }),
  34813. $globals.MethodLexicalScope);
  34814. $core.addMethod(
  34815. $core.method({
  34816. selector: "removeNonLocalReturn:",
  34817. protocol: 'adding',
  34818. fn: function (aScope){
  34819. var self=this;
  34820. return $core.withContext(function($ctx1) {
  34821. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  34822. }));
  34823. return self;
  34824. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34825. },
  34826. args: ["aScope"],
  34827. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  34828. referencedClasses: [],
  34829. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  34830. }),
  34831. $globals.MethodLexicalScope);
  34832. $core.addMethod(
  34833. $core.method({
  34834. selector: "unknownVariables",
  34835. protocol: 'accessing',
  34836. fn: function (){
  34837. var self=this;
  34838. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34839. return $core.withContext(function($ctx1) {
  34840. var $2,$1,$receiver;
  34841. $2=self["@unknownVariables"];
  34842. if(($receiver = $2) == null || $receiver.isNil){
  34843. self["@unknownVariables"]=$recv($OrderedCollection())._new();
  34844. $1=self["@unknownVariables"];
  34845. } else {
  34846. $1=$2;
  34847. };
  34848. return $1;
  34849. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  34850. },
  34851. args: [],
  34852. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  34853. referencedClasses: ["OrderedCollection"],
  34854. messageSends: ["ifNil:", "new"]
  34855. }),
  34856. $globals.MethodLexicalScope);
  34857. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  34858. $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.";
  34859. $core.addMethod(
  34860. $core.method({
  34861. selector: "alias",
  34862. protocol: 'accessing',
  34863. fn: function (){
  34864. var self=this;
  34865. return $core.withContext(function($ctx1) {
  34866. var $1;
  34867. $1=$recv(self._name())._asVariableName();
  34868. return $1;
  34869. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  34870. },
  34871. args: [],
  34872. source: "alias\x0a\x09^ self name asVariableName",
  34873. referencedClasses: [],
  34874. messageSends: ["asVariableName", "name"]
  34875. }),
  34876. $globals.ScopeVar);
  34877. $core.addMethod(
  34878. $core.method({
  34879. selector: "isArgVar",
  34880. protocol: 'testing',
  34881. fn: function (){
  34882. var self=this;
  34883. return false;
  34884. },
  34885. args: [],
  34886. source: "isArgVar\x0a\x09^ false",
  34887. referencedClasses: [],
  34888. messageSends: []
  34889. }),
  34890. $globals.ScopeVar);
  34891. $core.addMethod(
  34892. $core.method({
  34893. selector: "isClassRefVar",
  34894. protocol: 'testing',
  34895. fn: function (){
  34896. var self=this;
  34897. return false;
  34898. },
  34899. args: [],
  34900. source: "isClassRefVar\x0a\x09^ false",
  34901. referencedClasses: [],
  34902. messageSends: []
  34903. }),
  34904. $globals.ScopeVar);
  34905. $core.addMethod(
  34906. $core.method({
  34907. selector: "isImmutable",
  34908. protocol: 'testing',
  34909. fn: function (){
  34910. var self=this;
  34911. return false;
  34912. },
  34913. args: [],
  34914. source: "isImmutable\x0a\x09^ false",
  34915. referencedClasses: [],
  34916. messageSends: []
  34917. }),
  34918. $globals.ScopeVar);
  34919. $core.addMethod(
  34920. $core.method({
  34921. selector: "isInstanceVar",
  34922. protocol: 'testing',
  34923. fn: function (){
  34924. var self=this;
  34925. return false;
  34926. },
  34927. args: [],
  34928. source: "isInstanceVar\x0a\x09^ false",
  34929. referencedClasses: [],
  34930. messageSends: []
  34931. }),
  34932. $globals.ScopeVar);
  34933. $core.addMethod(
  34934. $core.method({
  34935. selector: "isPseudoVar",
  34936. protocol: 'testing',
  34937. fn: function (){
  34938. var self=this;
  34939. return false;
  34940. },
  34941. args: [],
  34942. source: "isPseudoVar\x0a\x09^ false",
  34943. referencedClasses: [],
  34944. messageSends: []
  34945. }),
  34946. $globals.ScopeVar);
  34947. $core.addMethod(
  34948. $core.method({
  34949. selector: "isTempVar",
  34950. protocol: 'testing',
  34951. fn: function (){
  34952. var self=this;
  34953. return false;
  34954. },
  34955. args: [],
  34956. source: "isTempVar\x0a\x09^ false",
  34957. referencedClasses: [],
  34958. messageSends: []
  34959. }),
  34960. $globals.ScopeVar);
  34961. $core.addMethod(
  34962. $core.method({
  34963. selector: "isUnknownVar",
  34964. protocol: 'testing',
  34965. fn: function (){
  34966. var self=this;
  34967. return false;
  34968. },
  34969. args: [],
  34970. source: "isUnknownVar\x0a\x09^ false",
  34971. referencedClasses: [],
  34972. messageSends: []
  34973. }),
  34974. $globals.ScopeVar);
  34975. $core.addMethod(
  34976. $core.method({
  34977. selector: "name",
  34978. protocol: 'accessing',
  34979. fn: function (){
  34980. var self=this;
  34981. var $1;
  34982. $1=self["@name"];
  34983. return $1;
  34984. },
  34985. args: [],
  34986. source: "name\x0a\x09^ name",
  34987. referencedClasses: [],
  34988. messageSends: []
  34989. }),
  34990. $globals.ScopeVar);
  34991. $core.addMethod(
  34992. $core.method({
  34993. selector: "name:",
  34994. protocol: 'accessing',
  34995. fn: function (aString){
  34996. var self=this;
  34997. self["@name"]=aString;
  34998. return self;
  34999. },
  35000. args: ["aString"],
  35001. source: "name: aString\x0a\x09name := aString",
  35002. referencedClasses: [],
  35003. messageSends: []
  35004. }),
  35005. $globals.ScopeVar);
  35006. $core.addMethod(
  35007. $core.method({
  35008. selector: "scope",
  35009. protocol: 'accessing',
  35010. fn: function (){
  35011. var self=this;
  35012. var $1;
  35013. $1=self["@scope"];
  35014. return $1;
  35015. },
  35016. args: [],
  35017. source: "scope\x0a\x09^ scope",
  35018. referencedClasses: [],
  35019. messageSends: []
  35020. }),
  35021. $globals.ScopeVar);
  35022. $core.addMethod(
  35023. $core.method({
  35024. selector: "scope:",
  35025. protocol: 'accessing',
  35026. fn: function (aScope){
  35027. var self=this;
  35028. self["@scope"]=aScope;
  35029. return self;
  35030. },
  35031. args: ["aScope"],
  35032. source: "scope: aScope\x0a\x09scope := aScope",
  35033. referencedClasses: [],
  35034. messageSends: []
  35035. }),
  35036. $globals.ScopeVar);
  35037. $core.addMethod(
  35038. $core.method({
  35039. selector: "validateAssignment",
  35040. protocol: 'testing',
  35041. fn: function (){
  35042. var self=this;
  35043. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  35044. return $core.withContext(function($ctx1) {
  35045. var $1,$2,$3;
  35046. $1=$recv(self._isArgVar())._or_((function(){
  35047. return $core.withContext(function($ctx2) {
  35048. return self._isPseudoVar();
  35049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35050. }));
  35051. if($core.assert($1)){
  35052. $2=$recv($InvalidAssignmentError())._new();
  35053. $recv($2)._variableName_(self._name());
  35054. $3=$recv($2)._signal();
  35055. $3;
  35056. };
  35057. return self;
  35058. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  35059. },
  35060. args: [],
  35061. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  35062. referencedClasses: ["InvalidAssignmentError"],
  35063. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  35064. }),
  35065. $globals.ScopeVar);
  35066. $core.addMethod(
  35067. $core.method({
  35068. selector: "on:",
  35069. protocol: 'instance creation',
  35070. fn: function (aString){
  35071. var self=this;
  35072. return $core.withContext(function($ctx1) {
  35073. var $2,$3,$1;
  35074. $2=self._new();
  35075. $recv($2)._name_(aString);
  35076. $3=$recv($2)._yourself();
  35077. $1=$3;
  35078. return $1;
  35079. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  35080. },
  35081. args: ["aString"],
  35082. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  35083. referencedClasses: [],
  35084. messageSends: ["name:", "new", "yourself"]
  35085. }),
  35086. $globals.ScopeVar.klass);
  35087. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  35088. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  35089. $core.addMethod(
  35090. $core.method({
  35091. selector: "node",
  35092. protocol: 'accessing',
  35093. fn: function (){
  35094. var self=this;
  35095. var $1;
  35096. $1=self["@node"];
  35097. return $1;
  35098. },
  35099. args: [],
  35100. source: "node\x0a\x09^ node",
  35101. referencedClasses: [],
  35102. messageSends: []
  35103. }),
  35104. $globals.AliasVar);
  35105. $core.addMethod(
  35106. $core.method({
  35107. selector: "node:",
  35108. protocol: 'accessing',
  35109. fn: function (aNode){
  35110. var self=this;
  35111. self["@node"]=aNode;
  35112. return self;
  35113. },
  35114. args: ["aNode"],
  35115. source: "node: aNode\x0a\x09node := aNode",
  35116. referencedClasses: [],
  35117. messageSends: []
  35118. }),
  35119. $globals.AliasVar);
  35120. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35121. $globals.ArgVar.comment="I am an argument of a method or block.";
  35122. $core.addMethod(
  35123. $core.method({
  35124. selector: "isArgVar",
  35125. protocol: 'testing',
  35126. fn: function (){
  35127. var self=this;
  35128. return true;
  35129. },
  35130. args: [],
  35131. source: "isArgVar\x0a\x09^ true",
  35132. referencedClasses: [],
  35133. messageSends: []
  35134. }),
  35135. $globals.ArgVar);
  35136. $core.addMethod(
  35137. $core.method({
  35138. selector: "isImmutable",
  35139. protocol: 'testing',
  35140. fn: function (){
  35141. var self=this;
  35142. return true;
  35143. },
  35144. args: [],
  35145. source: "isImmutable\x0a\x09^ true",
  35146. referencedClasses: [],
  35147. messageSends: []
  35148. }),
  35149. $globals.ArgVar);
  35150. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35151. $globals.ClassRefVar.comment="I am an class reference variable";
  35152. $core.addMethod(
  35153. $core.method({
  35154. selector: "alias",
  35155. protocol: 'accessing',
  35156. fn: function (){
  35157. var self=this;
  35158. return $core.withContext(function($ctx1) {
  35159. var $1;
  35160. $1=$recv("$".__comma(self._name())).__comma("()");
  35161. $ctx1.sendIdx[","]=1;
  35162. return $1;
  35163. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  35164. },
  35165. args: [],
  35166. 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^ '$', self name, '()'",
  35167. referencedClasses: [],
  35168. messageSends: [",", "name"]
  35169. }),
  35170. $globals.ClassRefVar);
  35171. $core.addMethod(
  35172. $core.method({
  35173. selector: "isClassRefVar",
  35174. protocol: 'testing',
  35175. fn: function (){
  35176. var self=this;
  35177. return true;
  35178. },
  35179. args: [],
  35180. source: "isClassRefVar\x0a\x09^ true",
  35181. referencedClasses: [],
  35182. messageSends: []
  35183. }),
  35184. $globals.ClassRefVar);
  35185. $core.addMethod(
  35186. $core.method({
  35187. selector: "isImmutable",
  35188. protocol: 'testing',
  35189. fn: function (){
  35190. var self=this;
  35191. return true;
  35192. },
  35193. args: [],
  35194. source: "isImmutable\x0a\x09^ true",
  35195. referencedClasses: [],
  35196. messageSends: []
  35197. }),
  35198. $globals.ClassRefVar);
  35199. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35200. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  35201. $core.addMethod(
  35202. $core.method({
  35203. selector: "alias",
  35204. protocol: 'testing',
  35205. fn: function (){
  35206. var self=this;
  35207. return $core.withContext(function($ctx1) {
  35208. var $1;
  35209. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  35210. $ctx1.sendIdx[","]=1;
  35211. return $1;
  35212. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  35213. },
  35214. args: [],
  35215. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  35216. referencedClasses: [],
  35217. messageSends: [",", "name"]
  35218. }),
  35219. $globals.InstanceVar);
  35220. $core.addMethod(
  35221. $core.method({
  35222. selector: "isInstanceVar",
  35223. protocol: 'testing',
  35224. fn: function (){
  35225. var self=this;
  35226. return true;
  35227. },
  35228. args: [],
  35229. source: "isInstanceVar\x0a\x09^ true",
  35230. referencedClasses: [],
  35231. messageSends: []
  35232. }),
  35233. $globals.InstanceVar);
  35234. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35235. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  35236. $core.addMethod(
  35237. $core.method({
  35238. selector: "alias",
  35239. protocol: 'accessing',
  35240. fn: function (){
  35241. var self=this;
  35242. return $core.withContext(function($ctx1) {
  35243. var $1;
  35244. $1=self._name();
  35245. return $1;
  35246. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  35247. },
  35248. args: [],
  35249. source: "alias\x0a\x09^ self name",
  35250. referencedClasses: [],
  35251. messageSends: ["name"]
  35252. }),
  35253. $globals.PseudoVar);
  35254. $core.addMethod(
  35255. $core.method({
  35256. selector: "isImmutable",
  35257. protocol: 'testing',
  35258. fn: function (){
  35259. var self=this;
  35260. return true;
  35261. },
  35262. args: [],
  35263. source: "isImmutable\x0a\x09^ true",
  35264. referencedClasses: [],
  35265. messageSends: []
  35266. }),
  35267. $globals.PseudoVar);
  35268. $core.addMethod(
  35269. $core.method({
  35270. selector: "isPseudoVar",
  35271. protocol: 'testing',
  35272. fn: function (){
  35273. var self=this;
  35274. return true;
  35275. },
  35276. args: [],
  35277. source: "isPseudoVar\x0a\x09^ true",
  35278. referencedClasses: [],
  35279. messageSends: []
  35280. }),
  35281. $globals.PseudoVar);
  35282. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35283. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  35284. $core.addMethod(
  35285. $core.method({
  35286. selector: "isTempVar",
  35287. protocol: 'testing',
  35288. fn: function (){
  35289. var self=this;
  35290. return true;
  35291. },
  35292. args: [],
  35293. source: "isTempVar\x0a\x09^ true",
  35294. referencedClasses: [],
  35295. messageSends: []
  35296. }),
  35297. $globals.TempVar);
  35298. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35299. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  35300. $core.addMethod(
  35301. $core.method({
  35302. selector: "isUnknownVar",
  35303. protocol: 'testing',
  35304. fn: function (){
  35305. var self=this;
  35306. return true;
  35307. },
  35308. args: [],
  35309. source: "isUnknownVar\x0a\x09^ true",
  35310. referencedClasses: [],
  35311. messageSends: []
  35312. }),
  35313. $globals.UnknownVar);
  35314. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  35315. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  35316. $core.addMethod(
  35317. $core.method({
  35318. selector: "classReferences",
  35319. protocol: 'accessing',
  35320. fn: function (){
  35321. var self=this;
  35322. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  35323. return $core.withContext(function($ctx1) {
  35324. var $2,$1,$receiver;
  35325. $2=self["@classReferences"];
  35326. if(($receiver = $2) == null || $receiver.isNil){
  35327. self["@classReferences"]=$recv($Set())._new();
  35328. $1=self["@classReferences"];
  35329. } else {
  35330. $1=$2;
  35331. };
  35332. return $1;
  35333. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  35334. },
  35335. args: [],
  35336. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  35337. referencedClasses: ["Set"],
  35338. messageSends: ["ifNil:", "new"]
  35339. }),
  35340. $globals.SemanticAnalyzer);
  35341. $core.addMethod(
  35342. $core.method({
  35343. selector: "errorShadowingVariable:",
  35344. protocol: 'error handling',
  35345. fn: function (aString){
  35346. var self=this;
  35347. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  35348. return $core.withContext(function($ctx1) {
  35349. var $1,$2;
  35350. $1=$recv($ShadowingVariableError())._new();
  35351. $recv($1)._variableName_(aString);
  35352. $2=$recv($1)._signal();
  35353. return self;
  35354. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  35355. },
  35356. args: ["aString"],
  35357. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  35358. referencedClasses: ["ShadowingVariableError"],
  35359. messageSends: ["variableName:", "new", "signal"]
  35360. }),
  35361. $globals.SemanticAnalyzer);
  35362. $core.addMethod(
  35363. $core.method({
  35364. selector: "errorUnknownVariable:",
  35365. protocol: 'error handling',
  35366. fn: function (aNode){
  35367. var self=this;
  35368. var identifier;
  35369. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  35370. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  35371. return $core.withContext(function($ctx1) {
  35372. var $1,$2,$3,$4,$5;
  35373. identifier=$recv(aNode)._value();
  35374. $ctx1.sendIdx["value"]=1;
  35375. $1=$recv($recv($recv($recv($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  35376. return $core.withContext(function($ctx2) {
  35377. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  35378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35379. }));
  35380. if($core.assert($1)){
  35381. $2=$recv($UnknownVariableError())._new();
  35382. $3=$2;
  35383. $4=$recv(aNode)._value();
  35384. $ctx1.sendIdx["value"]=2;
  35385. $recv($3)._variableName_($4);
  35386. $5=$recv($2)._signal();
  35387. $5;
  35388. } else {
  35389. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  35390. };
  35391. return self;
  35392. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  35393. },
  35394. args: ["aNode"],
  35395. 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 ]",
  35396. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  35397. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  35398. }),
  35399. $globals.SemanticAnalyzer);
  35400. $core.addMethod(
  35401. $core.method({
  35402. selector: "isVariableUndefined:inPackage:",
  35403. protocol: 'testing',
  35404. fn: function (aString,aPackage){
  35405. var self=this;
  35406. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  35407. return $core.withContext(function($ctx1) {
  35408. var $1,$3,$4,$2,$receiver;
  35409. if(($receiver = aPackage) == null || $receiver.isNil){
  35410. aPackage;
  35411. } else {
  35412. var packageKnownVars;
  35413. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  35414. packageKnownVars;
  35415. $1=$recv(packageKnownVars)._includes_(aString);
  35416. if($core.assert($1)){
  35417. return false;
  35418. };
  35419. };
  35420. $3=$recv($Compiler())._new();
  35421. $4=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  35422. $ctx1.sendIdx[","]=1;
  35423. $2=$recv($3)._eval_($4);
  35424. return $2;
  35425. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  35426. },
  35427. args: ["aString", "aPackage"],
  35428. 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'",
  35429. referencedClasses: ["Compiler"],
  35430. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  35431. }),
  35432. $globals.SemanticAnalyzer);
  35433. $core.addMethod(
  35434. $core.method({
  35435. selector: "messageSends",
  35436. protocol: 'accessing',
  35437. fn: function (){
  35438. var self=this;
  35439. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  35440. return $core.withContext(function($ctx1) {
  35441. var $2,$1,$receiver;
  35442. $2=self["@messageSends"];
  35443. if(($receiver = $2) == null || $receiver.isNil){
  35444. self["@messageSends"]=$recv($Dictionary())._new();
  35445. $1=self["@messageSends"];
  35446. } else {
  35447. $1=$2;
  35448. };
  35449. return $1;
  35450. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  35451. },
  35452. args: [],
  35453. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  35454. referencedClasses: ["Dictionary"],
  35455. messageSends: ["ifNil:", "new"]
  35456. }),
  35457. $globals.SemanticAnalyzer);
  35458. $core.addMethod(
  35459. $core.method({
  35460. selector: "newBlockScope",
  35461. protocol: 'factory',
  35462. fn: function (){
  35463. var self=this;
  35464. function $LexicalScope(){return $globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  35465. return $core.withContext(function($ctx1) {
  35466. var $1;
  35467. $1=self._newScopeOfClass_($LexicalScope());
  35468. return $1;
  35469. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  35470. },
  35471. args: [],
  35472. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  35473. referencedClasses: ["LexicalScope"],
  35474. messageSends: ["newScopeOfClass:"]
  35475. }),
  35476. $globals.SemanticAnalyzer);
  35477. $core.addMethod(
  35478. $core.method({
  35479. selector: "newMethodScope",
  35480. protocol: 'factory',
  35481. fn: function (){
  35482. var self=this;
  35483. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  35484. return $core.withContext(function($ctx1) {
  35485. var $1;
  35486. $1=self._newScopeOfClass_($MethodLexicalScope());
  35487. return $1;
  35488. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  35489. },
  35490. args: [],
  35491. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  35492. referencedClasses: ["MethodLexicalScope"],
  35493. messageSends: ["newScopeOfClass:"]
  35494. }),
  35495. $globals.SemanticAnalyzer);
  35496. $core.addMethod(
  35497. $core.method({
  35498. selector: "newScopeOfClass:",
  35499. protocol: 'factory',
  35500. fn: function (aLexicalScopeClass){
  35501. var self=this;
  35502. return $core.withContext(function($ctx1) {
  35503. var $2,$3,$1;
  35504. $2=$recv(aLexicalScopeClass)._new();
  35505. $recv($2)._outerScope_(self["@currentScope"]);
  35506. $3=$recv($2)._yourself();
  35507. $1=$3;
  35508. return $1;
  35509. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  35510. },
  35511. args: ["aLexicalScopeClass"],
  35512. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  35513. referencedClasses: [],
  35514. messageSends: ["outerScope:", "new", "yourself"]
  35515. }),
  35516. $globals.SemanticAnalyzer);
  35517. $core.addMethod(
  35518. $core.method({
  35519. selector: "nextBlockIndex",
  35520. protocol: 'private',
  35521. fn: function (){
  35522. var self=this;
  35523. return $core.withContext(function($ctx1) {
  35524. var $1,$2,$receiver;
  35525. $1=self["@blockIndex"];
  35526. if(($receiver = $1) == null || $receiver.isNil){
  35527. self["@blockIndex"]=(0);
  35528. self["@blockIndex"];
  35529. } else {
  35530. $1;
  35531. };
  35532. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  35533. $2=self["@blockIndex"];
  35534. return $2;
  35535. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  35536. },
  35537. args: [],
  35538. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  35539. referencedClasses: [],
  35540. messageSends: ["ifNil:", "+"]
  35541. }),
  35542. $globals.SemanticAnalyzer);
  35543. $core.addMethod(
  35544. $core.method({
  35545. selector: "popScope",
  35546. protocol: 'scope',
  35547. fn: function (){
  35548. var self=this;
  35549. return $core.withContext(function($ctx1) {
  35550. var $1,$receiver;
  35551. $1=self["@currentScope"];
  35552. if(($receiver = $1) == null || $receiver.isNil){
  35553. $1;
  35554. } else {
  35555. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  35556. self["@currentScope"];
  35557. };
  35558. return self;
  35559. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  35560. },
  35561. args: [],
  35562. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  35563. referencedClasses: [],
  35564. messageSends: ["ifNotNil:", "outerScope"]
  35565. }),
  35566. $globals.SemanticAnalyzer);
  35567. $core.addMethod(
  35568. $core.method({
  35569. selector: "pushScope:",
  35570. protocol: 'scope',
  35571. fn: function (aScope){
  35572. var self=this;
  35573. return $core.withContext(function($ctx1) {
  35574. $recv(aScope)._outerScope_(self["@currentScope"]);
  35575. self["@currentScope"]=aScope;
  35576. return self;
  35577. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  35578. },
  35579. args: ["aScope"],
  35580. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  35581. referencedClasses: [],
  35582. messageSends: ["outerScope:"]
  35583. }),
  35584. $globals.SemanticAnalyzer);
  35585. $core.addMethod(
  35586. $core.method({
  35587. selector: "superSends",
  35588. protocol: 'accessing',
  35589. fn: function (){
  35590. var self=this;
  35591. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  35592. return $core.withContext(function($ctx1) {
  35593. var $2,$1,$receiver;
  35594. $2=self["@superSends"];
  35595. if(($receiver = $2) == null || $receiver.isNil){
  35596. self["@superSends"]=$recv($Dictionary())._new();
  35597. $1=self["@superSends"];
  35598. } else {
  35599. $1=$2;
  35600. };
  35601. return $1;
  35602. }, function($ctx1) {$ctx1.fill(self,"superSends",{},$globals.SemanticAnalyzer)});
  35603. },
  35604. args: [],
  35605. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  35606. referencedClasses: ["Dictionary"],
  35607. messageSends: ["ifNil:", "new"]
  35608. }),
  35609. $globals.SemanticAnalyzer);
  35610. $core.addMethod(
  35611. $core.method({
  35612. selector: "theClass",
  35613. protocol: 'accessing',
  35614. fn: function (){
  35615. var self=this;
  35616. var $1;
  35617. $1=self["@theClass"];
  35618. return $1;
  35619. },
  35620. args: [],
  35621. source: "theClass\x0a\x09^ theClass",
  35622. referencedClasses: [],
  35623. messageSends: []
  35624. }),
  35625. $globals.SemanticAnalyzer);
  35626. $core.addMethod(
  35627. $core.method({
  35628. selector: "theClass:",
  35629. protocol: 'accessing',
  35630. fn: function (aClass){
  35631. var self=this;
  35632. self["@theClass"]=aClass;
  35633. return self;
  35634. },
  35635. args: ["aClass"],
  35636. source: "theClass: aClass\x0a\x09theClass := aClass",
  35637. referencedClasses: [],
  35638. messageSends: []
  35639. }),
  35640. $globals.SemanticAnalyzer);
  35641. $core.addMethod(
  35642. $core.method({
  35643. selector: "thePackage",
  35644. protocol: 'accessing',
  35645. fn: function (){
  35646. var self=this;
  35647. var $1;
  35648. $1=self["@thePackage"];
  35649. return $1;
  35650. },
  35651. args: [],
  35652. source: "thePackage\x0a\x09^ thePackage",
  35653. referencedClasses: [],
  35654. messageSends: []
  35655. }),
  35656. $globals.SemanticAnalyzer);
  35657. $core.addMethod(
  35658. $core.method({
  35659. selector: "thePackage:",
  35660. protocol: 'accessing',
  35661. fn: function (aPackage){
  35662. var self=this;
  35663. self["@thePackage"]=aPackage;
  35664. return self;
  35665. },
  35666. args: ["aPackage"],
  35667. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  35668. referencedClasses: [],
  35669. messageSends: []
  35670. }),
  35671. $globals.SemanticAnalyzer);
  35672. $core.addMethod(
  35673. $core.method({
  35674. selector: "validateVariableScope:",
  35675. protocol: 'scope',
  35676. fn: function (aString){
  35677. var self=this;
  35678. return $core.withContext(function($ctx1) {
  35679. var $1,$receiver;
  35680. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  35681. if(($receiver = $1) == null || $receiver.isNil){
  35682. $1;
  35683. } else {
  35684. self._errorShadowingVariable_(aString);
  35685. };
  35686. return self;
  35687. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  35688. },
  35689. args: ["aString"],
  35690. 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 ]",
  35691. referencedClasses: [],
  35692. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  35693. }),
  35694. $globals.SemanticAnalyzer);
  35695. $core.addMethod(
  35696. $core.method({
  35697. selector: "visitAssignmentNode:",
  35698. protocol: 'visiting',
  35699. fn: function (aNode){
  35700. var self=this;
  35701. return $core.withContext(function($ctx1) {
  35702. (
  35703. $ctx1.supercall = true,
  35704. $globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  35705. $ctx1.supercall = false;
  35706. $recv($recv(aNode)._left())._beAssigned();
  35707. return self;
  35708. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35709. },
  35710. args: ["aNode"],
  35711. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  35712. referencedClasses: [],
  35713. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  35714. }),
  35715. $globals.SemanticAnalyzer);
  35716. $core.addMethod(
  35717. $core.method({
  35718. selector: "visitBlockNode:",
  35719. protocol: 'visiting',
  35720. fn: function (aNode){
  35721. var self=this;
  35722. return $core.withContext(function($ctx1) {
  35723. self._pushScope_(self._newBlockScope());
  35724. $recv(aNode)._scope_(self["@currentScope"]);
  35725. $recv(self["@currentScope"])._node_(aNode);
  35726. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  35727. $recv($recv(aNode)._parameters())._do_((function(each){
  35728. return $core.withContext(function($ctx2) {
  35729. self._validateVariableScope_(each);
  35730. return $recv(self["@currentScope"])._addArg_(each);
  35731. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35732. }));
  35733. (
  35734. $ctx1.supercall = true,
  35735. $globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  35736. $ctx1.supercall = false;
  35737. self._popScope();
  35738. return self;
  35739. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35740. },
  35741. args: ["aNode"],
  35742. 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",
  35743. referencedClasses: [],
  35744. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  35745. }),
  35746. $globals.SemanticAnalyzer);
  35747. $core.addMethod(
  35748. $core.method({
  35749. selector: "visitCascadeNode:",
  35750. protocol: 'visiting',
  35751. fn: function (aNode){
  35752. var self=this;
  35753. return $core.withContext(function($ctx1) {
  35754. var $3,$2,$1;
  35755. (
  35756. $ctx1.supercall = true,
  35757. $globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  35758. $ctx1.supercall = false;
  35759. $3=$recv(aNode)._nodes();
  35760. $ctx1.sendIdx["nodes"]=1;
  35761. $2=$recv($3)._first();
  35762. $1=$recv($2)._superSend();
  35763. if($core.assert($1)){
  35764. $recv($recv(aNode)._nodes())._do_((function(each){
  35765. return $core.withContext(function($ctx2) {
  35766. return $recv(each)._superSend_(true);
  35767. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35768. }));
  35769. };
  35770. return self;
  35771. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35772. },
  35773. args: ["aNode"],
  35774. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  35775. referencedClasses: [],
  35776. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"]
  35777. }),
  35778. $globals.SemanticAnalyzer);
  35779. $core.addMethod(
  35780. $core.method({
  35781. selector: "visitMethodNode:",
  35782. protocol: 'visiting',
  35783. fn: function (aNode){
  35784. var self=this;
  35785. return $core.withContext(function($ctx1) {
  35786. var $1;
  35787. self._pushScope_(self._newMethodScope());
  35788. $recv(aNode)._scope_(self["@currentScope"]);
  35789. $recv(self["@currentScope"])._node_(aNode);
  35790. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  35791. return $core.withContext(function($ctx2) {
  35792. return $recv(self["@currentScope"])._addIVar_(each);
  35793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35794. }));
  35795. $ctx1.sendIdx["do:"]=1;
  35796. $recv($recv(aNode)._arguments())._do_((function(each){
  35797. return $core.withContext(function($ctx2) {
  35798. self._validateVariableScope_(each);
  35799. return $recv(self["@currentScope"])._addArg_(each);
  35800. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35801. }));
  35802. (
  35803. $ctx1.supercall = true,
  35804. $globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  35805. $ctx1.supercall = false;
  35806. $recv(aNode)._classReferences_(self._classReferences());
  35807. $recv(aNode)._sendIndexes_(self._messageSends());
  35808. $1=$recv(aNode)._superSends_($recv(self._superSends())._keys());
  35809. self._popScope();
  35810. return self;
  35811. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35812. },
  35813. args: ["aNode"],
  35814. 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\x09\x09superSends: self superSends keys.\x0a\x09self popScope",
  35815. referencedClasses: [],
  35816. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"]
  35817. }),
  35818. $globals.SemanticAnalyzer);
  35819. $core.addMethod(
  35820. $core.method({
  35821. selector: "visitReturnNode:",
  35822. protocol: 'visiting',
  35823. fn: function (aNode){
  35824. var self=this;
  35825. return $core.withContext(function($ctx1) {
  35826. var $1;
  35827. $recv(aNode)._scope_(self["@currentScope"]);
  35828. $1=$recv(self["@currentScope"])._isMethodScope();
  35829. if($core.assert($1)){
  35830. $recv(self["@currentScope"])._localReturn_(true);
  35831. } else {
  35832. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  35833. };
  35834. (
  35835. $ctx1.supercall = true,
  35836. $globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  35837. $ctx1.supercall = false;
  35838. return self;
  35839. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35840. },
  35841. args: ["aNode"],
  35842. 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",
  35843. referencedClasses: [],
  35844. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  35845. }),
  35846. $globals.SemanticAnalyzer);
  35847. $core.addMethod(
  35848. $core.method({
  35849. selector: "visitSendNode:",
  35850. protocol: 'visiting',
  35851. fn: function (aNode){
  35852. var self=this;
  35853. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  35854. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  35855. return $core.withContext(function($ctx1) {
  35856. var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
  35857. $3=$recv(aNode)._receiver();
  35858. $ctx1.sendIdx["receiver"]=1;
  35859. $2=$recv($3)._value();
  35860. $1=$recv($2).__eq("super");
  35861. if($core.assert($1)){
  35862. $recv(aNode)._superSend_(true);
  35863. $4=$recv(aNode)._receiver();
  35864. $ctx1.sendIdx["receiver"]=2;
  35865. $recv($4)._value_("self");
  35866. $5=self._superSends();
  35867. $ctx1.sendIdx["superSends"]=1;
  35868. $6=$recv(aNode)._selector();
  35869. $ctx1.sendIdx["selector"]=1;
  35870. $recv($5)._at_ifAbsentPut_($6,(function(){
  35871. return $core.withContext(function($ctx2) {
  35872. return $recv($Set())._new();
  35873. $ctx2.sendIdx["new"]=1;
  35874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  35875. }));
  35876. $ctx1.sendIdx["at:ifAbsentPut:"]=1;
  35877. $8=self._superSends();
  35878. $9=$recv(aNode)._selector();
  35879. $ctx1.sendIdx["selector"]=2;
  35880. $7=$recv($8)._at_($9);
  35881. $ctx1.sendIdx["at:"]=1;
  35882. $recv($7)._add_(aNode);
  35883. $ctx1.sendIdx["add:"]=1;
  35884. } else {
  35885. $11=$recv($IRSendInliner())._inlinedSelectors();
  35886. $12=$recv(aNode)._selector();
  35887. $ctx1.sendIdx["selector"]=3;
  35888. $10=$recv($11)._includes_($12);
  35889. if($core.assert($10)){
  35890. $recv(aNode)._shouldBeInlined_(true);
  35891. $13=$recv(aNode)._receiver();
  35892. if(($receiver = $13) == null || $receiver.isNil){
  35893. $13;
  35894. } else {
  35895. var receiver;
  35896. receiver=$receiver;
  35897. $recv(receiver)._shouldBeAliased_(true);
  35898. };
  35899. };
  35900. };
  35901. $14=self._messageSends();
  35902. $ctx1.sendIdx["messageSends"]=1;
  35903. $15=$recv(aNode)._selector();
  35904. $ctx1.sendIdx["selector"]=4;
  35905. $recv($14)._at_ifAbsentPut_($15,(function(){
  35906. return $core.withContext(function($ctx2) {
  35907. return $recv($Set())._new();
  35908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  35909. }));
  35910. $17=self._messageSends();
  35911. $ctx1.sendIdx["messageSends"]=2;
  35912. $18=$recv(aNode)._selector();
  35913. $ctx1.sendIdx["selector"]=5;
  35914. $16=$recv($17)._at_($18);
  35915. $ctx1.sendIdx["at:"]=2;
  35916. $recv($16)._add_(aNode);
  35917. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  35918. (
  35919. $ctx1.supercall = true,
  35920. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  35921. $ctx1.supercall = false;
  35922. return self;
  35923. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35924. },
  35925. args: ["aNode"],
  35926. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a\x09\x09\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",
  35927. referencedClasses: ["Set", "IRSendInliner"],
  35928. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"]
  35929. }),
  35930. $globals.SemanticAnalyzer);
  35931. $core.addMethod(
  35932. $core.method({
  35933. selector: "visitSequenceNode:",
  35934. protocol: 'visiting',
  35935. fn: function (aNode){
  35936. var self=this;
  35937. return $core.withContext(function($ctx1) {
  35938. $recv($recv(aNode)._temps())._do_((function(each){
  35939. return $core.withContext(function($ctx2) {
  35940. self._validateVariableScope_(each);
  35941. return $recv(self["@currentScope"])._addTemp_(each);
  35942. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35943. }));
  35944. (
  35945. $ctx1.supercall = true,
  35946. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  35947. $ctx1.supercall = false;
  35948. return self;
  35949. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35950. },
  35951. args: ["aNode"],
  35952. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  35953. referencedClasses: [],
  35954. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  35955. }),
  35956. $globals.SemanticAnalyzer);
  35957. $core.addMethod(
  35958. $core.method({
  35959. selector: "visitVariableNode:",
  35960. protocol: 'visiting',
  35961. fn: function (aNode){
  35962. var self=this;
  35963. var binding;
  35964. function $ClassRefVar(){return $globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  35965. function $UnknownVar(){return $globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  35966. return $core.withContext(function($ctx1) {
  35967. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  35968. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  35969. $1=binding;
  35970. if(($receiver = $1) == null || $receiver.isNil){
  35971. $3=$recv(aNode)._value();
  35972. $ctx1.sendIdx["value"]=1;
  35973. $2=$recv($3)._isCapitalized();
  35974. if($core.assert($2)){
  35975. $4=$recv($ClassRefVar())._new();
  35976. $ctx1.sendIdx["new"]=1;
  35977. $5=$4;
  35978. $6=$recv(aNode)._value();
  35979. $ctx1.sendIdx["value"]=2;
  35980. $recv($5)._name_($6);
  35981. $ctx1.sendIdx["name:"]=1;
  35982. $7=$recv($4)._yourself();
  35983. $ctx1.sendIdx["yourself"]=1;
  35984. binding=$7;
  35985. binding;
  35986. $8=self._classReferences();
  35987. $9=$recv(aNode)._value();
  35988. $ctx1.sendIdx["value"]=3;
  35989. $recv($8)._add_($9);
  35990. } else {
  35991. self._errorUnknownVariable_(aNode);
  35992. $10=$recv($UnknownVar())._new();
  35993. $recv($10)._name_($recv(aNode)._value());
  35994. $11=$recv($10)._yourself();
  35995. binding=$11;
  35996. binding;
  35997. };
  35998. } else {
  35999. $1;
  36000. };
  36001. $recv(aNode)._binding_(binding);
  36002. return self;
  36003. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  36004. },
  36005. args: ["aNode"],
  36006. 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.",
  36007. referencedClasses: ["ClassRefVar", "UnknownVar"],
  36008. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  36009. }),
  36010. $globals.SemanticAnalyzer);
  36011. $core.addMethod(
  36012. $core.method({
  36013. selector: "on:",
  36014. protocol: 'instance creation',
  36015. fn: function (aClass){
  36016. var self=this;
  36017. return $core.withContext(function($ctx1) {
  36018. var $2,$3,$1;
  36019. $2=self._new();
  36020. $recv($2)._theClass_(aClass);
  36021. $3=$recv($2)._yourself();
  36022. $1=$3;
  36023. return $1;
  36024. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  36025. },
  36026. args: ["aClass"],
  36027. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  36028. referencedClasses: [],
  36029. messageSends: ["theClass:", "new", "yourself"]
  36030. }),
  36031. $globals.SemanticAnalyzer.klass);
  36032. });
  36033. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  36034. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  36035. $core.addPackage('Compiler-IR');
  36036. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  36037. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36038. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  36039. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  36040. $core.addMethod(
  36041. $core.method({
  36042. selector: "alias:",
  36043. protocol: 'visiting',
  36044. fn: function (aNode){
  36045. var self=this;
  36046. var variable;
  36047. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36048. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  36049. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  36050. return $core.withContext(function($ctx1) {
  36051. var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
  36052. $1=$recv(aNode)._isImmutable();
  36053. if($core.assert($1)){
  36054. $2=self._visit_(aNode);
  36055. $ctx1.sendIdx["visit:"]=1;
  36056. return $2;
  36057. };
  36058. $3=$recv($IRVariable())._new();
  36059. $ctx1.sendIdx["new"]=1;
  36060. $4=$3;
  36061. $6=$recv($AliasVar())._new();
  36062. $ctx1.sendIdx["new"]=2;
  36063. $5=$recv($6)._name_("$".__comma(self._nextAlias()));
  36064. $recv($4)._variable_($5);
  36065. $7=$recv($3)._yourself();
  36066. $ctx1.sendIdx["yourself"]=1;
  36067. variable=$7;
  36068. $8=self._sequence();
  36069. $10=$recv($IRAssignment())._new();
  36070. $recv($10)._add_(variable);
  36071. $ctx1.sendIdx["add:"]=2;
  36072. $recv($10)._add_(self._visit_(aNode));
  36073. $ctx1.sendIdx["add:"]=3;
  36074. $11=$recv($10)._yourself();
  36075. $9=$11;
  36076. $recv($8)._add_($9);
  36077. $ctx1.sendIdx["add:"]=1;
  36078. $recv($recv(self._method())._internalVariables())._add_(variable);
  36079. $12=variable;
  36080. return $12;
  36081. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  36082. },
  36083. args: ["aNode"],
  36084. 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",
  36085. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  36086. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  36087. }),
  36088. $globals.IRASTTranslator);
  36089. $core.addMethod(
  36090. $core.method({
  36091. selector: "aliasTemporally:",
  36092. protocol: 'visiting',
  36093. fn: function (aCollection){
  36094. var self=this;
  36095. var threshold,result;
  36096. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  36097. return $core.withContext(function($ctx1) {
  36098. var $1,$2,$4,$3,$5;
  36099. threshold=(0);
  36100. $recv(aCollection)._withIndexDo_((function(each,i){
  36101. return $core.withContext(function($ctx2) {
  36102. $1=$recv(each)._subtreeNeedsAliasing();
  36103. if($core.assert($1)){
  36104. threshold=i;
  36105. return threshold;
  36106. };
  36107. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  36108. }));
  36109. $ctx1.sendIdx["withIndexDo:"]=1;
  36110. result=$recv($OrderedCollection())._new();
  36111. $recv(aCollection)._withIndexDo_((function(each,i){
  36112. return $core.withContext(function($ctx2) {
  36113. $2=result;
  36114. $4=$recv(i).__lt_eq(threshold);
  36115. if($core.assert($4)){
  36116. $3=self._alias_(each);
  36117. } else {
  36118. $3=self._visit_(each);
  36119. };
  36120. return $recv($2)._add_($3);
  36121. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  36122. }));
  36123. $5=result;
  36124. return $5;
  36125. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  36126. },
  36127. args: ["aCollection"],
  36128. source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]) ].\x0a\x0a\x09^ result",
  36129. referencedClasses: ["OrderedCollection"],
  36130. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  36131. }),
  36132. $globals.IRASTTranslator);
  36133. $core.addMethod(
  36134. $core.method({
  36135. selector: "method",
  36136. protocol: 'accessing',
  36137. fn: function (){
  36138. var self=this;
  36139. var $1;
  36140. $1=self["@method"];
  36141. return $1;
  36142. },
  36143. args: [],
  36144. source: "method\x0a\x09^ method",
  36145. referencedClasses: [],
  36146. messageSends: []
  36147. }),
  36148. $globals.IRASTTranslator);
  36149. $core.addMethod(
  36150. $core.method({
  36151. selector: "method:",
  36152. protocol: 'accessing',
  36153. fn: function (anIRMethod){
  36154. var self=this;
  36155. self["@method"]=anIRMethod;
  36156. return self;
  36157. },
  36158. args: ["anIRMethod"],
  36159. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  36160. referencedClasses: [],
  36161. messageSends: []
  36162. }),
  36163. $globals.IRASTTranslator);
  36164. $core.addMethod(
  36165. $core.method({
  36166. selector: "nextAlias",
  36167. protocol: 'accessing',
  36168. fn: function (){
  36169. var self=this;
  36170. return $core.withContext(function($ctx1) {
  36171. var $1,$2,$receiver;
  36172. $1=self["@nextAlias"];
  36173. if(($receiver = $1) == null || $receiver.isNil){
  36174. self["@nextAlias"]=(0);
  36175. self["@nextAlias"];
  36176. } else {
  36177. $1;
  36178. };
  36179. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  36180. $2=$recv(self["@nextAlias"])._asString();
  36181. return $2;
  36182. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  36183. },
  36184. args: [],
  36185. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  36186. referencedClasses: [],
  36187. messageSends: ["ifNil:", "+", "asString"]
  36188. }),
  36189. $globals.IRASTTranslator);
  36190. $core.addMethod(
  36191. $core.method({
  36192. selector: "sequence",
  36193. protocol: 'accessing',
  36194. fn: function (){
  36195. var self=this;
  36196. var $1;
  36197. $1=self["@sequence"];
  36198. return $1;
  36199. },
  36200. args: [],
  36201. source: "sequence\x0a\x09^ sequence",
  36202. referencedClasses: [],
  36203. messageSends: []
  36204. }),
  36205. $globals.IRASTTranslator);
  36206. $core.addMethod(
  36207. $core.method({
  36208. selector: "sequence:",
  36209. protocol: 'accessing',
  36210. fn: function (anIRSequence){
  36211. var self=this;
  36212. self["@sequence"]=anIRSequence;
  36213. return self;
  36214. },
  36215. args: ["anIRSequence"],
  36216. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  36217. referencedClasses: [],
  36218. messageSends: []
  36219. }),
  36220. $globals.IRASTTranslator);
  36221. $core.addMethod(
  36222. $core.method({
  36223. selector: "source",
  36224. protocol: 'accessing',
  36225. fn: function (){
  36226. var self=this;
  36227. var $1;
  36228. $1=self["@source"];
  36229. return $1;
  36230. },
  36231. args: [],
  36232. source: "source\x0a\x09^ source",
  36233. referencedClasses: [],
  36234. messageSends: []
  36235. }),
  36236. $globals.IRASTTranslator);
  36237. $core.addMethod(
  36238. $core.method({
  36239. selector: "source:",
  36240. protocol: 'accessing',
  36241. fn: function (aString){
  36242. var self=this;
  36243. self["@source"]=aString;
  36244. return self;
  36245. },
  36246. args: ["aString"],
  36247. source: "source: aString\x0a\x09source := aString",
  36248. referencedClasses: [],
  36249. messageSends: []
  36250. }),
  36251. $globals.IRASTTranslator);
  36252. $core.addMethod(
  36253. $core.method({
  36254. selector: "theClass",
  36255. protocol: 'accessing',
  36256. fn: function (){
  36257. var self=this;
  36258. var $1;
  36259. $1=self["@theClass"];
  36260. return $1;
  36261. },
  36262. args: [],
  36263. source: "theClass\x0a\x09^ theClass",
  36264. referencedClasses: [],
  36265. messageSends: []
  36266. }),
  36267. $globals.IRASTTranslator);
  36268. $core.addMethod(
  36269. $core.method({
  36270. selector: "theClass:",
  36271. protocol: 'accessing',
  36272. fn: function (aClass){
  36273. var self=this;
  36274. self["@theClass"]=aClass;
  36275. return self;
  36276. },
  36277. args: ["aClass"],
  36278. source: "theClass: aClass\x0a\x09theClass := aClass",
  36279. referencedClasses: [],
  36280. messageSends: []
  36281. }),
  36282. $globals.IRASTTranslator);
  36283. $core.addMethod(
  36284. $core.method({
  36285. selector: "visitAssignmentNode:",
  36286. protocol: 'visiting',
  36287. fn: function (aNode){
  36288. var self=this;
  36289. var left,right,assignment;
  36290. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  36291. return $core.withContext(function($ctx1) {
  36292. var $1,$3,$4,$2,$5;
  36293. right=self._visit_($recv(aNode)._right());
  36294. $ctx1.sendIdx["visit:"]=1;
  36295. left=self._visit_($recv(aNode)._left());
  36296. $1=self._sequence();
  36297. $3=$recv($IRAssignment())._new();
  36298. $recv($3)._add_(left);
  36299. $ctx1.sendIdx["add:"]=2;
  36300. $recv($3)._add_(right);
  36301. $4=$recv($3)._yourself();
  36302. $2=$4;
  36303. $recv($1)._add_($2);
  36304. $ctx1.sendIdx["add:"]=1;
  36305. $5=left;
  36306. return $5;
  36307. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  36308. },
  36309. args: ["aNode"],
  36310. 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",
  36311. referencedClasses: ["IRAssignment"],
  36312. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  36313. }),
  36314. $globals.IRASTTranslator);
  36315. $core.addMethod(
  36316. $core.method({
  36317. selector: "visitBlockNode:",
  36318. protocol: 'visiting',
  36319. fn: function (aNode){
  36320. var self=this;
  36321. var closure;
  36322. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  36323. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  36324. return $core.withContext(function($ctx1) {
  36325. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  36326. $1=$recv($IRClosure())._new();
  36327. $ctx1.sendIdx["new"]=1;
  36328. $recv($1)._arguments_($recv(aNode)._parameters());
  36329. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  36330. $2=$1;
  36331. $3=$recv(aNode)._scope();
  36332. $ctx1.sendIdx["scope"]=1;
  36333. $recv($2)._scope_($3);
  36334. $ctx1.sendIdx["scope:"]=1;
  36335. $4=$recv($1)._yourself();
  36336. $ctx1.sendIdx["yourself"]=1;
  36337. closure=$4;
  36338. $6=$recv(aNode)._scope();
  36339. $ctx1.sendIdx["scope"]=2;
  36340. $5=$recv($6)._temps();
  36341. $recv($5)._do_((function(each){
  36342. return $core.withContext(function($ctx2) {
  36343. $7=$recv($IRTempDeclaration())._new();
  36344. $recv($7)._name_($recv(each)._name());
  36345. $recv($7)._scope_($recv(aNode)._scope());
  36346. $8=$recv($7)._yourself();
  36347. return $recv(closure)._add_($8);
  36348. $ctx2.sendIdx["add:"]=1;
  36349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36350. }));
  36351. $ctx1.sendIdx["do:"]=1;
  36352. $recv($recv(aNode)._nodes())._do_((function(each){
  36353. return $core.withContext(function($ctx2) {
  36354. return $recv(closure)._add_(self._visit_(each));
  36355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36356. }));
  36357. $9=closure;
  36358. return $9;
  36359. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  36360. },
  36361. args: ["aNode"],
  36362. 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",
  36363. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  36364. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  36365. }),
  36366. $globals.IRASTTranslator);
  36367. $core.addMethod(
  36368. $core.method({
  36369. selector: "visitBlockSequenceNode:",
  36370. protocol: 'visiting',
  36371. fn: function (aNode){
  36372. var self=this;
  36373. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  36374. function $IRBlockReturn(){return $globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  36375. return $core.withContext(function($ctx1) {
  36376. var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
  36377. $2=$recv($IRBlockSequence())._new();
  36378. $ctx1.sendIdx["new"]=1;
  36379. $1=self._withSequence_do_($2,(function(){
  36380. return $core.withContext(function($ctx2) {
  36381. $3=$recv(aNode)._nodes();
  36382. $ctx2.sendIdx["nodes"]=1;
  36383. return $recv($3)._ifNotEmpty_((function(){
  36384. return $core.withContext(function($ctx3) {
  36385. $5=$recv(aNode)._nodes();
  36386. $ctx3.sendIdx["nodes"]=2;
  36387. $4=$recv($5)._allButLast();
  36388. $recv($4)._do_((function(each){
  36389. return $core.withContext(function($ctx4) {
  36390. $6=self._sequence();
  36391. $ctx4.sendIdx["sequence"]=1;
  36392. $7=self._visitOrAlias_(each);
  36393. $ctx4.sendIdx["visitOrAlias:"]=1;
  36394. return $recv($6)._add_($7);
  36395. $ctx4.sendIdx["add:"]=1;
  36396. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  36397. }));
  36398. $10=$recv(aNode)._nodes();
  36399. $ctx3.sendIdx["nodes"]=3;
  36400. $9=$recv($10)._last();
  36401. $ctx3.sendIdx["last"]=1;
  36402. $8=$recv($9)._isReturnNode();
  36403. if($core.assert($8)){
  36404. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last()));
  36405. } else {
  36406. $11=self._sequence();
  36407. $ctx3.sendIdx["sequence"]=2;
  36408. $13=$recv($IRBlockReturn())._new();
  36409. $14=$13;
  36410. $17=$recv(aNode)._nodes();
  36411. $ctx3.sendIdx["nodes"]=4;
  36412. $16=$recv($17)._last();
  36413. $ctx3.sendIdx["last"]=2;
  36414. $15=self._visitOrAlias_($16);
  36415. $ctx3.sendIdx["visitOrAlias:"]=2;
  36416. $recv($14)._add_($15);
  36417. $ctx3.sendIdx["add:"]=3;
  36418. $18=$recv($13)._yourself();
  36419. $12=$18;
  36420. return $recv($11)._add_($12);
  36421. $ctx3.sendIdx["add:"]=2;
  36422. };
  36423. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36424. }));
  36425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36426. }));
  36427. return $1;
  36428. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36429. },
  36430. args: ["aNode"],
  36431. 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) ] ]]",
  36432. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  36433. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  36434. }),
  36435. $globals.IRASTTranslator);
  36436. $core.addMethod(
  36437. $core.method({
  36438. selector: "visitCascadeNode:",
  36439. protocol: 'visiting',
  36440. fn: function (aNode){
  36441. var self=this;
  36442. var alias,receiver;
  36443. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  36444. return $core.withContext(function($ctx1) {
  36445. var $2,$1,$3,$5,$4,$6;
  36446. $2=$recv(aNode)._receiver();
  36447. $ctx1.sendIdx["receiver"]=1;
  36448. $1=$recv($2)._isImmutable();
  36449. if($core.assert($1)){
  36450. receiver=$recv(aNode)._receiver();
  36451. $ctx1.sendIdx["receiver"]=2;
  36452. receiver;
  36453. } else {
  36454. alias=self._alias_($recv(aNode)._receiver());
  36455. $ctx1.sendIdx["alias:"]=1;
  36456. alias;
  36457. receiver=$recv($recv($VariableNode())._new())._binding_($recv(alias)._variable());
  36458. receiver;
  36459. };
  36460. $3=$recv(aNode)._nodes();
  36461. $ctx1.sendIdx["nodes"]=1;
  36462. $recv($3)._do_((function(each){
  36463. return $core.withContext(function($ctx2) {
  36464. return $recv(each)._receiver_(receiver);
  36465. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36466. }));
  36467. $ctx1.sendIdx["do:"]=1;
  36468. $5=$recv(aNode)._nodes();
  36469. $ctx1.sendIdx["nodes"]=2;
  36470. $4=$recv($5)._allButLast();
  36471. $recv($4)._do_((function(each){
  36472. return $core.withContext(function($ctx2) {
  36473. return $recv(self._sequence())._add_(self._visit_(each));
  36474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  36475. }));
  36476. $6=self._alias_($recv($recv(aNode)._nodes())._last());
  36477. return $6;
  36478. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},$globals.IRASTTranslator)});
  36479. },
  36480. args: ["aNode"],
  36481. source: "visitCascadeNode: aNode\x0a\x09| alias receiver |\x0a\x0a\x09aNode receiver isImmutable \x0a\x09\x09ifTrue: [ receiver := aNode receiver ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  36482. referencedClasses: ["VariableNode"],
  36483. messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"]
  36484. }),
  36485. $globals.IRASTTranslator);
  36486. $core.addMethod(
  36487. $core.method({
  36488. selector: "visitDynamicArrayNode:",
  36489. protocol: 'visiting',
  36490. fn: function (aNode){
  36491. var self=this;
  36492. var array;
  36493. function $IRDynamicArray(){return $globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  36494. return $core.withContext(function($ctx1) {
  36495. var $1;
  36496. array=$recv($IRDynamicArray())._new();
  36497. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36498. return $core.withContext(function($ctx2) {
  36499. return $recv(array)._add_(each);
  36500. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36501. }));
  36502. $1=array;
  36503. return $1;
  36504. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  36505. },
  36506. args: ["aNode"],
  36507. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  36508. referencedClasses: ["IRDynamicArray"],
  36509. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  36510. }),
  36511. $globals.IRASTTranslator);
  36512. $core.addMethod(
  36513. $core.method({
  36514. selector: "visitDynamicDictionaryNode:",
  36515. protocol: 'visiting',
  36516. fn: function (aNode){
  36517. var self=this;
  36518. var dictionary;
  36519. function $IRDynamicDictionary(){return $globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  36520. return $core.withContext(function($ctx1) {
  36521. var $1;
  36522. dictionary=$recv($IRDynamicDictionary())._new();
  36523. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36524. return $core.withContext(function($ctx2) {
  36525. return $recv(dictionary)._add_(each);
  36526. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36527. }));
  36528. $1=dictionary;
  36529. return $1;
  36530. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  36531. },
  36532. args: ["aNode"],
  36533. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  36534. referencedClasses: ["IRDynamicDictionary"],
  36535. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  36536. }),
  36537. $globals.IRASTTranslator);
  36538. $core.addMethod(
  36539. $core.method({
  36540. selector: "visitJSStatementNode:",
  36541. protocol: 'visiting',
  36542. fn: function (aNode){
  36543. var self=this;
  36544. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  36545. return $core.withContext(function($ctx1) {
  36546. var $2,$3,$1;
  36547. $2=$recv($IRVerbatim())._new();
  36548. $recv($2)._source_($recv($recv(aNode)._source())._crlfSanitized());
  36549. $3=$recv($2)._yourself();
  36550. $1=$3;
  36551. return $1;
  36552. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36553. },
  36554. args: ["aNode"],
  36555. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  36556. referencedClasses: ["IRVerbatim"],
  36557. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  36558. }),
  36559. $globals.IRASTTranslator);
  36560. $core.addMethod(
  36561. $core.method({
  36562. selector: "visitMethodNode:",
  36563. protocol: 'visiting',
  36564. fn: function (aNode){
  36565. var self=this;
  36566. function $IRMethod(){return $globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  36567. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  36568. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  36569. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36570. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  36571. return $core.withContext(function($ctx1) {
  36572. var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$17,$18,$20,$21,$23,$24,$22,$25,$19,$27,$28,$26,$29;
  36573. $2=$recv($IRMethod())._new();
  36574. $ctx1.sendIdx["new"]=1;
  36575. $recv($2)._source_($recv(self._source())._crlfSanitized());
  36576. $ctx1.sendIdx["source:"]=1;
  36577. $recv($2)._theClass_(self._theClass());
  36578. $recv($2)._arguments_($recv(aNode)._arguments());
  36579. $recv($2)._selector_($recv(aNode)._selector());
  36580. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  36581. $recv($2)._superSends_($recv(aNode)._superSends());
  36582. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  36583. $recv($2)._classReferences_($recv(aNode)._classReferences());
  36584. $3=$2;
  36585. $4=$recv(aNode)._scope();
  36586. $ctx1.sendIdx["scope"]=1;
  36587. $recv($3)._scope_($4);
  36588. $ctx1.sendIdx["scope:"]=1;
  36589. $5=$recv($2)._yourself();
  36590. $ctx1.sendIdx["yourself"]=1;
  36591. $1=$5;
  36592. self._method_($1);
  36593. $7=$recv(aNode)._scope();
  36594. $ctx1.sendIdx["scope"]=2;
  36595. $6=$recv($7)._temps();
  36596. $recv($6)._do_((function(each){
  36597. return $core.withContext(function($ctx2) {
  36598. $8=self._method();
  36599. $ctx2.sendIdx["method"]=1;
  36600. $10=$recv($IRTempDeclaration())._new();
  36601. $ctx2.sendIdx["new"]=2;
  36602. $recv($10)._name_($recv(each)._name());
  36603. $11=$10;
  36604. $12=$recv(aNode)._scope();
  36605. $ctx2.sendIdx["scope"]=3;
  36606. $recv($11)._scope_($12);
  36607. $13=$recv($10)._yourself();
  36608. $ctx2.sendIdx["yourself"]=2;
  36609. $9=$13;
  36610. return $recv($8)._add_($9);
  36611. $ctx2.sendIdx["add:"]=1;
  36612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36613. }));
  36614. $ctx1.sendIdx["do:"]=1;
  36615. $recv($recv(aNode)._nodes())._do_((function(each){
  36616. return $core.withContext(function($ctx2) {
  36617. $14=self._method();
  36618. $ctx2.sendIdx["method"]=2;
  36619. return $recv($14)._add_(self._visit_(each));
  36620. $ctx2.sendIdx["add:"]=2;
  36621. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36622. }));
  36623. $16=$recv(aNode)._scope();
  36624. $ctx1.sendIdx["scope"]=4;
  36625. $15=$recv($16)._hasLocalReturn();
  36626. if(!$core.assert($15)){
  36627. $17=self._method();
  36628. $ctx1.sendIdx["method"]=3;
  36629. $18=$17;
  36630. $20=$recv($IRReturn())._new();
  36631. $ctx1.sendIdx["new"]=3;
  36632. $21=$20;
  36633. $23=$recv($IRVariable())._new();
  36634. $ctx1.sendIdx["new"]=4;
  36635. $recv($23)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  36636. $24=$recv($23)._yourself();
  36637. $ctx1.sendIdx["yourself"]=3;
  36638. $22=$24;
  36639. $recv($21)._add_($22);
  36640. $ctx1.sendIdx["add:"]=4;
  36641. $25=$recv($20)._yourself();
  36642. $ctx1.sendIdx["yourself"]=4;
  36643. $19=$25;
  36644. $recv($18)._add_($19);
  36645. $ctx1.sendIdx["add:"]=3;
  36646. $27=$recv($IRVerbatim())._new();
  36647. $recv($27)._source_("");
  36648. $28=$recv($27)._yourself();
  36649. $26=$recv($17)._add_($28);
  36650. $26;
  36651. };
  36652. $29=self._method();
  36653. return $29;
  36654. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36655. },
  36656. args: ["aNode"],
  36657. 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\x09superSends: aNode superSends;\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",
  36658. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  36659. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "superSends:", "superSends", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"]
  36660. }),
  36661. $globals.IRASTTranslator);
  36662. $core.addMethod(
  36663. $core.method({
  36664. selector: "visitOrAlias:",
  36665. protocol: 'visiting',
  36666. fn: function (aNode){
  36667. var self=this;
  36668. return $core.withContext(function($ctx1) {
  36669. var $2,$1;
  36670. $2=$recv(aNode)._shouldBeAliased();
  36671. if($core.assert($2)){
  36672. $1=self._alias_(aNode);
  36673. } else {
  36674. $1=self._visit_(aNode);
  36675. };
  36676. return $1;
  36677. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  36678. },
  36679. args: ["aNode"],
  36680. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  36681. referencedClasses: [],
  36682. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  36683. }),
  36684. $globals.IRASTTranslator);
  36685. $core.addMethod(
  36686. $core.method({
  36687. selector: "visitReturnNode:",
  36688. protocol: 'visiting',
  36689. fn: function (aNode){
  36690. var self=this;
  36691. var return_;
  36692. function $IRNonLocalReturn(){return $globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  36693. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  36694. return $core.withContext(function($ctx1) {
  36695. var $1,$2;
  36696. $1=$recv(aNode)._nonLocalReturn();
  36697. if($core.assert($1)){
  36698. return_=$recv($IRNonLocalReturn())._new();
  36699. $ctx1.sendIdx["new"]=1;
  36700. } else {
  36701. return_=$recv($IRReturn())._new();
  36702. };
  36703. $recv(return_)._scope_($recv(aNode)._scope());
  36704. $recv($recv(aNode)._nodes())._do_((function(each){
  36705. return $core.withContext(function($ctx2) {
  36706. return $recv(return_)._add_(self._alias_(each));
  36707. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36708. }));
  36709. $2=return_;
  36710. return $2;
  36711. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  36712. },
  36713. args: ["aNode"],
  36714. 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 alias: each) ].\x0a\x09^ return",
  36715. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  36716. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"]
  36717. }),
  36718. $globals.IRASTTranslator);
  36719. $core.addMethod(
  36720. $core.method({
  36721. selector: "visitSendNode:",
  36722. protocol: 'visiting',
  36723. fn: function (aNode){
  36724. var self=this;
  36725. var send,all,receiver,arguments_;
  36726. function $IRSend(){return $globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  36727. return $core.withContext(function($ctx1) {
  36728. var $1,$2,$3,$4;
  36729. send=$recv($IRSend())._new();
  36730. $1=send;
  36731. $recv($1)._selector_($recv(aNode)._selector());
  36732. $2=$recv($1)._index_($recv(aNode)._index());
  36733. $3=$recv(aNode)._superSend();
  36734. if($core.assert($3)){
  36735. $recv(send)._classSend_($recv(self._theClass())._superclass());
  36736. };
  36737. all=self._aliasTemporally_($recv([$recv(aNode)._receiver()]).__comma($recv(aNode)._arguments()));
  36738. receiver=$recv(all)._first();
  36739. arguments_=$recv(all)._allButFirst();
  36740. $recv(send)._add_(receiver);
  36741. $ctx1.sendIdx["add:"]=1;
  36742. $recv(arguments_)._do_((function(each){
  36743. return $core.withContext(function($ctx2) {
  36744. return $recv(send)._add_(each);
  36745. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36746. }));
  36747. $4=send;
  36748. return $4;
  36749. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments_:arguments_},$globals.IRASTTranslator)});
  36750. },
  36751. args: ["aNode"],
  36752. source: "visitSendNode: aNode\x0a\x09| send all receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a\x09\x0a\x09all := self aliasTemporally: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  36753. referencedClasses: ["IRSend"],
  36754. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"]
  36755. }),
  36756. $globals.IRASTTranslator);
  36757. $core.addMethod(
  36758. $core.method({
  36759. selector: "visitSequenceNode:",
  36760. protocol: 'visiting',
  36761. fn: function (aNode){
  36762. var self=this;
  36763. function $IRSequence(){return $globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  36764. return $core.withContext(function($ctx1) {
  36765. var $2,$1;
  36766. $1=self._withSequence_do_($recv($IRSequence())._new(),(function(){
  36767. return $core.withContext(function($ctx2) {
  36768. return $recv($recv(aNode)._nodes())._do_((function(each){
  36769. var instruction;
  36770. return $core.withContext(function($ctx3) {
  36771. instruction=self._visitOrAlias_(each);
  36772. instruction;
  36773. $2=$recv(instruction)._isVariable();
  36774. if(!$core.assert($2)){
  36775. return $recv(self._sequence())._add_(instruction);
  36776. };
  36777. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  36778. }));
  36779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36780. }));
  36781. return $1;
  36782. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36783. },
  36784. args: ["aNode"],
  36785. 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 ] ]]",
  36786. referencedClasses: ["IRSequence"],
  36787. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  36788. }),
  36789. $globals.IRASTTranslator);
  36790. $core.addMethod(
  36791. $core.method({
  36792. selector: "visitValueNode:",
  36793. protocol: 'visiting',
  36794. fn: function (aNode){
  36795. var self=this;
  36796. function $IRValue(){return $globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  36797. return $core.withContext(function($ctx1) {
  36798. var $2,$3,$1;
  36799. $2=$recv($IRValue())._new();
  36800. $recv($2)._value_($recv(aNode)._value());
  36801. $3=$recv($2)._yourself();
  36802. $1=$3;
  36803. return $1;
  36804. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36805. },
  36806. args: ["aNode"],
  36807. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  36808. referencedClasses: ["IRValue"],
  36809. messageSends: ["value:", "new", "value", "yourself"]
  36810. }),
  36811. $globals.IRASTTranslator);
  36812. $core.addMethod(
  36813. $core.method({
  36814. selector: "visitVariableNode:",
  36815. protocol: 'visiting',
  36816. fn: function (aNode){
  36817. var self=this;
  36818. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36819. return $core.withContext(function($ctx1) {
  36820. var $2,$3,$1;
  36821. $2=$recv($IRVariable())._new();
  36822. $recv($2)._variable_($recv(aNode)._binding());
  36823. $3=$recv($2)._yourself();
  36824. $1=$3;
  36825. return $1;
  36826. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36827. },
  36828. args: ["aNode"],
  36829. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  36830. referencedClasses: ["IRVariable"],
  36831. messageSends: ["variable:", "new", "binding", "yourself"]
  36832. }),
  36833. $globals.IRASTTranslator);
  36834. $core.addMethod(
  36835. $core.method({
  36836. selector: "withSequence:do:",
  36837. protocol: 'accessing',
  36838. fn: function (aSequence,aBlock){
  36839. var self=this;
  36840. var outerSequence;
  36841. return $core.withContext(function($ctx1) {
  36842. outerSequence=self._sequence();
  36843. self._sequence_(aSequence);
  36844. $ctx1.sendIdx["sequence:"]=1;
  36845. $recv(aBlock)._value();
  36846. self._sequence_(outerSequence);
  36847. return aSequence;
  36848. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  36849. },
  36850. args: ["aSequence", "aBlock"],
  36851. 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",
  36852. referencedClasses: [],
  36853. messageSends: ["sequence", "sequence:", "value"]
  36854. }),
  36855. $globals.IRASTTranslator);
  36856. $core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  36857. $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.";
  36858. $core.addMethod(
  36859. $core.method({
  36860. selector: "accept:",
  36861. protocol: 'visiting',
  36862. fn: function (aVisitor){
  36863. var self=this;
  36864. return $core.withContext(function($ctx1) {
  36865. var $1;
  36866. $1=$recv(aVisitor)._visitIRInstruction_(self);
  36867. return $1;
  36868. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)});
  36869. },
  36870. args: ["aVisitor"],
  36871. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  36872. referencedClasses: [],
  36873. messageSends: ["visitIRInstruction:"]
  36874. }),
  36875. $globals.IRInstruction);
  36876. $core.addMethod(
  36877. $core.method({
  36878. selector: "add:",
  36879. protocol: 'building',
  36880. fn: function (anObject){
  36881. var self=this;
  36882. return $core.withContext(function($ctx1) {
  36883. var $1;
  36884. $recv(anObject)._parent_(self);
  36885. $1=$recv(self._instructions())._add_(anObject);
  36886. return $1;
  36887. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  36888. },
  36889. args: ["anObject"],
  36890. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  36891. referencedClasses: [],
  36892. messageSends: ["parent:", "add:", "instructions"]
  36893. }),
  36894. $globals.IRInstruction);
  36895. $core.addMethod(
  36896. $core.method({
  36897. selector: "canBeAssigned",
  36898. protocol: 'testing',
  36899. fn: function (){
  36900. var self=this;
  36901. return true;
  36902. },
  36903. args: [],
  36904. source: "canBeAssigned\x0a\x09^ true",
  36905. referencedClasses: [],
  36906. messageSends: []
  36907. }),
  36908. $globals.IRInstruction);
  36909. $core.addMethod(
  36910. $core.method({
  36911. selector: "instructions",
  36912. protocol: 'accessing',
  36913. fn: function (){
  36914. var self=this;
  36915. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  36916. return $core.withContext(function($ctx1) {
  36917. var $2,$1,$receiver;
  36918. $2=self["@instructions"];
  36919. if(($receiver = $2) == null || $receiver.isNil){
  36920. self["@instructions"]=$recv($OrderedCollection())._new();
  36921. $1=self["@instructions"];
  36922. } else {
  36923. $1=$2;
  36924. };
  36925. return $1;
  36926. }, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)});
  36927. },
  36928. args: [],
  36929. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  36930. referencedClasses: ["OrderedCollection"],
  36931. messageSends: ["ifNil:", "new"]
  36932. }),
  36933. $globals.IRInstruction);
  36934. $core.addMethod(
  36935. $core.method({
  36936. selector: "isClosure",
  36937. protocol: 'testing',
  36938. fn: function (){
  36939. var self=this;
  36940. return false;
  36941. },
  36942. args: [],
  36943. source: "isClosure\x0a\x09^ false",
  36944. referencedClasses: [],
  36945. messageSends: []
  36946. }),
  36947. $globals.IRInstruction);
  36948. $core.addMethod(
  36949. $core.method({
  36950. selector: "isInlined",
  36951. protocol: 'testing',
  36952. fn: function (){
  36953. var self=this;
  36954. return false;
  36955. },
  36956. args: [],
  36957. source: "isInlined\x0a\x09^ false",
  36958. referencedClasses: [],
  36959. messageSends: []
  36960. }),
  36961. $globals.IRInstruction);
  36962. $core.addMethod(
  36963. $core.method({
  36964. selector: "isLocalReturn",
  36965. protocol: 'testing',
  36966. fn: function (){
  36967. var self=this;
  36968. return false;
  36969. },
  36970. args: [],
  36971. source: "isLocalReturn\x0a\x09^ false",
  36972. referencedClasses: [],
  36973. messageSends: []
  36974. }),
  36975. $globals.IRInstruction);
  36976. $core.addMethod(
  36977. $core.method({
  36978. selector: "isMethod",
  36979. protocol: 'testing',
  36980. fn: function (){
  36981. var self=this;
  36982. return false;
  36983. },
  36984. args: [],
  36985. source: "isMethod\x0a\x09^ false",
  36986. referencedClasses: [],
  36987. messageSends: []
  36988. }),
  36989. $globals.IRInstruction);
  36990. $core.addMethod(
  36991. $core.method({
  36992. selector: "isReturn",
  36993. protocol: 'testing',
  36994. fn: function (){
  36995. var self=this;
  36996. return false;
  36997. },
  36998. args: [],
  36999. source: "isReturn\x0a\x09^ false",
  37000. referencedClasses: [],
  37001. messageSends: []
  37002. }),
  37003. $globals.IRInstruction);
  37004. $core.addMethod(
  37005. $core.method({
  37006. selector: "isSend",
  37007. protocol: 'testing',
  37008. fn: function (){
  37009. var self=this;
  37010. return false;
  37011. },
  37012. args: [],
  37013. source: "isSend\x0a\x09^ false",
  37014. referencedClasses: [],
  37015. messageSends: []
  37016. }),
  37017. $globals.IRInstruction);
  37018. $core.addMethod(
  37019. $core.method({
  37020. selector: "isSequence",
  37021. protocol: 'testing',
  37022. fn: function (){
  37023. var self=this;
  37024. return false;
  37025. },
  37026. args: [],
  37027. source: "isSequence\x0a\x09^ false",
  37028. referencedClasses: [],
  37029. messageSends: []
  37030. }),
  37031. $globals.IRInstruction);
  37032. $core.addMethod(
  37033. $core.method({
  37034. selector: "isTempDeclaration",
  37035. protocol: 'testing',
  37036. fn: function (){
  37037. var self=this;
  37038. return false;
  37039. },
  37040. args: [],
  37041. source: "isTempDeclaration\x0a\x09^ false",
  37042. referencedClasses: [],
  37043. messageSends: []
  37044. }),
  37045. $globals.IRInstruction);
  37046. $core.addMethod(
  37047. $core.method({
  37048. selector: "isVariable",
  37049. protocol: 'testing',
  37050. fn: function (){
  37051. var self=this;
  37052. return false;
  37053. },
  37054. args: [],
  37055. source: "isVariable\x0a\x09^ false",
  37056. referencedClasses: [],
  37057. messageSends: []
  37058. }),
  37059. $globals.IRInstruction);
  37060. $core.addMethod(
  37061. $core.method({
  37062. selector: "method",
  37063. protocol: 'accessing',
  37064. fn: function (){
  37065. var self=this;
  37066. return $core.withContext(function($ctx1) {
  37067. var $1;
  37068. $1=$recv(self._parent())._method();
  37069. return $1;
  37070. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  37071. },
  37072. args: [],
  37073. source: "method\x0a\x09^ self parent method",
  37074. referencedClasses: [],
  37075. messageSends: ["method", "parent"]
  37076. }),
  37077. $globals.IRInstruction);
  37078. $core.addMethod(
  37079. $core.method({
  37080. selector: "needsBoxingAsReceiver",
  37081. protocol: 'testing',
  37082. fn: function (){
  37083. var self=this;
  37084. return true;
  37085. },
  37086. args: [],
  37087. source: "needsBoxingAsReceiver\x0a\x09^ true",
  37088. referencedClasses: [],
  37089. messageSends: []
  37090. }),
  37091. $globals.IRInstruction);
  37092. $core.addMethod(
  37093. $core.method({
  37094. selector: "parent",
  37095. protocol: 'accessing',
  37096. fn: function (){
  37097. var self=this;
  37098. var $1;
  37099. $1=self["@parent"];
  37100. return $1;
  37101. },
  37102. args: [],
  37103. source: "parent\x0a\x09^ parent",
  37104. referencedClasses: [],
  37105. messageSends: []
  37106. }),
  37107. $globals.IRInstruction);
  37108. $core.addMethod(
  37109. $core.method({
  37110. selector: "parent:",
  37111. protocol: 'accessing',
  37112. fn: function (anIRInstruction){
  37113. var self=this;
  37114. self["@parent"]=anIRInstruction;
  37115. return self;
  37116. },
  37117. args: ["anIRInstruction"],
  37118. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  37119. referencedClasses: [],
  37120. messageSends: []
  37121. }),
  37122. $globals.IRInstruction);
  37123. $core.addMethod(
  37124. $core.method({
  37125. selector: "remove",
  37126. protocol: 'building',
  37127. fn: function (){
  37128. var self=this;
  37129. return $core.withContext(function($ctx1) {
  37130. $recv(self._parent())._remove_(self);
  37131. return self;
  37132. }, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)});
  37133. },
  37134. args: [],
  37135. source: "remove\x0a\x09self parent remove: self",
  37136. referencedClasses: [],
  37137. messageSends: ["remove:", "parent"]
  37138. }),
  37139. $globals.IRInstruction);
  37140. $core.addMethod(
  37141. $core.method({
  37142. selector: "remove:",
  37143. protocol: 'building',
  37144. fn: function (anIRInstruction){
  37145. var self=this;
  37146. return $core.withContext(function($ctx1) {
  37147. $recv(self._instructions())._remove_(anIRInstruction);
  37148. return self;
  37149. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37150. },
  37151. args: ["anIRInstruction"],
  37152. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  37153. referencedClasses: [],
  37154. messageSends: ["remove:", "instructions"]
  37155. }),
  37156. $globals.IRInstruction);
  37157. $core.addMethod(
  37158. $core.method({
  37159. selector: "replace:with:",
  37160. protocol: 'building',
  37161. fn: function (anIRInstruction,anotherIRInstruction){
  37162. var self=this;
  37163. return $core.withContext(function($ctx1) {
  37164. var $1;
  37165. $recv(anotherIRInstruction)._parent_(self);
  37166. $1=self._instructions();
  37167. $ctx1.sendIdx["instructions"]=1;
  37168. $recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  37169. return self;
  37170. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  37171. },
  37172. args: ["anIRInstruction", "anotherIRInstruction"],
  37173. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  37174. referencedClasses: [],
  37175. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  37176. }),
  37177. $globals.IRInstruction);
  37178. $core.addMethod(
  37179. $core.method({
  37180. selector: "replaceWith:",
  37181. protocol: 'building',
  37182. fn: function (anIRInstruction){
  37183. var self=this;
  37184. return $core.withContext(function($ctx1) {
  37185. $recv(self._parent())._replace_with_(self,anIRInstruction);
  37186. return self;
  37187. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37188. },
  37189. args: ["anIRInstruction"],
  37190. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  37191. referencedClasses: [],
  37192. messageSends: ["replace:with:", "parent"]
  37193. }),
  37194. $globals.IRInstruction);
  37195. $core.addMethod(
  37196. $core.method({
  37197. selector: "scope",
  37198. protocol: 'accessing',
  37199. fn: function (){
  37200. var self=this;
  37201. return $core.withContext(function($ctx1) {
  37202. var $2,$1,$receiver;
  37203. $2=self._parent();
  37204. if(($receiver = $2) == null || $receiver.isNil){
  37205. $1=$2;
  37206. } else {
  37207. var node;
  37208. node=$receiver;
  37209. $1=$recv(node)._scope();
  37210. };
  37211. return $1;
  37212. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  37213. },
  37214. args: [],
  37215. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  37216. referencedClasses: [],
  37217. messageSends: ["ifNotNil:", "parent", "scope"]
  37218. }),
  37219. $globals.IRInstruction);
  37220. $core.addMethod(
  37221. $core.method({
  37222. selector: "on:",
  37223. protocol: 'instance creation',
  37224. fn: function (aBuilder){
  37225. var self=this;
  37226. return $core.withContext(function($ctx1) {
  37227. var $2,$3,$1;
  37228. $2=self._new();
  37229. $recv($2)._builder_(aBuilder);
  37230. $3=$recv($2)._yourself();
  37231. $1=$3;
  37232. return $1;
  37233. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  37234. },
  37235. args: ["aBuilder"],
  37236. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  37237. referencedClasses: [],
  37238. messageSends: ["builder:", "new", "yourself"]
  37239. }),
  37240. $globals.IRInstruction.klass);
  37241. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  37242. $core.addMethod(
  37243. $core.method({
  37244. selector: "accept:",
  37245. protocol: 'visiting',
  37246. fn: function (aVisitor){
  37247. var self=this;
  37248. return $core.withContext(function($ctx1) {
  37249. var $1;
  37250. $1=$recv(aVisitor)._visitIRAssignment_(self);
  37251. return $1;
  37252. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)});
  37253. },
  37254. args: ["aVisitor"],
  37255. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  37256. referencedClasses: [],
  37257. messageSends: ["visitIRAssignment:"]
  37258. }),
  37259. $globals.IRAssignment);
  37260. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  37261. $core.addMethod(
  37262. $core.method({
  37263. selector: "accept:",
  37264. protocol: 'visiting',
  37265. fn: function (aVisitor){
  37266. var self=this;
  37267. return $core.withContext(function($ctx1) {
  37268. var $1;
  37269. $1=$recv(aVisitor)._visitIRDynamicArray_(self);
  37270. return $1;
  37271. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  37272. },
  37273. args: ["aVisitor"],
  37274. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  37275. referencedClasses: [],
  37276. messageSends: ["visitIRDynamicArray:"]
  37277. }),
  37278. $globals.IRDynamicArray);
  37279. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  37280. $core.addMethod(
  37281. $core.method({
  37282. selector: "accept:",
  37283. protocol: 'visiting',
  37284. fn: function (aVisitor){
  37285. var self=this;
  37286. return $core.withContext(function($ctx1) {
  37287. var $1;
  37288. $1=$recv(aVisitor)._visitIRDynamicDictionary_(self);
  37289. return $1;
  37290. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  37291. },
  37292. args: ["aVisitor"],
  37293. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  37294. referencedClasses: [],
  37295. messageSends: ["visitIRDynamicDictionary:"]
  37296. }),
  37297. $globals.IRDynamicDictionary);
  37298. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  37299. $core.addMethod(
  37300. $core.method({
  37301. selector: "scope",
  37302. protocol: 'accessing',
  37303. fn: function (){
  37304. var self=this;
  37305. var $1;
  37306. $1=self["@scope"];
  37307. return $1;
  37308. },
  37309. args: [],
  37310. source: "scope\x0a\x09^ scope",
  37311. referencedClasses: [],
  37312. messageSends: []
  37313. }),
  37314. $globals.IRScopedInstruction);
  37315. $core.addMethod(
  37316. $core.method({
  37317. selector: "scope:",
  37318. protocol: 'accessing',
  37319. fn: function (aScope){
  37320. var self=this;
  37321. self["@scope"]=aScope;
  37322. return self;
  37323. },
  37324. args: ["aScope"],
  37325. source: "scope: aScope\x0a\x09scope := aScope",
  37326. referencedClasses: [],
  37327. messageSends: []
  37328. }),
  37329. $globals.IRScopedInstruction);
  37330. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  37331. $core.addMethod(
  37332. $core.method({
  37333. selector: "arguments",
  37334. protocol: 'accessing',
  37335. fn: function (){
  37336. var self=this;
  37337. return $core.withContext(function($ctx1) {
  37338. var $2,$1,$receiver;
  37339. $2=self["@arguments"];
  37340. if(($receiver = $2) == null || $receiver.isNil){
  37341. $1=[];
  37342. } else {
  37343. $1=$2;
  37344. };
  37345. return $1;
  37346. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  37347. },
  37348. args: [],
  37349. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  37350. referencedClasses: [],
  37351. messageSends: ["ifNil:"]
  37352. }),
  37353. $globals.IRClosureInstruction);
  37354. $core.addMethod(
  37355. $core.method({
  37356. selector: "arguments:",
  37357. protocol: 'accessing',
  37358. fn: function (aCollection){
  37359. var self=this;
  37360. self["@arguments"]=aCollection;
  37361. return self;
  37362. },
  37363. args: ["aCollection"],
  37364. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  37365. referencedClasses: [],
  37366. messageSends: []
  37367. }),
  37368. $globals.IRClosureInstruction);
  37369. $core.addMethod(
  37370. $core.method({
  37371. selector: "locals",
  37372. protocol: 'accessing',
  37373. fn: function (){
  37374. var self=this;
  37375. return $core.withContext(function($ctx1) {
  37376. var $2,$3,$1;
  37377. $2=$recv(self._arguments())._copy();
  37378. $recv($2)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  37379. return $core.withContext(function($ctx2) {
  37380. return $recv(each)._name();
  37381. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37382. })));
  37383. $3=$recv($2)._yourself();
  37384. $1=$3;
  37385. return $1;
  37386. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  37387. },
  37388. args: [],
  37389. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  37390. referencedClasses: [],
  37391. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  37392. }),
  37393. $globals.IRClosureInstruction);
  37394. $core.addMethod(
  37395. $core.method({
  37396. selector: "requiresSmalltalkContext",
  37397. protocol: 'accessing',
  37398. fn: function (){
  37399. var self=this;
  37400. return $core.withContext(function($ctx1) {
  37401. var $2,$1,$receiver;
  37402. $2=self["@requiresSmalltalkContext"];
  37403. if(($receiver = $2) == null || $receiver.isNil){
  37404. $1=false;
  37405. } else {
  37406. $1=$2;
  37407. };
  37408. return $1;
  37409. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  37410. },
  37411. args: [],
  37412. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  37413. referencedClasses: [],
  37414. messageSends: ["ifNil:"]
  37415. }),
  37416. $globals.IRClosureInstruction);
  37417. $core.addMethod(
  37418. $core.method({
  37419. selector: "requiresSmalltalkContext:",
  37420. protocol: 'accessing',
  37421. fn: function (anObject){
  37422. var self=this;
  37423. self["@requiresSmalltalkContext"]=anObject;
  37424. return self;
  37425. },
  37426. args: ["anObject"],
  37427. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  37428. referencedClasses: [],
  37429. messageSends: []
  37430. }),
  37431. $globals.IRClosureInstruction);
  37432. $core.addMethod(
  37433. $core.method({
  37434. selector: "scope:",
  37435. protocol: 'accessing',
  37436. fn: function (aScope){
  37437. var self=this;
  37438. return $core.withContext(function($ctx1) {
  37439. (
  37440. $ctx1.supercall = true,
  37441. $globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply($recv(self), [aScope]));
  37442. $ctx1.supercall = false;
  37443. $recv(aScope)._instruction_(self);
  37444. return self;
  37445. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  37446. },
  37447. args: ["aScope"],
  37448. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  37449. referencedClasses: [],
  37450. messageSends: ["scope:", "instruction:"]
  37451. }),
  37452. $globals.IRClosureInstruction);
  37453. $core.addMethod(
  37454. $core.method({
  37455. selector: "tempDeclarations",
  37456. protocol: 'accessing',
  37457. fn: function (){
  37458. var self=this;
  37459. return $core.withContext(function($ctx1) {
  37460. var $1;
  37461. $1=$recv(self._instructions())._select_((function(each){
  37462. return $core.withContext(function($ctx2) {
  37463. return $recv(each)._isTempDeclaration();
  37464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37465. }));
  37466. return $1;
  37467. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  37468. },
  37469. args: [],
  37470. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  37471. referencedClasses: [],
  37472. messageSends: ["select:", "instructions", "isTempDeclaration"]
  37473. }),
  37474. $globals.IRClosureInstruction);
  37475. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  37476. $core.addMethod(
  37477. $core.method({
  37478. selector: "accept:",
  37479. protocol: 'visiting',
  37480. fn: function (aVisitor){
  37481. var self=this;
  37482. return $core.withContext(function($ctx1) {
  37483. var $1;
  37484. $1=$recv(aVisitor)._visitIRClosure_(self);
  37485. return $1;
  37486. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)});
  37487. },
  37488. args: ["aVisitor"],
  37489. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  37490. referencedClasses: [],
  37491. messageSends: ["visitIRClosure:"]
  37492. }),
  37493. $globals.IRClosure);
  37494. $core.addMethod(
  37495. $core.method({
  37496. selector: "isClosure",
  37497. protocol: 'testing',
  37498. fn: function (){
  37499. var self=this;
  37500. return true;
  37501. },
  37502. args: [],
  37503. source: "isClosure\x0a\x09^ true",
  37504. referencedClasses: [],
  37505. messageSends: []
  37506. }),
  37507. $globals.IRClosure);
  37508. $core.addMethod(
  37509. $core.method({
  37510. selector: "sequence",
  37511. protocol: 'accessing',
  37512. fn: function (){
  37513. var self=this;
  37514. return $core.withContext(function($ctx1) {
  37515. var $1;
  37516. $1=$recv(self._instructions())._last();
  37517. return $1;
  37518. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  37519. },
  37520. args: [],
  37521. source: "sequence\x0a\x09^ self instructions last",
  37522. referencedClasses: [],
  37523. messageSends: ["last", "instructions"]
  37524. }),
  37525. $globals.IRClosure);
  37526. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  37527. $globals.IRMethod.comment="I am a method instruction";
  37528. $core.addMethod(
  37529. $core.method({
  37530. selector: "accept:",
  37531. protocol: 'visiting',
  37532. fn: function (aVisitor){
  37533. var self=this;
  37534. return $core.withContext(function($ctx1) {
  37535. var $1;
  37536. $1=$recv(aVisitor)._visitIRMethod_(self);
  37537. return $1;
  37538. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)});
  37539. },
  37540. args: ["aVisitor"],
  37541. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  37542. referencedClasses: [],
  37543. messageSends: ["visitIRMethod:"]
  37544. }),
  37545. $globals.IRMethod);
  37546. $core.addMethod(
  37547. $core.method({
  37548. selector: "classReferences",
  37549. protocol: 'accessing',
  37550. fn: function (){
  37551. var self=this;
  37552. var $1;
  37553. $1=self["@classReferences"];
  37554. return $1;
  37555. },
  37556. args: [],
  37557. source: "classReferences\x0a\x09^ classReferences",
  37558. referencedClasses: [],
  37559. messageSends: []
  37560. }),
  37561. $globals.IRMethod);
  37562. $core.addMethod(
  37563. $core.method({
  37564. selector: "classReferences:",
  37565. protocol: 'accessing',
  37566. fn: function (aCollection){
  37567. var self=this;
  37568. self["@classReferences"]=aCollection;
  37569. return self;
  37570. },
  37571. args: ["aCollection"],
  37572. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  37573. referencedClasses: [],
  37574. messageSends: []
  37575. }),
  37576. $globals.IRMethod);
  37577. $core.addMethod(
  37578. $core.method({
  37579. selector: "internalVariables",
  37580. protocol: 'accessing',
  37581. fn: function (){
  37582. var self=this;
  37583. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  37584. return $core.withContext(function($ctx1) {
  37585. var $2,$1,$receiver;
  37586. $2=self["@internalVariables"];
  37587. if(($receiver = $2) == null || $receiver.isNil){
  37588. self["@internalVariables"]=$recv($Set())._new();
  37589. $1=self["@internalVariables"];
  37590. } else {
  37591. $1=$2;
  37592. };
  37593. return $1;
  37594. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  37595. },
  37596. args: [],
  37597. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  37598. referencedClasses: ["Set"],
  37599. messageSends: ["ifNil:", "new"]
  37600. }),
  37601. $globals.IRMethod);
  37602. $core.addMethod(
  37603. $core.method({
  37604. selector: "isMethod",
  37605. protocol: 'accessing',
  37606. fn: function (){
  37607. var self=this;
  37608. return true;
  37609. },
  37610. args: [],
  37611. source: "isMethod\x0a\x09^ true",
  37612. referencedClasses: [],
  37613. messageSends: []
  37614. }),
  37615. $globals.IRMethod);
  37616. $core.addMethod(
  37617. $core.method({
  37618. selector: "messageSends",
  37619. protocol: 'accessing',
  37620. fn: function (){
  37621. var self=this;
  37622. return $core.withContext(function($ctx1) {
  37623. var $1;
  37624. $1=$recv(self._sendIndexes())._keys();
  37625. return $1;
  37626. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  37627. },
  37628. args: [],
  37629. source: "messageSends\x0a\x09^ self sendIndexes keys",
  37630. referencedClasses: [],
  37631. messageSends: ["keys", "sendIndexes"]
  37632. }),
  37633. $globals.IRMethod);
  37634. $core.addMethod(
  37635. $core.method({
  37636. selector: "method",
  37637. protocol: 'accessing',
  37638. fn: function (){
  37639. var self=this;
  37640. return self;
  37641. },
  37642. args: [],
  37643. source: "method\x0a\x09^ self",
  37644. referencedClasses: [],
  37645. messageSends: []
  37646. }),
  37647. $globals.IRMethod);
  37648. $core.addMethod(
  37649. $core.method({
  37650. selector: "selector",
  37651. protocol: 'accessing',
  37652. fn: function (){
  37653. var self=this;
  37654. var $1;
  37655. $1=self["@selector"];
  37656. return $1;
  37657. },
  37658. args: [],
  37659. source: "selector\x0a\x09^ selector",
  37660. referencedClasses: [],
  37661. messageSends: []
  37662. }),
  37663. $globals.IRMethod);
  37664. $core.addMethod(
  37665. $core.method({
  37666. selector: "selector:",
  37667. protocol: 'accessing',
  37668. fn: function (aString){
  37669. var self=this;
  37670. self["@selector"]=aString;
  37671. return self;
  37672. },
  37673. args: ["aString"],
  37674. source: "selector: aString\x0a\x09selector := aString",
  37675. referencedClasses: [],
  37676. messageSends: []
  37677. }),
  37678. $globals.IRMethod);
  37679. $core.addMethod(
  37680. $core.method({
  37681. selector: "sendIndexes",
  37682. protocol: 'accessing',
  37683. fn: function (){
  37684. var self=this;
  37685. var $1;
  37686. $1=self["@sendIndexes"];
  37687. return $1;
  37688. },
  37689. args: [],
  37690. source: "sendIndexes\x0a\x09^ sendIndexes",
  37691. referencedClasses: [],
  37692. messageSends: []
  37693. }),
  37694. $globals.IRMethod);
  37695. $core.addMethod(
  37696. $core.method({
  37697. selector: "sendIndexes:",
  37698. protocol: 'accessing',
  37699. fn: function (aDictionary){
  37700. var self=this;
  37701. self["@sendIndexes"]=aDictionary;
  37702. return self;
  37703. },
  37704. args: ["aDictionary"],
  37705. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  37706. referencedClasses: [],
  37707. messageSends: []
  37708. }),
  37709. $globals.IRMethod);
  37710. $core.addMethod(
  37711. $core.method({
  37712. selector: "source",
  37713. protocol: 'accessing',
  37714. fn: function (){
  37715. var self=this;
  37716. var $1;
  37717. $1=self["@source"];
  37718. return $1;
  37719. },
  37720. args: [],
  37721. source: "source\x0a\x09^ source",
  37722. referencedClasses: [],
  37723. messageSends: []
  37724. }),
  37725. $globals.IRMethod);
  37726. $core.addMethod(
  37727. $core.method({
  37728. selector: "source:",
  37729. protocol: 'accessing',
  37730. fn: function (aString){
  37731. var self=this;
  37732. self["@source"]=aString;
  37733. return self;
  37734. },
  37735. args: ["aString"],
  37736. source: "source: aString\x0a\x09source := aString",
  37737. referencedClasses: [],
  37738. messageSends: []
  37739. }),
  37740. $globals.IRMethod);
  37741. $core.addMethod(
  37742. $core.method({
  37743. selector: "superSends",
  37744. protocol: 'accessing',
  37745. fn: function (){
  37746. var self=this;
  37747. var $1;
  37748. $1=self["@superSends"];
  37749. return $1;
  37750. },
  37751. args: [],
  37752. source: "superSends\x0a\x09^ superSends",
  37753. referencedClasses: [],
  37754. messageSends: []
  37755. }),
  37756. $globals.IRMethod);
  37757. $core.addMethod(
  37758. $core.method({
  37759. selector: "superSends:",
  37760. protocol: 'accessing',
  37761. fn: function (aCollection){
  37762. var self=this;
  37763. self["@superSends"]=aCollection;
  37764. return self;
  37765. },
  37766. args: ["aCollection"],
  37767. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  37768. referencedClasses: [],
  37769. messageSends: []
  37770. }),
  37771. $globals.IRMethod);
  37772. $core.addMethod(
  37773. $core.method({
  37774. selector: "theClass",
  37775. protocol: 'accessing',
  37776. fn: function (){
  37777. var self=this;
  37778. var $1;
  37779. $1=self["@theClass"];
  37780. return $1;
  37781. },
  37782. args: [],
  37783. source: "theClass\x0a\x09^ theClass",
  37784. referencedClasses: [],
  37785. messageSends: []
  37786. }),
  37787. $globals.IRMethod);
  37788. $core.addMethod(
  37789. $core.method({
  37790. selector: "theClass:",
  37791. protocol: 'accessing',
  37792. fn: function (aClass){
  37793. var self=this;
  37794. self["@theClass"]=aClass;
  37795. return self;
  37796. },
  37797. args: ["aClass"],
  37798. source: "theClass: aClass\x0a\x09theClass := aClass",
  37799. referencedClasses: [],
  37800. messageSends: []
  37801. }),
  37802. $globals.IRMethod);
  37803. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  37804. $globals.IRReturn.comment="I am a local return instruction.";
  37805. $core.addMethod(
  37806. $core.method({
  37807. selector: "accept:",
  37808. protocol: 'visiting',
  37809. fn: function (aVisitor){
  37810. var self=this;
  37811. return $core.withContext(function($ctx1) {
  37812. var $1;
  37813. $1=$recv(aVisitor)._visitIRReturn_(self);
  37814. return $1;
  37815. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)});
  37816. },
  37817. args: ["aVisitor"],
  37818. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  37819. referencedClasses: [],
  37820. messageSends: ["visitIRReturn:"]
  37821. }),
  37822. $globals.IRReturn);
  37823. $core.addMethod(
  37824. $core.method({
  37825. selector: "canBeAssigned",
  37826. protocol: 'testing',
  37827. fn: function (){
  37828. var self=this;
  37829. return false;
  37830. },
  37831. args: [],
  37832. source: "canBeAssigned\x0a\x09^ false",
  37833. referencedClasses: [],
  37834. messageSends: []
  37835. }),
  37836. $globals.IRReturn);
  37837. $core.addMethod(
  37838. $core.method({
  37839. selector: "isBlockReturn",
  37840. protocol: 'testing',
  37841. fn: function (){
  37842. var self=this;
  37843. return false;
  37844. },
  37845. args: [],
  37846. source: "isBlockReturn\x0a\x09^ false",
  37847. referencedClasses: [],
  37848. messageSends: []
  37849. }),
  37850. $globals.IRReturn);
  37851. $core.addMethod(
  37852. $core.method({
  37853. selector: "isLocalReturn",
  37854. protocol: 'testing',
  37855. fn: function (){
  37856. var self=this;
  37857. return true;
  37858. },
  37859. args: [],
  37860. source: "isLocalReturn\x0a\x09^ true",
  37861. referencedClasses: [],
  37862. messageSends: []
  37863. }),
  37864. $globals.IRReturn);
  37865. $core.addMethod(
  37866. $core.method({
  37867. selector: "isNonLocalReturn",
  37868. protocol: 'testing',
  37869. fn: function (){
  37870. var self=this;
  37871. return $core.withContext(function($ctx1) {
  37872. var $1;
  37873. $1=$recv(self._isLocalReturn())._not();
  37874. return $1;
  37875. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)});
  37876. },
  37877. args: [],
  37878. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  37879. referencedClasses: [],
  37880. messageSends: ["not", "isLocalReturn"]
  37881. }),
  37882. $globals.IRReturn);
  37883. $core.addMethod(
  37884. $core.method({
  37885. selector: "isReturn",
  37886. protocol: 'testing',
  37887. fn: function (){
  37888. var self=this;
  37889. return true;
  37890. },
  37891. args: [],
  37892. source: "isReturn\x0a\x09^ true",
  37893. referencedClasses: [],
  37894. messageSends: []
  37895. }),
  37896. $globals.IRReturn);
  37897. $core.addMethod(
  37898. $core.method({
  37899. selector: "scope",
  37900. protocol: 'accessing',
  37901. fn: function (){
  37902. var self=this;
  37903. return $core.withContext(function($ctx1) {
  37904. var $2,$1,$receiver;
  37905. $2=self["@scope"];
  37906. if(($receiver = $2) == null || $receiver.isNil){
  37907. $1=$recv(self._parent())._scope();
  37908. } else {
  37909. $1=$2;
  37910. };
  37911. return $1;
  37912. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  37913. },
  37914. args: [],
  37915. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  37916. referencedClasses: [],
  37917. messageSends: ["ifNil:", "scope", "parent"]
  37918. }),
  37919. $globals.IRReturn);
  37920. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  37921. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  37922. $core.addMethod(
  37923. $core.method({
  37924. selector: "accept:",
  37925. protocol: 'visiting',
  37926. fn: function (aVisitor){
  37927. var self=this;
  37928. return $core.withContext(function($ctx1) {
  37929. var $1;
  37930. $1=$recv(aVisitor)._visitIRBlockReturn_(self);
  37931. return $1;
  37932. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  37933. },
  37934. args: ["aVisitor"],
  37935. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  37936. referencedClasses: [],
  37937. messageSends: ["visitIRBlockReturn:"]
  37938. }),
  37939. $globals.IRBlockReturn);
  37940. $core.addMethod(
  37941. $core.method({
  37942. selector: "isBlockReturn",
  37943. protocol: 'testing',
  37944. fn: function (){
  37945. var self=this;
  37946. return true;
  37947. },
  37948. args: [],
  37949. source: "isBlockReturn\x0a\x09^ true",
  37950. referencedClasses: [],
  37951. messageSends: []
  37952. }),
  37953. $globals.IRBlockReturn);
  37954. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  37955. $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.";
  37956. $core.addMethod(
  37957. $core.method({
  37958. selector: "accept:",
  37959. protocol: 'visiting',
  37960. fn: function (aVisitor){
  37961. var self=this;
  37962. return $core.withContext(function($ctx1) {
  37963. var $1;
  37964. $1=$recv(aVisitor)._visitIRNonLocalReturn_(self);
  37965. return $1;
  37966. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  37967. },
  37968. args: ["aVisitor"],
  37969. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  37970. referencedClasses: [],
  37971. messageSends: ["visitIRNonLocalReturn:"]
  37972. }),
  37973. $globals.IRNonLocalReturn);
  37974. $core.addMethod(
  37975. $core.method({
  37976. selector: "isLocalReturn",
  37977. protocol: 'testing',
  37978. fn: function (){
  37979. var self=this;
  37980. return false;
  37981. },
  37982. args: [],
  37983. source: "isLocalReturn\x0a\x09^ false",
  37984. referencedClasses: [],
  37985. messageSends: []
  37986. }),
  37987. $globals.IRNonLocalReturn);
  37988. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  37989. $core.addMethod(
  37990. $core.method({
  37991. selector: "accept:",
  37992. protocol: 'visiting',
  37993. fn: function (aVisitor){
  37994. var self=this;
  37995. return $core.withContext(function($ctx1) {
  37996. var $1;
  37997. $1=$recv(aVisitor)._visitIRTempDeclaration_(self);
  37998. return $1;
  37999. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  38000. },
  38001. args: ["aVisitor"],
  38002. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  38003. referencedClasses: [],
  38004. messageSends: ["visitIRTempDeclaration:"]
  38005. }),
  38006. $globals.IRTempDeclaration);
  38007. $core.addMethod(
  38008. $core.method({
  38009. selector: "isTempDeclaration",
  38010. protocol: 'testing',
  38011. fn: function (){
  38012. var self=this;
  38013. return true;
  38014. },
  38015. args: [],
  38016. source: "isTempDeclaration\x0a\x09^ true",
  38017. referencedClasses: [],
  38018. messageSends: []
  38019. }),
  38020. $globals.IRTempDeclaration);
  38021. $core.addMethod(
  38022. $core.method({
  38023. selector: "name",
  38024. protocol: 'accessing',
  38025. fn: function (){
  38026. var self=this;
  38027. var $1;
  38028. $1=self["@name"];
  38029. return $1;
  38030. },
  38031. args: [],
  38032. source: "name\x0a\x09^ name",
  38033. referencedClasses: [],
  38034. messageSends: []
  38035. }),
  38036. $globals.IRTempDeclaration);
  38037. $core.addMethod(
  38038. $core.method({
  38039. selector: "name:",
  38040. protocol: 'accessing',
  38041. fn: function (aString){
  38042. var self=this;
  38043. self["@name"]=aString;
  38044. return self;
  38045. },
  38046. args: ["aString"],
  38047. source: "name: aString\x0a\x09name := aString",
  38048. referencedClasses: [],
  38049. messageSends: []
  38050. }),
  38051. $globals.IRTempDeclaration);
  38052. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  38053. $globals.IRSend.comment="I am a message send instruction.";
  38054. $core.addMethod(
  38055. $core.method({
  38056. selector: "accept:",
  38057. protocol: 'visiting',
  38058. fn: function (aVisitor){
  38059. var self=this;
  38060. return $core.withContext(function($ctx1) {
  38061. var $1;
  38062. $1=$recv(aVisitor)._visitIRSend_(self);
  38063. return $1;
  38064. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)});
  38065. },
  38066. args: ["aVisitor"],
  38067. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  38068. referencedClasses: [],
  38069. messageSends: ["visitIRSend:"]
  38070. }),
  38071. $globals.IRSend);
  38072. $core.addMethod(
  38073. $core.method({
  38074. selector: "classSend",
  38075. protocol: 'accessing',
  38076. fn: function (){
  38077. var self=this;
  38078. var $1;
  38079. $1=self["@classSend"];
  38080. return $1;
  38081. },
  38082. args: [],
  38083. source: "classSend\x0a\x09^ classSend",
  38084. referencedClasses: [],
  38085. messageSends: []
  38086. }),
  38087. $globals.IRSend);
  38088. $core.addMethod(
  38089. $core.method({
  38090. selector: "classSend:",
  38091. protocol: 'accessing',
  38092. fn: function (aClass){
  38093. var self=this;
  38094. self["@classSend"]=aClass;
  38095. return self;
  38096. },
  38097. args: ["aClass"],
  38098. source: "classSend: aClass\x0a\x09classSend := aClass",
  38099. referencedClasses: [],
  38100. messageSends: []
  38101. }),
  38102. $globals.IRSend);
  38103. $core.addMethod(
  38104. $core.method({
  38105. selector: "index",
  38106. protocol: 'accessing',
  38107. fn: function (){
  38108. var self=this;
  38109. var $1;
  38110. $1=self["@index"];
  38111. return $1;
  38112. },
  38113. args: [],
  38114. source: "index\x0a\x09^ index",
  38115. referencedClasses: [],
  38116. messageSends: []
  38117. }),
  38118. $globals.IRSend);
  38119. $core.addMethod(
  38120. $core.method({
  38121. selector: "index:",
  38122. protocol: 'accessing',
  38123. fn: function (anInteger){
  38124. var self=this;
  38125. self["@index"]=anInteger;
  38126. return self;
  38127. },
  38128. args: ["anInteger"],
  38129. source: "index: anInteger\x0a\x09index := anInteger",
  38130. referencedClasses: [],
  38131. messageSends: []
  38132. }),
  38133. $globals.IRSend);
  38134. $core.addMethod(
  38135. $core.method({
  38136. selector: "isSend",
  38137. protocol: 'testing',
  38138. fn: function (){
  38139. var self=this;
  38140. return true;
  38141. },
  38142. args: [],
  38143. source: "isSend\x0a\x09^ true",
  38144. referencedClasses: [],
  38145. messageSends: []
  38146. }),
  38147. $globals.IRSend);
  38148. $core.addMethod(
  38149. $core.method({
  38150. selector: "selector",
  38151. protocol: 'accessing',
  38152. fn: function (){
  38153. var self=this;
  38154. var $1;
  38155. $1=self["@selector"];
  38156. return $1;
  38157. },
  38158. args: [],
  38159. source: "selector\x0a\x09^ selector",
  38160. referencedClasses: [],
  38161. messageSends: []
  38162. }),
  38163. $globals.IRSend);
  38164. $core.addMethod(
  38165. $core.method({
  38166. selector: "selector:",
  38167. protocol: 'accessing',
  38168. fn: function (aString){
  38169. var self=this;
  38170. self["@selector"]=aString;
  38171. return self;
  38172. },
  38173. args: ["aString"],
  38174. source: "selector: aString\x0a\x09selector := aString",
  38175. referencedClasses: [],
  38176. messageSends: []
  38177. }),
  38178. $globals.IRSend);
  38179. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  38180. $core.addMethod(
  38181. $core.method({
  38182. selector: "accept:",
  38183. protocol: 'visiting',
  38184. fn: function (aVisitor){
  38185. var self=this;
  38186. return $core.withContext(function($ctx1) {
  38187. var $1;
  38188. $1=$recv(aVisitor)._visitIRSequence_(self);
  38189. return $1;
  38190. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)});
  38191. },
  38192. args: ["aVisitor"],
  38193. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  38194. referencedClasses: [],
  38195. messageSends: ["visitIRSequence:"]
  38196. }),
  38197. $globals.IRSequence);
  38198. $core.addMethod(
  38199. $core.method({
  38200. selector: "isSequence",
  38201. protocol: 'testing',
  38202. fn: function (){
  38203. var self=this;
  38204. return true;
  38205. },
  38206. args: [],
  38207. source: "isSequence\x0a\x09^ true",
  38208. referencedClasses: [],
  38209. messageSends: []
  38210. }),
  38211. $globals.IRSequence);
  38212. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  38213. $core.addMethod(
  38214. $core.method({
  38215. selector: "accept:",
  38216. protocol: 'visiting',
  38217. fn: function (aVisitor){
  38218. var self=this;
  38219. return $core.withContext(function($ctx1) {
  38220. var $1;
  38221. $1=$recv(aVisitor)._visitIRBlockSequence_(self);
  38222. return $1;
  38223. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  38224. },
  38225. args: ["aVisitor"],
  38226. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  38227. referencedClasses: [],
  38228. messageSends: ["visitIRBlockSequence:"]
  38229. }),
  38230. $globals.IRBlockSequence);
  38231. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  38232. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  38233. $core.addMethod(
  38234. $core.method({
  38235. selector: "accept:",
  38236. protocol: 'visiting',
  38237. fn: function (aVisitor){
  38238. var self=this;
  38239. return $core.withContext(function($ctx1) {
  38240. var $1;
  38241. $1=$recv(aVisitor)._visitIRValue_(self);
  38242. return $1;
  38243. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)});
  38244. },
  38245. args: ["aVisitor"],
  38246. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  38247. referencedClasses: [],
  38248. messageSends: ["visitIRValue:"]
  38249. }),
  38250. $globals.IRValue);
  38251. $core.addMethod(
  38252. $core.method({
  38253. selector: "needsBoxingAsReceiver",
  38254. protocol: 'testing',
  38255. fn: function (){
  38256. var self=this;
  38257. return false;
  38258. },
  38259. args: [],
  38260. source: "needsBoxingAsReceiver\x0a\x09^ false",
  38261. referencedClasses: [],
  38262. messageSends: []
  38263. }),
  38264. $globals.IRValue);
  38265. $core.addMethod(
  38266. $core.method({
  38267. selector: "value",
  38268. protocol: 'accessing',
  38269. fn: function (){
  38270. var self=this;
  38271. var $1;
  38272. $1=self["@value"];
  38273. return $1;
  38274. },
  38275. args: [],
  38276. source: "value\x0a\x09^ value",
  38277. referencedClasses: [],
  38278. messageSends: []
  38279. }),
  38280. $globals.IRValue);
  38281. $core.addMethod(
  38282. $core.method({
  38283. selector: "value:",
  38284. protocol: 'accessing',
  38285. fn: function (aString){
  38286. var self=this;
  38287. self["@value"]=aString;
  38288. return self;
  38289. },
  38290. args: ["aString"],
  38291. source: "value: aString\x0a\x09value := aString",
  38292. referencedClasses: [],
  38293. messageSends: []
  38294. }),
  38295. $globals.IRValue);
  38296. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  38297. $globals.IRVariable.comment="I am a variable instruction.";
  38298. $core.addMethod(
  38299. $core.method({
  38300. selector: "accept:",
  38301. protocol: 'visiting',
  38302. fn: function (aVisitor){
  38303. var self=this;
  38304. return $core.withContext(function($ctx1) {
  38305. var $1;
  38306. $1=$recv(aVisitor)._visitIRVariable_(self);
  38307. return $1;
  38308. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)});
  38309. },
  38310. args: ["aVisitor"],
  38311. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  38312. referencedClasses: [],
  38313. messageSends: ["visitIRVariable:"]
  38314. }),
  38315. $globals.IRVariable);
  38316. $core.addMethod(
  38317. $core.method({
  38318. selector: "isVariable",
  38319. protocol: 'testing',
  38320. fn: function (){
  38321. var self=this;
  38322. return true;
  38323. },
  38324. args: [],
  38325. source: "isVariable\x0a\x09^ true",
  38326. referencedClasses: [],
  38327. messageSends: []
  38328. }),
  38329. $globals.IRVariable);
  38330. $core.addMethod(
  38331. $core.method({
  38332. selector: "needsBoxingAsReceiver",
  38333. protocol: 'testing',
  38334. fn: function (){
  38335. var self=this;
  38336. return $core.withContext(function($ctx1) {
  38337. var $1;
  38338. $1=$recv($recv(self._variable())._isPseudoVar())._not();
  38339. return $1;
  38340. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  38341. },
  38342. args: [],
  38343. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  38344. referencedClasses: [],
  38345. messageSends: ["not", "isPseudoVar", "variable"]
  38346. }),
  38347. $globals.IRVariable);
  38348. $core.addMethod(
  38349. $core.method({
  38350. selector: "variable",
  38351. protocol: 'accessing',
  38352. fn: function (){
  38353. var self=this;
  38354. var $1;
  38355. $1=self["@variable"];
  38356. return $1;
  38357. },
  38358. args: [],
  38359. source: "variable\x0a\x09^ variable",
  38360. referencedClasses: [],
  38361. messageSends: []
  38362. }),
  38363. $globals.IRVariable);
  38364. $core.addMethod(
  38365. $core.method({
  38366. selector: "variable:",
  38367. protocol: 'accessing',
  38368. fn: function (aScopeVariable){
  38369. var self=this;
  38370. self["@variable"]=aScopeVariable;
  38371. return self;
  38372. },
  38373. args: ["aScopeVariable"],
  38374. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  38375. referencedClasses: [],
  38376. messageSends: []
  38377. }),
  38378. $globals.IRVariable);
  38379. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  38380. $core.addMethod(
  38381. $core.method({
  38382. selector: "accept:",
  38383. protocol: 'visiting',
  38384. fn: function (aVisitor){
  38385. var self=this;
  38386. return $core.withContext(function($ctx1) {
  38387. var $1;
  38388. $1=$recv(aVisitor)._visitIRVerbatim_(self);
  38389. return $1;
  38390. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  38391. },
  38392. args: ["aVisitor"],
  38393. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  38394. referencedClasses: [],
  38395. messageSends: ["visitIRVerbatim:"]
  38396. }),
  38397. $globals.IRVerbatim);
  38398. $core.addMethod(
  38399. $core.method({
  38400. selector: "source",
  38401. protocol: 'accessing',
  38402. fn: function (){
  38403. var self=this;
  38404. var $1;
  38405. $1=self["@source"];
  38406. return $1;
  38407. },
  38408. args: [],
  38409. source: "source\x0a\x09^ source",
  38410. referencedClasses: [],
  38411. messageSends: []
  38412. }),
  38413. $globals.IRVerbatim);
  38414. $core.addMethod(
  38415. $core.method({
  38416. selector: "source:",
  38417. protocol: 'accessing',
  38418. fn: function (aString){
  38419. var self=this;
  38420. self["@source"]=aString;
  38421. return self;
  38422. },
  38423. args: ["aString"],
  38424. source: "source: aString\x0a\x09source := aString",
  38425. referencedClasses: [],
  38426. messageSends: []
  38427. }),
  38428. $globals.IRVerbatim);
  38429. $core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR');
  38430. $core.addMethod(
  38431. $core.method({
  38432. selector: "visit:",
  38433. protocol: 'visiting',
  38434. fn: function (anIRInstruction){
  38435. var self=this;
  38436. return $core.withContext(function($ctx1) {
  38437. var $1;
  38438. $1=$recv(anIRInstruction)._accept_(self);
  38439. return $1;
  38440. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  38441. },
  38442. args: ["anIRInstruction"],
  38443. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  38444. referencedClasses: [],
  38445. messageSends: ["accept:"]
  38446. }),
  38447. $globals.IRVisitor);
  38448. $core.addMethod(
  38449. $core.method({
  38450. selector: "visitIRAssignment:",
  38451. protocol: 'visiting',
  38452. fn: function (anIRAssignment){
  38453. var self=this;
  38454. return $core.withContext(function($ctx1) {
  38455. var $1;
  38456. $1=self._visitIRInstruction_(anIRAssignment);
  38457. return $1;
  38458. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  38459. },
  38460. args: ["anIRAssignment"],
  38461. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  38462. referencedClasses: [],
  38463. messageSends: ["visitIRInstruction:"]
  38464. }),
  38465. $globals.IRVisitor);
  38466. $core.addMethod(
  38467. $core.method({
  38468. selector: "visitIRBlockReturn:",
  38469. protocol: 'visiting',
  38470. fn: function (anIRBlockReturn){
  38471. var self=this;
  38472. return $core.withContext(function($ctx1) {
  38473. var $1;
  38474. $1=self._visitIRReturn_(anIRBlockReturn);
  38475. return $1;
  38476. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  38477. },
  38478. args: ["anIRBlockReturn"],
  38479. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  38480. referencedClasses: [],
  38481. messageSends: ["visitIRReturn:"]
  38482. }),
  38483. $globals.IRVisitor);
  38484. $core.addMethod(
  38485. $core.method({
  38486. selector: "visitIRBlockSequence:",
  38487. protocol: 'visiting',
  38488. fn: function (anIRBlockSequence){
  38489. var self=this;
  38490. return $core.withContext(function($ctx1) {
  38491. var $1;
  38492. $1=self._visitIRSequence_(anIRBlockSequence);
  38493. return $1;
  38494. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  38495. },
  38496. args: ["anIRBlockSequence"],
  38497. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  38498. referencedClasses: [],
  38499. messageSends: ["visitIRSequence:"]
  38500. }),
  38501. $globals.IRVisitor);
  38502. $core.addMethod(
  38503. $core.method({
  38504. selector: "visitIRClosure:",
  38505. protocol: 'visiting',
  38506. fn: function (anIRClosure){
  38507. var self=this;
  38508. return $core.withContext(function($ctx1) {
  38509. var $1;
  38510. $1=self._visitIRInstruction_(anIRClosure);
  38511. return $1;
  38512. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  38513. },
  38514. args: ["anIRClosure"],
  38515. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  38516. referencedClasses: [],
  38517. messageSends: ["visitIRInstruction:"]
  38518. }),
  38519. $globals.IRVisitor);
  38520. $core.addMethod(
  38521. $core.method({
  38522. selector: "visitIRDynamicArray:",
  38523. protocol: 'visiting',
  38524. fn: function (anIRDynamicArray){
  38525. var self=this;
  38526. return $core.withContext(function($ctx1) {
  38527. var $1;
  38528. $1=self._visitIRInstruction_(anIRDynamicArray);
  38529. return $1;
  38530. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  38531. },
  38532. args: ["anIRDynamicArray"],
  38533. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  38534. referencedClasses: [],
  38535. messageSends: ["visitIRInstruction:"]
  38536. }),
  38537. $globals.IRVisitor);
  38538. $core.addMethod(
  38539. $core.method({
  38540. selector: "visitIRDynamicDictionary:",
  38541. protocol: 'visiting',
  38542. fn: function (anIRDynamicDictionary){
  38543. var self=this;
  38544. return $core.withContext(function($ctx1) {
  38545. var $1;
  38546. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  38547. return $1;
  38548. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  38549. },
  38550. args: ["anIRDynamicDictionary"],
  38551. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  38552. referencedClasses: [],
  38553. messageSends: ["visitIRInstruction:"]
  38554. }),
  38555. $globals.IRVisitor);
  38556. $core.addMethod(
  38557. $core.method({
  38558. selector: "visitIRInlinedClosure:",
  38559. protocol: 'visiting',
  38560. fn: function (anIRInlinedClosure){
  38561. var self=this;
  38562. return $core.withContext(function($ctx1) {
  38563. var $1;
  38564. $1=self._visitIRClosure_(anIRInlinedClosure);
  38565. return $1;
  38566. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  38567. },
  38568. args: ["anIRInlinedClosure"],
  38569. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  38570. referencedClasses: [],
  38571. messageSends: ["visitIRClosure:"]
  38572. }),
  38573. $globals.IRVisitor);
  38574. $core.addMethod(
  38575. $core.method({
  38576. selector: "visitIRInlinedSequence:",
  38577. protocol: 'visiting',
  38578. fn: function (anIRInlinedSequence){
  38579. var self=this;
  38580. return $core.withContext(function($ctx1) {
  38581. var $1;
  38582. $1=self._visitIRSequence_(anIRInlinedSequence);
  38583. return $1;
  38584. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  38585. },
  38586. args: ["anIRInlinedSequence"],
  38587. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  38588. referencedClasses: [],
  38589. messageSends: ["visitIRSequence:"]
  38590. }),
  38591. $globals.IRVisitor);
  38592. $core.addMethod(
  38593. $core.method({
  38594. selector: "visitIRInstruction:",
  38595. protocol: 'visiting',
  38596. fn: function (anIRInstruction){
  38597. var self=this;
  38598. return $core.withContext(function($ctx1) {
  38599. $recv($recv(anIRInstruction)._instructions())._do_((function(each){
  38600. return $core.withContext(function($ctx2) {
  38601. return self._visit_(each);
  38602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38603. }));
  38604. return anIRInstruction;
  38605. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  38606. },
  38607. args: ["anIRInstruction"],
  38608. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  38609. referencedClasses: [],
  38610. messageSends: ["do:", "instructions", "visit:"]
  38611. }),
  38612. $globals.IRVisitor);
  38613. $core.addMethod(
  38614. $core.method({
  38615. selector: "visitIRMethod:",
  38616. protocol: 'visiting',
  38617. fn: function (anIRMethod){
  38618. var self=this;
  38619. return $core.withContext(function($ctx1) {
  38620. var $1;
  38621. $1=self._visitIRInstruction_(anIRMethod);
  38622. return $1;
  38623. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  38624. },
  38625. args: ["anIRMethod"],
  38626. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  38627. referencedClasses: [],
  38628. messageSends: ["visitIRInstruction:"]
  38629. }),
  38630. $globals.IRVisitor);
  38631. $core.addMethod(
  38632. $core.method({
  38633. selector: "visitIRNonLocalReturn:",
  38634. protocol: 'visiting',
  38635. fn: function (anIRNonLocalReturn){
  38636. var self=this;
  38637. return $core.withContext(function($ctx1) {
  38638. var $1;
  38639. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  38640. return $1;
  38641. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  38642. },
  38643. args: ["anIRNonLocalReturn"],
  38644. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  38645. referencedClasses: [],
  38646. messageSends: ["visitIRInstruction:"]
  38647. }),
  38648. $globals.IRVisitor);
  38649. $core.addMethod(
  38650. $core.method({
  38651. selector: "visitIRNonLocalReturnHandling:",
  38652. protocol: 'visiting',
  38653. fn: function (anIRNonLocalReturnHandling){
  38654. var self=this;
  38655. return $core.withContext(function($ctx1) {
  38656. var $1;
  38657. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  38658. return $1;
  38659. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  38660. },
  38661. args: ["anIRNonLocalReturnHandling"],
  38662. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  38663. referencedClasses: [],
  38664. messageSends: ["visitIRInstruction:"]
  38665. }),
  38666. $globals.IRVisitor);
  38667. $core.addMethod(
  38668. $core.method({
  38669. selector: "visitIRReturn:",
  38670. protocol: 'visiting',
  38671. fn: function (anIRReturn){
  38672. var self=this;
  38673. return $core.withContext(function($ctx1) {
  38674. var $1;
  38675. $1=self._visitIRInstruction_(anIRReturn);
  38676. return $1;
  38677. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  38678. },
  38679. args: ["anIRReturn"],
  38680. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  38681. referencedClasses: [],
  38682. messageSends: ["visitIRInstruction:"]
  38683. }),
  38684. $globals.IRVisitor);
  38685. $core.addMethod(
  38686. $core.method({
  38687. selector: "visitIRSend:",
  38688. protocol: 'visiting',
  38689. fn: function (anIRSend){
  38690. var self=this;
  38691. return $core.withContext(function($ctx1) {
  38692. var $1;
  38693. $1=self._visitIRInstruction_(anIRSend);
  38694. return $1;
  38695. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  38696. },
  38697. args: ["anIRSend"],
  38698. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  38699. referencedClasses: [],
  38700. messageSends: ["visitIRInstruction:"]
  38701. }),
  38702. $globals.IRVisitor);
  38703. $core.addMethod(
  38704. $core.method({
  38705. selector: "visitIRSequence:",
  38706. protocol: 'visiting',
  38707. fn: function (anIRSequence){
  38708. var self=this;
  38709. return $core.withContext(function($ctx1) {
  38710. var $1;
  38711. $1=self._visitIRInstruction_(anIRSequence);
  38712. return $1;
  38713. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  38714. },
  38715. args: ["anIRSequence"],
  38716. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  38717. referencedClasses: [],
  38718. messageSends: ["visitIRInstruction:"]
  38719. }),
  38720. $globals.IRVisitor);
  38721. $core.addMethod(
  38722. $core.method({
  38723. selector: "visitIRTempDeclaration:",
  38724. protocol: 'visiting',
  38725. fn: function (anIRTempDeclaration){
  38726. var self=this;
  38727. return $core.withContext(function($ctx1) {
  38728. var $1;
  38729. $1=self._visitIRInstruction_(anIRTempDeclaration);
  38730. return $1;
  38731. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  38732. },
  38733. args: ["anIRTempDeclaration"],
  38734. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  38735. referencedClasses: [],
  38736. messageSends: ["visitIRInstruction:"]
  38737. }),
  38738. $globals.IRVisitor);
  38739. $core.addMethod(
  38740. $core.method({
  38741. selector: "visitIRValue:",
  38742. protocol: 'visiting',
  38743. fn: function (anIRValue){
  38744. var self=this;
  38745. return $core.withContext(function($ctx1) {
  38746. var $1;
  38747. $1=self._visitIRInstruction_(anIRValue);
  38748. return $1;
  38749. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  38750. },
  38751. args: ["anIRValue"],
  38752. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  38753. referencedClasses: [],
  38754. messageSends: ["visitIRInstruction:"]
  38755. }),
  38756. $globals.IRVisitor);
  38757. $core.addMethod(
  38758. $core.method({
  38759. selector: "visitIRVariable:",
  38760. protocol: 'visiting',
  38761. fn: function (anIRVariable){
  38762. var self=this;
  38763. return $core.withContext(function($ctx1) {
  38764. var $1;
  38765. $1=self._visitIRInstruction_(anIRVariable);
  38766. return $1;
  38767. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  38768. },
  38769. args: ["anIRVariable"],
  38770. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  38771. referencedClasses: [],
  38772. messageSends: ["visitIRInstruction:"]
  38773. }),
  38774. $globals.IRVisitor);
  38775. $core.addMethod(
  38776. $core.method({
  38777. selector: "visitIRVerbatim:",
  38778. protocol: 'visiting',
  38779. fn: function (anIRVerbatim){
  38780. var self=this;
  38781. return $core.withContext(function($ctx1) {
  38782. var $1;
  38783. $1=self._visitIRInstruction_(anIRVerbatim);
  38784. return $1;
  38785. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  38786. },
  38787. args: ["anIRVerbatim"],
  38788. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  38789. referencedClasses: [],
  38790. messageSends: ["visitIRInstruction:"]
  38791. }),
  38792. $globals.IRVisitor);
  38793. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  38794. $core.addMethod(
  38795. $core.method({
  38796. selector: "contents",
  38797. protocol: 'accessing',
  38798. fn: function (){
  38799. var self=this;
  38800. return $core.withContext(function($ctx1) {
  38801. var $1;
  38802. $1=$recv(self._stream())._contents();
  38803. return $1;
  38804. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  38805. },
  38806. args: [],
  38807. source: "contents\x0a\x09^ self stream contents",
  38808. referencedClasses: [],
  38809. messageSends: ["contents", "stream"]
  38810. }),
  38811. $globals.IRJSTranslator);
  38812. $core.addMethod(
  38813. $core.method({
  38814. selector: "currentClass",
  38815. protocol: 'accessing',
  38816. fn: function (){
  38817. var self=this;
  38818. var $1;
  38819. $1=self["@currentClass"];
  38820. return $1;
  38821. },
  38822. args: [],
  38823. source: "currentClass\x0a\x09^ currentClass",
  38824. referencedClasses: [],
  38825. messageSends: []
  38826. }),
  38827. $globals.IRJSTranslator);
  38828. $core.addMethod(
  38829. $core.method({
  38830. selector: "currentClass:",
  38831. protocol: 'accessing',
  38832. fn: function (aClass){
  38833. var self=this;
  38834. self["@currentClass"]=aClass;
  38835. return self;
  38836. },
  38837. args: ["aClass"],
  38838. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  38839. referencedClasses: [],
  38840. messageSends: []
  38841. }),
  38842. $globals.IRJSTranslator);
  38843. $core.addMethod(
  38844. $core.method({
  38845. selector: "initialize",
  38846. protocol: 'initialization',
  38847. fn: function (){
  38848. var self=this;
  38849. function $JSStream(){return $globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  38850. return $core.withContext(function($ctx1) {
  38851. (
  38852. $ctx1.supercall = true,
  38853. $globals.IRJSTranslator.superclass.fn.prototype._initialize.apply($recv(self), []));
  38854. $ctx1.supercall = false;
  38855. self["@stream"]=$recv($JSStream())._new();
  38856. return self;
  38857. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  38858. },
  38859. args: [],
  38860. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  38861. referencedClasses: ["JSStream"],
  38862. messageSends: ["initialize", "new"]
  38863. }),
  38864. $globals.IRJSTranslator);
  38865. $core.addMethod(
  38866. $core.method({
  38867. selector: "stream",
  38868. protocol: 'accessing',
  38869. fn: function (){
  38870. var self=this;
  38871. var $1;
  38872. $1=self["@stream"];
  38873. return $1;
  38874. },
  38875. args: [],
  38876. source: "stream\x0a\x09^ stream",
  38877. referencedClasses: [],
  38878. messageSends: []
  38879. }),
  38880. $globals.IRJSTranslator);
  38881. $core.addMethod(
  38882. $core.method({
  38883. selector: "stream:",
  38884. protocol: 'accessing',
  38885. fn: function (aStream){
  38886. var self=this;
  38887. self["@stream"]=aStream;
  38888. return self;
  38889. },
  38890. args: ["aStream"],
  38891. source: "stream: aStream\x0a\x09stream := aStream",
  38892. referencedClasses: [],
  38893. messageSends: []
  38894. }),
  38895. $globals.IRJSTranslator);
  38896. $core.addMethod(
  38897. $core.method({
  38898. selector: "visitIRAssignment:",
  38899. protocol: 'visiting',
  38900. fn: function (anIRAssignment){
  38901. var self=this;
  38902. return $core.withContext(function($ctx1) {
  38903. var $2,$1;
  38904. $2=$recv(anIRAssignment)._instructions();
  38905. $ctx1.sendIdx["instructions"]=1;
  38906. $1=$recv($2)._first();
  38907. self._visit_($1);
  38908. $ctx1.sendIdx["visit:"]=1;
  38909. $recv(self._stream())._nextPutAssignment();
  38910. self._visit_($recv($recv(anIRAssignment)._instructions())._last());
  38911. return self;
  38912. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  38913. },
  38914. args: ["anIRAssignment"],
  38915. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  38916. referencedClasses: [],
  38917. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"]
  38918. }),
  38919. $globals.IRJSTranslator);
  38920. $core.addMethod(
  38921. $core.method({
  38922. selector: "visitIRClosure:",
  38923. protocol: 'visiting',
  38924. fn: function (anIRClosure){
  38925. var self=this;
  38926. return $core.withContext(function($ctx1) {
  38927. var $1,$2;
  38928. $1=self._stream();
  38929. $ctx1.sendIdx["stream"]=1;
  38930. $recv($1)._nextPutClosureWith_arguments_((function(){
  38931. return $core.withContext(function($ctx2) {
  38932. $2=self._stream();
  38933. $ctx2.sendIdx["stream"]=2;
  38934. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  38935. return $core.withContext(function($ctx3) {
  38936. return $recv($recv(each)._name())._asVariableName();
  38937. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38938. })));
  38939. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  38940. return $core.withContext(function($ctx3) {
  38941. return (
  38942. $ctx3.supercall = true,
  38943. $globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  38944. $ctx3.supercall = false;
  38945. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38946. }));
  38947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38948. }),$recv(anIRClosure)._arguments());
  38949. return self;
  38950. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  38951. },
  38952. args: ["anIRClosure"],
  38953. 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",
  38954. referencedClasses: [],
  38955. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  38956. }),
  38957. $globals.IRJSTranslator);
  38958. $core.addMethod(
  38959. $core.method({
  38960. selector: "visitIRDynamicArray:",
  38961. protocol: 'visiting',
  38962. fn: function (anIRDynamicArray){
  38963. var self=this;
  38964. return $core.withContext(function($ctx1) {
  38965. var $1;
  38966. $1=self._stream();
  38967. $ctx1.sendIdx["stream"]=1;
  38968. $recv($1)._nextPutAll_("[");
  38969. $ctx1.sendIdx["nextPutAll:"]=1;
  38970. $recv($recv(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  38971. return $core.withContext(function($ctx2) {
  38972. return self._visit_(each);
  38973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38974. }),(function(){
  38975. return $core.withContext(function($ctx2) {
  38976. return $recv(self._stream())._nextPutAll_(",");
  38977. $ctx2.sendIdx["nextPutAll:"]=2;
  38978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38979. }));
  38980. $recv(self["@stream"])._nextPutAll_("]");
  38981. return self;
  38982. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  38983. },
  38984. args: ["anIRDynamicArray"],
  38985. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self stream nextPutAll: '['.\x0a\x09anIRDynamicArray instructions\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ']'",
  38986. referencedClasses: [],
  38987. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  38988. }),
  38989. $globals.IRJSTranslator);
  38990. $core.addMethod(
  38991. $core.method({
  38992. selector: "visitIRDynamicDictionary:",
  38993. protocol: 'visiting',
  38994. fn: function (anIRDynamicDictionary){
  38995. var self=this;
  38996. return $core.withContext(function($ctx1) {
  38997. var $1,$2;
  38998. $1=self._stream();
  38999. $ctx1.sendIdx["stream"]=1;
  39000. $recv($1)._nextPutAll_("$globals.HashedCollection._newFromPairs_([");
  39001. $ctx1.sendIdx["nextPutAll:"]=1;
  39002. $recv($recv(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  39003. return $core.withContext(function($ctx2) {
  39004. return self._visit_(each);
  39005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39006. }),(function(){
  39007. return $core.withContext(function($ctx2) {
  39008. $2=self._stream();
  39009. $ctx2.sendIdx["stream"]=2;
  39010. return $recv($2)._nextPutAll_(",");
  39011. $ctx2.sendIdx["nextPutAll:"]=2;
  39012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39013. }));
  39014. $recv(self._stream())._nextPutAll_("])");
  39015. return self;
  39016. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  39017. },
  39018. args: ["anIRDynamicDictionary"],
  39019. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: '$globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  39020. referencedClasses: [],
  39021. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  39022. }),
  39023. $globals.IRJSTranslator);
  39024. $core.addMethod(
  39025. $core.method({
  39026. selector: "visitIRMethod:",
  39027. protocol: 'visiting',
  39028. fn: function (anIRMethod){
  39029. var self=this;
  39030. return $core.withContext(function($ctx1) {
  39031. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  39032. $1=self._stream();
  39033. $ctx1.sendIdx["stream"]=1;
  39034. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  39035. return $core.withContext(function($ctx2) {
  39036. $2=self._stream();
  39037. $ctx2.sendIdx["stream"]=2;
  39038. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  39039. return $core.withContext(function($ctx3) {
  39040. $3=self._stream();
  39041. $ctx3.sendIdx["stream"]=3;
  39042. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  39043. return $core.withContext(function($ctx4) {
  39044. return $recv($recv(each)._name())._asVariableName();
  39045. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39046. }));
  39047. $ctx3.sendIdx["collect:"]=1;
  39048. $recv($3)._nextPutVars_($4);
  39049. $ctx3.sendIdx["nextPutVars:"]=1;
  39050. $recv($recv(anIRMethod)._classReferences())._do_((function(each){
  39051. return $core.withContext(function($ctx4) {
  39052. $5=self._stream();
  39053. $ctx4.sendIdx["stream"]=4;
  39054. return $recv($5)._nextPutClassRefFunction_(each);
  39055. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)});
  39056. }));
  39057. $6=self._stream();
  39058. $ctx3.sendIdx["stream"]=5;
  39059. return $recv($6)._nextPutContextFor_during_(anIRMethod,(function(){
  39060. return $core.withContext(function($ctx4) {
  39061. $8=$recv(anIRMethod)._internalVariables();
  39062. $ctx4.sendIdx["internalVariables"]=1;
  39063. $7=$recv($8)._notEmpty();
  39064. if($core.assert($7)){
  39065. $9=self._stream();
  39066. $ctx4.sendIdx["stream"]=6;
  39067. $recv($9)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  39068. return $core.withContext(function($ctx5) {
  39069. return $recv($recv(each)._variable())._alias();
  39070. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)});
  39071. })));
  39072. };
  39073. $10=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  39074. if($core.assert($10)){
  39075. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  39076. return $core.withContext(function($ctx5) {
  39077. return (
  39078. $ctx5.supercall = true,
  39079. $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39080. $ctx5.supercall = false;
  39081. $ctx5.sendIdx["visitIRMethod:"]=1;
  39082. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)});
  39083. }));
  39084. } else {
  39085. return (
  39086. $ctx4.supercall = true,
  39087. $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39088. $ctx4.supercall = false;
  39089. };
  39090. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  39091. }));
  39092. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39093. }),$recv(anIRMethod)._arguments());
  39094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39095. }));
  39096. return self;
  39097. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  39098. },
  39099. args: ["anIRMethod"],
  39100. 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\x09anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].\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 ]",
  39101. referencedClasses: [],
  39102. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "classReferences", "nextPutClassRefFunction:", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"]
  39103. }),
  39104. $globals.IRJSTranslator);
  39105. $core.addMethod(
  39106. $core.method({
  39107. selector: "visitIRNonLocalReturn:",
  39108. protocol: 'visiting',
  39109. fn: function (anIRNonLocalReturn){
  39110. var self=this;
  39111. return $core.withContext(function($ctx1) {
  39112. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  39113. return $core.withContext(function($ctx2) {
  39114. return (
  39115. $ctx2.supercall = true,
  39116. $globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39117. $ctx2.supercall = false;
  39118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39119. }));
  39120. return self;
  39121. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  39122. },
  39123. args: ["anIRNonLocalReturn"],
  39124. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  39125. referencedClasses: [],
  39126. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  39127. }),
  39128. $globals.IRJSTranslator);
  39129. $core.addMethod(
  39130. $core.method({
  39131. selector: "visitIRReturn:",
  39132. protocol: 'visiting',
  39133. fn: function (anIRReturn){
  39134. var self=this;
  39135. return $core.withContext(function($ctx1) {
  39136. $recv(self._stream())._nextPutReturnWith_((function(){
  39137. return $core.withContext(function($ctx2) {
  39138. return (
  39139. $ctx2.supercall = true,
  39140. $globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39141. $ctx2.supercall = false;
  39142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39143. }));
  39144. return self;
  39145. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  39146. },
  39147. args: ["anIRReturn"],
  39148. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  39149. referencedClasses: [],
  39150. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  39151. }),
  39152. $globals.IRJSTranslator);
  39153. $core.addMethod(
  39154. $core.method({
  39155. selector: "visitIRSend:",
  39156. protocol: 'visiting',
  39157. fn: function (anIRSend){
  39158. var self=this;
  39159. var sends;
  39160. return $core.withContext(function($ctx1) {
  39161. var $1,$2,$receiver;
  39162. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  39163. $1=$recv(anIRSend)._classSend();
  39164. if(($receiver = $1) == null || $receiver.isNil){
  39165. self._visitSend_(anIRSend);
  39166. } else {
  39167. self._visitSuperSend_(anIRSend);
  39168. };
  39169. $2=$recv($recv(sends).__gt((1)))._and_((function(){
  39170. return $core.withContext(function($ctx2) {
  39171. return $recv($recv(anIRSend)._index()).__lt(sends);
  39172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39173. }));
  39174. if($core.assert($2)){
  39175. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  39176. };
  39177. return self;
  39178. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},$globals.IRJSTranslator)});
  39179. },
  39180. args: ["anIRSend"],
  39181. source: "visitIRSend: anIRSend\x0a\x09| sends |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  39182. referencedClasses: [],
  39183. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  39184. }),
  39185. $globals.IRJSTranslator);
  39186. $core.addMethod(
  39187. $core.method({
  39188. selector: "visitIRSequence:",
  39189. protocol: 'visiting',
  39190. fn: function (anIRSequence){
  39191. var self=this;
  39192. return $core.withContext(function($ctx1) {
  39193. var $1;
  39194. $1=self._stream();
  39195. $ctx1.sendIdx["stream"]=1;
  39196. $recv($1)._nextPutSequenceWith_((function(){
  39197. return $core.withContext(function($ctx2) {
  39198. return $recv($recv(anIRSequence)._instructions())._do_((function(each){
  39199. return $core.withContext(function($ctx3) {
  39200. return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
  39201. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39202. }));
  39203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39204. }));
  39205. return self;
  39206. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  39207. },
  39208. args: ["anIRSequence"],
  39209. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  39210. referencedClasses: [],
  39211. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  39212. }),
  39213. $globals.IRJSTranslator);
  39214. $core.addMethod(
  39215. $core.method({
  39216. selector: "visitIRTempDeclaration:",
  39217. protocol: 'visiting',
  39218. fn: function (anIRTempDeclaration){
  39219. var self=this;
  39220. return self;
  39221. },
  39222. args: ["anIRTempDeclaration"],
  39223. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  39224. referencedClasses: [],
  39225. messageSends: []
  39226. }),
  39227. $globals.IRJSTranslator);
  39228. $core.addMethod(
  39229. $core.method({
  39230. selector: "visitIRValue:",
  39231. protocol: 'visiting',
  39232. fn: function (anIRValue){
  39233. var self=this;
  39234. return $core.withContext(function($ctx1) {
  39235. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  39236. return self;
  39237. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  39238. },
  39239. args: ["anIRValue"],
  39240. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  39241. referencedClasses: [],
  39242. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  39243. }),
  39244. $globals.IRJSTranslator);
  39245. $core.addMethod(
  39246. $core.method({
  39247. selector: "visitIRVariable:",
  39248. protocol: 'visiting',
  39249. fn: function (anIRVariable){
  39250. var self=this;
  39251. return $core.withContext(function($ctx1) {
  39252. var $3,$2,$1,$4;
  39253. $3=$recv(anIRVariable)._variable();
  39254. $ctx1.sendIdx["variable"]=1;
  39255. $2=$recv($3)._name();
  39256. $1=$recv($2).__eq("thisContext");
  39257. if($core.assert($1)){
  39258. $4=self._stream();
  39259. $ctx1.sendIdx["stream"]=1;
  39260. $recv($4)._nextPutAll_("$core.getThisContext()");
  39261. $ctx1.sendIdx["nextPutAll:"]=1;
  39262. } else {
  39263. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  39264. };
  39265. return self;
  39266. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  39267. },
  39268. args: ["anIRVariable"],
  39269. 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 ]",
  39270. referencedClasses: [],
  39271. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  39272. }),
  39273. $globals.IRJSTranslator);
  39274. $core.addMethod(
  39275. $core.method({
  39276. selector: "visitIRVerbatim:",
  39277. protocol: 'visiting',
  39278. fn: function (anIRVerbatim){
  39279. var self=this;
  39280. return $core.withContext(function($ctx1) {
  39281. var $1;
  39282. $1=self._stream();
  39283. $ctx1.sendIdx["stream"]=1;
  39284. $recv($1)._nextPutStatementWith_((function(){
  39285. return $core.withContext(function($ctx2) {
  39286. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  39287. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39288. }));
  39289. return self;
  39290. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  39291. },
  39292. args: ["anIRVerbatim"],
  39293. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  39294. referencedClasses: [],
  39295. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  39296. }),
  39297. $globals.IRJSTranslator);
  39298. $core.addMethod(
  39299. $core.method({
  39300. selector: "visitReceiver:",
  39301. protocol: 'visiting',
  39302. fn: function (anIRInstruction){
  39303. var self=this;
  39304. return $core.withContext(function($ctx1) {
  39305. var $1,$2,$3;
  39306. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  39307. if(!$core.assert($1)){
  39308. $2=self._visit_(anIRInstruction);
  39309. $ctx1.sendIdx["visit:"]=1;
  39310. return $2;
  39311. };
  39312. $3=self._stream();
  39313. $ctx1.sendIdx["stream"]=1;
  39314. $recv($3)._nextPutAll_("$recv(");
  39315. $ctx1.sendIdx["nextPutAll:"]=1;
  39316. self._visit_(anIRInstruction);
  39317. $recv(self._stream())._nextPutAll_(")");
  39318. return self;
  39319. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  39320. },
  39321. args: ["anIRInstruction"],
  39322. 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: ')'",
  39323. referencedClasses: [],
  39324. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  39325. }),
  39326. $globals.IRJSTranslator);
  39327. $core.addMethod(
  39328. $core.method({
  39329. selector: "visitSend:",
  39330. protocol: 'visiting',
  39331. fn: function (anIRSend){
  39332. var self=this;
  39333. return $core.withContext(function($ctx1) {
  39334. var $2,$1,$3,$4,$5;
  39335. $2=$recv(anIRSend)._instructions();
  39336. $ctx1.sendIdx["instructions"]=1;
  39337. $1=$recv($2)._first();
  39338. self._visitReceiver_($1);
  39339. $3=self._stream();
  39340. $ctx1.sendIdx["stream"]=1;
  39341. $4=$recv(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName())).__comma("(");
  39342. $ctx1.sendIdx[","]=1;
  39343. $recv($3)._nextPutAll_($4);
  39344. $ctx1.sendIdx["nextPutAll:"]=1;
  39345. $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39346. return $core.withContext(function($ctx2) {
  39347. return self._visit_(each);
  39348. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39349. }),(function(){
  39350. return $core.withContext(function($ctx2) {
  39351. $5=self._stream();
  39352. $ctx2.sendIdx["stream"]=2;
  39353. return $recv($5)._nextPutAll_(",");
  39354. $ctx2.sendIdx["nextPutAll:"]=2;
  39355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39356. }));
  39357. $recv(self._stream())._nextPutAll_(")");
  39358. return self;
  39359. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39360. },
  39361. args: ["anIRSend"],
  39362. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'",
  39363. referencedClasses: [],
  39364. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"]
  39365. }),
  39366. $globals.IRJSTranslator);
  39367. $core.addMethod(
  39368. $core.method({
  39369. selector: "visitSuperSend:",
  39370. protocol: 'visiting',
  39371. fn: function (anIRSend){
  39372. var self=this;
  39373. return $core.withContext(function($ctx1) {
  39374. var $1,$2,$5,$4,$3,$6,$7,$8,$10,$9,$11,$12,$13,$14;
  39375. $1=self._stream();
  39376. $ctx1.sendIdx["stream"]=1;
  39377. $recv($1)._nextPutAll_("(");
  39378. $ctx1.sendIdx["nextPutAll:"]=1;
  39379. $recv($1)._lf();
  39380. $ctx1.sendIdx["lf"]=1;
  39381. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39382. $ctx1.sendIdx["nextPutAll:"]=2;
  39383. $recv($1)._lf();
  39384. $ctx1.sendIdx["lf"]=2;
  39385. $2=$1;
  39386. $5=$recv(anIRSend)._scope();
  39387. $ctx1.sendIdx["scope"]=1;
  39388. $4=$recv($5)._alias();
  39389. $ctx1.sendIdx["alias"]=1;
  39390. $3=$recv($4).__comma(".supercall = true, ");
  39391. $ctx1.sendIdx[","]=1;
  39392. $recv($2)._nextPutAll_($3);
  39393. $ctx1.sendIdx["nextPutAll:"]=3;
  39394. $recv($1)._lf();
  39395. $ctx1.sendIdx["lf"]=3;
  39396. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39397. $ctx1.sendIdx["nextPutAll:"]=4;
  39398. $recv($1)._lf();
  39399. $ctx1.sendIdx["lf"]=4;
  39400. $recv($1)._nextPutAll_($recv(self._currentClass())._asJavascript());
  39401. $ctx1.sendIdx["nextPutAll:"]=5;
  39402. $recv($1)._nextPutAll_(".superclass.fn.prototype.");
  39403. $ctx1.sendIdx["nextPutAll:"]=6;
  39404. $6=$1;
  39405. $7=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  39406. $ctx1.sendIdx[","]=2;
  39407. $recv($6)._nextPutAll_($7);
  39408. $ctx1.sendIdx["nextPutAll:"]=7;
  39409. $8=$recv($1)._nextPutAll_("$recv(");
  39410. $ctx1.sendIdx["nextPutAll:"]=8;
  39411. $10=$recv(anIRSend)._instructions();
  39412. $ctx1.sendIdx["instructions"]=1;
  39413. $9=$recv($10)._first();
  39414. self._visit_($9);
  39415. $ctx1.sendIdx["visit:"]=1;
  39416. $11=self._stream();
  39417. $ctx1.sendIdx["stream"]=2;
  39418. $recv($11)._nextPutAll_("), [");
  39419. $ctx1.sendIdx["nextPutAll:"]=9;
  39420. $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39421. return $core.withContext(function($ctx2) {
  39422. return self._visit_(each);
  39423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39424. }),(function(){
  39425. return $core.withContext(function($ctx2) {
  39426. $12=self._stream();
  39427. $ctx2.sendIdx["stream"]=3;
  39428. return $recv($12)._nextPutAll_(",");
  39429. $ctx2.sendIdx["nextPutAll:"]=10;
  39430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39431. }));
  39432. $13=self._stream();
  39433. $recv($13)._nextPutAll_("]));");
  39434. $ctx1.sendIdx["nextPutAll:"]=11;
  39435. $recv($13)._lf();
  39436. $ctx1.sendIdx["lf"]=5;
  39437. $recv($13)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39438. $ctx1.sendIdx["nextPutAll:"]=12;
  39439. $recv($13)._lf();
  39440. $ctx1.sendIdx["lf"]=6;
  39441. $recv($13)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  39442. $ctx1.sendIdx["nextPutAll:"]=13;
  39443. $recv($13)._lf();
  39444. $14=$recv($13)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39445. return self;
  39446. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39447. },
  39448. args: ["anIRSend"],
  39449. 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.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\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);'",
  39450. referencedClasses: [],
  39451. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"]
  39452. }),
  39453. $globals.IRJSTranslator);
  39454. $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
  39455. $core.addMethod(
  39456. $core.method({
  39457. selector: "contents",
  39458. protocol: 'accessing',
  39459. fn: function (){
  39460. var self=this;
  39461. return $core.withContext(function($ctx1) {
  39462. var $1;
  39463. $1=$recv(self["@stream"])._contents();
  39464. return $1;
  39465. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  39466. },
  39467. args: [],
  39468. source: "contents\x0a\x09^ stream contents",
  39469. referencedClasses: [],
  39470. messageSends: ["contents"]
  39471. }),
  39472. $globals.JSStream);
  39473. $core.addMethod(
  39474. $core.method({
  39475. selector: "initialize",
  39476. protocol: 'initialization',
  39477. fn: function (){
  39478. var self=this;
  39479. return $core.withContext(function($ctx1) {
  39480. (
  39481. $ctx1.supercall = true,
  39482. $globals.JSStream.superclass.fn.prototype._initialize.apply($recv(self), []));
  39483. $ctx1.supercall = false;
  39484. self["@stream"]=""._writeStream();
  39485. return self;
  39486. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  39487. },
  39488. args: [],
  39489. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  39490. referencedClasses: [],
  39491. messageSends: ["initialize", "writeStream"]
  39492. }),
  39493. $globals.JSStream);
  39494. $core.addMethod(
  39495. $core.method({
  39496. selector: "lf",
  39497. protocol: 'streaming',
  39498. fn: function (){
  39499. var self=this;
  39500. return $core.withContext(function($ctx1) {
  39501. $recv(self["@stream"])._lf();
  39502. return self;
  39503. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  39504. },
  39505. args: [],
  39506. source: "lf\x0a\x09stream lf",
  39507. referencedClasses: [],
  39508. messageSends: ["lf"]
  39509. }),
  39510. $globals.JSStream);
  39511. $core.addMethod(
  39512. $core.method({
  39513. selector: "nextPut:",
  39514. protocol: 'streaming',
  39515. fn: function (aString){
  39516. var self=this;
  39517. return $core.withContext(function($ctx1) {
  39518. $recv(self["@stream"])._nextPut_(aString);
  39519. return self;
  39520. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  39521. },
  39522. args: ["aString"],
  39523. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  39524. referencedClasses: [],
  39525. messageSends: ["nextPut:"]
  39526. }),
  39527. $globals.JSStream);
  39528. $core.addMethod(
  39529. $core.method({
  39530. selector: "nextPutAll:",
  39531. protocol: 'streaming',
  39532. fn: function (aString){
  39533. var self=this;
  39534. return $core.withContext(function($ctx1) {
  39535. $recv(self["@stream"])._nextPutAll_(aString);
  39536. return self;
  39537. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  39538. },
  39539. args: ["aString"],
  39540. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  39541. referencedClasses: [],
  39542. messageSends: ["nextPutAll:"]
  39543. }),
  39544. $globals.JSStream);
  39545. $core.addMethod(
  39546. $core.method({
  39547. selector: "nextPutAssignment",
  39548. protocol: 'streaming',
  39549. fn: function (){
  39550. var self=this;
  39551. return $core.withContext(function($ctx1) {
  39552. $recv(self["@stream"])._nextPutAll_("=");
  39553. return self;
  39554. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},$globals.JSStream)});
  39555. },
  39556. args: [],
  39557. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  39558. referencedClasses: [],
  39559. messageSends: ["nextPutAll:"]
  39560. }),
  39561. $globals.JSStream);
  39562. $core.addMethod(
  39563. $core.method({
  39564. selector: "nextPutBlockContextFor:during:",
  39565. protocol: 'streaming',
  39566. fn: function (anIRClosure,aBlock){
  39567. var self=this;
  39568. return $core.withContext(function($ctx1) {
  39569. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18,$24;
  39570. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  39571. if(!$core.assert($1)){
  39572. $2=$recv(aBlock)._value();
  39573. $ctx1.sendIdx["value"]=1;
  39574. return $2;
  39575. };
  39576. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39577. $ctx1.sendIdx["nextPutAll:"]=1;
  39578. self._lf();
  39579. $ctx1.sendIdx["lf"]=1;
  39580. $6=$recv(anIRClosure)._scope();
  39581. $ctx1.sendIdx["scope"]=1;
  39582. $5=$recv($6)._alias();
  39583. $ctx1.sendIdx["alias"]=1;
  39584. $4="return $core.withContext(function(".__comma($5);
  39585. $ctx1.sendIdx[","]=2;
  39586. $3=$recv($4).__comma(") {");
  39587. $ctx1.sendIdx[","]=1;
  39588. self._nextPutAll_($3);
  39589. $ctx1.sendIdx["nextPutAll:"]=2;
  39590. self._lf();
  39591. $ctx1.sendIdx["lf"]=2;
  39592. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39593. $ctx1.sendIdx["nextPutAll:"]=3;
  39594. $7=self._lf();
  39595. $ctx1.sendIdx["lf"]=3;
  39596. $recv(aBlock)._value();
  39597. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39598. $ctx1.sendIdx["nextPutAll:"]=4;
  39599. self._lf();
  39600. $ctx1.sendIdx["lf"]=4;
  39601. $11=$recv(anIRClosure)._scope();
  39602. $ctx1.sendIdx["scope"]=2;
  39603. $10=$recv($11)._alias();
  39604. $ctx1.sendIdx["alias"]=2;
  39605. $9="}, function(".__comma($10);
  39606. $ctx1.sendIdx[","]=4;
  39607. $8=$recv($9).__comma(") {");
  39608. $ctx1.sendIdx[","]=3;
  39609. self._nextPutAll_($8);
  39610. $ctx1.sendIdx["nextPutAll:"]=5;
  39611. $15=$recv(anIRClosure)._scope();
  39612. $ctx1.sendIdx["scope"]=3;
  39613. $14=$recv($15)._alias();
  39614. $ctx1.sendIdx["alias"]=3;
  39615. $13=$recv($14).__comma(".fillBlock({");
  39616. $ctx1.sendIdx[","]=5;
  39617. $12=self._nextPutAll_($13);
  39618. $ctx1.sendIdx["nextPutAll:"]=6;
  39619. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  39620. return $core.withContext(function($ctx2) {
  39621. $16=$recv(each)._asVariableName();
  39622. $ctx2.sendIdx["asVariableName"]=1;
  39623. self._nextPutAll_($16);
  39624. $ctx2.sendIdx["nextPutAll:"]=7;
  39625. self._nextPutAll_(":");
  39626. $ctx2.sendIdx["nextPutAll:"]=8;
  39627. $17=self._nextPutAll_($recv(each)._asVariableName());
  39628. $ctx2.sendIdx["nextPutAll:"]=9;
  39629. return $17;
  39630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39631. }),(function(){
  39632. return $core.withContext(function($ctx2) {
  39633. return self._nextPutAll_(",");
  39634. $ctx2.sendIdx["nextPutAll:"]=10;
  39635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39636. }));
  39637. self._nextPutAll_("},");
  39638. $ctx1.sendIdx["nextPutAll:"]=11;
  39639. $23=$recv(anIRClosure)._scope();
  39640. $ctx1.sendIdx["scope"]=4;
  39641. $22=$recv($23)._outerScope();
  39642. $21=$recv($22)._alias();
  39643. $20=$recv($21).__comma(",");
  39644. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  39645. $ctx1.sendIdx[","]=7;
  39646. $18=$recv($19).__comma(")});");
  39647. $ctx1.sendIdx[","]=6;
  39648. self._nextPutAll_($18);
  39649. $ctx1.sendIdx["nextPutAll:"]=12;
  39650. self._lf();
  39651. $24=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39652. return self;
  39653. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  39654. },
  39655. args: ["anIRClosure", "aBlock"],
  39656. 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);'",
  39657. referencedClasses: [],
  39658. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  39659. }),
  39660. $globals.JSStream);
  39661. $core.addMethod(
  39662. $core.method({
  39663. selector: "nextPutClassRefFunction:",
  39664. protocol: 'streaming',
  39665. fn: function (aString){
  39666. var self=this;
  39667. return $core.withContext(function($ctx1) {
  39668. var $1,$2;
  39669. $1=self["@stream"];
  39670. $recv($1)._nextPutAll_("function $");
  39671. $ctx1.sendIdx["nextPutAll:"]=1;
  39672. $recv($1)._nextPutAll_(aString);
  39673. $ctx1.sendIdx["nextPutAll:"]=2;
  39674. $recv($1)._nextPutAll_("(){return $globals.");
  39675. $ctx1.sendIdx["nextPutAll:"]=3;
  39676. $recv($1)._nextPutAll_(aString);
  39677. $ctx1.sendIdx["nextPutAll:"]=4;
  39678. $recv($1)._nextPutAll_("||(typeof ");
  39679. $ctx1.sendIdx["nextPutAll:"]=5;
  39680. $recv($1)._nextPutAll_(aString);
  39681. $ctx1.sendIdx["nextPutAll:"]=6;
  39682. $recv($1)._nextPutAll_("==\x22undefined\x22?nil:");
  39683. $ctx1.sendIdx["nextPutAll:"]=7;
  39684. $recv($1)._nextPutAll_(aString);
  39685. $ctx1.sendIdx["nextPutAll:"]=8;
  39686. $recv($1)._nextPutAll_(")}");
  39687. $2=$recv($1)._lf();
  39688. return self;
  39689. }, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},$globals.JSStream)});
  39690. },
  39691. args: ["aString"],
  39692. source: "nextPutClassRefFunction: aString\x0a\x09\x22Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.\x0a\x09This ensures that undefined global access will answer `nil`\x22\x0a\x09\x0a\x09stream\x0a\x09\x09nextPutAll: 'function $';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '(){return $globals.';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '||(typeof ';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '==\x22undefined\x22?nil:';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: ')}';\x0a\x09\x09lf",
  39693. referencedClasses: [],
  39694. messageSends: ["nextPutAll:", "lf"]
  39695. }),
  39696. $globals.JSStream);
  39697. $core.addMethod(
  39698. $core.method({
  39699. selector: "nextPutClosureWith:arguments:",
  39700. protocol: 'streaming',
  39701. fn: function (aBlock,anArray){
  39702. var self=this;
  39703. return $core.withContext(function($ctx1) {
  39704. var $1,$2,$3,$4;
  39705. $recv(self["@stream"])._nextPutAll_("(function(");
  39706. $ctx1.sendIdx["nextPutAll:"]=1;
  39707. $recv(anArray)._do_separatedBy_((function(each){
  39708. return $core.withContext(function($ctx2) {
  39709. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  39710. $ctx2.sendIdx["nextPutAll:"]=2;
  39711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39712. }),(function(){
  39713. return $core.withContext(function($ctx2) {
  39714. return $recv(self["@stream"])._nextPut_(",");
  39715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39716. }));
  39717. $1=self["@stream"];
  39718. $recv($1)._nextPutAll_("){");
  39719. $ctx1.sendIdx["nextPutAll:"]=3;
  39720. $2=$recv($1)._lf();
  39721. $ctx1.sendIdx["lf"]=1;
  39722. $recv(aBlock)._value();
  39723. $3=self["@stream"];
  39724. $recv($3)._lf();
  39725. $4=$recv($3)._nextPutAll_("})");
  39726. return self;
  39727. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  39728. },
  39729. args: ["aBlock", "anArray"],
  39730. 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: '})'",
  39731. referencedClasses: [],
  39732. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  39733. }),
  39734. $globals.JSStream);
  39735. $core.addMethod(
  39736. $core.method({
  39737. selector: "nextPutContextFor:during:",
  39738. protocol: 'streaming',
  39739. fn: function (aMethod,aBlock){
  39740. var self=this;
  39741. return $core.withContext(function($ctx1) {
  39742. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
  39743. $1=$recv(aMethod)._requiresSmalltalkContext();
  39744. if(!$core.assert($1)){
  39745. $2=$recv(aBlock)._value();
  39746. $ctx1.sendIdx["value"]=1;
  39747. return $2;
  39748. };
  39749. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39750. $ctx1.sendIdx["nextPutAll:"]=1;
  39751. self._lf();
  39752. $ctx1.sendIdx["lf"]=1;
  39753. $6=$recv(aMethod)._scope();
  39754. $ctx1.sendIdx["scope"]=1;
  39755. $5=$recv($6)._alias();
  39756. $ctx1.sendIdx["alias"]=1;
  39757. $4="return $core.withContext(function(".__comma($5);
  39758. $ctx1.sendIdx[","]=2;
  39759. $3=$recv($4).__comma(") {");
  39760. $ctx1.sendIdx[","]=1;
  39761. self._nextPutAll_($3);
  39762. $ctx1.sendIdx["nextPutAll:"]=2;
  39763. self._lf();
  39764. $ctx1.sendIdx["lf"]=2;
  39765. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39766. $ctx1.sendIdx["nextPutAll:"]=3;
  39767. $7=self._lf();
  39768. $ctx1.sendIdx["lf"]=3;
  39769. $recv(aBlock)._value();
  39770. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39771. $ctx1.sendIdx["nextPutAll:"]=4;
  39772. self._lf();
  39773. $ctx1.sendIdx["lf"]=4;
  39774. $12=$recv(aMethod)._scope();
  39775. $ctx1.sendIdx["scope"]=2;
  39776. $11=$recv($12)._alias();
  39777. $ctx1.sendIdx["alias"]=2;
  39778. $10="}, function(".__comma($11);
  39779. $ctx1.sendIdx[","]=5;
  39780. $9=$recv($10).__comma(") {");
  39781. $ctx1.sendIdx[","]=4;
  39782. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  39783. $ctx1.sendIdx[","]=3;
  39784. self._nextPutAll_($8);
  39785. $ctx1.sendIdx["nextPutAll:"]=5;
  39786. $16=$recv($recv(aMethod)._selector())._asJavascript();
  39787. $ctx1.sendIdx["asJavascript"]=1;
  39788. $15=".fill(self,".__comma($16);
  39789. $14=$recv($15).__comma(",{");
  39790. $ctx1.sendIdx[","]=6;
  39791. $13=self._nextPutAll_($14);
  39792. $ctx1.sendIdx["nextPutAll:"]=6;
  39793. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  39794. return $core.withContext(function($ctx2) {
  39795. $17=$recv(each)._asVariableName();
  39796. $ctx2.sendIdx["asVariableName"]=1;
  39797. self._nextPutAll_($17);
  39798. $ctx2.sendIdx["nextPutAll:"]=7;
  39799. self._nextPutAll_(":");
  39800. $ctx2.sendIdx["nextPutAll:"]=8;
  39801. $18=self._nextPutAll_($recv(each)._asVariableName());
  39802. $ctx2.sendIdx["nextPutAll:"]=9;
  39803. return $18;
  39804. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39805. }),(function(){
  39806. return $core.withContext(function($ctx2) {
  39807. return self._nextPutAll_(",");
  39808. $ctx2.sendIdx["nextPutAll:"]=10;
  39809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39810. }));
  39811. self._nextPutAll_("},");
  39812. $ctx1.sendIdx["nextPutAll:"]=11;
  39813. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  39814. $ctx1.sendIdx["nextPutAll:"]=12;
  39815. self._nextPutAll_(")});");
  39816. $ctx1.sendIdx["nextPutAll:"]=13;
  39817. self._lf();
  39818. $19=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39819. return self;
  39820. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  39821. },
  39822. args: ["aMethod", "aBlock"],
  39823. 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);'",
  39824. referencedClasses: [],
  39825. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  39826. }),
  39827. $globals.JSStream);
  39828. $core.addMethod(
  39829. $core.method({
  39830. selector: "nextPutFunctionWith:arguments:",
  39831. protocol: 'streaming',
  39832. fn: function (aBlock,anArray){
  39833. var self=this;
  39834. return $core.withContext(function($ctx1) {
  39835. var $1,$2,$3,$4,$5,$6;
  39836. $recv(self["@stream"])._nextPutAll_("fn: function(");
  39837. $ctx1.sendIdx["nextPutAll:"]=1;
  39838. $recv(anArray)._do_separatedBy_((function(each){
  39839. return $core.withContext(function($ctx2) {
  39840. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  39841. $ctx2.sendIdx["nextPutAll:"]=2;
  39842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39843. }),(function(){
  39844. return $core.withContext(function($ctx2) {
  39845. return $recv(self["@stream"])._nextPut_(",");
  39846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39847. }));
  39848. $1=self["@stream"];
  39849. $recv($1)._nextPutAll_("){");
  39850. $ctx1.sendIdx["nextPutAll:"]=3;
  39851. $2=$recv($1)._lf();
  39852. $ctx1.sendIdx["lf"]=1;
  39853. $3=self["@stream"];
  39854. $recv($3)._nextPutAll_("var self=this;");
  39855. $ctx1.sendIdx["nextPutAll:"]=4;
  39856. $4=$recv($3)._lf();
  39857. $ctx1.sendIdx["lf"]=2;
  39858. $recv(aBlock)._value();
  39859. $5=self["@stream"];
  39860. $recv($5)._lf();
  39861. $6=$recv($5)._nextPutAll_("}");
  39862. return self;
  39863. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  39864. },
  39865. args: ["aBlock", "anArray"],
  39866. 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: '}'",
  39867. referencedClasses: [],
  39868. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  39869. }),
  39870. $globals.JSStream);
  39871. $core.addMethod(
  39872. $core.method({
  39873. selector: "nextPutIf:with:",
  39874. protocol: 'streaming',
  39875. fn: function (aBlock,anotherBlock){
  39876. var self=this;
  39877. return $core.withContext(function($ctx1) {
  39878. var $1,$2;
  39879. $recv(self["@stream"])._nextPutAll_("if(");
  39880. $ctx1.sendIdx["nextPutAll:"]=1;
  39881. $recv(aBlock)._value();
  39882. $ctx1.sendIdx["value"]=1;
  39883. $1=self["@stream"];
  39884. $recv($1)._nextPutAll_("){");
  39885. $ctx1.sendIdx["nextPutAll:"]=2;
  39886. $2=$recv($1)._lf();
  39887. $recv(anotherBlock)._value();
  39888. $recv(self["@stream"])._nextPutAll_("}");
  39889. return self;
  39890. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  39891. },
  39892. args: ["aBlock", "anotherBlock"],
  39893. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  39894. referencedClasses: [],
  39895. messageSends: ["nextPutAll:", "value", "lf"]
  39896. }),
  39897. $globals.JSStream);
  39898. $core.addMethod(
  39899. $core.method({
  39900. selector: "nextPutIfElse:with:with:",
  39901. protocol: 'streaming',
  39902. fn: function (aBlock,ifBlock,elseBlock){
  39903. var self=this;
  39904. return $core.withContext(function($ctx1) {
  39905. var $1,$2,$3,$4;
  39906. $recv(self["@stream"])._nextPutAll_("if(");
  39907. $ctx1.sendIdx["nextPutAll:"]=1;
  39908. $recv(aBlock)._value();
  39909. $ctx1.sendIdx["value"]=1;
  39910. $1=self["@stream"];
  39911. $recv($1)._nextPutAll_("){");
  39912. $ctx1.sendIdx["nextPutAll:"]=2;
  39913. $2=$recv($1)._lf();
  39914. $ctx1.sendIdx["lf"]=1;
  39915. $recv(ifBlock)._value();
  39916. $ctx1.sendIdx["value"]=2;
  39917. $3=self["@stream"];
  39918. $recv($3)._nextPutAll_("} else {");
  39919. $ctx1.sendIdx["nextPutAll:"]=3;
  39920. $4=$recv($3)._lf();
  39921. $recv(elseBlock)._value();
  39922. $recv(self["@stream"])._nextPutAll_("}");
  39923. return self;
  39924. }, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  39925. },
  39926. args: ["aBlock", "ifBlock", "elseBlock"],
  39927. source: "nextPutIfElse: aBlock with: ifBlock with: 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: '}'",
  39928. referencedClasses: [],
  39929. messageSends: ["nextPutAll:", "value", "lf"]
  39930. }),
  39931. $globals.JSStream);
  39932. $core.addMethod(
  39933. $core.method({
  39934. selector: "nextPutMethodDeclaration:with:",
  39935. protocol: 'streaming',
  39936. fn: function (aMethod,aBlock){
  39937. var self=this;
  39938. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  39939. return $core.withContext(function($ctx1) {
  39940. var $1,$2,$5,$4,$3,$6,$9,$8,$7,$10,$11,$12,$15,$14,$13,$16,$19,$18,$17,$20,$23,$22,$21,$24,$25,$26;
  39941. $1=self["@stream"];
  39942. $recv($1)._nextPutAll_("$core.method({");
  39943. $ctx1.sendIdx["nextPutAll:"]=1;
  39944. $recv($1)._lf();
  39945. $ctx1.sendIdx["lf"]=1;
  39946. $2=$1;
  39947. $5=$recv($recv(aMethod)._selector())._asJavascript();
  39948. $ctx1.sendIdx["asJavascript"]=1;
  39949. $4="selector: ".__comma($5);
  39950. $ctx1.sendIdx[","]=2;
  39951. $3=$recv($4).__comma(",");
  39952. $ctx1.sendIdx[","]=1;
  39953. $recv($2)._nextPutAll_($3);
  39954. $ctx1.sendIdx["nextPutAll:"]=2;
  39955. $recv($1)._lf();
  39956. $ctx1.sendIdx["lf"]=2;
  39957. $6=$1;
  39958. $9=$recv($recv(aMethod)._source())._asJavascript();
  39959. $ctx1.sendIdx["asJavascript"]=2;
  39960. $8="source: ".__comma($9);
  39961. $ctx1.sendIdx[","]=4;
  39962. $7=$recv($8).__comma(",");
  39963. $ctx1.sendIdx[","]=3;
  39964. $recv($6)._nextPutAll_($7);
  39965. $ctx1.sendIdx["nextPutAll:"]=3;
  39966. $10=$recv($1)._lf();
  39967. $ctx1.sendIdx["lf"]=3;
  39968. $recv(aBlock)._value();
  39969. $ctx1.sendIdx["value"]=1;
  39970. $11=self["@stream"];
  39971. $12=$11;
  39972. $15=$recv($String())._lf();
  39973. $ctx1.sendIdx["lf"]=4;
  39974. $14=",".__comma($15);
  39975. $ctx1.sendIdx[","]=6;
  39976. $13=$recv($14).__comma("messageSends: ");
  39977. $ctx1.sendIdx[","]=5;
  39978. $recv($12)._nextPutAll_($13);
  39979. $ctx1.sendIdx["nextPutAll:"]=4;
  39980. $16=$11;
  39981. $19=$recv($recv(aMethod)._messageSends())._asArray();
  39982. $ctx1.sendIdx["asArray"]=1;
  39983. $18=$recv($19)._asJavascript();
  39984. $ctx1.sendIdx["asJavascript"]=3;
  39985. $17=$recv($18).__comma(",");
  39986. $ctx1.sendIdx[","]=7;
  39987. $recv($16)._nextPutAll_($17);
  39988. $ctx1.sendIdx["nextPutAll:"]=5;
  39989. $recv($11)._lf();
  39990. $ctx1.sendIdx["lf"]=5;
  39991. $20=$11;
  39992. $23=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  39993. return $core.withContext(function($ctx2) {
  39994. return $recv(each)._value();
  39995. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39996. })))._asArray())._asJavascript();
  39997. $ctx1.sendIdx["asJavascript"]=4;
  39998. $22="args: ".__comma($23);
  39999. $21=$recv($22).__comma(",");
  40000. $ctx1.sendIdx[","]=8;
  40001. $recv($20)._nextPutAll_($21);
  40002. $ctx1.sendIdx["nextPutAll:"]=6;
  40003. $recv($11)._lf();
  40004. $24=$recv($11)._nextPutAll_("referencedClasses: [");
  40005. $ctx1.sendIdx["nextPutAll:"]=7;
  40006. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  40007. return $core.withContext(function($ctx2) {
  40008. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  40009. $ctx2.sendIdx["nextPutAll:"]=8;
  40010. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40011. }),(function(){
  40012. return $core.withContext(function($ctx2) {
  40013. return $recv(self["@stream"])._nextPutAll_(",");
  40014. $ctx2.sendIdx["nextPutAll:"]=9;
  40015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40016. }));
  40017. $25=self["@stream"];
  40018. $recv($25)._nextPutAll_("]");
  40019. $ctx1.sendIdx["nextPutAll:"]=10;
  40020. $26=$recv($25)._nextPutAll_("})");
  40021. return self;
  40022. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  40023. },
  40024. args: ["aMethod", "aBlock"],
  40025. 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: '})'",
  40026. referencedClasses: ["String"],
  40027. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  40028. }),
  40029. $globals.JSStream);
  40030. $core.addMethod(
  40031. $core.method({
  40032. selector: "nextPutNonLocalReturnHandlingWith:",
  40033. protocol: 'streaming',
  40034. fn: function (aBlock){
  40035. var self=this;
  40036. return $core.withContext(function($ctx1) {
  40037. var $1,$2,$3,$4;
  40038. $1=self["@stream"];
  40039. $recv($1)._nextPutAll_("var $early={};");
  40040. $ctx1.sendIdx["nextPutAll:"]=1;
  40041. $recv($1)._lf();
  40042. $ctx1.sendIdx["lf"]=1;
  40043. $recv($1)._nextPutAll_("try {");
  40044. $ctx1.sendIdx["nextPutAll:"]=2;
  40045. $2=$recv($1)._lf();
  40046. $ctx1.sendIdx["lf"]=2;
  40047. $recv(aBlock)._value();
  40048. $3=self["@stream"];
  40049. $recv($3)._nextPutAll_("}");
  40050. $ctx1.sendIdx["nextPutAll:"]=3;
  40051. $recv($3)._lf();
  40052. $ctx1.sendIdx["lf"]=3;
  40053. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  40054. $4=$recv($3)._lf();
  40055. return self;
  40056. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  40057. },
  40058. args: ["aBlock"],
  40059. 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",
  40060. referencedClasses: [],
  40061. messageSends: ["nextPutAll:", "lf", "value"]
  40062. }),
  40063. $globals.JSStream);
  40064. $core.addMethod(
  40065. $core.method({
  40066. selector: "nextPutNonLocalReturnWith:",
  40067. protocol: 'streaming',
  40068. fn: function (aBlock){
  40069. var self=this;
  40070. return $core.withContext(function($ctx1) {
  40071. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  40072. $ctx1.sendIdx["nextPutAll:"]=1;
  40073. $recv(aBlock)._value();
  40074. $recv(self["@stream"])._nextPutAll_("]");
  40075. return self;
  40076. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40077. },
  40078. args: ["aBlock"],
  40079. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  40080. referencedClasses: [],
  40081. messageSends: ["nextPutAll:", "value"]
  40082. }),
  40083. $globals.JSStream);
  40084. $core.addMethod(
  40085. $core.method({
  40086. selector: "nextPutReturn",
  40087. protocol: 'streaming',
  40088. fn: function (){
  40089. var self=this;
  40090. return $core.withContext(function($ctx1) {
  40091. $recv(self["@stream"])._nextPutAll_("return ");
  40092. return self;
  40093. }, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},$globals.JSStream)});
  40094. },
  40095. args: [],
  40096. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  40097. referencedClasses: [],
  40098. messageSends: ["nextPutAll:"]
  40099. }),
  40100. $globals.JSStream);
  40101. $core.addMethod(
  40102. $core.method({
  40103. selector: "nextPutReturnWith:",
  40104. protocol: 'streaming',
  40105. fn: function (aBlock){
  40106. var self=this;
  40107. return $core.withContext(function($ctx1) {
  40108. self._nextPutReturn();
  40109. $recv(aBlock)._value();
  40110. return self;
  40111. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40112. },
  40113. args: ["aBlock"],
  40114. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  40115. referencedClasses: [],
  40116. messageSends: ["nextPutReturn", "value"]
  40117. }),
  40118. $globals.JSStream);
  40119. $core.addMethod(
  40120. $core.method({
  40121. selector: "nextPutSendIndexFor:",
  40122. protocol: 'streaming',
  40123. fn: function (anIRSend){
  40124. var self=this;
  40125. return $core.withContext(function($ctx1) {
  40126. var $1;
  40127. self._nextPutAll_(";");
  40128. $ctx1.sendIdx["nextPutAll:"]=1;
  40129. self._lf();
  40130. $ctx1.sendIdx["lf"]=1;
  40131. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40132. $ctx1.sendIdx["nextPutAll:"]=2;
  40133. self._lf();
  40134. $ctx1.sendIdx["lf"]=2;
  40135. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  40136. $ctx1.sendIdx["nextPutAll:"]=3;
  40137. self._nextPutAll_(".sendIdx[");
  40138. $ctx1.sendIdx["nextPutAll:"]=4;
  40139. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  40140. $ctx1.sendIdx["nextPutAll:"]=5;
  40141. self._nextPutAll_("]=");
  40142. $ctx1.sendIdx["nextPutAll:"]=6;
  40143. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  40144. $ctx1.sendIdx["nextPutAll:"]=7;
  40145. self._nextPutAll_(";");
  40146. $ctx1.sendIdx["nextPutAll:"]=8;
  40147. self._lf();
  40148. $1=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  40149. return self;
  40150. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  40151. },
  40152. args: ["anIRSend"],
  40153. 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)'",
  40154. referencedClasses: [],
  40155. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  40156. }),
  40157. $globals.JSStream);
  40158. $core.addMethod(
  40159. $core.method({
  40160. selector: "nextPutSequenceWith:",
  40161. protocol: 'streaming',
  40162. fn: function (aBlock){
  40163. var self=this;
  40164. return $core.withContext(function($ctx1) {
  40165. $recv(aBlock)._value();
  40166. return self;
  40167. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
  40168. },
  40169. args: ["aBlock"],
  40170. 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",
  40171. referencedClasses: [],
  40172. messageSends: ["value"]
  40173. }),
  40174. $globals.JSStream);
  40175. $core.addMethod(
  40176. $core.method({
  40177. selector: "nextPutStatementWith:",
  40178. protocol: 'streaming',
  40179. fn: function (aBlock){
  40180. var self=this;
  40181. return $core.withContext(function($ctx1) {
  40182. var $1,$2;
  40183. $recv(aBlock)._value();
  40184. $1=self["@stream"];
  40185. $recv($1)._nextPutAll_(";");
  40186. $2=$recv($1)._lf();
  40187. return self;
  40188. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  40189. },
  40190. args: ["aBlock"],
  40191. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  40192. referencedClasses: [],
  40193. messageSends: ["value", "nextPutAll:", "lf"]
  40194. }),
  40195. $globals.JSStream);
  40196. $core.addMethod(
  40197. $core.method({
  40198. selector: "nextPutVars:",
  40199. protocol: 'streaming',
  40200. fn: function (aCollection){
  40201. var self=this;
  40202. return $core.withContext(function($ctx1) {
  40203. var $1,$2;
  40204. var $early={};
  40205. try {
  40206. $recv(aCollection)._ifEmpty_((function(){
  40207. throw $early=[self];
  40208. }));
  40209. $recv(self["@stream"])._nextPutAll_("var ");
  40210. $ctx1.sendIdx["nextPutAll:"]=1;
  40211. $recv(aCollection)._do_separatedBy_((function(each){
  40212. return $core.withContext(function($ctx2) {
  40213. return $recv(self["@stream"])._nextPutAll_(each);
  40214. $ctx2.sendIdx["nextPutAll:"]=2;
  40215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40216. }),(function(){
  40217. return $core.withContext(function($ctx2) {
  40218. return $recv(self["@stream"])._nextPutAll_(",");
  40219. $ctx2.sendIdx["nextPutAll:"]=3;
  40220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40221. }));
  40222. $1=self["@stream"];
  40223. $recv($1)._nextPutAll_(";");
  40224. $2=$recv($1)._lf();
  40225. return self;
  40226. }
  40227. catch(e) {if(e===$early)return e[0]; throw e}
  40228. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  40229. },
  40230. args: ["aCollection"],
  40231. source: "nextPutVars: aCollection\x0a\x09aCollection ifEmpty: [ ^ self ].\x0a\x09\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection\x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  40232. referencedClasses: [],
  40233. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  40234. }),
  40235. $globals.JSStream);
  40236. $core.addMethod(
  40237. $core.method({
  40238. selector: "appendToInstruction:",
  40239. protocol: '*Compiler-IR',
  40240. fn: function (anIRInstruction){
  40241. var self=this;
  40242. return $core.withContext(function($ctx1) {
  40243. $recv(anIRInstruction)._appendBlock_(self);
  40244. return self;
  40245. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  40246. },
  40247. args: ["anIRInstruction"],
  40248. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  40249. referencedClasses: [],
  40250. messageSends: ["appendBlock:"]
  40251. }),
  40252. $globals.BlockClosure);
  40253. });
  40254. define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){"use strict";
  40255. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  40256. $core.addPackage('Compiler-Inlining');
  40257. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  40258. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40259. $core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
  40260. $globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  40261. $core.addMethod(
  40262. $core.method({
  40263. selector: "accept:",
  40264. protocol: 'visiting',
  40265. fn: function (aVisitor){
  40266. var self=this;
  40267. return $core.withContext(function($ctx1) {
  40268. var $1;
  40269. $1=$recv(aVisitor)._visitIRInlinedAssignment_(self);
  40270. return $1;
  40271. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
  40272. },
  40273. args: ["aVisitor"],
  40274. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  40275. referencedClasses: [],
  40276. messageSends: ["visitIRInlinedAssignment:"]
  40277. }),
  40278. $globals.IRInlinedAssignment);
  40279. $core.addMethod(
  40280. $core.method({
  40281. selector: "isInlined",
  40282. protocol: 'testing',
  40283. fn: function (){
  40284. var self=this;
  40285. return true;
  40286. },
  40287. args: [],
  40288. source: "isInlined\x0a\x09^ true",
  40289. referencedClasses: [],
  40290. messageSends: []
  40291. }),
  40292. $globals.IRInlinedAssignment);
  40293. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  40294. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  40295. $core.addMethod(
  40296. $core.method({
  40297. selector: "accept:",
  40298. protocol: 'visiting',
  40299. fn: function (aVisitor){
  40300. var self=this;
  40301. return $core.withContext(function($ctx1) {
  40302. $recv(aVisitor)._visitIRInlinedClosure_(self);
  40303. return self;
  40304. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  40305. },
  40306. args: ["aVisitor"],
  40307. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  40308. referencedClasses: [],
  40309. messageSends: ["visitIRInlinedClosure:"]
  40310. }),
  40311. $globals.IRInlinedClosure);
  40312. $core.addMethod(
  40313. $core.method({
  40314. selector: "isInlined",
  40315. protocol: 'testing',
  40316. fn: function (){
  40317. var self=this;
  40318. return true;
  40319. },
  40320. args: [],
  40321. source: "isInlined\x0a\x09^ true",
  40322. referencedClasses: [],
  40323. messageSends: []
  40324. }),
  40325. $globals.IRInlinedClosure);
  40326. $core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
  40327. $globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  40328. $core.addMethod(
  40329. $core.method({
  40330. selector: "accept:",
  40331. protocol: 'visiting',
  40332. fn: function (aVisitor){
  40333. var self=this;
  40334. return $core.withContext(function($ctx1) {
  40335. var $1;
  40336. $1=$recv(aVisitor)._visitIRInlinedReturn_(self);
  40337. return $1;
  40338. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
  40339. },
  40340. args: ["aVisitor"],
  40341. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  40342. referencedClasses: [],
  40343. messageSends: ["visitIRInlinedReturn:"]
  40344. }),
  40345. $globals.IRInlinedReturn);
  40346. $core.addMethod(
  40347. $core.method({
  40348. selector: "isInlined",
  40349. protocol: 'testing',
  40350. fn: function (){
  40351. var self=this;
  40352. return true;
  40353. },
  40354. args: [],
  40355. source: "isInlined\x0a\x09^ true",
  40356. referencedClasses: [],
  40357. messageSends: []
  40358. }),
  40359. $globals.IRInlinedReturn);
  40360. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  40361. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  40362. $core.addMethod(
  40363. $core.method({
  40364. selector: "accept:",
  40365. protocol: 'visiting',
  40366. fn: function (aVisitor){
  40367. var self=this;
  40368. return $core.withContext(function($ctx1) {
  40369. $recv(aVisitor)._visitInlinedSend_(self);
  40370. return self;
  40371. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  40372. },
  40373. args: ["aVisitor"],
  40374. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  40375. referencedClasses: [],
  40376. messageSends: ["visitInlinedSend:"]
  40377. }),
  40378. $globals.IRInlinedSend);
  40379. $core.addMethod(
  40380. $core.method({
  40381. selector: "internalVariables",
  40382. protocol: 'accessing',
  40383. fn: function (){
  40384. var self=this;
  40385. var $1;
  40386. $1=[];
  40387. return $1;
  40388. },
  40389. args: [],
  40390. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  40391. referencedClasses: [],
  40392. messageSends: []
  40393. }),
  40394. $globals.IRInlinedSend);
  40395. $core.addMethod(
  40396. $core.method({
  40397. selector: "isInlined",
  40398. protocol: 'testing',
  40399. fn: function (){
  40400. var self=this;
  40401. return true;
  40402. },
  40403. args: [],
  40404. source: "isInlined\x0a\x09^ true",
  40405. referencedClasses: [],
  40406. messageSends: []
  40407. }),
  40408. $globals.IRInlinedSend);
  40409. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40410. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  40411. $core.addMethod(
  40412. $core.method({
  40413. selector: "accept:",
  40414. protocol: 'visiting',
  40415. fn: function (aVisitor){
  40416. var self=this;
  40417. return $core.withContext(function($ctx1) {
  40418. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  40419. return self;
  40420. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  40421. },
  40422. args: ["aVisitor"],
  40423. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  40424. referencedClasses: [],
  40425. messageSends: ["visitIRInlinedIfFalse:"]
  40426. }),
  40427. $globals.IRInlinedIfFalse);
  40428. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40429. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  40430. $core.addMethod(
  40431. $core.method({
  40432. selector: "accept:",
  40433. protocol: 'visiting',
  40434. fn: function (aVisitor){
  40435. var self=this;
  40436. return $core.withContext(function($ctx1) {
  40437. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  40438. return self;
  40439. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  40440. },
  40441. args: ["aVisitor"],
  40442. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  40443. referencedClasses: [],
  40444. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  40445. }),
  40446. $globals.IRInlinedIfNilIfNotNil);
  40447. $core.addMethod(
  40448. $core.method({
  40449. selector: "internalVariables",
  40450. protocol: 'accessing',
  40451. fn: function (){
  40452. var self=this;
  40453. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  40454. return $core.withContext(function($ctx1) {
  40455. var $1;
  40456. $1=$recv($Array())._with_(self._receiverInternalVariable());
  40457. return $1;
  40458. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  40459. },
  40460. args: [],
  40461. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  40462. referencedClasses: ["Array"],
  40463. messageSends: ["with:", "receiverInternalVariable"]
  40464. }),
  40465. $globals.IRInlinedIfNilIfNotNil);
  40466. $core.addMethod(
  40467. $core.method({
  40468. selector: "receiverInternalVariable",
  40469. protocol: 'accessing',
  40470. fn: function (){
  40471. var self=this;
  40472. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  40473. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  40474. return $core.withContext(function($ctx1) {
  40475. var $2,$3,$1;
  40476. $2=$recv($IRVariable())._new();
  40477. $ctx1.sendIdx["new"]=1;
  40478. $recv($2)._variable_($recv($recv($AliasVar())._new())._name_(self._receiverInternalVariableName()));
  40479. $3=$recv($2)._yourself();
  40480. $1=$3;
  40481. return $1;
  40482. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  40483. },
  40484. args: [],
  40485. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  40486. referencedClasses: ["IRVariable", "AliasVar"],
  40487. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  40488. }),
  40489. $globals.IRInlinedIfNilIfNotNil);
  40490. $core.addMethod(
  40491. $core.method({
  40492. selector: "receiverInternalVariableName",
  40493. protocol: 'accessing',
  40494. fn: function (){
  40495. var self=this;
  40496. return "$receiver";
  40497. },
  40498. args: [],
  40499. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  40500. referencedClasses: [],
  40501. messageSends: []
  40502. }),
  40503. $globals.IRInlinedIfNilIfNotNil);
  40504. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40505. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  40506. $core.addMethod(
  40507. $core.method({
  40508. selector: "accept:",
  40509. protocol: 'visiting',
  40510. fn: function (aVisitor){
  40511. var self=this;
  40512. return $core.withContext(function($ctx1) {
  40513. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  40514. return self;
  40515. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  40516. },
  40517. args: ["aVisitor"],
  40518. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  40519. referencedClasses: [],
  40520. messageSends: ["visitIRInlinedIfTrue:"]
  40521. }),
  40522. $globals.IRInlinedIfTrue);
  40523. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40524. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  40525. $core.addMethod(
  40526. $core.method({
  40527. selector: "accept:",
  40528. protocol: 'visiting',
  40529. fn: function (aVisitor){
  40530. var self=this;
  40531. return $core.withContext(function($ctx1) {
  40532. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  40533. return self;
  40534. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  40535. },
  40536. args: ["aVisitor"],
  40537. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  40538. referencedClasses: [],
  40539. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  40540. }),
  40541. $globals.IRInlinedIfTrueIfFalse);
  40542. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  40543. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  40544. $core.addMethod(
  40545. $core.method({
  40546. selector: "accept:",
  40547. protocol: 'visiting',
  40548. fn: function (aVisitor){
  40549. var self=this;
  40550. return $core.withContext(function($ctx1) {
  40551. $recv(aVisitor)._visitIRInlinedSequence_(self);
  40552. return self;
  40553. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  40554. },
  40555. args: ["aVisitor"],
  40556. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  40557. referencedClasses: [],
  40558. messageSends: ["visitIRInlinedSequence:"]
  40559. }),
  40560. $globals.IRInlinedSequence);
  40561. $core.addMethod(
  40562. $core.method({
  40563. selector: "isInlined",
  40564. protocol: 'testing',
  40565. fn: function (){
  40566. var self=this;
  40567. return true;
  40568. },
  40569. args: [],
  40570. source: "isInlined\x0a\x09^ true",
  40571. referencedClasses: [],
  40572. messageSends: []
  40573. }),
  40574. $globals.IRInlinedSequence);
  40575. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  40576. $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`";
  40577. $core.addMethod(
  40578. $core.method({
  40579. selector: "assignmentInliner",
  40580. protocol: 'factory',
  40581. fn: function (){
  40582. var self=this;
  40583. function $IRAssignmentInliner(){return $globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  40584. return $core.withContext(function($ctx1) {
  40585. var $2,$3,$1;
  40586. $2=$recv($IRAssignmentInliner())._new();
  40587. $recv($2)._translator_(self);
  40588. $3=$recv($2)._yourself();
  40589. $1=$3;
  40590. return $1;
  40591. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  40592. },
  40593. args: [],
  40594. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40595. referencedClasses: ["IRAssignmentInliner"],
  40596. messageSends: ["translator:", "new", "yourself"]
  40597. }),
  40598. $globals.IRInliner);
  40599. $core.addMethod(
  40600. $core.method({
  40601. selector: "returnInliner",
  40602. protocol: 'factory',
  40603. fn: function (){
  40604. var self=this;
  40605. function $IRReturnInliner(){return $globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  40606. return $core.withContext(function($ctx1) {
  40607. var $2,$3,$1;
  40608. $2=$recv($IRReturnInliner())._new();
  40609. $recv($2)._translator_(self);
  40610. $3=$recv($2)._yourself();
  40611. $1=$3;
  40612. return $1;
  40613. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  40614. },
  40615. args: [],
  40616. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40617. referencedClasses: ["IRReturnInliner"],
  40618. messageSends: ["translator:", "new", "yourself"]
  40619. }),
  40620. $globals.IRInliner);
  40621. $core.addMethod(
  40622. $core.method({
  40623. selector: "sendInliner",
  40624. protocol: 'factory',
  40625. fn: function (){
  40626. var self=this;
  40627. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  40628. return $core.withContext(function($ctx1) {
  40629. var $2,$3,$1;
  40630. $2=$recv($IRSendInliner())._new();
  40631. $recv($2)._translator_(self);
  40632. $3=$recv($2)._yourself();
  40633. $1=$3;
  40634. return $1;
  40635. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  40636. },
  40637. args: [],
  40638. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40639. referencedClasses: ["IRSendInliner"],
  40640. messageSends: ["translator:", "new", "yourself"]
  40641. }),
  40642. $globals.IRInliner);
  40643. $core.addMethod(
  40644. $core.method({
  40645. selector: "shouldInlineAssignment:",
  40646. protocol: 'testing',
  40647. fn: function (anIRAssignment){
  40648. var self=this;
  40649. return $core.withContext(function($ctx1) {
  40650. var $4,$3,$2,$1;
  40651. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  40652. return $core.withContext(function($ctx2) {
  40653. $4=$recv(anIRAssignment)._instructions();
  40654. $ctx2.sendIdx["instructions"]=1;
  40655. $3=$recv($4)._last();
  40656. $ctx2.sendIdx["last"]=1;
  40657. $2=$recv($3)._isSend();
  40658. return $recv($2)._and_((function(){
  40659. return $core.withContext(function($ctx3) {
  40660. return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last());
  40661. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40662. }));
  40663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40664. }));
  40665. $ctx1.sendIdx["and:"]=1;
  40666. return $1;
  40667. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  40668. },
  40669. args: ["anIRAssignment"],
  40670. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  40671. referencedClasses: [],
  40672. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
  40673. }),
  40674. $globals.IRInliner);
  40675. $core.addMethod(
  40676. $core.method({
  40677. selector: "shouldInlineReturn:",
  40678. protocol: 'testing',
  40679. fn: function (anIRReturn){
  40680. var self=this;
  40681. return $core.withContext(function($ctx1) {
  40682. var $4,$3,$2,$1;
  40683. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  40684. return $core.withContext(function($ctx2) {
  40685. $4=$recv(anIRReturn)._instructions();
  40686. $ctx2.sendIdx["instructions"]=1;
  40687. $3=$recv($4)._first();
  40688. $ctx2.sendIdx["first"]=1;
  40689. $2=$recv($3)._isSend();
  40690. return $recv($2)._and_((function(){
  40691. return $core.withContext(function($ctx3) {
  40692. return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first());
  40693. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40694. }));
  40695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40696. }));
  40697. $ctx1.sendIdx["and:"]=1;
  40698. return $1;
  40699. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  40700. },
  40701. args: ["anIRReturn"],
  40702. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  40703. referencedClasses: [],
  40704. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
  40705. }),
  40706. $globals.IRInliner);
  40707. $core.addMethod(
  40708. $core.method({
  40709. selector: "shouldInlineSend:",
  40710. protocol: 'testing',
  40711. fn: function (anIRSend){
  40712. var self=this;
  40713. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  40714. return $core.withContext(function($ctx1) {
  40715. var $1;
  40716. $1=$recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  40717. return $core.withContext(function($ctx2) {
  40718. return $recv($IRSendInliner())._shouldInline_(anIRSend);
  40719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40720. }));
  40721. return $1;
  40722. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  40723. },
  40724. args: ["anIRSend"],
  40725. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  40726. referencedClasses: ["IRSendInliner"],
  40727. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  40728. }),
  40729. $globals.IRInliner);
  40730. $core.addMethod(
  40731. $core.method({
  40732. selector: "transformNonLocalReturn:",
  40733. protocol: 'visiting',
  40734. fn: function (anIRNonLocalReturn){
  40735. var self=this;
  40736. var localReturn;
  40737. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  40738. return $core.withContext(function($ctx1) {
  40739. var $2,$1,$4,$3,$5,$6,$7,$8,$9;
  40740. $2=$recv(anIRNonLocalReturn)._scope();
  40741. $ctx1.sendIdx["scope"]=1;
  40742. $1=$recv($2)._canInlineNonLocalReturns();
  40743. if($core.assert($1)){
  40744. $4=$recv(anIRNonLocalReturn)._scope();
  40745. $ctx1.sendIdx["scope"]=2;
  40746. $3=$recv($4)._methodScope();
  40747. $5=$recv(anIRNonLocalReturn)._scope();
  40748. $ctx1.sendIdx["scope"]=3;
  40749. $recv($3)._removeNonLocalReturn_($5);
  40750. $6=$recv($IRReturn())._new();
  40751. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  40752. $7=$recv($6)._yourself();
  40753. localReturn=$7;
  40754. localReturn;
  40755. $recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){
  40756. return $core.withContext(function($ctx2) {
  40757. return $recv(localReturn)._add_(each);
  40758. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40759. }));
  40760. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  40761. $8=localReturn;
  40762. return $8;
  40763. };
  40764. $9=(
  40765. $ctx1.supercall = true,
  40766. $globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  40767. $ctx1.supercall = false;
  40768. return $9;
  40769. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  40770. },
  40771. args: ["anIRNonLocalReturn"],
  40772. 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",
  40773. referencedClasses: ["IRReturn"],
  40774. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  40775. }),
  40776. $globals.IRInliner);
  40777. $core.addMethod(
  40778. $core.method({
  40779. selector: "visitIRAssignment:",
  40780. protocol: 'visiting',
  40781. fn: function (anIRAssignment){
  40782. var self=this;
  40783. return $core.withContext(function($ctx1) {
  40784. var $2,$1;
  40785. $2=self._shouldInlineAssignment_(anIRAssignment);
  40786. if($core.assert($2)){
  40787. $1=$recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  40788. } else {
  40789. $1=(
  40790. $ctx1.supercall = true,
  40791. $globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  40792. $ctx1.supercall = false;
  40793. };
  40794. return $1;
  40795. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  40796. },
  40797. args: ["anIRAssignment"],
  40798. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  40799. referencedClasses: [],
  40800. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  40801. }),
  40802. $globals.IRInliner);
  40803. $core.addMethod(
  40804. $core.method({
  40805. selector: "visitIRNonLocalReturn:",
  40806. protocol: 'visiting',
  40807. fn: function (anIRNonLocalReturn){
  40808. var self=this;
  40809. return $core.withContext(function($ctx1) {
  40810. var $1;
  40811. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  40812. return $1;
  40813. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)});
  40814. },
  40815. args: ["anIRNonLocalReturn"],
  40816. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  40817. referencedClasses: [],
  40818. messageSends: ["transformNonLocalReturn:"]
  40819. }),
  40820. $globals.IRInliner);
  40821. $core.addMethod(
  40822. $core.method({
  40823. selector: "visitIRReturn:",
  40824. protocol: 'visiting',
  40825. fn: function (anIRReturn){
  40826. var self=this;
  40827. return $core.withContext(function($ctx1) {
  40828. var $2,$1;
  40829. $2=self._shouldInlineReturn_(anIRReturn);
  40830. if($core.assert($2)){
  40831. $1=$recv(self._returnInliner())._inlineReturn_(anIRReturn);
  40832. } else {
  40833. $1=(
  40834. $ctx1.supercall = true,
  40835. $globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  40836. $ctx1.supercall = false;
  40837. };
  40838. return $1;
  40839. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  40840. },
  40841. args: ["anIRReturn"],
  40842. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  40843. referencedClasses: [],
  40844. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  40845. }),
  40846. $globals.IRInliner);
  40847. $core.addMethod(
  40848. $core.method({
  40849. selector: "visitIRSend:",
  40850. protocol: 'visiting',
  40851. fn: function (anIRSend){
  40852. var self=this;
  40853. return $core.withContext(function($ctx1) {
  40854. var $2,$1;
  40855. $2=self._shouldInlineSend_(anIRSend);
  40856. if($core.assert($2)){
  40857. $1=$recv(self._sendInliner())._inlineSend_(anIRSend);
  40858. } else {
  40859. $1=(
  40860. $ctx1.supercall = true,
  40861. $globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  40862. $ctx1.supercall = false;
  40863. };
  40864. return $1;
  40865. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  40866. },
  40867. args: ["anIRSend"],
  40868. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  40869. referencedClasses: [],
  40870. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  40871. }),
  40872. $globals.IRInliner);
  40873. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  40874. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  40875. $core.addMethod(
  40876. $core.method({
  40877. selector: "visitIRInlinedAssignment:",
  40878. protocol: 'visiting',
  40879. fn: function (anIRInlinedAssignment){
  40880. var self=this;
  40881. return $core.withContext(function($ctx1) {
  40882. self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last());
  40883. return self;
  40884. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
  40885. },
  40886. args: ["anIRInlinedAssignment"],
  40887. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  40888. referencedClasses: [],
  40889. messageSends: ["visit:", "last", "instructions"]
  40890. }),
  40891. $globals.IRInliningJSTranslator);
  40892. $core.addMethod(
  40893. $core.method({
  40894. selector: "visitIRInlinedClosure:",
  40895. protocol: 'visiting',
  40896. fn: function (anIRInlinedClosure){
  40897. var self=this;
  40898. return $core.withContext(function($ctx1) {
  40899. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  40900. return $core.withContext(function($ctx2) {
  40901. return $recv($recv(each)._name())._asVariableName();
  40902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40903. })));
  40904. $recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){
  40905. return $core.withContext(function($ctx2) {
  40906. return self._visit_(each);
  40907. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40908. }));
  40909. return self;
  40910. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  40911. },
  40912. args: ["anIRInlinedClosure"],
  40913. 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 ]",
  40914. referencedClasses: [],
  40915. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  40916. }),
  40917. $globals.IRInliningJSTranslator);
  40918. $core.addMethod(
  40919. $core.method({
  40920. selector: "visitIRInlinedIfFalse:",
  40921. protocol: 'visiting',
  40922. fn: function (anIRInlinedIfFalse){
  40923. var self=this;
  40924. return $core.withContext(function($ctx1) {
  40925. var $1,$2,$4,$3;
  40926. $1=self._stream();
  40927. $ctx1.sendIdx["stream"]=1;
  40928. $recv($1)._nextPutIf_with_((function(){
  40929. return $core.withContext(function($ctx2) {
  40930. $2=self._stream();
  40931. $ctx2.sendIdx["stream"]=2;
  40932. $recv($2)._nextPutAll_("!$core.assert(");
  40933. $ctx2.sendIdx["nextPutAll:"]=1;
  40934. $4=$recv(anIRInlinedIfFalse)._instructions();
  40935. $ctx2.sendIdx["instructions"]=1;
  40936. $3=$recv($4)._first();
  40937. self._visit_($3);
  40938. $ctx2.sendIdx["visit:"]=1;
  40939. return $recv(self._stream())._nextPutAll_(")");
  40940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40941. }),(function(){
  40942. return $core.withContext(function($ctx2) {
  40943. return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last());
  40944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40945. }));
  40946. return self;
  40947. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  40948. },
  40949. args: ["anIRInlinedIfFalse"],
  40950. 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\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
  40951. referencedClasses: [],
  40952. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  40953. }),
  40954. $globals.IRInliningJSTranslator);
  40955. $core.addMethod(
  40956. $core.method({
  40957. selector: "visitIRInlinedIfNilIfNotNil:",
  40958. protocol: 'visiting',
  40959. fn: function (anIRInlinedIfNilIfNotNil){
  40960. var self=this;
  40961. return $core.withContext(function($ctx1) {
  40962. var $1,$2,$3,$5,$4,$7,$6;
  40963. $1=self._stream();
  40964. $ctx1.sendIdx["stream"]=1;
  40965. $recv($1)._nextPutIfElse_with_with_((function(){
  40966. return $core.withContext(function($ctx2) {
  40967. $2=self._stream();
  40968. $ctx2.sendIdx["stream"]=2;
  40969. $3=$recv("(".__comma($recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = ");
  40970. $ctx2.sendIdx[","]=1;
  40971. $recv($2)._nextPutAll_($3);
  40972. $ctx2.sendIdx["nextPutAll:"]=1;
  40973. $5=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  40974. $ctx2.sendIdx["instructions"]=1;
  40975. $4=$recv($5)._first();
  40976. self._visit_($4);
  40977. $ctx2.sendIdx["visit:"]=1;
  40978. return $recv(self._stream())._nextPutAll_(") == null || $receiver.isNil");
  40979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40980. }),(function(){
  40981. return $core.withContext(function($ctx2) {
  40982. $7=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  40983. $ctx2.sendIdx["instructions"]=2;
  40984. $6=$recv($7)._second();
  40985. return self._visit_($6);
  40986. $ctx2.sendIdx["visit:"]=2;
  40987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40988. }),(function(){
  40989. return $core.withContext(function($ctx2) {
  40990. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third());
  40991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40992. }));
  40993. return self;
  40994. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  40995. },
  40996. args: ["anIRInlinedIfNilIfNotNil"],
  40997. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '(', anIRInlinedIfNilIfNotNil receiverInternalVariableName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || $receiver.isNil' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  40998. referencedClasses: [],
  40999. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"]
  41000. }),
  41001. $globals.IRInliningJSTranslator);
  41002. $core.addMethod(
  41003. $core.method({
  41004. selector: "visitIRInlinedIfTrue:",
  41005. protocol: 'visiting',
  41006. fn: function (anIRInlinedIfTrue){
  41007. var self=this;
  41008. return $core.withContext(function($ctx1) {
  41009. var $1,$2,$4,$3;
  41010. $1=self._stream();
  41011. $ctx1.sendIdx["stream"]=1;
  41012. $recv($1)._nextPutIf_with_((function(){
  41013. return $core.withContext(function($ctx2) {
  41014. $2=self._stream();
  41015. $ctx2.sendIdx["stream"]=2;
  41016. $recv($2)._nextPutAll_("$core.assert(");
  41017. $ctx2.sendIdx["nextPutAll:"]=1;
  41018. $4=$recv(anIRInlinedIfTrue)._instructions();
  41019. $ctx2.sendIdx["instructions"]=1;
  41020. $3=$recv($4)._first();
  41021. self._visit_($3);
  41022. $ctx2.sendIdx["visit:"]=1;
  41023. return $recv(self._stream())._nextPutAll_(")");
  41024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41025. }),(function(){
  41026. return $core.withContext(function($ctx2) {
  41027. return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last());
  41028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41029. }));
  41030. return self;
  41031. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  41032. },
  41033. args: ["anIRInlinedIfTrue"],
  41034. 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\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
  41035. referencedClasses: [],
  41036. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  41037. }),
  41038. $globals.IRInliningJSTranslator);
  41039. $core.addMethod(
  41040. $core.method({
  41041. selector: "visitIRInlinedIfTrueIfFalse:",
  41042. protocol: 'visiting',
  41043. fn: function (anIRInlinedIfTrueIfFalse){
  41044. var self=this;
  41045. return $core.withContext(function($ctx1) {
  41046. var $1,$2,$4,$3,$6,$5;
  41047. $1=self._stream();
  41048. $ctx1.sendIdx["stream"]=1;
  41049. $recv($1)._nextPutIfElse_with_with_((function(){
  41050. return $core.withContext(function($ctx2) {
  41051. $2=self._stream();
  41052. $ctx2.sendIdx["stream"]=2;
  41053. $recv($2)._nextPutAll_("$core.assert(");
  41054. $ctx2.sendIdx["nextPutAll:"]=1;
  41055. $4=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  41056. $ctx2.sendIdx["instructions"]=1;
  41057. $3=$recv($4)._first();
  41058. self._visit_($3);
  41059. $ctx2.sendIdx["visit:"]=1;
  41060. return $recv(self._stream())._nextPutAll_(")");
  41061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41062. }),(function(){
  41063. return $core.withContext(function($ctx2) {
  41064. $6=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  41065. $ctx2.sendIdx["instructions"]=2;
  41066. $5=$recv($6)._second();
  41067. return self._visit_($5);
  41068. $ctx2.sendIdx["visit:"]=2;
  41069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41070. }),(function(){
  41071. return $core.withContext(function($ctx2) {
  41072. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third());
  41073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41074. }));
  41075. return self;
  41076. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  41077. },
  41078. args: ["anIRInlinedIfTrueIfFalse"],
  41079. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
  41080. referencedClasses: [],
  41081. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  41082. }),
  41083. $globals.IRInliningJSTranslator);
  41084. $core.addMethod(
  41085. $core.method({
  41086. selector: "visitIRInlinedNonLocalReturn:",
  41087. protocol: 'visiting',
  41088. fn: function (anIRInlinedReturn){
  41089. var self=this;
  41090. return $core.withContext(function($ctx1) {
  41091. var $1;
  41092. $1=self._stream();
  41093. $ctx1.sendIdx["stream"]=1;
  41094. $recv($1)._nextPutStatementWith_((function(){
  41095. return $core.withContext(function($ctx2) {
  41096. return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  41097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41098. }));
  41099. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  41100. }));
  41101. return self;
  41102. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  41103. },
  41104. args: ["anIRInlinedReturn"],
  41105. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  41106. referencedClasses: [],
  41107. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
  41108. }),
  41109. $globals.IRInliningJSTranslator);
  41110. $core.addMethod(
  41111. $core.method({
  41112. selector: "visitIRInlinedReturn:",
  41113. protocol: 'visiting',
  41114. fn: function (anIRInlinedReturn){
  41115. var self=this;
  41116. return $core.withContext(function($ctx1) {
  41117. self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  41118. return self;
  41119. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  41120. },
  41121. args: ["anIRInlinedReturn"],
  41122. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  41123. referencedClasses: [],
  41124. messageSends: ["visit:", "last", "instructions"]
  41125. }),
  41126. $globals.IRInliningJSTranslator);
  41127. $core.addMethod(
  41128. $core.method({
  41129. selector: "visitIRInlinedSequence:",
  41130. protocol: 'visiting',
  41131. fn: function (anIRInlinedSequence){
  41132. var self=this;
  41133. return $core.withContext(function($ctx1) {
  41134. $recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){
  41135. return $core.withContext(function($ctx2) {
  41136. return $recv(self._stream())._nextPutStatementWith_((function(){
  41137. return $core.withContext(function($ctx3) {
  41138. return self._visit_(each);
  41139. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41140. }));
  41141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41142. }));
  41143. return self;
  41144. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
  41145. },
  41146. args: ["anIRInlinedSequence"],
  41147. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  41148. referencedClasses: [],
  41149. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  41150. }),
  41151. $globals.IRInliningJSTranslator);
  41152. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  41153. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  41154. $core.addMethod(
  41155. $core.method({
  41156. selector: "ifFalse:",
  41157. protocol: 'inlining',
  41158. fn: function (anIRInstruction){
  41159. var self=this;
  41160. function $IRInlinedIfFalse(){return $globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  41161. return $core.withContext(function($ctx1) {
  41162. var $1;
  41163. $1=self._inlinedSend_with_($recv($IRInlinedIfFalse())._new(),anIRInstruction);
  41164. return $1;
  41165. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41166. },
  41167. args: ["anIRInstruction"],
  41168. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  41169. referencedClasses: ["IRInlinedIfFalse"],
  41170. messageSends: ["inlinedSend:with:", "new"]
  41171. }),
  41172. $globals.IRSendInliner);
  41173. $core.addMethod(
  41174. $core.method({
  41175. selector: "ifFalse:ifTrue:",
  41176. protocol: 'inlining',
  41177. fn: function (anIRInstruction,anotherIRInstruction){
  41178. var self=this;
  41179. return $core.withContext(function($ctx1) {
  41180. var $1;
  41181. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  41182. return $1;
  41183. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41184. },
  41185. args: ["anIRInstruction", "anotherIRInstruction"],
  41186. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  41187. referencedClasses: [],
  41188. messageSends: ["perform:withArguments:"]
  41189. }),
  41190. $globals.IRSendInliner);
  41191. $core.addMethod(
  41192. $core.method({
  41193. selector: "ifNil:",
  41194. protocol: 'inlining',
  41195. fn: function (anIRInstruction){
  41196. var self=this;
  41197. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41198. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  41199. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  41200. return $core.withContext(function($ctx1) {
  41201. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  41202. $2=$recv($IRInlinedIfNilIfNotNil())._new();
  41203. $ctx1.sendIdx["new"]=1;
  41204. $4=$recv($IRClosure())._new();
  41205. $ctx1.sendIdx["new"]=2;
  41206. $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41207. $5=$4;
  41208. $7=$recv($IRBlockSequence())._new();
  41209. $recv($7)._add_($recv($recv(self._send())._instructions())._first());
  41210. $8=$recv($7)._yourself();
  41211. $ctx1.sendIdx["yourself"]=1;
  41212. $6=$8;
  41213. $recv($5)._add_($6);
  41214. $ctx1.sendIdx["add:"]=1;
  41215. $9=$recv($4)._yourself();
  41216. $3=$9;
  41217. $1=self._inlinedSend_with_with_($2,anIRInstruction,$3);
  41218. return $1;
  41219. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41220. },
  41221. args: ["anIRInstruction"],
  41222. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: anIRInstruction\x0a\x09\x09with: (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)",
  41223. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41224. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  41225. }),
  41226. $globals.IRSendInliner);
  41227. $core.addMethod(
  41228. $core.method({
  41229. selector: "ifNil:ifNotNil:",
  41230. protocol: 'inlining',
  41231. fn: function (anIRInstruction,anotherIRInstruction){
  41232. var self=this;
  41233. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41234. return $core.withContext(function($ctx1) {
  41235. var $1;
  41236. $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  41237. return $1;
  41238. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41239. },
  41240. args: ["anIRInstruction", "anotherIRInstruction"],
  41241. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  41242. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41243. messageSends: ["inlinedSend:with:with:", "new"]
  41244. }),
  41245. $globals.IRSendInliner);
  41246. $core.addMethod(
  41247. $core.method({
  41248. selector: "ifNotNil:",
  41249. protocol: 'inlining',
  41250. fn: function (anIRInstruction){
  41251. var self=this;
  41252. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41253. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  41254. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  41255. return $core.withContext(function($ctx1) {
  41256. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  41257. $2=$recv($IRInlinedIfNilIfNotNil())._new();
  41258. $ctx1.sendIdx["new"]=1;
  41259. $4=$recv($IRClosure())._new();
  41260. $ctx1.sendIdx["new"]=2;
  41261. $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41262. $5=$4;
  41263. $7=$recv($IRBlockSequence())._new();
  41264. $recv($7)._add_($recv($recv(self._send())._instructions())._first());
  41265. $8=$recv($7)._yourself();
  41266. $ctx1.sendIdx["yourself"]=1;
  41267. $6=$8;
  41268. $recv($5)._add_($6);
  41269. $ctx1.sendIdx["add:"]=1;
  41270. $9=$recv($4)._yourself();
  41271. $3=$9;
  41272. $1=self._inlinedSend_with_with_($2,$3,anIRInstruction);
  41273. return $1;
  41274. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41275. },
  41276. args: ["anIRInstruction"],
  41277. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: (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\x09with: anIRInstruction",
  41278. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41279. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  41280. }),
  41281. $globals.IRSendInliner);
  41282. $core.addMethod(
  41283. $core.method({
  41284. selector: "ifNotNil:ifNil:",
  41285. protocol: 'inlining',
  41286. fn: function (anIRInstruction,anotherIRInstruction){
  41287. var self=this;
  41288. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41289. return $core.withContext(function($ctx1) {
  41290. var $1;
  41291. $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  41292. return $1;
  41293. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41294. },
  41295. args: ["anIRInstruction", "anotherIRInstruction"],
  41296. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  41297. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41298. messageSends: ["inlinedSend:with:with:", "new"]
  41299. }),
  41300. $globals.IRSendInliner);
  41301. $core.addMethod(
  41302. $core.method({
  41303. selector: "ifTrue:",
  41304. protocol: 'inlining',
  41305. fn: function (anIRInstruction){
  41306. var self=this;
  41307. function $IRInlinedIfTrue(){return $globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  41308. return $core.withContext(function($ctx1) {
  41309. var $1;
  41310. $1=self._inlinedSend_with_($recv($IRInlinedIfTrue())._new(),anIRInstruction);
  41311. return $1;
  41312. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41313. },
  41314. args: ["anIRInstruction"],
  41315. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  41316. referencedClasses: ["IRInlinedIfTrue"],
  41317. messageSends: ["inlinedSend:with:", "new"]
  41318. }),
  41319. $globals.IRSendInliner);
  41320. $core.addMethod(
  41321. $core.method({
  41322. selector: "ifTrue:ifFalse:",
  41323. protocol: 'inlining',
  41324. fn: function (anIRInstruction,anotherIRInstruction){
  41325. var self=this;
  41326. function $IRInlinedIfTrueIfFalse(){return $globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  41327. return $core.withContext(function($ctx1) {
  41328. var $1;
  41329. $1=self._inlinedSend_with_with_($recv($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  41330. return $1;
  41331. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41332. },
  41333. args: ["anIRInstruction", "anotherIRInstruction"],
  41334. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  41335. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  41336. messageSends: ["inlinedSend:with:with:", "new"]
  41337. }),
  41338. $globals.IRSendInliner);
  41339. $core.addMethod(
  41340. $core.method({
  41341. selector: "inlineClosure:",
  41342. protocol: 'inlining',
  41343. fn: function (anIRClosure){
  41344. var self=this;
  41345. var inlinedClosure,sequence,statements;
  41346. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  41347. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  41348. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  41349. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  41350. return $core.withContext(function($ctx1) {
  41351. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$11,$12,$14,$16,$17,$18,$19,$15,$13,$20,$22,$24,$25,$23,$21,$26,$10,$28,$27,$31,$30,$32,$29,$33,$36,$35,$34,$37;
  41352. inlinedClosure=self._inlinedClosure();
  41353. $1=inlinedClosure;
  41354. $2=$1;
  41355. $3=$recv(anIRClosure)._scope();
  41356. $ctx1.sendIdx["scope"]=1;
  41357. $recv($2)._scope_($3);
  41358. $ctx1.sendIdx["scope:"]=1;
  41359. $4=$recv($1)._parent_($recv(anIRClosure)._parent());
  41360. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  41361. return $core.withContext(function($ctx2) {
  41362. return $recv(inlinedClosure)._add_(each);
  41363. $ctx2.sendIdx["add:"]=1;
  41364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41365. }));
  41366. $ctx1.sendIdx["do:"]=1;
  41367. sequence=self._inlinedSequence();
  41368. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  41369. return $core.withContext(function($ctx2) {
  41370. $5=inlinedClosure;
  41371. $7=$recv($IRTempDeclaration())._new();
  41372. $ctx2.sendIdx["new"]=1;
  41373. $recv($7)._name_(each);
  41374. $ctx2.sendIdx["name:"]=1;
  41375. $8=$recv($7)._yourself();
  41376. $ctx2.sendIdx["yourself"]=1;
  41377. $6=$8;
  41378. $recv($5)._add_($6);
  41379. $ctx2.sendIdx["add:"]=2;
  41380. $9=sequence;
  41381. $11=$recv($IRAssignment())._new();
  41382. $ctx2.sendIdx["new"]=2;
  41383. $12=$11;
  41384. $14=$recv($IRVariable())._new();
  41385. $ctx2.sendIdx["new"]=3;
  41386. $16=$recv($AliasVar())._new();
  41387. $ctx2.sendIdx["new"]=4;
  41388. $17=$16;
  41389. $18=$recv(inlinedClosure)._scope();
  41390. $ctx2.sendIdx["scope"]=2;
  41391. $recv($17)._scope_($18);
  41392. $ctx2.sendIdx["scope:"]=2;
  41393. $recv($16)._name_(each);
  41394. $ctx2.sendIdx["name:"]=2;
  41395. $19=$recv($16)._yourself();
  41396. $ctx2.sendIdx["yourself"]=2;
  41397. $15=$19;
  41398. $13=$recv($14)._variable_($15);
  41399. $ctx2.sendIdx["variable:"]=1;
  41400. $recv($12)._add_($13);
  41401. $ctx2.sendIdx["add:"]=4;
  41402. $20=$11;
  41403. $22=$recv($IRVariable())._new();
  41404. $ctx2.sendIdx["new"]=5;
  41405. $24=$recv($AliasVar())._new();
  41406. $recv($24)._scope_($recv(inlinedClosure)._scope());
  41407. $recv($24)._name_("$receiver");
  41408. $25=$recv($24)._yourself();
  41409. $ctx2.sendIdx["yourself"]=3;
  41410. $23=$25;
  41411. $21=$recv($22)._variable_($23);
  41412. $recv($20)._add_($21);
  41413. $ctx2.sendIdx["add:"]=5;
  41414. $26=$recv($11)._yourself();
  41415. $10=$26;
  41416. return $recv($9)._add_($10);
  41417. $ctx2.sendIdx["add:"]=3;
  41418. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41419. }));
  41420. $ctx1.sendIdx["do:"]=2;
  41421. $recv(inlinedClosure)._add_(sequence);
  41422. $ctx1.sendIdx["add:"]=6;
  41423. $28=$recv(anIRClosure)._instructions();
  41424. $ctx1.sendIdx["instructions"]=2;
  41425. $27=$recv($28)._last();
  41426. $ctx1.sendIdx["last"]=1;
  41427. statements=$recv($27)._instructions();
  41428. $ctx1.sendIdx["instructions"]=1;
  41429. $recv(statements)._ifNotEmpty_((function(){
  41430. return $core.withContext(function($ctx2) {
  41431. $recv($recv(statements)._allButLast())._do_((function(each){
  41432. return $core.withContext(function($ctx3) {
  41433. return $recv(sequence)._add_(each);
  41434. $ctx3.sendIdx["add:"]=7;
  41435. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  41436. }));
  41437. $31=$recv(statements)._last();
  41438. $ctx2.sendIdx["last"]=2;
  41439. $30=$recv($31)._isReturn();
  41440. $29=$recv($30)._and_((function(){
  41441. return $core.withContext(function($ctx3) {
  41442. $32=$recv(statements)._last();
  41443. $ctx3.sendIdx["last"]=3;
  41444. return $recv($32)._isBlockReturn();
  41445. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  41446. }));
  41447. if($core.assert($29)){
  41448. $33=sequence;
  41449. $36=$recv(statements)._last();
  41450. $ctx2.sendIdx["last"]=4;
  41451. $35=$recv($36)._instructions();
  41452. $34=$recv($35)._first();
  41453. return $recv($33)._add_($34);
  41454. $ctx2.sendIdx["add:"]=8;
  41455. } else {
  41456. return $recv(sequence)._add_($recv(statements)._last());
  41457. };
  41458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41459. }));
  41460. $37=inlinedClosure;
  41461. return $37;
  41462. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  41463. },
  41464. args: ["anIRClosure"],
  41465. 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",
  41466. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  41467. 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"]
  41468. }),
  41469. $globals.IRSendInliner);
  41470. $core.addMethod(
  41471. $core.method({
  41472. selector: "inlineSend:",
  41473. protocol: 'inlining',
  41474. fn: function (anIRSend){
  41475. var self=this;
  41476. return $core.withContext(function($ctx1) {
  41477. var $3,$2,$1;
  41478. self._send_(anIRSend);
  41479. $3=self._send();
  41480. $ctx1.sendIdx["send"]=1;
  41481. $2=$recv($3)._selector();
  41482. $1=self._perform_withArguments_($2,$recv($recv(self._send())._instructions())._allButFirst());
  41483. return $1;
  41484. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  41485. },
  41486. args: ["anIRSend"],
  41487. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  41488. referencedClasses: [],
  41489. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
  41490. }),
  41491. $globals.IRSendInliner);
  41492. $core.addMethod(
  41493. $core.method({
  41494. selector: "inlinedClosure",
  41495. protocol: 'factory',
  41496. fn: function (){
  41497. var self=this;
  41498. function $IRInlinedClosure(){return $globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  41499. return $core.withContext(function($ctx1) {
  41500. var $1;
  41501. $1=$recv($IRInlinedClosure())._new();
  41502. return $1;
  41503. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  41504. },
  41505. args: [],
  41506. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  41507. referencedClasses: ["IRInlinedClosure"],
  41508. messageSends: ["new"]
  41509. }),
  41510. $globals.IRSendInliner);
  41511. $core.addMethod(
  41512. $core.method({
  41513. selector: "inlinedSend:with:",
  41514. protocol: 'inlining',
  41515. fn: function (inlinedSend,anIRInstruction){
  41516. var self=this;
  41517. var inlinedClosure;
  41518. return $core.withContext(function($ctx1) {
  41519. var $1,$2,$5,$4,$3,$6,$7;
  41520. $1=$recv(anIRInstruction)._isClosure();
  41521. if(!$core.assert($1)){
  41522. self._inliningError_("Message argument should be a block");
  41523. $ctx1.sendIdx["inliningError:"]=1;
  41524. };
  41525. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  41526. if(!$core.assert($2)){
  41527. self._inliningError_("Inlined block should have zero argument");
  41528. };
  41529. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  41530. $5=self._send();
  41531. $ctx1.sendIdx["send"]=1;
  41532. $4=$recv($5)._instructions();
  41533. $3=$recv($4)._first();
  41534. $recv(inlinedSend)._add_($3);
  41535. $ctx1.sendIdx["add:"]=1;
  41536. $6=$recv(inlinedSend)._add_(inlinedClosure);
  41537. $recv(self._send())._replaceWith_(inlinedSend);
  41538. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  41539. $ctx1.sendIdx["internalVariables"]=1;
  41540. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  41541. return inlinedSend;
  41542. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  41543. },
  41544. args: ["inlinedSend", "anIRInstruction"],
  41545. source: "inlinedSend: inlinedSend with: 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",
  41546. referencedClasses: [],
  41547. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41548. }),
  41549. $globals.IRSendInliner);
  41550. $core.addMethod(
  41551. $core.method({
  41552. selector: "inlinedSend:with:with:",
  41553. protocol: 'inlining',
  41554. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  41555. var self=this;
  41556. var inlinedClosure1,inlinedClosure2;
  41557. return $core.withContext(function($ctx1) {
  41558. var $1,$2,$3,$4,$7,$6,$5,$8,$9;
  41559. $1=$recv(anIRInstruction)._isClosure();
  41560. $ctx1.sendIdx["isClosure"]=1;
  41561. if(!$core.assert($1)){
  41562. self._inliningError_("Message argument should be a block");
  41563. $ctx1.sendIdx["inliningError:"]=1;
  41564. };
  41565. $2=$recv(anotherIRInstruction)._isClosure();
  41566. if(!$core.assert($2)){
  41567. self._inliningError_("Message argument should be a block");
  41568. };
  41569. $3=self._translator();
  41570. $ctx1.sendIdx["translator"]=1;
  41571. $4=self._inlineClosure_(anIRInstruction);
  41572. $ctx1.sendIdx["inlineClosure:"]=1;
  41573. inlinedClosure1=$recv($3)._visit_($4);
  41574. $ctx1.sendIdx["visit:"]=1;
  41575. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  41576. $7=self._send();
  41577. $ctx1.sendIdx["send"]=1;
  41578. $6=$recv($7)._instructions();
  41579. $5=$recv($6)._first();
  41580. $recv(inlinedSend)._add_($5);
  41581. $ctx1.sendIdx["add:"]=1;
  41582. $recv(inlinedSend)._add_(inlinedClosure1);
  41583. $ctx1.sendIdx["add:"]=2;
  41584. $8=$recv(inlinedSend)._add_(inlinedClosure2);
  41585. $recv(self._send())._replaceWith_(inlinedSend);
  41586. $9=$recv($recv(inlinedSend)._method())._internalVariables();
  41587. $ctx1.sendIdx["internalVariables"]=1;
  41588. $recv($9)._addAll_($recv(inlinedSend)._internalVariables());
  41589. return inlinedSend;
  41590. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  41591. },
  41592. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  41593. source: "inlinedSend: inlinedSend with: anIRInstruction with: 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",
  41594. referencedClasses: [],
  41595. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41596. }),
  41597. $globals.IRSendInliner);
  41598. $core.addMethod(
  41599. $core.method({
  41600. selector: "inlinedSequence",
  41601. protocol: 'factory',
  41602. fn: function (){
  41603. var self=this;
  41604. function $IRInlinedSequence(){return $globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  41605. return $core.withContext(function($ctx1) {
  41606. var $1;
  41607. $1=$recv($IRInlinedSequence())._new();
  41608. return $1;
  41609. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  41610. },
  41611. args: [],
  41612. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  41613. referencedClasses: ["IRInlinedSequence"],
  41614. messageSends: ["new"]
  41615. }),
  41616. $globals.IRSendInliner);
  41617. $core.addMethod(
  41618. $core.method({
  41619. selector: "inliningError:",
  41620. protocol: 'error handling',
  41621. fn: function (aString){
  41622. var self=this;
  41623. function $InliningError(){return $globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  41624. return $core.withContext(function($ctx1) {
  41625. $recv($InliningError())._signal_(aString);
  41626. return self;
  41627. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  41628. },
  41629. args: ["aString"],
  41630. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  41631. referencedClasses: ["InliningError"],
  41632. messageSends: ["signal:"]
  41633. }),
  41634. $globals.IRSendInliner);
  41635. $core.addMethod(
  41636. $core.method({
  41637. selector: "send",
  41638. protocol: 'accessing',
  41639. fn: function (){
  41640. var self=this;
  41641. var $1;
  41642. $1=self["@send"];
  41643. return $1;
  41644. },
  41645. args: [],
  41646. source: "send\x0a\x09^ send",
  41647. referencedClasses: [],
  41648. messageSends: []
  41649. }),
  41650. $globals.IRSendInliner);
  41651. $core.addMethod(
  41652. $core.method({
  41653. selector: "send:",
  41654. protocol: 'accessing',
  41655. fn: function (anIRSend){
  41656. var self=this;
  41657. self["@send"]=anIRSend;
  41658. return self;
  41659. },
  41660. args: ["anIRSend"],
  41661. source: "send: anIRSend\x0a\x09send := anIRSend",
  41662. referencedClasses: [],
  41663. messageSends: []
  41664. }),
  41665. $globals.IRSendInliner);
  41666. $core.addMethod(
  41667. $core.method({
  41668. selector: "translator",
  41669. protocol: 'accessing',
  41670. fn: function (){
  41671. var self=this;
  41672. var $1;
  41673. $1=self["@translator"];
  41674. return $1;
  41675. },
  41676. args: [],
  41677. source: "translator\x0a\x09^ translator",
  41678. referencedClasses: [],
  41679. messageSends: []
  41680. }),
  41681. $globals.IRSendInliner);
  41682. $core.addMethod(
  41683. $core.method({
  41684. selector: "translator:",
  41685. protocol: 'accessing',
  41686. fn: function (anASTTranslator){
  41687. var self=this;
  41688. self["@translator"]=anASTTranslator;
  41689. return self;
  41690. },
  41691. args: ["anASTTranslator"],
  41692. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  41693. referencedClasses: [],
  41694. messageSends: []
  41695. }),
  41696. $globals.IRSendInliner);
  41697. $core.addMethod(
  41698. $core.method({
  41699. selector: "inlinedSelectors",
  41700. protocol: 'accessing',
  41701. fn: function (){
  41702. var self=this;
  41703. var $1;
  41704. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  41705. return $1;
  41706. },
  41707. args: [],
  41708. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  41709. referencedClasses: [],
  41710. messageSends: []
  41711. }),
  41712. $globals.IRSendInliner.klass);
  41713. $core.addMethod(
  41714. $core.method({
  41715. selector: "shouldInline:",
  41716. protocol: 'accessing',
  41717. fn: function (anIRInstruction){
  41718. var self=this;
  41719. return $core.withContext(function($ctx1) {
  41720. var $1,$2;
  41721. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector());
  41722. if(!$core.assert($1)){
  41723. return false;
  41724. };
  41725. $2=$recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._allSatisfy_((function(each){
  41726. return $core.withContext(function($ctx2) {
  41727. return $recv(each)._isClosure();
  41728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41729. }));
  41730. return $2;
  41731. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)});
  41732. },
  41733. args: ["anIRInstruction"],
  41734. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09^ anIRInstruction instructions allButFirst allSatisfy: [ :each | each isClosure]",
  41735. referencedClasses: [],
  41736. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "allButFirst", "instructions", "isClosure"]
  41737. }),
  41738. $globals.IRSendInliner.klass);
  41739. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  41740. $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};";
  41741. $core.addMethod(
  41742. $core.method({
  41743. selector: "assignment",
  41744. protocol: 'accessing',
  41745. fn: function (){
  41746. var self=this;
  41747. var $1;
  41748. $1=self["@assignment"];
  41749. return $1;
  41750. },
  41751. args: [],
  41752. source: "assignment\x0a\x09^ assignment",
  41753. referencedClasses: [],
  41754. messageSends: []
  41755. }),
  41756. $globals.IRAssignmentInliner);
  41757. $core.addMethod(
  41758. $core.method({
  41759. selector: "assignment:",
  41760. protocol: 'accessing',
  41761. fn: function (aNode){
  41762. var self=this;
  41763. self["@assignment"]=aNode;
  41764. return self;
  41765. },
  41766. args: ["aNode"],
  41767. source: "assignment: aNode\x0a\x09assignment := aNode",
  41768. referencedClasses: [],
  41769. messageSends: []
  41770. }),
  41771. $globals.IRAssignmentInliner);
  41772. $core.addMethod(
  41773. $core.method({
  41774. selector: "inlineAssignment:",
  41775. protocol: 'inlining',
  41776. fn: function (anIRAssignment){
  41777. var self=this;
  41778. var inlinedAssignment;
  41779. function $IRInlinedAssignment(){return $globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  41780. return $core.withContext(function($ctx1) {
  41781. var $1,$2;
  41782. self._assignment_(anIRAssignment);
  41783. inlinedAssignment=$recv($IRInlinedAssignment())._new();
  41784. $1=$recv(anIRAssignment)._instructions();
  41785. $ctx1.sendIdx["instructions"]=1;
  41786. $recv($1)._do_((function(each){
  41787. return $core.withContext(function($ctx2) {
  41788. return $recv(inlinedAssignment)._add_(each);
  41789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41790. }));
  41791. $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
  41792. self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last());
  41793. $2=inlinedAssignment;
  41794. return $2;
  41795. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
  41796. },
  41797. args: ["anIRAssignment"],
  41798. 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",
  41799. referencedClasses: ["IRInlinedAssignment"],
  41800. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  41801. }),
  41802. $globals.IRAssignmentInliner);
  41803. $core.addMethod(
  41804. $core.method({
  41805. selector: "inlineClosure:",
  41806. protocol: 'inlining',
  41807. fn: function (anIRClosure){
  41808. var self=this;
  41809. var inlinedClosure,statements;
  41810. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  41811. return $core.withContext(function($ctx1) {
  41812. var $2,$1,$4,$3,$5,$7,$8,$6,$9;
  41813. inlinedClosure=(
  41814. $ctx1.supercall = true,
  41815. $globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  41816. $ctx1.supercall = false;
  41817. $2=$recv(inlinedClosure)._instructions();
  41818. $ctx1.sendIdx["instructions"]=2;
  41819. $1=$recv($2)._last();
  41820. $ctx1.sendIdx["last"]=1;
  41821. statements=$recv($1)._instructions();
  41822. $ctx1.sendIdx["instructions"]=1;
  41823. $recv(statements)._ifNotEmpty_((function(){
  41824. return $core.withContext(function($ctx2) {
  41825. $4=$recv(statements)._last();
  41826. $ctx2.sendIdx["last"]=2;
  41827. $3=$recv($4)._canBeAssigned();
  41828. if($core.assert($3)){
  41829. $5=$recv(statements)._last();
  41830. $ctx2.sendIdx["last"]=3;
  41831. $7=$recv($IRAssignment())._new();
  41832. $recv($7)._add_($recv($recv(self._assignment())._instructions())._first());
  41833. $ctx2.sendIdx["add:"]=1;
  41834. $recv($7)._add_($recv($recv(statements)._last())._copy());
  41835. $8=$recv($7)._yourself();
  41836. $6=$8;
  41837. return $recv($5)._replaceWith_($6);
  41838. };
  41839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41840. }));
  41841. $9=inlinedClosure;
  41842. return $9;
  41843. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)});
  41844. },
  41845. args: ["anIRClosure"],
  41846. 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",
  41847. referencedClasses: ["IRAssignment"],
  41848. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
  41849. }),
  41850. $globals.IRAssignmentInliner);
  41851. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  41852. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  41853. $core.addMethod(
  41854. $core.method({
  41855. selector: "inlineClosure:",
  41856. protocol: 'inlining',
  41857. fn: function (anIRClosure){
  41858. var self=this;
  41859. var closure,statements;
  41860. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  41861. return $core.withContext(function($ctx1) {
  41862. var $1,$3,$2,$4,$5,$6,$7;
  41863. closure=(
  41864. $ctx1.supercall = true,
  41865. $globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  41866. $ctx1.supercall = false;
  41867. $1=$recv($recv(closure)._instructions())._last();
  41868. $ctx1.sendIdx["last"]=1;
  41869. statements=$recv($1)._instructions();
  41870. $ctx1.sendIdx["instructions"]=1;
  41871. $recv(statements)._ifNotEmpty_((function(){
  41872. return $core.withContext(function($ctx2) {
  41873. $3=$recv(statements)._last();
  41874. $ctx2.sendIdx["last"]=2;
  41875. $2=$recv($3)._isReturn();
  41876. if(!$core.assert($2)){
  41877. $4=$recv(statements)._last();
  41878. $ctx2.sendIdx["last"]=3;
  41879. $5=$recv($IRReturn())._new();
  41880. $recv($5)._add_($recv($recv(statements)._last())._copy());
  41881. $6=$recv($5)._yourself();
  41882. return $recv($4)._replaceWith_($6);
  41883. };
  41884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41885. }));
  41886. $7=closure;
  41887. return $7;
  41888. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
  41889. },
  41890. args: ["anIRClosure"],
  41891. 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",
  41892. referencedClasses: ["IRReturn"],
  41893. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
  41894. }),
  41895. $globals.IRReturnInliner);
  41896. $core.addMethod(
  41897. $core.method({
  41898. selector: "inlineReturn:",
  41899. protocol: 'inlining',
  41900. fn: function (anIRReturn){
  41901. var self=this;
  41902. var return_;
  41903. return $core.withContext(function($ctx1) {
  41904. var $1,$2;
  41905. return_=self._inlinedReturn();
  41906. $1=$recv(anIRReturn)._instructions();
  41907. $ctx1.sendIdx["instructions"]=1;
  41908. $recv($1)._do_((function(each){
  41909. return $core.withContext(function($ctx2) {
  41910. return $recv(return_)._add_(each);
  41911. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41912. }));
  41913. $recv(anIRReturn)._replaceWith_(return_);
  41914. self._inlineSend_($recv($recv(return_)._instructions())._last());
  41915. $2=return_;
  41916. return $2;
  41917. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
  41918. },
  41919. args: ["anIRReturn"],
  41920. 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",
  41921. referencedClasses: [],
  41922. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  41923. }),
  41924. $globals.IRReturnInliner);
  41925. $core.addMethod(
  41926. $core.method({
  41927. selector: "inlinedReturn",
  41928. protocol: 'factory',
  41929. fn: function (){
  41930. var self=this;
  41931. function $IRInlinedReturn(){return $globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  41932. return $core.withContext(function($ctx1) {
  41933. var $1;
  41934. $1=$recv($IRInlinedReturn())._new();
  41935. return $1;
  41936. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
  41937. },
  41938. args: [],
  41939. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  41940. referencedClasses: ["IRInlinedReturn"],
  41941. messageSends: ["new"]
  41942. }),
  41943. $globals.IRReturnInliner);
  41944. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  41945. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  41946. $core.addMethod(
  41947. $core.method({
  41948. selector: "compileNode:",
  41949. protocol: 'compiling',
  41950. fn: function (aNode){
  41951. var self=this;
  41952. var ir,stream;
  41953. return $core.withContext(function($ctx1) {
  41954. var $2,$3,$1;
  41955. $recv(self._semanticAnalyzer())._visit_(aNode);
  41956. $ctx1.sendIdx["visit:"]=1;
  41957. ir=$recv(self._translator())._visit_(aNode);
  41958. $ctx1.sendIdx["visit:"]=2;
  41959. $recv(self._inliner())._visit_(ir);
  41960. $ctx1.sendIdx["visit:"]=3;
  41961. $2=self._irTranslator();
  41962. $recv($2)._currentClass_(self._currentClass());
  41963. $recv($2)._visit_(ir);
  41964. $3=$recv($2)._contents();
  41965. $1=$3;
  41966. return $1;
  41967. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
  41968. },
  41969. args: ["aNode"],
  41970. 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",
  41971. referencedClasses: [],
  41972. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  41973. }),
  41974. $globals.InliningCodeGenerator);
  41975. $core.addMethod(
  41976. $core.method({
  41977. selector: "inliner",
  41978. protocol: 'compiling',
  41979. fn: function (){
  41980. var self=this;
  41981. function $IRInliner(){return $globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  41982. return $core.withContext(function($ctx1) {
  41983. var $1;
  41984. $1=$recv($IRInliner())._new();
  41985. return $1;
  41986. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  41987. },
  41988. args: [],
  41989. source: "inliner\x0a\x09^ IRInliner new",
  41990. referencedClasses: ["IRInliner"],
  41991. messageSends: ["new"]
  41992. }),
  41993. $globals.InliningCodeGenerator);
  41994. $core.addMethod(
  41995. $core.method({
  41996. selector: "irTranslator",
  41997. protocol: 'compiling',
  41998. fn: function (){
  41999. var self=this;
  42000. function $IRInliningJSTranslator(){return $globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  42001. return $core.withContext(function($ctx1) {
  42002. var $1;
  42003. $1=$recv($IRInliningJSTranslator())._new();
  42004. return $1;
  42005. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
  42006. },
  42007. args: [],
  42008. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  42009. referencedClasses: ["IRInliningJSTranslator"],
  42010. messageSends: ["new"]
  42011. }),
  42012. $globals.InliningCodeGenerator);
  42013. });
  42014. define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Exceptions", "amber_core/Compiler-AST"], function($boot){"use strict";
  42015. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  42016. $core.addPackage('Compiler-Interpreter');
  42017. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  42018. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42019. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  42020. $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`).";
  42021. $core.addMethod(
  42022. $core.method({
  42023. selector: "applyTo:arguments:",
  42024. protocol: 'evaluating',
  42025. fn: function (anObject,aCollection){
  42026. var self=this;
  42027. return $core.withContext(function($ctx1) {
  42028. self._interpreterError();
  42029. return self;
  42030. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  42031. },
  42032. args: ["anObject", "aCollection"],
  42033. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  42034. referencedClasses: [],
  42035. messageSends: ["interpreterError"]
  42036. }),
  42037. $globals.AIBlockClosure);
  42038. $core.addMethod(
  42039. $core.method({
  42040. selector: "compiledSource",
  42041. protocol: 'accessing',
  42042. fn: function (){
  42043. var self=this;
  42044. return "[ AST Block closure ]";
  42045. },
  42046. args: [],
  42047. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  42048. referencedClasses: [],
  42049. messageSends: []
  42050. }),
  42051. $globals.AIBlockClosure);
  42052. $core.addMethod(
  42053. $core.method({
  42054. selector: "currySelf",
  42055. protocol: 'converting',
  42056. fn: function (){
  42057. var self=this;
  42058. return $core.withContext(function($ctx1) {
  42059. self._interpreterError();
  42060. return self;
  42061. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  42062. },
  42063. args: [],
  42064. source: "currySelf\x0a\x09self interpreterError",
  42065. referencedClasses: [],
  42066. messageSends: ["interpreterError"]
  42067. }),
  42068. $globals.AIBlockClosure);
  42069. $core.addMethod(
  42070. $core.method({
  42071. selector: "initializeWithContext:node:",
  42072. protocol: 'initialization',
  42073. fn: function (aContext,aNode){
  42074. var self=this;
  42075. self["@node"]=aNode;
  42076. self["@outerContext"]=aContext;
  42077. return self;
  42078. },
  42079. args: ["aContext", "aNode"],
  42080. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  42081. referencedClasses: [],
  42082. messageSends: []
  42083. }),
  42084. $globals.AIBlockClosure);
  42085. $core.addMethod(
  42086. $core.method({
  42087. selector: "interpreterError",
  42088. protocol: 'error handling',
  42089. fn: function (){
  42090. var self=this;
  42091. function $ASTInterpreterError(){return $globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  42092. return $core.withContext(function($ctx1) {
  42093. $recv($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  42094. return self;
  42095. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  42096. },
  42097. args: [],
  42098. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  42099. referencedClasses: ["ASTInterpreterError"],
  42100. messageSends: ["signal:"]
  42101. }),
  42102. $globals.AIBlockClosure);
  42103. $core.addMethod(
  42104. $core.method({
  42105. selector: "numArgs",
  42106. protocol: 'accessing',
  42107. fn: function (){
  42108. var self=this;
  42109. return $core.withContext(function($ctx1) {
  42110. var $1;
  42111. $1=$recv($recv(self["@node"])._temps())._size();
  42112. return $1;
  42113. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  42114. },
  42115. args: [],
  42116. source: "numArgs\x0a\x09^ node temps size",
  42117. referencedClasses: [],
  42118. messageSends: ["size", "temps"]
  42119. }),
  42120. $globals.AIBlockClosure);
  42121. $core.addMethod(
  42122. $core.method({
  42123. selector: "value",
  42124. protocol: 'evaluating',
  42125. fn: function (){
  42126. var self=this;
  42127. return $core.withContext(function($ctx1) {
  42128. var $1;
  42129. $1=self._valueWithPossibleArguments_([]);
  42130. return $1;
  42131. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  42132. },
  42133. args: [],
  42134. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  42135. referencedClasses: [],
  42136. messageSends: ["valueWithPossibleArguments:"]
  42137. }),
  42138. $globals.AIBlockClosure);
  42139. $core.addMethod(
  42140. $core.method({
  42141. selector: "value:",
  42142. protocol: 'evaluating',
  42143. fn: function (anArgument){
  42144. var self=this;
  42145. return $core.withContext(function($ctx1) {
  42146. var $1;
  42147. $1=self._valueWithPossibleArguments_([anArgument]);
  42148. return $1;
  42149. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  42150. },
  42151. args: ["anArgument"],
  42152. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  42153. referencedClasses: [],
  42154. messageSends: ["valueWithPossibleArguments:"]
  42155. }),
  42156. $globals.AIBlockClosure);
  42157. $core.addMethod(
  42158. $core.method({
  42159. selector: "value:value:",
  42160. protocol: 'evaluating',
  42161. fn: function (firstArgument,secondArgument){
  42162. var self=this;
  42163. return $core.withContext(function($ctx1) {
  42164. var $1;
  42165. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  42166. return $1;
  42167. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  42168. },
  42169. args: ["firstArgument", "secondArgument"],
  42170. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  42171. referencedClasses: [],
  42172. messageSends: ["valueWithPossibleArguments:"]
  42173. }),
  42174. $globals.AIBlockClosure);
  42175. $core.addMethod(
  42176. $core.method({
  42177. selector: "value:value:value:",
  42178. protocol: 'evaluating',
  42179. fn: function (firstArgument,secondArgument,thirdArgument){
  42180. var self=this;
  42181. return $core.withContext(function($ctx1) {
  42182. var $1;
  42183. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  42184. return $1;
  42185. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  42186. },
  42187. args: ["firstArgument", "secondArgument", "thirdArgument"],
  42188. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  42189. referencedClasses: [],
  42190. messageSends: ["valueWithPossibleArguments:"]
  42191. }),
  42192. $globals.AIBlockClosure);
  42193. $core.addMethod(
  42194. $core.method({
  42195. selector: "valueWithPossibleArguments:",
  42196. protocol: 'evaluating',
  42197. fn: function (aCollection){
  42198. var self=this;
  42199. var context,sequenceNode;
  42200. return $core.withContext(function($ctx1) {
  42201. var $1,$2,$3,$4,$5,$6;
  42202. context=$recv(self["@outerContext"])._newInnerContext();
  42203. $1=$recv($recv($recv(self["@node"])._nodes())._first())._copy();
  42204. $recv($1)._parent_(nil);
  42205. $2=$recv($1)._yourself();
  42206. sequenceNode=$2;
  42207. $recv($recv(sequenceNode)._temps())._do_((function(each){
  42208. return $core.withContext(function($ctx2) {
  42209. return $recv(context)._defineLocal_(each);
  42210. $ctx2.sendIdx["defineLocal:"]=1;
  42211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42212. }));
  42213. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  42214. return $core.withContext(function($ctx2) {
  42215. $recv(context)._defineLocal_(each);
  42216. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  42217. return nil;
  42218. })));
  42219. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  42220. }));
  42221. $3=$recv(context)._interpreter();
  42222. $ctx1.sendIdx["interpreter"]=1;
  42223. $recv($3)._node_($recv(sequenceNode)._nextChild());
  42224. $4=$recv($3)._proceed();
  42225. $5=$recv(self["@outerContext"])._interpreter();
  42226. $ctx1.sendIdx["interpreter"]=2;
  42227. $recv($5)._setNonLocalReturnFromContext_(context);
  42228. $6=$recv($recv(context)._interpreter())._pop();
  42229. return $6;
  42230. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  42231. },
  42232. args: ["aCollection"],
  42233. 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 nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  42234. referencedClasses: [],
  42235. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"]
  42236. }),
  42237. $globals.AIBlockClosure);
  42238. $core.addMethod(
  42239. $core.method({
  42240. selector: "forContext:node:",
  42241. protocol: 'instance creation',
  42242. fn: function (aContext,aNode){
  42243. var self=this;
  42244. return $core.withContext(function($ctx1) {
  42245. var $2,$3,$1;
  42246. $2=self._new();
  42247. $recv($2)._initializeWithContext_node_(aContext,aNode);
  42248. $3=$recv($2)._yourself();
  42249. $1=$3;
  42250. return $1;
  42251. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  42252. },
  42253. args: ["aContext", "aNode"],
  42254. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  42255. referencedClasses: [],
  42256. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  42257. }),
  42258. $globals.AIBlockClosure.klass);
  42259. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  42260. $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)";
  42261. $core.addMethod(
  42262. $core.method({
  42263. selector: "arguments",
  42264. protocol: 'interpreting',
  42265. fn: function (){
  42266. var self=this;
  42267. return $core.withContext(function($ctx1) {
  42268. var $1;
  42269. $1=$recv($recv(self._ast())._arguments())._collect_((function(each){
  42270. return $core.withContext(function($ctx2) {
  42271. return self._localAt_ifAbsent_(each,(function(){
  42272. return $core.withContext(function($ctx3) {
  42273. return self._error_("Argument not in context");
  42274. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42275. }));
  42276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42277. }));
  42278. return $1;
  42279. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  42280. },
  42281. args: [],
  42282. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  42283. referencedClasses: [],
  42284. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  42285. }),
  42286. $globals.AIContext);
  42287. $core.addMethod(
  42288. $core.method({
  42289. selector: "ast",
  42290. protocol: 'interpreting',
  42291. fn: function (){
  42292. var self=this;
  42293. return $core.withContext(function($ctx1) {
  42294. var $1,$3,$2,$4,$5,$receiver;
  42295. $1=self._isBlockContext();
  42296. if($core.assert($1)){
  42297. $3=self._outerContext();
  42298. if(($receiver = $3) == null || $receiver.isNil){
  42299. $2=$3;
  42300. } else {
  42301. var context;
  42302. context=$receiver;
  42303. $2=$recv(context)._ast();
  42304. };
  42305. return $2;
  42306. };
  42307. $4=self["@ast"];
  42308. if(($receiver = $4) == null || $receiver.isNil){
  42309. self._initializeAST();
  42310. } else {
  42311. $4;
  42312. };
  42313. $5=self["@ast"];
  42314. return $5;
  42315. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  42316. },
  42317. args: [],
  42318. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  42319. referencedClasses: [],
  42320. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  42321. }),
  42322. $globals.AIContext);
  42323. $core.addMethod(
  42324. $core.method({
  42325. selector: "basicLocalAt:",
  42326. protocol: 'private',
  42327. fn: function (aString){
  42328. var self=this;
  42329. return $core.withContext(function($ctx1) {
  42330. var $1;
  42331. $1=$recv(self._locals())._at_(aString);
  42332. return $1;
  42333. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  42334. },
  42335. args: ["aString"],
  42336. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  42337. referencedClasses: [],
  42338. messageSends: ["at:", "locals"]
  42339. }),
  42340. $globals.AIContext);
  42341. $core.addMethod(
  42342. $core.method({
  42343. selector: "basicLocalAt:put:",
  42344. protocol: 'private',
  42345. fn: function (aString,anObject){
  42346. var self=this;
  42347. return $core.withContext(function($ctx1) {
  42348. $recv(self._locals())._at_put_(aString,anObject);
  42349. return self;
  42350. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  42351. },
  42352. args: ["aString", "anObject"],
  42353. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  42354. referencedClasses: [],
  42355. messageSends: ["at:put:", "locals"]
  42356. }),
  42357. $globals.AIContext);
  42358. $core.addMethod(
  42359. $core.method({
  42360. selector: "basicReceiver",
  42361. protocol: 'interpreting',
  42362. fn: function (){
  42363. var self=this;
  42364. return $core.withContext(function($ctx1) {
  42365. var $1;
  42366. $1=self._localAt_("self");
  42367. return $1;
  42368. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  42369. },
  42370. args: [],
  42371. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  42372. referencedClasses: [],
  42373. messageSends: ["localAt:"]
  42374. }),
  42375. $globals.AIContext);
  42376. $core.addMethod(
  42377. $core.method({
  42378. selector: "defineLocal:",
  42379. protocol: 'accessing',
  42380. fn: function (aString){
  42381. var self=this;
  42382. return $core.withContext(function($ctx1) {
  42383. $recv(self._locals())._at_put_(aString,nil);
  42384. return self;
  42385. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  42386. },
  42387. args: ["aString"],
  42388. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  42389. referencedClasses: [],
  42390. messageSends: ["at:put:", "locals"]
  42391. }),
  42392. $globals.AIContext);
  42393. $core.addMethod(
  42394. $core.method({
  42395. selector: "evaluate:on:",
  42396. protocol: 'evaluating',
  42397. fn: function (aString,anEvaluator){
  42398. var self=this;
  42399. return $core.withContext(function($ctx1) {
  42400. var $1;
  42401. $1=$recv(anEvaluator)._evaluate_context_(aString,self);
  42402. return $1;
  42403. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  42404. },
  42405. args: ["aString", "anEvaluator"],
  42406. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  42407. referencedClasses: [],
  42408. messageSends: ["evaluate:context:"]
  42409. }),
  42410. $globals.AIContext);
  42411. $core.addMethod(
  42412. $core.method({
  42413. selector: "evaluateNode:",
  42414. protocol: 'evaluating',
  42415. fn: function (aNode){
  42416. var self=this;
  42417. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  42418. return $core.withContext(function($ctx1) {
  42419. var $2,$3,$1;
  42420. $2=$recv($ASTInterpreter())._new();
  42421. $recv($2)._context_(self);
  42422. $recv($2)._node_($recv(aNode)._nextChild());
  42423. $recv($2)._proceed();
  42424. $3=$recv($2)._result();
  42425. $1=$3;
  42426. return $1;
  42427. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  42428. },
  42429. args: ["aNode"],
  42430. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  42431. referencedClasses: ["ASTInterpreter"],
  42432. messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"]
  42433. }),
  42434. $globals.AIContext);
  42435. $core.addMethod(
  42436. $core.method({
  42437. selector: "evaluatedSelector",
  42438. protocol: 'accessing',
  42439. fn: function (){
  42440. var self=this;
  42441. var $1;
  42442. $1=self["@evaluatedSelector"];
  42443. return $1;
  42444. },
  42445. args: [],
  42446. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  42447. referencedClasses: [],
  42448. messageSends: []
  42449. }),
  42450. $globals.AIContext);
  42451. $core.addMethod(
  42452. $core.method({
  42453. selector: "evaluatedSelector:",
  42454. protocol: 'accessing',
  42455. fn: function (aString){
  42456. var self=this;
  42457. self["@evaluatedSelector"]=aString;
  42458. return self;
  42459. },
  42460. args: ["aString"],
  42461. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  42462. referencedClasses: [],
  42463. messageSends: []
  42464. }),
  42465. $globals.AIContext);
  42466. $core.addMethod(
  42467. $core.method({
  42468. selector: "index",
  42469. protocol: 'accessing',
  42470. fn: function (){
  42471. var self=this;
  42472. return $core.withContext(function($ctx1) {
  42473. var $2,$1,$receiver;
  42474. $2=self["@index"];
  42475. if(($receiver = $2) == null || $receiver.isNil){
  42476. $1=(0);
  42477. } else {
  42478. $1=$2;
  42479. };
  42480. return $1;
  42481. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  42482. },
  42483. args: [],
  42484. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  42485. referencedClasses: [],
  42486. messageSends: ["ifNil:"]
  42487. }),
  42488. $globals.AIContext);
  42489. $core.addMethod(
  42490. $core.method({
  42491. selector: "index:",
  42492. protocol: 'accessing',
  42493. fn: function (anInteger){
  42494. var self=this;
  42495. self["@index"]=anInteger;
  42496. return self;
  42497. },
  42498. args: ["anInteger"],
  42499. source: "index: anInteger\x0a\x09index := anInteger",
  42500. referencedClasses: [],
  42501. messageSends: []
  42502. }),
  42503. $globals.AIContext);
  42504. $core.addMethod(
  42505. $core.method({
  42506. selector: "initializeAST",
  42507. protocol: 'initialization',
  42508. fn: function (){
  42509. var self=this;
  42510. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  42511. return $core.withContext(function($ctx1) {
  42512. var $1;
  42513. $1=self._method();
  42514. $ctx1.sendIdx["method"]=1;
  42515. self["@ast"]=$recv($1)._ast();
  42516. $recv($recv($SemanticAnalyzer())._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  42517. return self;
  42518. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  42519. },
  42520. args: [],
  42521. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  42522. referencedClasses: ["SemanticAnalyzer"],
  42523. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  42524. }),
  42525. $globals.AIContext);
  42526. $core.addMethod(
  42527. $core.method({
  42528. selector: "initializeFromMethodContext:",
  42529. protocol: 'initialization',
  42530. fn: function (aMethodContext){
  42531. var self=this;
  42532. return $core.withContext(function($ctx1) {
  42533. var $1,$2,$3,$4,$receiver;
  42534. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  42535. self._index_($recv(aMethodContext)._index());
  42536. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  42537. self._receiver_($recv(aMethodContext)._receiver());
  42538. self._supercall_($recv(aMethodContext)._supercall());
  42539. $1=self._selector_($recv(aMethodContext)._selector());
  42540. $2=$recv(aMethodContext)._outerContext();
  42541. $ctx1.sendIdx["outerContext"]=1;
  42542. if(($receiver = $2) == null || $receiver.isNil){
  42543. $2;
  42544. } else {
  42545. var outer;
  42546. outer=$receiver;
  42547. $3=$recv(outer)._methodContext();
  42548. if(($receiver = $3) == null || $receiver.isNil){
  42549. $3;
  42550. } else {
  42551. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  42552. };
  42553. $4=$recv(aMethodContext)._locals();
  42554. $ctx1.sendIdx["locals"]=1;
  42555. $recv($4)._keysAndValuesDo_((function(key,value){
  42556. return $core.withContext(function($ctx2) {
  42557. return $recv(self._locals())._at_put_(key,value);
  42558. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  42559. }));
  42560. };
  42561. return self;
  42562. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  42563. },
  42564. args: ["aMethodContext"],
  42565. 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 ] ]",
  42566. referencedClasses: [],
  42567. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  42568. }),
  42569. $globals.AIContext);
  42570. $core.addMethod(
  42571. $core.method({
  42572. selector: "initializeInterpreter",
  42573. protocol: 'initialization',
  42574. fn: function (){
  42575. var self=this;
  42576. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  42577. return $core.withContext(function($ctx1) {
  42578. var $1,$2,$3,$receiver;
  42579. $1=$recv($ASTInterpreter())._new();
  42580. $recv($1)._context_(self);
  42581. $2=$recv($1)._yourself();
  42582. self["@interpreter"]=$2;
  42583. $3=self._innerContext();
  42584. if(($receiver = $3) == null || $receiver.isNil){
  42585. $3;
  42586. } else {
  42587. self._setupInterpreter_(self["@interpreter"]);
  42588. };
  42589. return self;
  42590. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  42591. },
  42592. args: [],
  42593. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  42594. referencedClasses: ["ASTInterpreter"],
  42595. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  42596. }),
  42597. $globals.AIContext);
  42598. $core.addMethod(
  42599. $core.method({
  42600. selector: "initializeLocals",
  42601. protocol: 'initialization',
  42602. fn: function (){
  42603. var self=this;
  42604. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  42605. return $core.withContext(function($ctx1) {
  42606. self["@locals"]=$recv($Dictionary())._new();
  42607. $recv(self["@locals"])._at_put_("thisContext",self);
  42608. return self;
  42609. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  42610. },
  42611. args: [],
  42612. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  42613. referencedClasses: ["Dictionary"],
  42614. messageSends: ["new", "at:put:"]
  42615. }),
  42616. $globals.AIContext);
  42617. $core.addMethod(
  42618. $core.method({
  42619. selector: "innerContext",
  42620. protocol: 'accessing',
  42621. fn: function (){
  42622. var self=this;
  42623. var $1;
  42624. $1=self["@innerContext"];
  42625. return $1;
  42626. },
  42627. args: [],
  42628. source: "innerContext\x0a\x09^ innerContext",
  42629. referencedClasses: [],
  42630. messageSends: []
  42631. }),
  42632. $globals.AIContext);
  42633. $core.addMethod(
  42634. $core.method({
  42635. selector: "innerContext:",
  42636. protocol: 'accessing',
  42637. fn: function (anAIContext){
  42638. var self=this;
  42639. self["@innerContext"]=anAIContext;
  42640. return self;
  42641. },
  42642. args: ["anAIContext"],
  42643. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  42644. referencedClasses: [],
  42645. messageSends: []
  42646. }),
  42647. $globals.AIContext);
  42648. $core.addMethod(
  42649. $core.method({
  42650. selector: "interpreter",
  42651. protocol: 'interpreting',
  42652. fn: function (){
  42653. var self=this;
  42654. return $core.withContext(function($ctx1) {
  42655. var $1,$2,$receiver;
  42656. $1=self["@interpreter"];
  42657. if(($receiver = $1) == null || $receiver.isNil){
  42658. self._initializeInterpreter();
  42659. } else {
  42660. $1;
  42661. };
  42662. $2=self["@interpreter"];
  42663. return $2;
  42664. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  42665. },
  42666. args: [],
  42667. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  42668. referencedClasses: [],
  42669. messageSends: ["ifNil:", "initializeInterpreter"]
  42670. }),
  42671. $globals.AIContext);
  42672. $core.addMethod(
  42673. $core.method({
  42674. selector: "interpreter:",
  42675. protocol: 'interpreting',
  42676. fn: function (anInterpreter){
  42677. var self=this;
  42678. self["@interpreter"]=anInterpreter;
  42679. return self;
  42680. },
  42681. args: ["anInterpreter"],
  42682. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  42683. referencedClasses: [],
  42684. messageSends: []
  42685. }),
  42686. $globals.AIContext);
  42687. $core.addMethod(
  42688. $core.method({
  42689. selector: "isTopContext",
  42690. protocol: 'testing',
  42691. fn: function (){
  42692. var self=this;
  42693. return $core.withContext(function($ctx1) {
  42694. var $1;
  42695. $1=$recv(self._innerContext())._isNil();
  42696. return $1;
  42697. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  42698. },
  42699. args: [],
  42700. source: "isTopContext\x0a\x09^ self innerContext isNil",
  42701. referencedClasses: [],
  42702. messageSends: ["isNil", "innerContext"]
  42703. }),
  42704. $globals.AIContext);
  42705. $core.addMethod(
  42706. $core.method({
  42707. selector: "localAt:",
  42708. protocol: 'accessing',
  42709. fn: function (aString){
  42710. var self=this;
  42711. var context;
  42712. return $core.withContext(function($ctx1) {
  42713. var $1;
  42714. context=self._lookupContextForLocal_(aString);
  42715. $1=$recv(context)._basicLocalAt_(aString);
  42716. return $1;
  42717. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  42718. },
  42719. args: ["aString"],
  42720. 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",
  42721. referencedClasses: [],
  42722. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  42723. }),
  42724. $globals.AIContext);
  42725. $core.addMethod(
  42726. $core.method({
  42727. selector: "localAt:ifAbsent:",
  42728. protocol: 'accessing',
  42729. fn: function (aString,aBlock){
  42730. var self=this;
  42731. var context;
  42732. return $core.withContext(function($ctx1) {
  42733. var $1,$2;
  42734. var $early={};
  42735. try {
  42736. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  42737. return $core.withContext(function($ctx2) {
  42738. $1=$recv(aBlock)._value();
  42739. throw $early=[$1];
  42740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42741. }));
  42742. $2=$recv(context)._basicLocalAt_(aString);
  42743. return $2;
  42744. }
  42745. catch(e) {if(e===$early)return e[0]; throw e}
  42746. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  42747. },
  42748. args: ["aString", "aBlock"],
  42749. 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",
  42750. referencedClasses: [],
  42751. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  42752. }),
  42753. $globals.AIContext);
  42754. $core.addMethod(
  42755. $core.method({
  42756. selector: "localAt:put:",
  42757. protocol: 'accessing',
  42758. fn: function (aString,anObject){
  42759. var self=this;
  42760. var context;
  42761. return $core.withContext(function($ctx1) {
  42762. context=self._lookupContextForLocal_(aString);
  42763. $recv(context)._basicLocalAt_put_(aString,anObject);
  42764. return self;
  42765. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  42766. },
  42767. args: ["aString", "anObject"],
  42768. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  42769. referencedClasses: [],
  42770. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  42771. }),
  42772. $globals.AIContext);
  42773. $core.addMethod(
  42774. $core.method({
  42775. selector: "locals",
  42776. protocol: 'accessing',
  42777. fn: function (){
  42778. var self=this;
  42779. return $core.withContext(function($ctx1) {
  42780. var $1,$2,$receiver;
  42781. $1=self["@locals"];
  42782. if(($receiver = $1) == null || $receiver.isNil){
  42783. self._initializeLocals();
  42784. } else {
  42785. $1;
  42786. };
  42787. $2=self["@locals"];
  42788. return $2;
  42789. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  42790. },
  42791. args: [],
  42792. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  42793. referencedClasses: [],
  42794. messageSends: ["ifNil:", "initializeLocals"]
  42795. }),
  42796. $globals.AIContext);
  42797. $core.addMethod(
  42798. $core.method({
  42799. selector: "lookupContextForLocal:",
  42800. protocol: 'private',
  42801. fn: function (aString){
  42802. var self=this;
  42803. return $core.withContext(function($ctx1) {
  42804. var $1;
  42805. $1=self._lookupContextForLocal_ifNone_(aString,(function(){
  42806. return $core.withContext(function($ctx2) {
  42807. return self._variableNotFound();
  42808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42809. }));
  42810. return $1;
  42811. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  42812. },
  42813. args: ["aString"],
  42814. 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 ]",
  42815. referencedClasses: [],
  42816. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  42817. }),
  42818. $globals.AIContext);
  42819. $core.addMethod(
  42820. $core.method({
  42821. selector: "lookupContextForLocal:ifNone:",
  42822. protocol: 'private',
  42823. fn: function (aString,aBlock){
  42824. var self=this;
  42825. return $core.withContext(function($ctx1) {
  42826. var $2,$1;
  42827. $1=$recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  42828. return self;
  42829. }),(function(){
  42830. return $core.withContext(function($ctx2) {
  42831. $2=self._outerContext();
  42832. return $recv($2)._ifNil_ifNotNil_(aBlock,(function(context){
  42833. return $core.withContext(function($ctx3) {
  42834. return $recv(context)._lookupContextForLocal_(aString);
  42835. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  42836. }));
  42837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42838. }));
  42839. return $1;
  42840. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  42841. },
  42842. args: ["aString", "aBlock"],
  42843. 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 ] ]",
  42844. referencedClasses: [],
  42845. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  42846. }),
  42847. $globals.AIContext);
  42848. $core.addMethod(
  42849. $core.method({
  42850. selector: "newInnerContext",
  42851. protocol: 'factory',
  42852. fn: function (){
  42853. var self=this;
  42854. return $core.withContext(function($ctx1) {
  42855. var $2,$3,$1;
  42856. $2=$recv(self._class())._new();
  42857. $recv($2)._outerContext_(self);
  42858. $3=$recv($2)._yourself();
  42859. $1=$3;
  42860. return $1;
  42861. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  42862. },
  42863. args: [],
  42864. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  42865. referencedClasses: [],
  42866. messageSends: ["outerContext:", "new", "class", "yourself"]
  42867. }),
  42868. $globals.AIContext);
  42869. $core.addMethod(
  42870. $core.method({
  42871. selector: "outerContext",
  42872. protocol: 'accessing',
  42873. fn: function (){
  42874. var self=this;
  42875. var $1;
  42876. $1=self["@outerContext"];
  42877. return $1;
  42878. },
  42879. args: [],
  42880. source: "outerContext\x0a\x09^ outerContext",
  42881. referencedClasses: [],
  42882. messageSends: []
  42883. }),
  42884. $globals.AIContext);
  42885. $core.addMethod(
  42886. $core.method({
  42887. selector: "outerContext:",
  42888. protocol: 'accessing',
  42889. fn: function (anAIContext){
  42890. var self=this;
  42891. return $core.withContext(function($ctx1) {
  42892. var $1,$receiver;
  42893. self["@outerContext"]=anAIContext;
  42894. $1=self["@outerContext"];
  42895. if(($receiver = $1) == null || $receiver.isNil){
  42896. $1;
  42897. } else {
  42898. var context;
  42899. context=$receiver;
  42900. $recv(context)._innerContext_(self);
  42901. };
  42902. return self;
  42903. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  42904. },
  42905. args: ["anAIContext"],
  42906. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  42907. referencedClasses: [],
  42908. messageSends: ["ifNotNil:", "innerContext:"]
  42909. }),
  42910. $globals.AIContext);
  42911. $core.addMethod(
  42912. $core.method({
  42913. selector: "receiver:",
  42914. protocol: 'interpreting',
  42915. fn: function (anObject){
  42916. var self=this;
  42917. return $core.withContext(function($ctx1) {
  42918. $recv(self._locals())._at_put_("self",anObject);
  42919. return self;
  42920. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  42921. },
  42922. args: ["anObject"],
  42923. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  42924. referencedClasses: [],
  42925. messageSends: ["at:put:", "locals"]
  42926. }),
  42927. $globals.AIContext);
  42928. $core.addMethod(
  42929. $core.method({
  42930. selector: "selector",
  42931. protocol: 'accessing',
  42932. fn: function (){
  42933. var self=this;
  42934. var $1;
  42935. $1=self["@selector"];
  42936. return $1;
  42937. },
  42938. args: [],
  42939. source: "selector\x0a\x09^ selector",
  42940. referencedClasses: [],
  42941. messageSends: []
  42942. }),
  42943. $globals.AIContext);
  42944. $core.addMethod(
  42945. $core.method({
  42946. selector: "selector:",
  42947. protocol: 'accessing',
  42948. fn: function (aString){
  42949. var self=this;
  42950. self["@selector"]=aString;
  42951. return self;
  42952. },
  42953. args: ["aString"],
  42954. source: "selector: aString\x0a\x09selector := aString",
  42955. referencedClasses: [],
  42956. messageSends: []
  42957. }),
  42958. $globals.AIContext);
  42959. $core.addMethod(
  42960. $core.method({
  42961. selector: "sendIndexAt:",
  42962. protocol: 'accessing',
  42963. fn: function (aString){
  42964. var self=this;
  42965. return $core.withContext(function($ctx1) {
  42966. var $1;
  42967. $1=$recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  42968. return (0);
  42969. }));
  42970. return $1;
  42971. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  42972. },
  42973. args: ["aString"],
  42974. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  42975. referencedClasses: [],
  42976. messageSends: ["at:ifAbsent:", "sendIndexes"]
  42977. }),
  42978. $globals.AIContext);
  42979. $core.addMethod(
  42980. $core.method({
  42981. selector: "sendIndexes",
  42982. protocol: 'accessing',
  42983. fn: function (){
  42984. var self=this;
  42985. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  42986. return $core.withContext(function($ctx1) {
  42987. var $2,$1,$receiver;
  42988. $2=self["@sendIndexes"];
  42989. if(($receiver = $2) == null || $receiver.isNil){
  42990. $1=$recv($Dictionary())._new();
  42991. } else {
  42992. $1=$2;
  42993. };
  42994. return $1;
  42995. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  42996. },
  42997. args: [],
  42998. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  42999. referencedClasses: ["Dictionary"],
  43000. messageSends: ["ifNil:", "new"]
  43001. }),
  43002. $globals.AIContext);
  43003. $core.addMethod(
  43004. $core.method({
  43005. selector: "sendIndexes:",
  43006. protocol: 'accessing',
  43007. fn: function (aDictionary){
  43008. var self=this;
  43009. self["@sendIndexes"]=aDictionary;
  43010. return self;
  43011. },
  43012. args: ["aDictionary"],
  43013. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  43014. referencedClasses: [],
  43015. messageSends: []
  43016. }),
  43017. $globals.AIContext);
  43018. $core.addMethod(
  43019. $core.method({
  43020. selector: "setupInterpreter:",
  43021. protocol: 'interpreting',
  43022. fn: function (anInterpreter){
  43023. var self=this;
  43024. var currentNode;
  43025. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  43026. return $core.withContext(function($ctx1) {
  43027. var $1,$2,$3,$4,$5,$8,$7,$6,$receiver;
  43028. $1=$recv($ASTPCNodeVisitor())._new();
  43029. $recv($1)._selector_(self._evaluatedSelector());
  43030. $recv($1)._context_(self);
  43031. $2=$1;
  43032. $3=self._ast();
  43033. $ctx1.sendIdx["ast"]=1;
  43034. $recv($2)._visit_($3);
  43035. $4=$recv($1)._currentNode();
  43036. currentNode=$4;
  43037. $5=$recv(self._ast())._sequenceNode();
  43038. if(($receiver = $5) == null || $receiver.isNil){
  43039. $5;
  43040. } else {
  43041. var sequence;
  43042. sequence=$receiver;
  43043. $recv($recv(sequence)._temps())._do_((function(each){
  43044. return $core.withContext(function($ctx2) {
  43045. return self._defineLocal_(each);
  43046. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43047. }));
  43048. $ctx1.sendIdx["do:"]=1;
  43049. };
  43050. $recv(anInterpreter)._node_(currentNode);
  43051. $8=self._innerContext();
  43052. $ctx1.sendIdx["innerContext"]=1;
  43053. $7=$recv($8)._arguments();
  43054. $6=$recv($7)._reversed();
  43055. $recv($6)._do_((function(each){
  43056. return $core.withContext(function($ctx2) {
  43057. return $recv(anInterpreter)._push_(each);
  43058. $ctx2.sendIdx["push:"]=1;
  43059. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  43060. }));
  43061. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  43062. return self;
  43063. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  43064. },
  43065. args: ["anInterpreter"],
  43066. 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)",
  43067. referencedClasses: ["ASTPCNodeVisitor"],
  43068. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  43069. }),
  43070. $globals.AIContext);
  43071. $core.addMethod(
  43072. $core.method({
  43073. selector: "supercall",
  43074. protocol: 'interpreting',
  43075. fn: function (){
  43076. var self=this;
  43077. return $core.withContext(function($ctx1) {
  43078. var $2,$1,$receiver;
  43079. $2=self["@supercall"];
  43080. if(($receiver = $2) == null || $receiver.isNil){
  43081. $1=false;
  43082. } else {
  43083. $1=$2;
  43084. };
  43085. return $1;
  43086. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  43087. },
  43088. args: [],
  43089. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  43090. referencedClasses: [],
  43091. messageSends: ["ifNil:"]
  43092. }),
  43093. $globals.AIContext);
  43094. $core.addMethod(
  43095. $core.method({
  43096. selector: "supercall:",
  43097. protocol: 'interpreting',
  43098. fn: function (aBoolean){
  43099. var self=this;
  43100. self["@supercall"]=aBoolean;
  43101. return self;
  43102. },
  43103. args: ["aBoolean"],
  43104. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  43105. referencedClasses: [],
  43106. messageSends: []
  43107. }),
  43108. $globals.AIContext);
  43109. $core.addMethod(
  43110. $core.method({
  43111. selector: "variableNotFound",
  43112. protocol: 'error handling',
  43113. fn: function (){
  43114. var self=this;
  43115. return $core.withContext(function($ctx1) {
  43116. self._error_("Variable missing");
  43117. return self;
  43118. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  43119. },
  43120. args: [],
  43121. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  43122. referencedClasses: [],
  43123. messageSends: ["error:"]
  43124. }),
  43125. $globals.AIContext);
  43126. $core.addMethod(
  43127. $core.method({
  43128. selector: "fromMethodContext:",
  43129. protocol: 'instance creation',
  43130. fn: function (aMethodContext){
  43131. var self=this;
  43132. return $core.withContext(function($ctx1) {
  43133. var $2,$3,$1;
  43134. $2=self._new();
  43135. $recv($2)._initializeFromMethodContext_(aMethodContext);
  43136. $3=$recv($2)._yourself();
  43137. $1=$3;
  43138. return $1;
  43139. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  43140. },
  43141. args: ["aMethodContext"],
  43142. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  43143. referencedClasses: [],
  43144. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  43145. }),
  43146. $globals.AIContext.klass);
  43147. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  43148. $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.";
  43149. $core.addMethod(
  43150. $core.method({
  43151. selector: "context",
  43152. protocol: 'accessing',
  43153. fn: function (){
  43154. var self=this;
  43155. var $1;
  43156. $1=self["@context"];
  43157. return $1;
  43158. },
  43159. args: [],
  43160. source: "context\x0a\x09^ context",
  43161. referencedClasses: [],
  43162. messageSends: []
  43163. }),
  43164. $globals.AISemanticAnalyzer);
  43165. $core.addMethod(
  43166. $core.method({
  43167. selector: "context:",
  43168. protocol: 'accessing',
  43169. fn: function (anAIContext){
  43170. var self=this;
  43171. self["@context"]=anAIContext;
  43172. return self;
  43173. },
  43174. args: ["anAIContext"],
  43175. source: "context: anAIContext\x0a\x09context := anAIContext",
  43176. referencedClasses: [],
  43177. messageSends: []
  43178. }),
  43179. $globals.AISemanticAnalyzer);
  43180. $core.addMethod(
  43181. $core.method({
  43182. selector: "visitVariableNode:",
  43183. protocol: 'visiting',
  43184. fn: function (aNode){
  43185. var self=this;
  43186. function $ASTContextVar(){return $globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)}
  43187. return $core.withContext(function($ctx1) {
  43188. var $1;
  43189. var $early={};
  43190. try {
  43191. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  43192. return $core.withContext(function($ctx2) {
  43193. $1=(
  43194. $ctx2.supercall = true,
  43195. $globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  43196. $ctx2.supercall = false;
  43197. throw $early=[$1];
  43198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43199. }));
  43200. $recv(aNode)._binding_($recv($ASTContextVar())._new());
  43201. return self;
  43202. }
  43203. catch(e) {if(e===$early)return e[0]; throw e}
  43204. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  43205. },
  43206. args: ["aNode"],
  43207. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  43208. referencedClasses: ["ASTContextVar"],
  43209. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  43210. }),
  43211. $globals.AISemanticAnalyzer);
  43212. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  43213. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  43214. $core.addMethod(
  43215. $core.method({
  43216. selector: "context",
  43217. protocol: 'accessing',
  43218. fn: function (){
  43219. var self=this;
  43220. var $1;
  43221. $1=self["@context"];
  43222. return $1;
  43223. },
  43224. args: [],
  43225. source: "context\x0a\x09^ context",
  43226. referencedClasses: [],
  43227. messageSends: []
  43228. }),
  43229. $globals.ASTContextVar);
  43230. $core.addMethod(
  43231. $core.method({
  43232. selector: "context:",
  43233. protocol: 'accessing',
  43234. fn: function (anObject){
  43235. var self=this;
  43236. self["@context"]=anObject;
  43237. return self;
  43238. },
  43239. args: ["anObject"],
  43240. source: "context: anObject\x0a\x09context := anObject",
  43241. referencedClasses: [],
  43242. messageSends: []
  43243. }),
  43244. $globals.ASTContextVar);
  43245. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  43246. $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.";
  43247. $core.addMethod(
  43248. $core.method({
  43249. selector: "atEnd",
  43250. protocol: 'testing',
  43251. fn: function (){
  43252. var self=this;
  43253. return $core.withContext(function($ctx1) {
  43254. var $1,$2,$receiver;
  43255. $1=self._context();
  43256. $ctx1.sendIdx["context"]=1;
  43257. if(($receiver = $1) == null || $receiver.isNil){
  43258. return true;
  43259. } else {
  43260. $1;
  43261. };
  43262. $2=$recv($recv(self._interpreter())._atEnd())._and_((function(){
  43263. return $core.withContext(function($ctx2) {
  43264. return $recv(self._context())._isTopContext();
  43265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43266. }));
  43267. return $2;
  43268. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  43269. },
  43270. args: [],
  43271. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  43272. referencedClasses: [],
  43273. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  43274. }),
  43275. $globals.ASTDebugger);
  43276. $core.addMethod(
  43277. $core.method({
  43278. selector: "context",
  43279. protocol: 'accessing',
  43280. fn: function (){
  43281. var self=this;
  43282. var $1;
  43283. $1=self["@context"];
  43284. return $1;
  43285. },
  43286. args: [],
  43287. source: "context\x0a\x09^ context",
  43288. referencedClasses: [],
  43289. messageSends: []
  43290. }),
  43291. $globals.ASTDebugger);
  43292. $core.addMethod(
  43293. $core.method({
  43294. selector: "context:",
  43295. protocol: 'accessing',
  43296. fn: function (aContext){
  43297. var self=this;
  43298. self["@context"]=aContext;
  43299. return self;
  43300. },
  43301. args: ["aContext"],
  43302. source: "context: aContext\x0a\x09context := aContext",
  43303. referencedClasses: [],
  43304. messageSends: []
  43305. }),
  43306. $globals.ASTDebugger);
  43307. $core.addMethod(
  43308. $core.method({
  43309. selector: "flushInnerContexts",
  43310. protocol: 'actions',
  43311. fn: function (){
  43312. var self=this;
  43313. return $core.withContext(function($ctx1) {
  43314. var $1,$receiver;
  43315. $1=self._context();
  43316. if(($receiver = $1) == null || $receiver.isNil){
  43317. $1;
  43318. } else {
  43319. var cxt;
  43320. cxt=$receiver;
  43321. $recv(cxt)._innerContext_(nil);
  43322. };
  43323. return self;
  43324. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  43325. },
  43326. args: [],
  43327. 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 ]",
  43328. referencedClasses: [],
  43329. messageSends: ["ifNotNil:", "context", "innerContext:"]
  43330. }),
  43331. $globals.ASTDebugger);
  43332. $core.addMethod(
  43333. $core.method({
  43334. selector: "interpreter",
  43335. protocol: 'accessing',
  43336. fn: function (){
  43337. var self=this;
  43338. return $core.withContext(function($ctx1) {
  43339. var $2,$1,$receiver;
  43340. $2=self._context();
  43341. if(($receiver = $2) == null || $receiver.isNil){
  43342. $1=$2;
  43343. } else {
  43344. var ctx;
  43345. ctx=$receiver;
  43346. $1=$recv(ctx)._interpreter();
  43347. };
  43348. return $1;
  43349. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  43350. },
  43351. args: [],
  43352. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  43353. referencedClasses: [],
  43354. messageSends: ["ifNotNil:", "context", "interpreter"]
  43355. }),
  43356. $globals.ASTDebugger);
  43357. $core.addMethod(
  43358. $core.method({
  43359. selector: "method",
  43360. protocol: 'accessing',
  43361. fn: function (){
  43362. var self=this;
  43363. return $core.withContext(function($ctx1) {
  43364. var $1;
  43365. $1=$recv(self._context())._method();
  43366. return $1;
  43367. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  43368. },
  43369. args: [],
  43370. source: "method\x0a\x09^ self context method",
  43371. referencedClasses: [],
  43372. messageSends: ["method", "context"]
  43373. }),
  43374. $globals.ASTDebugger);
  43375. $core.addMethod(
  43376. $core.method({
  43377. selector: "node",
  43378. protocol: 'accessing',
  43379. fn: function (){
  43380. var self=this;
  43381. return $core.withContext(function($ctx1) {
  43382. var $2,$1,$receiver;
  43383. $2=self._interpreter();
  43384. $ctx1.sendIdx["interpreter"]=1;
  43385. if(($receiver = $2) == null || $receiver.isNil){
  43386. $1=$2;
  43387. } else {
  43388. $1=$recv(self._interpreter())._node();
  43389. };
  43390. return $1;
  43391. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  43392. },
  43393. args: [],
  43394. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  43395. referencedClasses: [],
  43396. messageSends: ["ifNotNil:", "interpreter", "node"]
  43397. }),
  43398. $globals.ASTDebugger);
  43399. $core.addMethod(
  43400. $core.method({
  43401. selector: "onStep",
  43402. protocol: 'private',
  43403. fn: function (){
  43404. var self=this;
  43405. return $core.withContext(function($ctx1) {
  43406. var $1,$3,$2,$4,$6,$5,$receiver;
  43407. $1=self._interpreter();
  43408. $ctx1.sendIdx["interpreter"]=1;
  43409. self["@result"]=$recv($1)._result();
  43410. $3=self._interpreter();
  43411. $ctx1.sendIdx["interpreter"]=2;
  43412. $2=$recv($3)._atEnd();
  43413. $ctx1.sendIdx["atEnd"]=1;
  43414. if($core.assert($2)){
  43415. $4=$recv(self._context())._outerContext();
  43416. if(($receiver = $4) == null || $receiver.isNil){
  43417. $4;
  43418. } else {
  43419. var outerContext;
  43420. outerContext=$receiver;
  43421. self._context_(outerContext);
  43422. };
  43423. $6=self._interpreter();
  43424. $ctx1.sendIdx["interpreter"]=3;
  43425. $5=$recv($6)._atEnd();
  43426. if(!$core.assert($5)){
  43427. $recv(self._interpreter())._skip();
  43428. };
  43429. };
  43430. self._flushInnerContexts();
  43431. return self;
  43432. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  43433. },
  43434. args: [],
  43435. 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",
  43436. referencedClasses: [],
  43437. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  43438. }),
  43439. $globals.ASTDebugger);
  43440. $core.addMethod(
  43441. $core.method({
  43442. selector: "proceed",
  43443. protocol: 'stepping',
  43444. fn: function (){
  43445. var self=this;
  43446. return $core.withContext(function($ctx1) {
  43447. $recv((function(){
  43448. return $core.withContext(function($ctx2) {
  43449. return self._atEnd();
  43450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43451. }))._whileFalse_((function(){
  43452. return $core.withContext(function($ctx2) {
  43453. return self._stepOver();
  43454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43455. }));
  43456. return self;
  43457. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  43458. },
  43459. args: [],
  43460. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  43461. referencedClasses: [],
  43462. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  43463. }),
  43464. $globals.ASTDebugger);
  43465. $core.addMethod(
  43466. $core.method({
  43467. selector: "restart",
  43468. protocol: 'stepping',
  43469. fn: function (){
  43470. var self=this;
  43471. return $core.withContext(function($ctx1) {
  43472. $recv(self._interpreter())._restart();
  43473. self._flushInnerContexts();
  43474. return self;
  43475. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  43476. },
  43477. args: [],
  43478. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  43479. referencedClasses: [],
  43480. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  43481. }),
  43482. $globals.ASTDebugger);
  43483. $core.addMethod(
  43484. $core.method({
  43485. selector: "result",
  43486. protocol: 'accessing',
  43487. fn: function (){
  43488. var self=this;
  43489. var $1;
  43490. $1=self["@result"];
  43491. return $1;
  43492. },
  43493. args: [],
  43494. source: "result\x0a\x09^ result",
  43495. referencedClasses: [],
  43496. messageSends: []
  43497. }),
  43498. $globals.ASTDebugger);
  43499. $core.addMethod(
  43500. $core.method({
  43501. selector: "stepInto",
  43502. protocol: 'stepping',
  43503. fn: function (){
  43504. var self=this;
  43505. return $core.withContext(function($ctx1) {
  43506. self._shouldBeImplemented();
  43507. return self;
  43508. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  43509. },
  43510. args: [],
  43511. source: "stepInto\x0a\x09self shouldBeImplemented",
  43512. referencedClasses: [],
  43513. messageSends: ["shouldBeImplemented"]
  43514. }),
  43515. $globals.ASTDebugger);
  43516. $core.addMethod(
  43517. $core.method({
  43518. selector: "stepOver",
  43519. protocol: 'stepping',
  43520. fn: function (){
  43521. var self=this;
  43522. return $core.withContext(function($ctx1) {
  43523. var $1,$2;
  43524. $1=$recv(self._context())._isTopContext();
  43525. if($core.assert($1)){
  43526. $recv(self._interpreter())._stepOver();
  43527. } else {
  43528. $2=self._interpreter();
  43529. $ctx1.sendIdx["interpreter"]=1;
  43530. $recv($2)._skip();
  43531. };
  43532. self._onStep();
  43533. return self;
  43534. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  43535. },
  43536. args: [],
  43537. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  43538. referencedClasses: [],
  43539. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  43540. }),
  43541. $globals.ASTDebugger);
  43542. $core.addMethod(
  43543. $core.method({
  43544. selector: "context:",
  43545. protocol: 'instance creation',
  43546. fn: function (aContext){
  43547. var self=this;
  43548. return $core.withContext(function($ctx1) {
  43549. var $2,$3,$1;
  43550. $2=self._new();
  43551. $recv($2)._context_(aContext);
  43552. $3=$recv($2)._yourself();
  43553. $1=$3;
  43554. return $1;
  43555. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  43556. },
  43557. args: ["aContext"],
  43558. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  43559. referencedClasses: [],
  43560. messageSends: ["context:", "new", "yourself"]
  43561. }),
  43562. $globals.ASTDebugger.klass);
  43563. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  43564. $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";
  43565. $core.addMethod(
  43566. $core.method({
  43567. selector: "assign:to:",
  43568. protocol: 'private',
  43569. fn: function (aNode,anObject){
  43570. var self=this;
  43571. return $core.withContext(function($ctx1) {
  43572. var $1,$3,$2,$4;
  43573. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  43574. if($core.assert($1)){
  43575. $3=self._context();
  43576. $ctx1.sendIdx["context"]=1;
  43577. $2=$recv($3)._receiver();
  43578. $4=$recv(aNode)._value();
  43579. $ctx1.sendIdx["value"]=1;
  43580. $recv($2)._instVarAt_put_($4,anObject);
  43581. } else {
  43582. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  43583. };
  43584. return self;
  43585. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  43586. },
  43587. args: ["aNode", "anObject"],
  43588. 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 ]",
  43589. referencedClasses: [],
  43590. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  43591. }),
  43592. $globals.ASTInterpreter);
  43593. $core.addMethod(
  43594. $core.method({
  43595. selector: "atEnd",
  43596. protocol: 'testing',
  43597. fn: function (){
  43598. var self=this;
  43599. return $core.withContext(function($ctx1) {
  43600. var $1,$2;
  43601. $1=self["@forceAtEnd"];
  43602. if($core.assert($1)){
  43603. return true;
  43604. };
  43605. $2=$recv(self._hasReturned())._or_((function(){
  43606. return $core.withContext(function($ctx2) {
  43607. return $recv(self._node())._isNil();
  43608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43609. }));
  43610. return $2;
  43611. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  43612. },
  43613. args: [],
  43614. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  43615. referencedClasses: [],
  43616. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  43617. }),
  43618. $globals.ASTInterpreter);
  43619. $core.addMethod(
  43620. $core.method({
  43621. selector: "context",
  43622. protocol: 'accessing',
  43623. fn: function (){
  43624. var self=this;
  43625. var $1;
  43626. $1=self["@context"];
  43627. return $1;
  43628. },
  43629. args: [],
  43630. source: "context\x0a\x09^ context",
  43631. referencedClasses: [],
  43632. messageSends: []
  43633. }),
  43634. $globals.ASTInterpreter);
  43635. $core.addMethod(
  43636. $core.method({
  43637. selector: "context:",
  43638. protocol: 'accessing',
  43639. fn: function (aContext){
  43640. var self=this;
  43641. self["@context"]=aContext;
  43642. return self;
  43643. },
  43644. args: ["aContext"],
  43645. source: "context: aContext\x0a\x09context := aContext",
  43646. referencedClasses: [],
  43647. messageSends: []
  43648. }),
  43649. $globals.ASTInterpreter);
  43650. $core.addMethod(
  43651. $core.method({
  43652. selector: "eval:",
  43653. protocol: 'private',
  43654. fn: function (aString){
  43655. var self=this;
  43656. var source,function_;
  43657. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  43658. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  43659. return $core.withContext(function($ctx1) {
  43660. var $3,$2,$1,$4,$5;
  43661. source=$recv($String())._streamContents_((function(str){
  43662. return $core.withContext(function($ctx2) {
  43663. $recv(str)._nextPutAll_("0,(function(");
  43664. $ctx2.sendIdx["nextPutAll:"]=1;
  43665. $3=self._context();
  43666. $ctx2.sendIdx["context"]=1;
  43667. $2=$recv($3)._locals();
  43668. $ctx2.sendIdx["locals"]=1;
  43669. $1=$recv($2)._keys();
  43670. $recv($1)._do_separatedBy_((function(each){
  43671. return $core.withContext(function($ctx3) {
  43672. return $recv(str)._nextPutAll_(each);
  43673. $ctx3.sendIdx["nextPutAll:"]=2;
  43674. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  43675. }),(function(){
  43676. return $core.withContext(function($ctx3) {
  43677. return $recv(str)._nextPutAll_(",");
  43678. $ctx3.sendIdx["nextPutAll:"]=3;
  43679. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  43680. }));
  43681. $recv(str)._nextPutAll_("){ return (function() {");
  43682. $ctx2.sendIdx["nextPutAll:"]=4;
  43683. $recv(str)._nextPutAll_(aString);
  43684. $ctx2.sendIdx["nextPutAll:"]=5;
  43685. $4=$recv(str)._nextPutAll_("})()})");
  43686. return $4;
  43687. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  43688. }));
  43689. function_=$recv($recv($Compiler())._new())._eval_(source);
  43690. $5=$recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  43691. return $5;
  43692. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  43693. },
  43694. args: ["aString"],
  43695. 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",
  43696. referencedClasses: ["String", "Compiler"],
  43697. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  43698. }),
  43699. $globals.ASTInterpreter);
  43700. $core.addMethod(
  43701. $core.method({
  43702. selector: "hasReturned",
  43703. protocol: 'testing',
  43704. fn: function (){
  43705. var self=this;
  43706. return $core.withContext(function($ctx1) {
  43707. var $2,$1,$receiver;
  43708. $2=self["@returned"];
  43709. if(($receiver = $2) == null || $receiver.isNil){
  43710. $1=false;
  43711. } else {
  43712. $1=$2;
  43713. };
  43714. return $1;
  43715. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  43716. },
  43717. args: [],
  43718. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  43719. referencedClasses: [],
  43720. messageSends: ["ifNil:"]
  43721. }),
  43722. $globals.ASTInterpreter);
  43723. $core.addMethod(
  43724. $core.method({
  43725. selector: "initialize",
  43726. protocol: 'initialization',
  43727. fn: function (){
  43728. var self=this;
  43729. return $core.withContext(function($ctx1) {
  43730. (
  43731. $ctx1.supercall = true,
  43732. $globals.ASTInterpreter.superclass.fn.prototype._initialize.apply($recv(self), []));
  43733. $ctx1.supercall = false;
  43734. self["@forceAtEnd"]=false;
  43735. return self;
  43736. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  43737. },
  43738. args: [],
  43739. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  43740. referencedClasses: [],
  43741. messageSends: ["initialize"]
  43742. }),
  43743. $globals.ASTInterpreter);
  43744. $core.addMethod(
  43745. $core.method({
  43746. selector: "interpret",
  43747. protocol: 'interpreting',
  43748. fn: function (){
  43749. var self=this;
  43750. return $core.withContext(function($ctx1) {
  43751. self._visit_(self._node());
  43752. return self;
  43753. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  43754. },
  43755. args: [],
  43756. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  43757. referencedClasses: [],
  43758. messageSends: ["visit:", "node"]
  43759. }),
  43760. $globals.ASTInterpreter);
  43761. $core.addMethod(
  43762. $core.method({
  43763. selector: "interpret:",
  43764. protocol: 'interpreting',
  43765. fn: function (aNode){
  43766. var self=this;
  43767. return $core.withContext(function($ctx1) {
  43768. self._node_(aNode);
  43769. self._interpret();
  43770. return self;
  43771. }, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},$globals.ASTInterpreter)});
  43772. },
  43773. args: ["aNode"],
  43774. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  43775. referencedClasses: [],
  43776. messageSends: ["node:", "interpret"]
  43777. }),
  43778. $globals.ASTInterpreter);
  43779. $core.addMethod(
  43780. $core.method({
  43781. selector: "messageFromSendNode:arguments:",
  43782. protocol: 'private',
  43783. fn: function (aSendNode,aCollection){
  43784. var self=this;
  43785. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  43786. return $core.withContext(function($ctx1) {
  43787. var $2,$3,$1;
  43788. $2=$recv($Message())._new();
  43789. $recv($2)._selector_($recv(aSendNode)._selector());
  43790. $recv($2)._arguments_(aCollection);
  43791. $3=$recv($2)._yourself();
  43792. $1=$3;
  43793. return $1;
  43794. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  43795. },
  43796. args: ["aSendNode", "aCollection"],
  43797. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  43798. referencedClasses: ["Message"],
  43799. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  43800. }),
  43801. $globals.ASTInterpreter);
  43802. $core.addMethod(
  43803. $core.method({
  43804. selector: "messageNotUnderstood:receiver:",
  43805. protocol: 'private',
  43806. fn: function (aMessage,anObject){
  43807. var self=this;
  43808. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  43809. return $core.withContext(function($ctx1) {
  43810. var $1,$2;
  43811. $1=$recv($MessageNotUnderstood())._new();
  43812. $recv($1)._meesage_(aMessage);
  43813. $recv($1)._receiver_(anObject);
  43814. $2=$recv($1)._signal();
  43815. return self;
  43816. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  43817. },
  43818. args: ["aMessage", "anObject"],
  43819. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  43820. referencedClasses: ["MessageNotUnderstood"],
  43821. messageSends: ["meesage:", "new", "receiver:", "signal"]
  43822. }),
  43823. $globals.ASTInterpreter);
  43824. $core.addMethod(
  43825. $core.method({
  43826. selector: "next",
  43827. protocol: 'interpreting',
  43828. fn: function (){
  43829. var self=this;
  43830. return $core.withContext(function($ctx1) {
  43831. self._node_($recv(self._node())._nextNode());
  43832. return self;
  43833. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ASTInterpreter)});
  43834. },
  43835. args: [],
  43836. source: "next\x0a\x09self node: self node nextNode",
  43837. referencedClasses: [],
  43838. messageSends: ["node:", "nextNode", "node"]
  43839. }),
  43840. $globals.ASTInterpreter);
  43841. $core.addMethod(
  43842. $core.method({
  43843. selector: "node",
  43844. protocol: 'accessing',
  43845. fn: function (){
  43846. var self=this;
  43847. var $1;
  43848. $1=self["@node"];
  43849. return $1;
  43850. },
  43851. args: [],
  43852. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  43853. referencedClasses: [],
  43854. messageSends: []
  43855. }),
  43856. $globals.ASTInterpreter);
  43857. $core.addMethod(
  43858. $core.method({
  43859. selector: "node:",
  43860. protocol: 'accessing',
  43861. fn: function (aNode){
  43862. var self=this;
  43863. self["@node"]=aNode;
  43864. return self;
  43865. },
  43866. args: ["aNode"],
  43867. source: "node: aNode\x0a\x09node := aNode",
  43868. referencedClasses: [],
  43869. messageSends: []
  43870. }),
  43871. $globals.ASTInterpreter);
  43872. $core.addMethod(
  43873. $core.method({
  43874. selector: "peek",
  43875. protocol: 'stack',
  43876. fn: function (){
  43877. var self=this;
  43878. return $core.withContext(function($ctx1) {
  43879. var $1,$2;
  43880. var $early={};
  43881. try {
  43882. $1=self._stack();
  43883. $ctx1.sendIdx["stack"]=1;
  43884. $recv($1)._ifEmpty_((function(){
  43885. throw $early=[nil];
  43886. }));
  43887. $2=$recv(self._stack())._last();
  43888. return $2;
  43889. }
  43890. catch(e) {if(e===$early)return e[0]; throw e}
  43891. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  43892. },
  43893. args: [],
  43894. 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",
  43895. referencedClasses: [],
  43896. messageSends: ["ifEmpty:", "stack", "last"]
  43897. }),
  43898. $globals.ASTInterpreter);
  43899. $core.addMethod(
  43900. $core.method({
  43901. selector: "pop",
  43902. protocol: 'stack',
  43903. fn: function (){
  43904. var self=this;
  43905. var peekedValue;
  43906. return $core.withContext(function($ctx1) {
  43907. var $1;
  43908. peekedValue=self._peek();
  43909. $recv(self._stack())._removeLast();
  43910. $1=peekedValue;
  43911. return $1;
  43912. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  43913. },
  43914. args: [],
  43915. 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",
  43916. referencedClasses: [],
  43917. messageSends: ["peek", "removeLast", "stack"]
  43918. }),
  43919. $globals.ASTInterpreter);
  43920. $core.addMethod(
  43921. $core.method({
  43922. selector: "proceed",
  43923. protocol: 'interpreting',
  43924. fn: function (){
  43925. var self=this;
  43926. return $core.withContext(function($ctx1) {
  43927. $recv((function(){
  43928. return $core.withContext(function($ctx2) {
  43929. return self._atEnd();
  43930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43931. }))._whileFalse_((function(){
  43932. return $core.withContext(function($ctx2) {
  43933. return self._step();
  43934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43935. }));
  43936. return self;
  43937. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  43938. },
  43939. args: [],
  43940. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  43941. referencedClasses: [],
  43942. messageSends: ["whileFalse:", "atEnd", "step"]
  43943. }),
  43944. $globals.ASTInterpreter);
  43945. $core.addMethod(
  43946. $core.method({
  43947. selector: "push:",
  43948. protocol: 'stack',
  43949. fn: function (anObject){
  43950. var self=this;
  43951. return $core.withContext(function($ctx1) {
  43952. var $1;
  43953. $1=$recv(self._stack())._add_(anObject);
  43954. return $1;
  43955. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  43956. },
  43957. args: ["anObject"],
  43958. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  43959. referencedClasses: [],
  43960. messageSends: ["add:", "stack"]
  43961. }),
  43962. $globals.ASTInterpreter);
  43963. $core.addMethod(
  43964. $core.method({
  43965. selector: "restart",
  43966. protocol: 'interpreting',
  43967. fn: function (){
  43968. var self=this;
  43969. return $core.withContext(function($ctx1) {
  43970. self._node_($recv($recv(self._context())._ast())._nextChild());
  43971. return self;
  43972. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  43973. },
  43974. args: [],
  43975. source: "restart\x0a\x09self node: self context ast nextChild",
  43976. referencedClasses: [],
  43977. messageSends: ["node:", "nextChild", "ast", "context"]
  43978. }),
  43979. $globals.ASTInterpreter);
  43980. $core.addMethod(
  43981. $core.method({
  43982. selector: "result",
  43983. protocol: 'accessing',
  43984. fn: function (){
  43985. var self=this;
  43986. return $core.withContext(function($ctx1) {
  43987. var $2,$1;
  43988. $2=self._hasReturned();
  43989. if($core.assert($2)){
  43990. $1=self._returnValue();
  43991. } else {
  43992. $1=$recv(self._context())._receiver();
  43993. };
  43994. return $1;
  43995. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  43996. },
  43997. args: [],
  43998. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  43999. referencedClasses: [],
  44000. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  44001. }),
  44002. $globals.ASTInterpreter);
  44003. $core.addMethod(
  44004. $core.method({
  44005. selector: "returnValue",
  44006. protocol: 'accessing',
  44007. fn: function (){
  44008. var self=this;
  44009. var $1;
  44010. $1=self["@returnValue"];
  44011. return $1;
  44012. },
  44013. args: [],
  44014. source: "returnValue\x0a\x09^ returnValue",
  44015. referencedClasses: [],
  44016. messageSends: []
  44017. }),
  44018. $globals.ASTInterpreter);
  44019. $core.addMethod(
  44020. $core.method({
  44021. selector: "returnValue:",
  44022. protocol: 'accessing',
  44023. fn: function (anObject){
  44024. var self=this;
  44025. self["@returnValue"]=anObject;
  44026. return self;
  44027. },
  44028. args: ["anObject"],
  44029. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  44030. referencedClasses: [],
  44031. messageSends: []
  44032. }),
  44033. $globals.ASTInterpreter);
  44034. $core.addMethod(
  44035. $core.method({
  44036. selector: "sendMessage:to:superSend:",
  44037. protocol: 'private',
  44038. fn: function (aMessage,anObject,aBoolean){
  44039. var self=this;
  44040. var method;
  44041. return $core.withContext(function($ctx1) {
  44042. var $1,$3,$2,$4,$5,$6,$receiver;
  44043. var $early={};
  44044. try {
  44045. if(!$core.assert(aBoolean)){
  44046. $1=$recv(aMessage)._sendTo_(anObject);
  44047. return $1;
  44048. };
  44049. $3=$recv(anObject)._class();
  44050. $ctx1.sendIdx["class"]=1;
  44051. $2=$recv($3)._superclass();
  44052. $ctx1.sendIdx["superclass"]=1;
  44053. if(($receiver = $2) == null || $receiver.isNil){
  44054. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  44055. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  44056. return $4;
  44057. } else {
  44058. $2;
  44059. };
  44060. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  44061. return $core.withContext(function($ctx2) {
  44062. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  44063. throw $early=[$5];
  44064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44065. }));
  44066. $6=$recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  44067. return $6;
  44068. }
  44069. catch(e) {if(e===$early)return e[0]; throw e}
  44070. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  44071. },
  44072. args: ["aMessage", "anObject", "aBoolean"],
  44073. 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",
  44074. referencedClasses: [],
  44075. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  44076. }),
  44077. $globals.ASTInterpreter);
  44078. $core.addMethod(
  44079. $core.method({
  44080. selector: "setNonLocalReturnFromContext:",
  44081. protocol: 'interpreting',
  44082. fn: function (aContext){
  44083. var self=this;
  44084. return $core.withContext(function($ctx1) {
  44085. var $2,$1;
  44086. $2=$recv(aContext)._interpreter();
  44087. $ctx1.sendIdx["interpreter"]=1;
  44088. $1=$recv($2)._hasReturned();
  44089. if($core.assert($1)){
  44090. self["@returned"]=true;
  44091. self["@returned"];
  44092. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  44093. };
  44094. return self;
  44095. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  44096. },
  44097. args: ["aContext"],
  44098. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  44099. referencedClasses: [],
  44100. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  44101. }),
  44102. $globals.ASTInterpreter);
  44103. $core.addMethod(
  44104. $core.method({
  44105. selector: "skip",
  44106. protocol: 'interpreting',
  44107. fn: function (){
  44108. var self=this;
  44109. return $core.withContext(function($ctx1) {
  44110. self._next();
  44111. return self;
  44112. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  44113. },
  44114. args: [],
  44115. source: "skip\x0a\x09self next",
  44116. referencedClasses: [],
  44117. messageSends: ["next"]
  44118. }),
  44119. $globals.ASTInterpreter);
  44120. $core.addMethod(
  44121. $core.method({
  44122. selector: "stack",
  44123. protocol: 'accessing',
  44124. fn: function (){
  44125. var self=this;
  44126. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44127. return $core.withContext(function($ctx1) {
  44128. var $2,$1,$receiver;
  44129. $2=self["@stack"];
  44130. if(($receiver = $2) == null || $receiver.isNil){
  44131. self["@stack"]=$recv($OrderedCollection())._new();
  44132. $1=self["@stack"];
  44133. } else {
  44134. $1=$2;
  44135. };
  44136. return $1;
  44137. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  44138. },
  44139. args: [],
  44140. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  44141. referencedClasses: ["OrderedCollection"],
  44142. messageSends: ["ifNil:", "new"]
  44143. }),
  44144. $globals.ASTInterpreter);
  44145. $core.addMethod(
  44146. $core.method({
  44147. selector: "step",
  44148. protocol: 'interpreting',
  44149. fn: function (){
  44150. var self=this;
  44151. return $core.withContext(function($ctx1) {
  44152. var $1;
  44153. self._interpret();
  44154. $1=self._next();
  44155. return self;
  44156. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  44157. },
  44158. args: [],
  44159. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  44160. referencedClasses: [],
  44161. messageSends: ["interpret", "next"]
  44162. }),
  44163. $globals.ASTInterpreter);
  44164. $core.addMethod(
  44165. $core.method({
  44166. selector: "stepOver",
  44167. protocol: 'interpreting',
  44168. fn: function (){
  44169. var self=this;
  44170. return $core.withContext(function($ctx1) {
  44171. var $2,$1;
  44172. self._step();
  44173. $ctx1.sendIdx["step"]=1;
  44174. $recv((function(){
  44175. return $core.withContext(function($ctx2) {
  44176. $2=self._node();
  44177. $ctx2.sendIdx["node"]=1;
  44178. $1=$recv($2)._isNil();
  44179. return $recv($1)._or_((function(){
  44180. return $core.withContext(function($ctx3) {
  44181. return $recv(self._node())._isSteppingNode();
  44182. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44183. }));
  44184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44185. }))._whileFalse_((function(){
  44186. return $core.withContext(function($ctx2) {
  44187. return self._step();
  44188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44189. }));
  44190. return self;
  44191. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  44192. },
  44193. args: [],
  44194. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  44195. referencedClasses: [],
  44196. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  44197. }),
  44198. $globals.ASTInterpreter);
  44199. $core.addMethod(
  44200. $core.method({
  44201. selector: "visit:",
  44202. protocol: 'visiting',
  44203. fn: function (aNode){
  44204. var self=this;
  44205. return $core.withContext(function($ctx1) {
  44206. var $1;
  44207. $1=self._hasReturned();
  44208. if(!$core.assert($1)){
  44209. (
  44210. $ctx1.supercall = true,
  44211. $globals.ASTInterpreter.superclass.fn.prototype._visit_.apply($recv(self), [aNode]));
  44212. $ctx1.supercall = false;
  44213. };
  44214. return self;
  44215. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  44216. },
  44217. args: ["aNode"],
  44218. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  44219. referencedClasses: [],
  44220. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  44221. }),
  44222. $globals.ASTInterpreter);
  44223. $core.addMethod(
  44224. $core.method({
  44225. selector: "visitAssignmentNode:",
  44226. protocol: 'visiting',
  44227. fn: function (aNode){
  44228. var self=this;
  44229. var poppedValue;
  44230. return $core.withContext(function($ctx1) {
  44231. poppedValue=self._pop();
  44232. $ctx1.sendIdx["pop"]=1;
  44233. self._pop();
  44234. self._push_(poppedValue);
  44235. self._assign_to_($recv(aNode)._left(),poppedValue);
  44236. return self;
  44237. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  44238. },
  44239. args: ["aNode"],
  44240. 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",
  44241. referencedClasses: [],
  44242. messageSends: ["pop", "push:", "assign:to:", "left"]
  44243. }),
  44244. $globals.ASTInterpreter);
  44245. $core.addMethod(
  44246. $core.method({
  44247. selector: "visitBlockNode:",
  44248. protocol: 'visiting',
  44249. fn: function (aNode){
  44250. var self=this;
  44251. var block;
  44252. function $AIBlockClosure(){return $globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  44253. return $core.withContext(function($ctx1) {
  44254. block=$recv($AIBlockClosure())._forContext_node_(self._context(),aNode);
  44255. self._push_(block);
  44256. return self;
  44257. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  44258. },
  44259. args: ["aNode"],
  44260. 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",
  44261. referencedClasses: ["AIBlockClosure"],
  44262. messageSends: ["forContext:node:", "context", "push:"]
  44263. }),
  44264. $globals.ASTInterpreter);
  44265. $core.addMethod(
  44266. $core.method({
  44267. selector: "visitBlockSequenceNode:",
  44268. protocol: 'visiting',
  44269. fn: function (aNode){
  44270. var self=this;
  44271. return $core.withContext(function($ctx1) {
  44272. (
  44273. $ctx1.supercall = true,
  44274. $globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  44275. $ctx1.supercall = false;
  44276. self["@forceAtEnd"]=true;
  44277. return self;
  44278. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44279. },
  44280. args: ["aNode"],
  44281. 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",
  44282. referencedClasses: [],
  44283. messageSends: ["visitBlockSequenceNode:"]
  44284. }),
  44285. $globals.ASTInterpreter);
  44286. $core.addMethod(
  44287. $core.method({
  44288. selector: "visitDynamicArrayNode:",
  44289. protocol: 'visiting',
  44290. fn: function (aNode){
  44291. var self=this;
  44292. var array;
  44293. return $core.withContext(function($ctx1) {
  44294. array=[];
  44295. $recv($recv(aNode)._nodes())._do_((function(each){
  44296. return $core.withContext(function($ctx2) {
  44297. return $recv(array)._addFirst_(self._pop());
  44298. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44299. }));
  44300. self._push_(array);
  44301. return self;
  44302. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  44303. },
  44304. args: ["aNode"],
  44305. 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",
  44306. referencedClasses: [],
  44307. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  44308. }),
  44309. $globals.ASTInterpreter);
  44310. $core.addMethod(
  44311. $core.method({
  44312. selector: "visitDynamicDictionaryNode:",
  44313. protocol: 'visiting',
  44314. fn: function (aNode){
  44315. var self=this;
  44316. var keyValueList;
  44317. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44318. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  44319. return $core.withContext(function($ctx1) {
  44320. keyValueList=$recv($OrderedCollection())._new();
  44321. $recv($recv(aNode)._nodes())._do_((function(each){
  44322. return $core.withContext(function($ctx2) {
  44323. return $recv(keyValueList)._add_(self._pop());
  44324. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44325. }));
  44326. self._push_($recv($HashedCollection())._newFromPairs_($recv(keyValueList)._reversed()));
  44327. return self;
  44328. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  44329. },
  44330. args: ["aNode"],
  44331. 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)",
  44332. referencedClasses: ["OrderedCollection", "HashedCollection"],
  44333. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  44334. }),
  44335. $globals.ASTInterpreter);
  44336. $core.addMethod(
  44337. $core.method({
  44338. selector: "visitJSStatementNode:",
  44339. protocol: 'visiting',
  44340. fn: function (aNode){
  44341. var self=this;
  44342. return $core.withContext(function($ctx1) {
  44343. self["@returned"]=true;
  44344. self._returnValue_(self._eval_($recv(aNode)._source()));
  44345. return self;
  44346. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44347. },
  44348. args: ["aNode"],
  44349. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  44350. referencedClasses: [],
  44351. messageSends: ["returnValue:", "eval:", "source"]
  44352. }),
  44353. $globals.ASTInterpreter);
  44354. $core.addMethod(
  44355. $core.method({
  44356. selector: "visitNode:",
  44357. protocol: 'visiting',
  44358. fn: function (aNode){
  44359. var self=this;
  44360. return self;
  44361. },
  44362. args: ["aNode"],
  44363. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  44364. referencedClasses: [],
  44365. messageSends: []
  44366. }),
  44367. $globals.ASTInterpreter);
  44368. $core.addMethod(
  44369. $core.method({
  44370. selector: "visitReturnNode:",
  44371. protocol: 'visiting',
  44372. fn: function (aNode){
  44373. var self=this;
  44374. return $core.withContext(function($ctx1) {
  44375. self["@returned"]=true;
  44376. self._returnValue_(self._pop());
  44377. return self;
  44378. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44379. },
  44380. args: ["aNode"],
  44381. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  44382. referencedClasses: [],
  44383. messageSends: ["returnValue:", "pop"]
  44384. }),
  44385. $globals.ASTInterpreter);
  44386. $core.addMethod(
  44387. $core.method({
  44388. selector: "visitSendNode:",
  44389. protocol: 'visiting',
  44390. fn: function (aNode){
  44391. var self=this;
  44392. var receiver,args,message,result;
  44393. return $core.withContext(function($ctx1) {
  44394. var $1;
  44395. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  44396. return $core.withContext(function($ctx2) {
  44397. return self._pop();
  44398. $ctx2.sendIdx["pop"]=1;
  44399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44400. }));
  44401. receiver=self._pop();
  44402. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  44403. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  44404. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  44405. return $core.withContext(function($ctx2) {
  44406. return $recv($recv(aNode)._isLastChild())._not();
  44407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44408. }));
  44409. if($core.assert($1)){
  44410. self._push_(receiver);
  44411. $ctx1.sendIdx["push:"]=1;
  44412. } else {
  44413. self._push_(result);
  44414. };
  44415. return self;
  44416. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  44417. },
  44418. args: ["aNode"],
  44419. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self pop.\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\x09ifTrue: [ self push: receiver ]\x0a\x09\x09ifFalse: [ self push: result ]",
  44420. referencedClasses: [],
  44421. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  44422. }),
  44423. $globals.ASTInterpreter);
  44424. $core.addMethod(
  44425. $core.method({
  44426. selector: "visitSequenceNode:",
  44427. protocol: 'visiting',
  44428. fn: function (aNode){
  44429. var self=this;
  44430. return $core.withContext(function($ctx1) {
  44431. $recv($recv(aNode)._temps())._do_((function(each){
  44432. return $core.withContext(function($ctx2) {
  44433. return $recv(self._context())._defineLocal_(each);
  44434. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44435. }));
  44436. return self;
  44437. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44438. },
  44439. args: ["aNode"],
  44440. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]",
  44441. referencedClasses: [],
  44442. messageSends: ["do:", "temps", "defineLocal:", "context"]
  44443. }),
  44444. $globals.ASTInterpreter);
  44445. $core.addMethod(
  44446. $core.method({
  44447. selector: "visitValueNode:",
  44448. protocol: 'visiting',
  44449. fn: function (aNode){
  44450. var self=this;
  44451. return $core.withContext(function($ctx1) {
  44452. self._push_($recv(aNode)._value());
  44453. return self;
  44454. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44455. },
  44456. args: ["aNode"],
  44457. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  44458. referencedClasses: [],
  44459. messageSends: ["push:", "value"]
  44460. }),
  44461. $globals.ASTInterpreter);
  44462. $core.addMethod(
  44463. $core.method({
  44464. selector: "visitVariableNode:",
  44465. protocol: 'visiting',
  44466. fn: function (aNode){
  44467. var self=this;
  44468. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  44469. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  44470. return $core.withContext(function($ctx1) {
  44471. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  44472. $2=$recv(aNode)._binding();
  44473. $ctx1.sendIdx["binding"]=1;
  44474. $1=$recv($2)._isUnknownVar();
  44475. if($core.assert($1)){
  44476. $5=$recv($Platform())._globals();
  44477. $ctx1.sendIdx["globals"]=1;
  44478. $6=$recv(aNode)._value();
  44479. $ctx1.sendIdx["value"]=1;
  44480. $4=$recv($5)._at_ifAbsent_($6,(function(){
  44481. return $core.withContext(function($ctx2) {
  44482. return self._error_("Unknown variable");
  44483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44484. }));
  44485. $ctx1.sendIdx["at:ifAbsent:"]=1;
  44486. $3=self._push_($4);
  44487. $ctx1.sendIdx["push:"]=1;
  44488. return $3;
  44489. };
  44490. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  44491. if($core.assert($8)){
  44492. $10=self._context();
  44493. $ctx1.sendIdx["context"]=1;
  44494. $9=$recv($10)._receiver();
  44495. $11=$recv(aNode)._value();
  44496. $ctx1.sendIdx["value"]=2;
  44497. $7=$recv($9)._instVarAt_($11);
  44498. } else {
  44499. $12=self._context();
  44500. $13=$recv(aNode)._value();
  44501. $ctx1.sendIdx["value"]=3;
  44502. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  44503. return $core.withContext(function($ctx2) {
  44504. $15=$recv(aNode)._value();
  44505. $ctx2.sendIdx["value"]=4;
  44506. $14=$recv($15)._isCapitalized();
  44507. if($core.assert($14)){
  44508. $16=$recv($Smalltalk())._globals();
  44509. $ctx2.sendIdx["globals"]=2;
  44510. $17=$recv(aNode)._value();
  44511. $ctx2.sendIdx["value"]=5;
  44512. return $recv($16)._at_ifAbsent_($17,(function(){
  44513. return $core.withContext(function($ctx3) {
  44514. return $recv($recv($Platform())._globals())._at_($recv(aNode)._value());
  44515. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  44516. }));
  44517. };
  44518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  44519. }));
  44520. };
  44521. self._push_($7);
  44522. return self;
  44523. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44524. },
  44525. args: ["aNode"],
  44526. 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 ] ] ] ])",
  44527. referencedClasses: ["Platform", "Smalltalk"],
  44528. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  44529. }),
  44530. $globals.ASTInterpreter);
  44531. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  44532. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  44533. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  44534. $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`";
  44535. $core.addMethod(
  44536. $core.method({
  44537. selector: "context",
  44538. protocol: 'accessing',
  44539. fn: function (){
  44540. var self=this;
  44541. var $1;
  44542. $1=self["@context"];
  44543. return $1;
  44544. },
  44545. args: [],
  44546. source: "context\x0a\x09^ context",
  44547. referencedClasses: [],
  44548. messageSends: []
  44549. }),
  44550. $globals.ASTPCNodeVisitor);
  44551. $core.addMethod(
  44552. $core.method({
  44553. selector: "context:",
  44554. protocol: 'accessing',
  44555. fn: function (aContext){
  44556. var self=this;
  44557. self["@context"]=aContext;
  44558. return self;
  44559. },
  44560. args: ["aContext"],
  44561. source: "context: aContext\x0a\x09context := aContext",
  44562. referencedClasses: [],
  44563. messageSends: []
  44564. }),
  44565. $globals.ASTPCNodeVisitor);
  44566. $core.addMethod(
  44567. $core.method({
  44568. selector: "currentNode",
  44569. protocol: 'accessing',
  44570. fn: function (){
  44571. var self=this;
  44572. var $1;
  44573. $1=self["@currentNode"];
  44574. return $1;
  44575. },
  44576. args: [],
  44577. source: "currentNode\x0a\x09^ currentNode",
  44578. referencedClasses: [],
  44579. messageSends: []
  44580. }),
  44581. $globals.ASTPCNodeVisitor);
  44582. $core.addMethod(
  44583. $core.method({
  44584. selector: "increaseIndex",
  44585. protocol: 'accessing',
  44586. fn: function (){
  44587. var self=this;
  44588. return $core.withContext(function($ctx1) {
  44589. self["@index"]=$recv(self._index()).__plus((1));
  44590. return self;
  44591. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)});
  44592. },
  44593. args: [],
  44594. source: "increaseIndex\x0a\x09index := self index + 1",
  44595. referencedClasses: [],
  44596. messageSends: ["+", "index"]
  44597. }),
  44598. $globals.ASTPCNodeVisitor);
  44599. $core.addMethod(
  44600. $core.method({
  44601. selector: "index",
  44602. protocol: 'accessing',
  44603. fn: function (){
  44604. var self=this;
  44605. return $core.withContext(function($ctx1) {
  44606. var $2,$1,$receiver;
  44607. $2=self["@index"];
  44608. if(($receiver = $2) == null || $receiver.isNil){
  44609. self["@index"]=(0);
  44610. $1=self["@index"];
  44611. } else {
  44612. $1=$2;
  44613. };
  44614. return $1;
  44615. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)});
  44616. },
  44617. args: [],
  44618. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  44619. referencedClasses: [],
  44620. messageSends: ["ifNil:"]
  44621. }),
  44622. $globals.ASTPCNodeVisitor);
  44623. $core.addMethod(
  44624. $core.method({
  44625. selector: "selector",
  44626. protocol: 'accessing',
  44627. fn: function (){
  44628. var self=this;
  44629. var $1;
  44630. $1=self["@selector"];
  44631. return $1;
  44632. },
  44633. args: [],
  44634. source: "selector\x0a\x09^ selector",
  44635. referencedClasses: [],
  44636. messageSends: []
  44637. }),
  44638. $globals.ASTPCNodeVisitor);
  44639. $core.addMethod(
  44640. $core.method({
  44641. selector: "selector:",
  44642. protocol: 'accessing',
  44643. fn: function (aString){
  44644. var self=this;
  44645. self["@selector"]=aString;
  44646. return self;
  44647. },
  44648. args: ["aString"],
  44649. source: "selector: aString\x0a\x09selector := aString",
  44650. referencedClasses: [],
  44651. messageSends: []
  44652. }),
  44653. $globals.ASTPCNodeVisitor);
  44654. $core.addMethod(
  44655. $core.method({
  44656. selector: "visitJSStatementNode:",
  44657. protocol: 'visiting',
  44658. fn: function (aNode){
  44659. var self=this;
  44660. self["@currentNode"]=aNode;
  44661. return self;
  44662. },
  44663. args: ["aNode"],
  44664. 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",
  44665. referencedClasses: [],
  44666. messageSends: []
  44667. }),
  44668. $globals.ASTPCNodeVisitor);
  44669. $core.addMethod(
  44670. $core.method({
  44671. selector: "visitSendNode:",
  44672. protocol: 'visiting',
  44673. fn: function (aNode){
  44674. var self=this;
  44675. var sendIndex;
  44676. return $core.withContext(function($ctx1) {
  44677. var $1,$2,$4,$3,$5;
  44678. $1=self._context();
  44679. $2=self._selector();
  44680. $ctx1.sendIdx["selector"]=1;
  44681. sendIndex=$recv($1)._sendIndexAt_($2);
  44682. (
  44683. $ctx1.supercall = true,
  44684. $globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  44685. $ctx1.supercall = false;
  44686. $4=self._selector();
  44687. $ctx1.sendIdx["selector"]=2;
  44688. $3=$recv($4).__eq($recv(aNode)._selector());
  44689. $ctx1.sendIdx["="]=1;
  44690. if($core.assert($3)){
  44691. $5=$recv(self._index()).__eq(sendIndex);
  44692. if($core.assert($5)){
  44693. self["@currentNode"]=aNode;
  44694. self["@currentNode"];
  44695. };
  44696. self._increaseIndex();
  44697. };
  44698. return self;
  44699. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)});
  44700. },
  44701. args: ["aNode"],
  44702. 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 ]",
  44703. referencedClasses: [],
  44704. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  44705. }),
  44706. $globals.ASTPCNodeVisitor);
  44707. $core.addMethod(
  44708. $core.method({
  44709. selector: "isSteppingNode",
  44710. protocol: '*Compiler-Interpreter',
  44711. fn: function (){
  44712. var self=this;
  44713. return true;
  44714. },
  44715. args: [],
  44716. source: "isSteppingNode\x0a\x09^ true",
  44717. referencedClasses: [],
  44718. messageSends: []
  44719. }),
  44720. $globals.AssignmentNode);
  44721. $core.addMethod(
  44722. $core.method({
  44723. selector: "isSteppingNode",
  44724. protocol: '*Compiler-Interpreter',
  44725. fn: function (){
  44726. var self=this;
  44727. return true;
  44728. },
  44729. args: [],
  44730. source: "isSteppingNode\x0a\x09^ true",
  44731. referencedClasses: [],
  44732. messageSends: []
  44733. }),
  44734. $globals.BlockNode);
  44735. $core.addMethod(
  44736. $core.method({
  44737. selector: "isSteppingNode",
  44738. protocol: '*Compiler-Interpreter',
  44739. fn: function (){
  44740. var self=this;
  44741. return true;
  44742. },
  44743. args: [],
  44744. source: "isSteppingNode\x0a\x09^ true",
  44745. referencedClasses: [],
  44746. messageSends: []
  44747. }),
  44748. $globals.DynamicArrayNode);
  44749. $core.addMethod(
  44750. $core.method({
  44751. selector: "isSteppingNode",
  44752. protocol: '*Compiler-Interpreter',
  44753. fn: function (){
  44754. var self=this;
  44755. return true;
  44756. },
  44757. args: [],
  44758. source: "isSteppingNode\x0a\x09^ true",
  44759. referencedClasses: [],
  44760. messageSends: []
  44761. }),
  44762. $globals.DynamicDictionaryNode);
  44763. $core.addMethod(
  44764. $core.method({
  44765. selector: "isSteppingNode",
  44766. protocol: '*Compiler-Interpreter',
  44767. fn: function (){
  44768. var self=this;
  44769. return true;
  44770. },
  44771. args: [],
  44772. source: "isSteppingNode\x0a\x09^ true",
  44773. referencedClasses: [],
  44774. messageSends: []
  44775. }),
  44776. $globals.JSStatementNode);
  44777. $core.addMethod(
  44778. $core.method({
  44779. selector: "isSteppingNode",
  44780. protocol: '*Compiler-Interpreter',
  44781. fn: function (){
  44782. var self=this;
  44783. return false;
  44784. },
  44785. args: [],
  44786. source: "isSteppingNode\x0a\x09^ false",
  44787. referencedClasses: [],
  44788. messageSends: []
  44789. }),
  44790. $globals.Node);
  44791. $core.addMethod(
  44792. $core.method({
  44793. selector: "isSteppingNode",
  44794. protocol: '*Compiler-Interpreter',
  44795. fn: function (){
  44796. var self=this;
  44797. return true;
  44798. },
  44799. args: [],
  44800. source: "isSteppingNode\x0a\x09^ true",
  44801. referencedClasses: [],
  44802. messageSends: []
  44803. }),
  44804. $globals.SendNode);
  44805. });
  44806. define('amber/lang',[
  44807. './helpers', // pre-fetch, dep of ./deploy
  44808. './deploy',
  44809. './parser',
  44810. // --- packages for the Amber reflection begin here ---
  44811. 'amber_core/Platform-ImportExport',
  44812. 'amber_core/Compiler-Exceptions',
  44813. 'amber_core/Compiler-Core',
  44814. 'amber_core/Compiler-AST',
  44815. 'amber_core/Compiler-Semantic',
  44816. 'amber_core/Compiler-IR',
  44817. 'amber_core/Compiler-Inlining',
  44818. 'amber_core/Compiler-Interpreter'
  44819. // --- packages for the Amber reflection end here ---
  44820. ], function (amber) { return amber; });
  44821. 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";
  44822. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  44823. $core.addPackage('SUnit');
  44824. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  44825. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44826. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  44827. $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.";
  44828. $core.addMethod(
  44829. $core.method({
  44830. selector: "result",
  44831. protocol: 'accessing',
  44832. fn: function (){
  44833. var self=this;
  44834. var $1;
  44835. $1=self["@result"];
  44836. return $1;
  44837. },
  44838. args: [],
  44839. source: "result\x0a\x09^ result",
  44840. referencedClasses: [],
  44841. messageSends: []
  44842. }),
  44843. $globals.ResultAnnouncement);
  44844. $core.addMethod(
  44845. $core.method({
  44846. selector: "result:",
  44847. protocol: 'accessing',
  44848. fn: function (aTestResult){
  44849. var self=this;
  44850. self["@result"]=aTestResult;
  44851. return self;
  44852. },
  44853. args: ["aTestResult"],
  44854. source: "result: aTestResult\x0a\x09result := aTestResult",
  44855. referencedClasses: [],
  44856. messageSends: []
  44857. }),
  44858. $globals.ResultAnnouncement);
  44859. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  44860. $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.";
  44861. $core.addMethod(
  44862. $core.method({
  44863. selector: "assert:",
  44864. protocol: 'testing',
  44865. fn: function (aBoolean){
  44866. var self=this;
  44867. return $core.withContext(function($ctx1) {
  44868. self._assert_description_(aBoolean,"Assertion failed");
  44869. return self;
  44870. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  44871. },
  44872. args: ["aBoolean"],
  44873. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  44874. referencedClasses: [],
  44875. messageSends: ["assert:description:"]
  44876. }),
  44877. $globals.TestCase);
  44878. $core.addMethod(
  44879. $core.method({
  44880. selector: "assert:description:",
  44881. protocol: 'testing',
  44882. fn: function (aBoolean,aString){
  44883. var self=this;
  44884. return $core.withContext(function($ctx1) {
  44885. if(!$core.assert(aBoolean)){
  44886. self._signalFailure_(aString);
  44887. };
  44888. return self;
  44889. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  44890. },
  44891. args: ["aBoolean", "aString"],
  44892. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  44893. referencedClasses: [],
  44894. messageSends: ["ifFalse:", "signalFailure:"]
  44895. }),
  44896. $globals.TestCase);
  44897. $core.addMethod(
  44898. $core.method({
  44899. selector: "assert:equals:",
  44900. protocol: 'testing',
  44901. fn: function (actual,expected){
  44902. var self=this;
  44903. return $core.withContext(function($ctx1) {
  44904. var $2,$6,$5,$4,$3,$1;
  44905. $2=$recv(actual).__eq(expected);
  44906. $6=$recv(expected)._printString();
  44907. $ctx1.sendIdx["printString"]=1;
  44908. $5="Expected: ".__comma($6);
  44909. $4=$recv($5).__comma(" but was: ");
  44910. $ctx1.sendIdx[","]=2;
  44911. $3=$recv($4).__comma($recv(actual)._printString());
  44912. $ctx1.sendIdx[","]=1;
  44913. $1=self._assert_description_($2,$3);
  44914. return $1;
  44915. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  44916. },
  44917. args: ["actual", "expected"],
  44918. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  44919. referencedClasses: [],
  44920. messageSends: ["assert:description:", "=", ",", "printString"]
  44921. }),
  44922. $globals.TestCase);
  44923. $core.addMethod(
  44924. $core.method({
  44925. selector: "async:",
  44926. protocol: 'async',
  44927. fn: function (aBlock){
  44928. var self=this;
  44929. var c;
  44930. return $core.withContext(function($ctx1) {
  44931. var $2,$1;
  44932. self._errorIfNotAsync_("#async");
  44933. c=self["@context"];
  44934. $1=(function(){
  44935. return $core.withContext(function($ctx2) {
  44936. $2=self._isAsync();
  44937. if($core.assert($2)){
  44938. return $recv(c)._execute_(aBlock);
  44939. };
  44940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44941. });
  44942. return $1;
  44943. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  44944. },
  44945. args: ["aBlock"],
  44946. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  44947. referencedClasses: [],
  44948. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  44949. }),
  44950. $globals.TestCase);
  44951. $core.addMethod(
  44952. $core.method({
  44953. selector: "context:",
  44954. protocol: 'accessing',
  44955. fn: function (aRunningTestContext){
  44956. var self=this;
  44957. self["@context"]=aRunningTestContext;
  44958. return self;
  44959. },
  44960. args: ["aRunningTestContext"],
  44961. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  44962. referencedClasses: [],
  44963. messageSends: []
  44964. }),
  44965. $globals.TestCase);
  44966. $core.addMethod(
  44967. $core.method({
  44968. selector: "deny:",
  44969. protocol: 'testing',
  44970. fn: function (aBoolean){
  44971. var self=this;
  44972. return $core.withContext(function($ctx1) {
  44973. self._assert_($recv(aBoolean)._not());
  44974. return self;
  44975. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  44976. },
  44977. args: ["aBoolean"],
  44978. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  44979. referencedClasses: [],
  44980. messageSends: ["assert:", "not"]
  44981. }),
  44982. $globals.TestCase);
  44983. $core.addMethod(
  44984. $core.method({
  44985. selector: "errorIfNotAsync:",
  44986. protocol: 'error handling',
  44987. fn: function (aString){
  44988. var self=this;
  44989. return $core.withContext(function($ctx1) {
  44990. var $1;
  44991. $1=self._isAsync();
  44992. if(!$core.assert($1)){
  44993. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  44994. };
  44995. return self;
  44996. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  44997. },
  44998. args: ["aString"],
  44999. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  45000. referencedClasses: [],
  45001. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  45002. }),
  45003. $globals.TestCase);
  45004. $core.addMethod(
  45005. $core.method({
  45006. selector: "finished",
  45007. protocol: 'async',
  45008. fn: function (){
  45009. var self=this;
  45010. return $core.withContext(function($ctx1) {
  45011. self._errorIfNotAsync_("#finished");
  45012. self["@asyncTimeout"]=nil;
  45013. return self;
  45014. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  45015. },
  45016. args: [],
  45017. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  45018. referencedClasses: [],
  45019. messageSends: ["errorIfNotAsync:"]
  45020. }),
  45021. $globals.TestCase);
  45022. $core.addMethod(
  45023. $core.method({
  45024. selector: "isAsync",
  45025. protocol: 'testing',
  45026. fn: function (){
  45027. var self=this;
  45028. return $core.withContext(function($ctx1) {
  45029. var $1;
  45030. $1=$recv(self["@asyncTimeout"])._notNil();
  45031. return $1;
  45032. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  45033. },
  45034. args: [],
  45035. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  45036. referencedClasses: [],
  45037. messageSends: ["notNil"]
  45038. }),
  45039. $globals.TestCase);
  45040. $core.addMethod(
  45041. $core.method({
  45042. selector: "performTest",
  45043. protocol: 'running',
  45044. fn: function (){
  45045. var self=this;
  45046. return $core.withContext(function($ctx1) {
  45047. self["@asyncTimeout"]=nil;
  45048. self._perform_(self._selector());
  45049. return self;
  45050. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  45051. },
  45052. args: [],
  45053. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  45054. referencedClasses: [],
  45055. messageSends: ["perform:", "selector"]
  45056. }),
  45057. $globals.TestCase);
  45058. $core.addMethod(
  45059. $core.method({
  45060. selector: "runCase",
  45061. protocol: 'running',
  45062. fn: function (){
  45063. var self=this;
  45064. function $TestContext(){return $globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)}
  45065. return $core.withContext(function($ctx1) {
  45066. $recv($recv($TestContext())._testCase_(self))._start();
  45067. return self;
  45068. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  45069. },
  45070. args: [],
  45071. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  45072. referencedClasses: ["TestContext"],
  45073. messageSends: ["start", "testCase:"]
  45074. }),
  45075. $globals.TestCase);
  45076. $core.addMethod(
  45077. $core.method({
  45078. selector: "selector",
  45079. protocol: 'accessing',
  45080. fn: function (){
  45081. var self=this;
  45082. var $1;
  45083. $1=self["@testSelector"];
  45084. return $1;
  45085. },
  45086. args: [],
  45087. source: "selector\x0a\x09^ testSelector",
  45088. referencedClasses: [],
  45089. messageSends: []
  45090. }),
  45091. $globals.TestCase);
  45092. $core.addMethod(
  45093. $core.method({
  45094. selector: "setTestSelector:",
  45095. protocol: 'accessing',
  45096. fn: function (aSelector){
  45097. var self=this;
  45098. self["@testSelector"]=aSelector;
  45099. return self;
  45100. },
  45101. args: ["aSelector"],
  45102. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  45103. referencedClasses: [],
  45104. messageSends: []
  45105. }),
  45106. $globals.TestCase);
  45107. $core.addMethod(
  45108. $core.method({
  45109. selector: "setUp",
  45110. protocol: 'running',
  45111. fn: function (){
  45112. var self=this;
  45113. return self;
  45114. },
  45115. args: [],
  45116. source: "setUp",
  45117. referencedClasses: [],
  45118. messageSends: []
  45119. }),
  45120. $globals.TestCase);
  45121. $core.addMethod(
  45122. $core.method({
  45123. selector: "should:",
  45124. protocol: 'testing',
  45125. fn: function (aBlock){
  45126. var self=this;
  45127. return $core.withContext(function($ctx1) {
  45128. self._assert_($recv(aBlock)._value());
  45129. return self;
  45130. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  45131. },
  45132. args: ["aBlock"],
  45133. source: "should: aBlock\x0a\x09self assert: aBlock value",
  45134. referencedClasses: [],
  45135. messageSends: ["assert:", "value"]
  45136. }),
  45137. $globals.TestCase);
  45138. $core.addMethod(
  45139. $core.method({
  45140. selector: "should:raise:",
  45141. protocol: 'testing',
  45142. fn: function (aBlock,anExceptionClass){
  45143. var self=this;
  45144. return $core.withContext(function($ctx1) {
  45145. self._assert_($recv((function(){
  45146. return $core.withContext(function($ctx2) {
  45147. $recv(aBlock)._value();
  45148. return false;
  45149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45150. }))._on_do_(anExceptionClass,(function(ex){
  45151. return true;
  45152. })));
  45153. return self;
  45154. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45155. },
  45156. args: ["aBlock", "anExceptionClass"],
  45157. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  45158. referencedClasses: [],
  45159. messageSends: ["assert:", "on:do:", "value"]
  45160. }),
  45161. $globals.TestCase);
  45162. $core.addMethod(
  45163. $core.method({
  45164. selector: "shouldnt:raise:",
  45165. protocol: 'testing',
  45166. fn: function (aBlock,anExceptionClass){
  45167. var self=this;
  45168. return $core.withContext(function($ctx1) {
  45169. self._assert_($recv((function(){
  45170. return $core.withContext(function($ctx2) {
  45171. $recv(aBlock)._value();
  45172. return true;
  45173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45174. }))._on_do_(anExceptionClass,(function(ex){
  45175. return false;
  45176. })));
  45177. return self;
  45178. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45179. },
  45180. args: ["aBlock", "anExceptionClass"],
  45181. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  45182. referencedClasses: [],
  45183. messageSends: ["assert:", "on:do:", "value"]
  45184. }),
  45185. $globals.TestCase);
  45186. $core.addMethod(
  45187. $core.method({
  45188. selector: "signalFailure:",
  45189. protocol: 'private',
  45190. fn: function (aString){
  45191. var self=this;
  45192. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45193. return $core.withContext(function($ctx1) {
  45194. var $1,$2;
  45195. $1=$recv($TestFailure())._new();
  45196. $recv($1)._messageText_(aString);
  45197. $2=$recv($1)._signal();
  45198. return self;
  45199. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  45200. },
  45201. args: ["aString"],
  45202. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  45203. referencedClasses: ["TestFailure"],
  45204. messageSends: ["messageText:", "new", "signal"]
  45205. }),
  45206. $globals.TestCase);
  45207. $core.addMethod(
  45208. $core.method({
  45209. selector: "tearDown",
  45210. protocol: 'running',
  45211. fn: function (){
  45212. var self=this;
  45213. return self;
  45214. },
  45215. args: [],
  45216. source: "tearDown",
  45217. referencedClasses: [],
  45218. messageSends: []
  45219. }),
  45220. $globals.TestCase);
  45221. $core.addMethod(
  45222. $core.method({
  45223. selector: "timeout:",
  45224. protocol: 'async',
  45225. fn: function (aNumber){
  45226. var self=this;
  45227. return $core.withContext(function($ctx1) {
  45228. var $1,$receiver;
  45229. $1=self["@asyncTimeout"];
  45230. if(($receiver = $1) == null || $receiver.isNil){
  45231. $1;
  45232. } else {
  45233. $recv(self["@asyncTimeout"])._clearTimeout();
  45234. };
  45235. self["@asyncTimeout"]=(0);
  45236. self["@asyncTimeout"]=$recv(self._async_((function(){
  45237. return $core.withContext(function($ctx2) {
  45238. return self._assert_description_(false,"SUnit grace time exhausted");
  45239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45240. })))._valueWithTimeout_(aNumber);
  45241. return self;
  45242. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  45243. },
  45244. args: ["aNumber"],
  45245. 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",
  45246. referencedClasses: [],
  45247. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  45248. }),
  45249. $globals.TestCase);
  45250. $core.addMethod(
  45251. $core.method({
  45252. selector: "allTestSelectors",
  45253. protocol: 'accessing',
  45254. fn: function (){
  45255. var self=this;
  45256. var selectors;
  45257. return $core.withContext(function($ctx1) {
  45258. var $1,$2;
  45259. selectors=self._testSelectors();
  45260. $1=self._shouldInheritSelectors();
  45261. if($core.assert($1)){
  45262. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  45263. };
  45264. $2=selectors;
  45265. return $2;
  45266. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  45267. },
  45268. args: [],
  45269. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  45270. referencedClasses: [],
  45271. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  45272. }),
  45273. $globals.TestCase.klass);
  45274. $core.addMethod(
  45275. $core.method({
  45276. selector: "buildSuite",
  45277. protocol: 'accessing',
  45278. fn: function (){
  45279. var self=this;
  45280. return $core.withContext(function($ctx1) {
  45281. var $1;
  45282. $1=$recv(self._allTestSelectors())._collect_((function(each){
  45283. return $core.withContext(function($ctx2) {
  45284. return self._selector_(each);
  45285. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45286. }));
  45287. return $1;
  45288. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  45289. },
  45290. args: [],
  45291. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  45292. referencedClasses: [],
  45293. messageSends: ["collect:", "allTestSelectors", "selector:"]
  45294. }),
  45295. $globals.TestCase.klass);
  45296. $core.addMethod(
  45297. $core.method({
  45298. selector: "classTag",
  45299. protocol: 'accessing',
  45300. fn: function (){
  45301. var self=this;
  45302. return "test";
  45303. },
  45304. args: [],
  45305. 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'",
  45306. referencedClasses: [],
  45307. messageSends: []
  45308. }),
  45309. $globals.TestCase.klass);
  45310. $core.addMethod(
  45311. $core.method({
  45312. selector: "isAbstract",
  45313. protocol: 'testing',
  45314. fn: function (){
  45315. var self=this;
  45316. return $core.withContext(function($ctx1) {
  45317. var $1;
  45318. $1=$recv(self._name()).__eq("TestCase");
  45319. return $1;
  45320. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  45321. },
  45322. args: [],
  45323. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  45324. referencedClasses: [],
  45325. messageSends: ["=", "name"]
  45326. }),
  45327. $globals.TestCase.klass);
  45328. $core.addMethod(
  45329. $core.method({
  45330. selector: "lookupHierarchyRoot",
  45331. protocol: 'accessing',
  45332. fn: function (){
  45333. var self=this;
  45334. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  45335. return $TestCase();
  45336. },
  45337. args: [],
  45338. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  45339. referencedClasses: ["TestCase"],
  45340. messageSends: []
  45341. }),
  45342. $globals.TestCase.klass);
  45343. $core.addMethod(
  45344. $core.method({
  45345. selector: "selector:",
  45346. protocol: 'accessing',
  45347. fn: function (aSelector){
  45348. var self=this;
  45349. return $core.withContext(function($ctx1) {
  45350. var $2,$3,$1;
  45351. $2=self._new();
  45352. $recv($2)._setTestSelector_(aSelector);
  45353. $3=$recv($2)._yourself();
  45354. $1=$3;
  45355. return $1;
  45356. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  45357. },
  45358. args: ["aSelector"],
  45359. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  45360. referencedClasses: [],
  45361. messageSends: ["setTestSelector:", "new", "yourself"]
  45362. }),
  45363. $globals.TestCase.klass);
  45364. $core.addMethod(
  45365. $core.method({
  45366. selector: "shouldInheritSelectors",
  45367. protocol: 'testing',
  45368. fn: function (){
  45369. var self=this;
  45370. return $core.withContext(function($ctx1) {
  45371. var $1;
  45372. $1=self.__tild_eq(self._lookupHierarchyRoot());
  45373. return $1;
  45374. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  45375. },
  45376. args: [],
  45377. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  45378. referencedClasses: [],
  45379. messageSends: ["~=", "lookupHierarchyRoot"]
  45380. }),
  45381. $globals.TestCase.klass);
  45382. $core.addMethod(
  45383. $core.method({
  45384. selector: "testSelectors",
  45385. protocol: 'accessing',
  45386. fn: function (){
  45387. var self=this;
  45388. return $core.withContext(function($ctx1) {
  45389. var $1;
  45390. $1=$recv($recv(self._methodDictionary())._keys())._select_((function(each){
  45391. return $core.withContext(function($ctx2) {
  45392. return $recv(each)._match_("^test");
  45393. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45394. }));
  45395. return $1;
  45396. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  45397. },
  45398. args: [],
  45399. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  45400. referencedClasses: [],
  45401. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  45402. }),
  45403. $globals.TestCase.klass);
  45404. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  45405. $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).";
  45406. $core.addMethod(
  45407. $core.method({
  45408. selector: "execute:",
  45409. protocol: 'running',
  45410. fn: function (aBlock){
  45411. var self=this;
  45412. var failed;
  45413. return $core.withContext(function($ctx1) {
  45414. var $1,$2;
  45415. $recv(self["@testCase"])._context_(self);
  45416. $ctx1.sendIdx["context:"]=1;
  45417. $recv((function(){
  45418. return $core.withContext(function($ctx2) {
  45419. failed=true;
  45420. failed;
  45421. $recv(aBlock)._value();
  45422. failed=false;
  45423. return failed;
  45424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45425. }))._ensure_((function(){
  45426. return $core.withContext(function($ctx2) {
  45427. $recv(self["@testCase"])._context_(nil);
  45428. $1=$recv(failed)._and_((function(){
  45429. return $core.withContext(function($ctx3) {
  45430. return $recv(self["@testCase"])._isAsync();
  45431. $ctx3.sendIdx["isAsync"]=1;
  45432. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45433. }));
  45434. if($core.assert($1)){
  45435. $recv(self["@testCase"])._finished();
  45436. };
  45437. $2=$recv(self["@testCase"])._isAsync();
  45438. if(!$core.assert($2)){
  45439. return $recv(self["@testCase"])._tearDown();
  45440. };
  45441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45442. }));
  45443. return self;
  45444. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  45445. },
  45446. args: ["aBlock"],
  45447. 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 ] ]",
  45448. referencedClasses: [],
  45449. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  45450. }),
  45451. $globals.TestContext);
  45452. $core.addMethod(
  45453. $core.method({
  45454. selector: "start",
  45455. protocol: 'running',
  45456. fn: function (){
  45457. var self=this;
  45458. return $core.withContext(function($ctx1) {
  45459. self._execute_((function(){
  45460. return $core.withContext(function($ctx2) {
  45461. $recv(self["@testCase"])._setUp();
  45462. return $recv(self["@testCase"])._performTest();
  45463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45464. }));
  45465. return self;
  45466. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  45467. },
  45468. args: [],
  45469. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  45470. referencedClasses: [],
  45471. messageSends: ["execute:", "setUp", "performTest"]
  45472. }),
  45473. $globals.TestContext);
  45474. $core.addMethod(
  45475. $core.method({
  45476. selector: "testCase:",
  45477. protocol: 'accessing',
  45478. fn: function (aTestCase){
  45479. var self=this;
  45480. self["@testCase"]=aTestCase;
  45481. return self;
  45482. },
  45483. args: ["aTestCase"],
  45484. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  45485. referencedClasses: [],
  45486. messageSends: []
  45487. }),
  45488. $globals.TestContext);
  45489. $core.addMethod(
  45490. $core.method({
  45491. selector: "testCase:",
  45492. protocol: 'instance creation',
  45493. fn: function (aTestCase){
  45494. var self=this;
  45495. return $core.withContext(function($ctx1) {
  45496. var $2,$3,$1;
  45497. $2=self._new();
  45498. $recv($2)._testCase_(aTestCase);
  45499. $3=$recv($2)._yourself();
  45500. $1=$3;
  45501. return $1;
  45502. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  45503. },
  45504. args: ["aTestCase"],
  45505. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  45506. referencedClasses: [],
  45507. messageSends: ["testCase:", "new", "yourself"]
  45508. }),
  45509. $globals.TestContext.klass);
  45510. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  45511. $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`.";
  45512. $core.addMethod(
  45513. $core.method({
  45514. selector: "execute:",
  45515. protocol: 'running',
  45516. fn: function (aBlock){
  45517. var self=this;
  45518. return $core.withContext(function($ctx1) {
  45519. var $1;
  45520. $recv((function(){
  45521. return $core.withContext(function($ctx2) {
  45522. return self._withErrorReporting_((function(){
  45523. return $core.withContext(function($ctx3) {
  45524. return (
  45525. $ctx3.supercall = true,
  45526. $globals.ReportingTestContext.superclass.fn.prototype._execute_.apply($recv(self), [aBlock]));
  45527. $ctx3.supercall = false;
  45528. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45529. }));
  45530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45531. }))._ensure_((function(){
  45532. return $core.withContext(function($ctx2) {
  45533. $1=$recv(self["@testCase"])._isAsync();
  45534. if(!$core.assert($1)){
  45535. $recv(self["@result"])._increaseRuns();
  45536. return $recv(self["@finished"])._value();
  45537. };
  45538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45539. }));
  45540. return self;
  45541. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  45542. },
  45543. args: ["aBlock"],
  45544. 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 ] ]",
  45545. referencedClasses: [],
  45546. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  45547. }),
  45548. $globals.ReportingTestContext);
  45549. $core.addMethod(
  45550. $core.method({
  45551. selector: "finished:",
  45552. protocol: 'accessing',
  45553. fn: function (aBlock){
  45554. var self=this;
  45555. self["@finished"]=aBlock;
  45556. return self;
  45557. },
  45558. args: ["aBlock"],
  45559. source: "finished: aBlock\x0a\x09finished := aBlock",
  45560. referencedClasses: [],
  45561. messageSends: []
  45562. }),
  45563. $globals.ReportingTestContext);
  45564. $core.addMethod(
  45565. $core.method({
  45566. selector: "result:",
  45567. protocol: 'accessing',
  45568. fn: function (aTestResult){
  45569. var self=this;
  45570. self["@result"]=aTestResult;
  45571. return self;
  45572. },
  45573. args: ["aTestResult"],
  45574. source: "result: aTestResult\x0a\x09result := aTestResult",
  45575. referencedClasses: [],
  45576. messageSends: []
  45577. }),
  45578. $globals.ReportingTestContext);
  45579. $core.addMethod(
  45580. $core.method({
  45581. selector: "withErrorReporting:",
  45582. protocol: 'private',
  45583. fn: function (aBlock){
  45584. var self=this;
  45585. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45586. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  45587. return $core.withContext(function($ctx1) {
  45588. $recv((function(){
  45589. return $core.withContext(function($ctx2) {
  45590. return $recv(aBlock)._on_do_($TestFailure(),(function(ex){
  45591. return $core.withContext(function($ctx3) {
  45592. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  45593. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  45594. }));
  45595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45596. }))._on_do_($Error(),(function(ex){
  45597. return $core.withContext(function($ctx2) {
  45598. return $recv(self["@result"])._addError_(self["@testCase"]);
  45599. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  45600. }));
  45601. $ctx1.sendIdx["on:do:"]=1;
  45602. return self;
  45603. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  45604. },
  45605. args: ["aBlock"],
  45606. 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 ]",
  45607. referencedClasses: ["TestFailure", "Error"],
  45608. messageSends: ["on:do:", "addFailure:", "addError:"]
  45609. }),
  45610. $globals.ReportingTestContext);
  45611. $core.addMethod(
  45612. $core.method({
  45613. selector: "testCase:result:finished:",
  45614. protocol: 'instance creation',
  45615. fn: function (aTestCase,aTestResult,aBlock){
  45616. var self=this;
  45617. return $core.withContext(function($ctx1) {
  45618. var $2,$3,$1;
  45619. $2=(
  45620. $ctx1.supercall = true,
  45621. $globals.ReportingTestContext.klass.superclass.fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  45622. $ctx1.supercall = false;
  45623. $recv($2)._result_(aTestResult);
  45624. $recv($2)._finished_(aBlock);
  45625. $3=$recv($2)._yourself();
  45626. $1=$3;
  45627. return $1;
  45628. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  45629. },
  45630. args: ["aTestCase", "aTestResult", "aBlock"],
  45631. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  45632. referencedClasses: [],
  45633. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  45634. }),
  45635. $globals.ReportingTestContext.klass);
  45636. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  45637. $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.";
  45638. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  45639. $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";
  45640. $core.addMethod(
  45641. $core.method({
  45642. selector: "addError:",
  45643. protocol: 'accessing',
  45644. fn: function (anError){
  45645. var self=this;
  45646. return $core.withContext(function($ctx1) {
  45647. $recv(self._errors())._add_(anError);
  45648. return self;
  45649. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  45650. },
  45651. args: ["anError"],
  45652. source: "addError: anError\x0a\x09self errors add: anError",
  45653. referencedClasses: [],
  45654. messageSends: ["add:", "errors"]
  45655. }),
  45656. $globals.TestResult);
  45657. $core.addMethod(
  45658. $core.method({
  45659. selector: "addFailure:",
  45660. protocol: 'accessing',
  45661. fn: function (aFailure){
  45662. var self=this;
  45663. return $core.withContext(function($ctx1) {
  45664. $recv(self._failures())._add_(aFailure);
  45665. return self;
  45666. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  45667. },
  45668. args: ["aFailure"],
  45669. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  45670. referencedClasses: [],
  45671. messageSends: ["add:", "failures"]
  45672. }),
  45673. $globals.TestResult);
  45674. $core.addMethod(
  45675. $core.method({
  45676. selector: "errors",
  45677. protocol: 'accessing',
  45678. fn: function (){
  45679. var self=this;
  45680. var $1;
  45681. $1=self["@errors"];
  45682. return $1;
  45683. },
  45684. args: [],
  45685. source: "errors\x0a\x09^ errors",
  45686. referencedClasses: [],
  45687. messageSends: []
  45688. }),
  45689. $globals.TestResult);
  45690. $core.addMethod(
  45691. $core.method({
  45692. selector: "failures",
  45693. protocol: 'accessing',
  45694. fn: function (){
  45695. var self=this;
  45696. var $1;
  45697. $1=self["@failures"];
  45698. return $1;
  45699. },
  45700. args: [],
  45701. source: "failures\x0a\x09^ failures",
  45702. referencedClasses: [],
  45703. messageSends: []
  45704. }),
  45705. $globals.TestResult);
  45706. $core.addMethod(
  45707. $core.method({
  45708. selector: "increaseRuns",
  45709. protocol: 'accessing',
  45710. fn: function (){
  45711. var self=this;
  45712. return $core.withContext(function($ctx1) {
  45713. self["@runs"]=$recv(self["@runs"]).__plus((1));
  45714. return self;
  45715. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  45716. },
  45717. args: [],
  45718. source: "increaseRuns\x0a\x09runs := runs + 1",
  45719. referencedClasses: [],
  45720. messageSends: ["+"]
  45721. }),
  45722. $globals.TestResult);
  45723. $core.addMethod(
  45724. $core.method({
  45725. selector: "initialize",
  45726. protocol: 'initialization',
  45727. fn: function (){
  45728. var self=this;
  45729. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  45730. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  45731. return $core.withContext(function($ctx1) {
  45732. (
  45733. $ctx1.supercall = true,
  45734. $globals.TestResult.superclass.fn.prototype._initialize.apply($recv(self), []));
  45735. $ctx1.supercall = false;
  45736. self["@timestamp"]=$recv($Date())._now();
  45737. self["@runs"]=(0);
  45738. self["@errors"]=$recv($Array())._new();
  45739. $ctx1.sendIdx["new"]=1;
  45740. self["@failures"]=$recv($Array())._new();
  45741. self["@total"]=(0);
  45742. return self;
  45743. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  45744. },
  45745. args: [],
  45746. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  45747. referencedClasses: ["Date", "Array"],
  45748. messageSends: ["initialize", "now", "new"]
  45749. }),
  45750. $globals.TestResult);
  45751. $core.addMethod(
  45752. $core.method({
  45753. selector: "nextRunDo:",
  45754. protocol: 'running',
  45755. fn: function (aBlock){
  45756. var self=this;
  45757. return $core.withContext(function($ctx1) {
  45758. var $3,$2,$1;
  45759. $3=self._runs();
  45760. $ctx1.sendIdx["runs"]=1;
  45761. $2=$recv($3).__eq_eq(self._total());
  45762. if(!$core.assert($2)){
  45763. $1=$recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  45764. };
  45765. return $1;
  45766. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  45767. },
  45768. args: ["aBlock"],
  45769. 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 ]",
  45770. referencedClasses: [],
  45771. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  45772. }),
  45773. $globals.TestResult);
  45774. $core.addMethod(
  45775. $core.method({
  45776. selector: "runCase:",
  45777. protocol: 'running',
  45778. fn: function (aTestCase){
  45779. var self=this;
  45780. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45781. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  45782. return $core.withContext(function($ctx1) {
  45783. $recv((function(){
  45784. return $core.withContext(function($ctx2) {
  45785. return $recv((function(){
  45786. return $core.withContext(function($ctx3) {
  45787. self._increaseRuns();
  45788. return $recv(aTestCase)._runCase();
  45789. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45790. }))._on_do_($TestFailure(),(function(ex){
  45791. return $core.withContext(function($ctx3) {
  45792. return self._addFailure_(aTestCase);
  45793. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  45794. }));
  45795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45796. }))._on_do_($Error(),(function(ex){
  45797. return $core.withContext(function($ctx2) {
  45798. return self._addError_(aTestCase);
  45799. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  45800. }));
  45801. $ctx1.sendIdx["on:do:"]=1;
  45802. return self;
  45803. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  45804. },
  45805. args: ["aTestCase"],
  45806. 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 ]",
  45807. referencedClasses: ["TestFailure", "Error"],
  45808. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  45809. }),
  45810. $globals.TestResult);
  45811. $core.addMethod(
  45812. $core.method({
  45813. selector: "runs",
  45814. protocol: 'accessing',
  45815. fn: function (){
  45816. var self=this;
  45817. var $1;
  45818. $1=self["@runs"];
  45819. return $1;
  45820. },
  45821. args: [],
  45822. source: "runs\x0a\x09^ runs",
  45823. referencedClasses: [],
  45824. messageSends: []
  45825. }),
  45826. $globals.TestResult);
  45827. $core.addMethod(
  45828. $core.method({
  45829. selector: "status",
  45830. protocol: 'accessing',
  45831. fn: function (){
  45832. var self=this;
  45833. return $core.withContext(function($ctx1) {
  45834. var $2,$3,$1;
  45835. $2=$recv(self._errors())._isEmpty();
  45836. $ctx1.sendIdx["isEmpty"]=1;
  45837. if($core.assert($2)){
  45838. $3=$recv(self._failures())._isEmpty();
  45839. if($core.assert($3)){
  45840. $1="success";
  45841. } else {
  45842. $1="failure";
  45843. };
  45844. } else {
  45845. $1="error";
  45846. };
  45847. return $1;
  45848. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  45849. },
  45850. args: [],
  45851. 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' ]",
  45852. referencedClasses: [],
  45853. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
  45854. }),
  45855. $globals.TestResult);
  45856. $core.addMethod(
  45857. $core.method({
  45858. selector: "timestamp",
  45859. protocol: 'accessing',
  45860. fn: function (){
  45861. var self=this;
  45862. var $1;
  45863. $1=self["@timestamp"];
  45864. return $1;
  45865. },
  45866. args: [],
  45867. source: "timestamp\x0a\x09^ timestamp",
  45868. referencedClasses: [],
  45869. messageSends: []
  45870. }),
  45871. $globals.TestResult);
  45872. $core.addMethod(
  45873. $core.method({
  45874. selector: "total",
  45875. protocol: 'accessing',
  45876. fn: function (){
  45877. var self=this;
  45878. var $1;
  45879. $1=self["@total"];
  45880. return $1;
  45881. },
  45882. args: [],
  45883. source: "total\x0a\x09^ total",
  45884. referencedClasses: [],
  45885. messageSends: []
  45886. }),
  45887. $globals.TestResult);
  45888. $core.addMethod(
  45889. $core.method({
  45890. selector: "total:",
  45891. protocol: 'accessing',
  45892. fn: function (aNumber){
  45893. var self=this;
  45894. self["@total"]=aNumber;
  45895. return self;
  45896. },
  45897. args: ["aNumber"],
  45898. source: "total: aNumber\x0a\x09total := aNumber",
  45899. referencedClasses: [],
  45900. messageSends: []
  45901. }),
  45902. $globals.TestResult);
  45903. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  45904. $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`.";
  45905. $core.addMethod(
  45906. $core.method({
  45907. selector: "announcer",
  45908. protocol: 'accessing',
  45909. fn: function (){
  45910. var self=this;
  45911. var $1;
  45912. $1=self["@announcer"];
  45913. return $1;
  45914. },
  45915. args: [],
  45916. source: "announcer\x0a\x09^ announcer",
  45917. referencedClasses: [],
  45918. messageSends: []
  45919. }),
  45920. $globals.TestSuiteRunner);
  45921. $core.addMethod(
  45922. $core.method({
  45923. selector: "contextOf:",
  45924. protocol: 'private',
  45925. fn: function (anInteger){
  45926. var self=this;
  45927. function $ReportingTestContext(){return $globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)}
  45928. return $core.withContext(function($ctx1) {
  45929. var $1;
  45930. $1=$recv($ReportingTestContext())._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  45931. return $core.withContext(function($ctx2) {
  45932. return self._resume();
  45933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45934. }));
  45935. return $1;
  45936. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  45937. },
  45938. args: ["anInteger"],
  45939. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  45940. referencedClasses: ["ReportingTestContext"],
  45941. messageSends: ["testCase:result:finished:", "at:", "resume"]
  45942. }),
  45943. $globals.TestSuiteRunner);
  45944. $core.addMethod(
  45945. $core.method({
  45946. selector: "initialize",
  45947. protocol: 'initialization',
  45948. fn: function (){
  45949. var self=this;
  45950. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  45951. function $TestResult(){return $globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)}
  45952. return $core.withContext(function($ctx1) {
  45953. var $1;
  45954. (
  45955. $ctx1.supercall = true,
  45956. $globals.TestSuiteRunner.superclass.fn.prototype._initialize.apply($recv(self), []));
  45957. $ctx1.supercall = false;
  45958. self["@announcer"]=$recv($Announcer())._new();
  45959. $ctx1.sendIdx["new"]=1;
  45960. self["@result"]=$recv($TestResult())._new();
  45961. self["@runNextTest"]=(function(){
  45962. var runs;
  45963. return $core.withContext(function($ctx2) {
  45964. runs=$recv(self["@result"])._runs();
  45965. runs;
  45966. $1=$recv(runs).__lt($recv(self["@result"])._total());
  45967. if($core.assert($1)){
  45968. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  45969. };
  45970. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  45971. });
  45972. return self;
  45973. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  45974. },
  45975. args: [],
  45976. 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 ] ].",
  45977. referencedClasses: ["Announcer", "TestResult"],
  45978. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  45979. }),
  45980. $globals.TestSuiteRunner);
  45981. $core.addMethod(
  45982. $core.method({
  45983. selector: "result",
  45984. protocol: 'accessing',
  45985. fn: function (){
  45986. var self=this;
  45987. var $1;
  45988. $1=self["@result"];
  45989. return $1;
  45990. },
  45991. args: [],
  45992. source: "result\x0a\x09^ result",
  45993. referencedClasses: [],
  45994. messageSends: []
  45995. }),
  45996. $globals.TestSuiteRunner);
  45997. $core.addMethod(
  45998. $core.method({
  45999. selector: "resume",
  46000. protocol: 'actions',
  46001. fn: function (){
  46002. var self=this;
  46003. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  46004. return $core.withContext(function($ctx1) {
  46005. $recv(self["@runNextTest"])._fork();
  46006. $recv(self["@announcer"])._announce_($recv($recv($ResultAnnouncement())._new())._result_(self["@result"]));
  46007. return self;
  46008. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  46009. },
  46010. args: [],
  46011. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  46012. referencedClasses: ["ResultAnnouncement"],
  46013. messageSends: ["fork", "announce:", "result:", "new"]
  46014. }),
  46015. $globals.TestSuiteRunner);
  46016. $core.addMethod(
  46017. $core.method({
  46018. selector: "run",
  46019. protocol: 'actions',
  46020. fn: function (){
  46021. var self=this;
  46022. return $core.withContext(function($ctx1) {
  46023. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  46024. self._resume();
  46025. return self;
  46026. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  46027. },
  46028. args: [],
  46029. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  46030. referencedClasses: [],
  46031. messageSends: ["total:", "size", "resume"]
  46032. }),
  46033. $globals.TestSuiteRunner);
  46034. $core.addMethod(
  46035. $core.method({
  46036. selector: "suite:",
  46037. protocol: 'accessing',
  46038. fn: function (aCollection){
  46039. var self=this;
  46040. self["@suite"]=aCollection;
  46041. return self;
  46042. },
  46043. args: ["aCollection"],
  46044. source: "suite: aCollection\x0a\x09suite := aCollection",
  46045. referencedClasses: [],
  46046. messageSends: []
  46047. }),
  46048. $globals.TestSuiteRunner);
  46049. $core.addMethod(
  46050. $core.method({
  46051. selector: "new",
  46052. protocol: 'instance creation',
  46053. fn: function (){
  46054. var self=this;
  46055. return $core.withContext(function($ctx1) {
  46056. self._shouldNotImplement();
  46057. return self;
  46058. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  46059. },
  46060. args: [],
  46061. source: "new\x0a\x09self shouldNotImplement",
  46062. referencedClasses: [],
  46063. messageSends: ["shouldNotImplement"]
  46064. }),
  46065. $globals.TestSuiteRunner.klass);
  46066. $core.addMethod(
  46067. $core.method({
  46068. selector: "on:",
  46069. protocol: 'instance creation',
  46070. fn: function (aCollection){
  46071. var self=this;
  46072. return $core.withContext(function($ctx1) {
  46073. var $2,$1;
  46074. $2=(
  46075. $ctx1.supercall = true,
  46076. $globals.TestSuiteRunner.klass.superclass.fn.prototype._new.apply($recv(self), []));
  46077. $ctx1.supercall = false;
  46078. $1=$recv($2)._suite_(aCollection);
  46079. return $1;
  46080. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  46081. },
  46082. args: ["aCollection"],
  46083. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  46084. referencedClasses: [],
  46085. messageSends: ["suite:", "new"]
  46086. }),
  46087. $globals.TestSuiteRunner.klass);
  46088. $core.addMethod(
  46089. $core.method({
  46090. selector: "isTestClass",
  46091. protocol: '*SUnit',
  46092. fn: function (){
  46093. var self=this;
  46094. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  46095. return $core.withContext(function($ctx1) {
  46096. var $1;
  46097. $1=$recv(self._includesBehavior_($TestCase()))._and_((function(){
  46098. return $core.withContext(function($ctx2) {
  46099. return $recv(self._isAbstract())._not();
  46100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46101. }));
  46102. return $1;
  46103. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  46104. },
  46105. args: [],
  46106. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  46107. referencedClasses: ["TestCase"],
  46108. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  46109. }),
  46110. $globals.Behavior);
  46111. $core.addMethod(
  46112. $core.method({
  46113. selector: "isTestPackage",
  46114. protocol: '*SUnit',
  46115. fn: function (){
  46116. var self=this;
  46117. return $core.withContext(function($ctx1) {
  46118. var $1;
  46119. $1=$recv(self._classes())._anySatisfy_((function(each){
  46120. return $core.withContext(function($ctx2) {
  46121. return $recv(each)._isTestClass();
  46122. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46123. }));
  46124. return $1;
  46125. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  46126. },
  46127. args: [],
  46128. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  46129. referencedClasses: [],
  46130. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  46131. }),
  46132. $globals.Package);
  46133. });
  46134. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  46135. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  46136. $core.addPackage('Compiler-Tests');
  46137. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  46138. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46139. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  46140. $core.addMethod(
  46141. $core.method({
  46142. selector: "analyze:forClass:",
  46143. protocol: 'convenience',
  46144. fn: function (aNode,aClass){
  46145. var self=this;
  46146. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  46147. return $core.withContext(function($ctx1) {
  46148. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  46149. return aNode;
  46150. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  46151. },
  46152. args: ["aNode", "aClass"],
  46153. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46154. referencedClasses: ["SemanticAnalyzer"],
  46155. messageSends: ["visit:", "on:"]
  46156. }),
  46157. $globals.ASTParsingTest);
  46158. $core.addMethod(
  46159. $core.method({
  46160. selector: "parse:",
  46161. protocol: 'parsing',
  46162. fn: function (aString){
  46163. var self=this;
  46164. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46165. return $core.withContext(function($ctx1) {
  46166. var $1;
  46167. $1=$recv($Smalltalk())._parse_(aString);
  46168. return $1;
  46169. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  46170. },
  46171. args: ["aString"],
  46172. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46173. referencedClasses: ["Smalltalk"],
  46174. messageSends: ["parse:"]
  46175. }),
  46176. $globals.ASTParsingTest);
  46177. $core.addMethod(
  46178. $core.method({
  46179. selector: "parse:forClass:",
  46180. protocol: 'parsing',
  46181. fn: function (aString,aClass){
  46182. var self=this;
  46183. return $core.withContext(function($ctx1) {
  46184. var $1;
  46185. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  46186. return $1;
  46187. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  46188. },
  46189. args: ["aString", "aClass"],
  46190. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46191. referencedClasses: [],
  46192. messageSends: ["analyze:forClass:", "parse:"]
  46193. }),
  46194. $globals.ASTParsingTest);
  46195. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  46196. $core.addMethod(
  46197. $core.method({
  46198. selector: "astPCNodeVisitor",
  46199. protocol: 'factory',
  46200. fn: function (){
  46201. var self=this;
  46202. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  46203. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  46204. return $core.withContext(function($ctx1) {
  46205. var $2,$3,$4,$5,$1;
  46206. $2=$recv($ASTPCNodeVisitor())._new();
  46207. $ctx1.sendIdx["new"]=1;
  46208. $3=$2;
  46209. $4=$recv($recv($AIContext())._new())._yourself();
  46210. $ctx1.sendIdx["yourself"]=1;
  46211. $recv($3)._context_($4);
  46212. $5=$recv($2)._yourself();
  46213. $1=$5;
  46214. return $1;
  46215. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  46216. },
  46217. args: [],
  46218. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  46219. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  46220. messageSends: ["context:", "new", "yourself"]
  46221. }),
  46222. $globals.ASTPCNodeVisitorTest);
  46223. $core.addMethod(
  46224. $core.method({
  46225. selector: "astPCNodeVisitorForSelector:",
  46226. protocol: 'factory',
  46227. fn: function (aString){
  46228. var self=this;
  46229. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  46230. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  46231. return $core.withContext(function($ctx1) {
  46232. var $2,$3,$4,$5,$1;
  46233. $2=$recv($ASTPCNodeVisitor())._new();
  46234. $ctx1.sendIdx["new"]=1;
  46235. $recv($2)._selector_(aString);
  46236. $3=$2;
  46237. $4=$recv($recv($AIContext())._new())._yourself();
  46238. $ctx1.sendIdx["yourself"]=1;
  46239. $recv($3)._context_($4);
  46240. $5=$recv($2)._yourself();
  46241. $1=$5;
  46242. return $1;
  46243. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  46244. },
  46245. args: ["aString"],
  46246. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  46247. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  46248. messageSends: ["selector:", "new", "context:", "yourself"]
  46249. }),
  46250. $globals.ASTPCNodeVisitorTest);
  46251. $core.addMethod(
  46252. $core.method({
  46253. selector: "testJSStatementNode",
  46254. protocol: 'tests',
  46255. fn: function (){
  46256. var self=this;
  46257. var ast,visitor;
  46258. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46259. return $core.withContext(function($ctx1) {
  46260. var $1,$2;
  46261. ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
  46262. $1=self._astPCNodeVisitor();
  46263. $recv($1)._visit_(ast);
  46264. $2=$recv($1)._currentNode();
  46265. self._assert_($recv($2)._isJSStatementNode());
  46266. return self;
  46267. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46268. },
  46269. args: [],
  46270. 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",
  46271. referencedClasses: ["Object"],
  46272. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46273. }),
  46274. $globals.ASTPCNodeVisitorTest);
  46275. $core.addMethod(
  46276. $core.method({
  46277. selector: "testMessageSend",
  46278. protocol: 'tests',
  46279. fn: function (){
  46280. var self=this;
  46281. var ast;
  46282. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46283. return $core.withContext(function($ctx1) {
  46284. var $1,$2;
  46285. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
  46286. $1=self._astPCNodeVisitorForSelector_("yourself");
  46287. $recv($1)._visit_(ast);
  46288. $2=$recv($1)._currentNode();
  46289. self._assert_equals_($recv($2)._selector(),"yourself");
  46290. return self;
  46291. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46292. },
  46293. args: [],
  46294. 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'",
  46295. referencedClasses: ["Object"],
  46296. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46297. }),
  46298. $globals.ASTPCNodeVisitorTest);
  46299. $core.addMethod(
  46300. $core.method({
  46301. selector: "testMessageSendWithBlocks",
  46302. protocol: 'tests',
  46303. fn: function (){
  46304. var self=this;
  46305. var ast;
  46306. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46307. return $core.withContext(function($ctx1) {
  46308. var $1,$2;
  46309. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object());
  46310. $1=self._astPCNodeVisitorForSelector_("yourself");
  46311. $recv($1)._visit_(ast);
  46312. $2=$recv($1)._currentNode();
  46313. self._assert_equals_($recv($2)._selector(),"yourself");
  46314. return self;
  46315. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46316. },
  46317. args: [],
  46318. 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'",
  46319. referencedClasses: ["Object"],
  46320. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46321. }),
  46322. $globals.ASTPCNodeVisitorTest);
  46323. $core.addMethod(
  46324. $core.method({
  46325. selector: "testMessageSendWithInlining",
  46326. protocol: 'tests',
  46327. fn: function (){
  46328. var self=this;
  46329. var ast;
  46330. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46331. return $core.withContext(function($ctx1) {
  46332. var $3,$4,$2,$1,$5,$6;
  46333. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  46334. $ctx1.sendIdx["parse:forClass:"]=1;
  46335. $3=self._astPCNodeVisitorForSelector_("yourself");
  46336. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  46337. $recv($3)._visit_(ast);
  46338. $ctx1.sendIdx["visit:"]=1;
  46339. $4=$recv($3)._currentNode();
  46340. $ctx1.sendIdx["currentNode"]=1;
  46341. $2=$4;
  46342. $1=$recv($2)._selector();
  46343. $ctx1.sendIdx["selector"]=1;
  46344. self._assert_equals_($1,"yourself");
  46345. $ctx1.sendIdx["assert:equals:"]=1;
  46346. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  46347. $5=self._astPCNodeVisitorForSelector_("asBoolean");
  46348. $recv($5)._visit_(ast);
  46349. $6=$recv($5)._currentNode();
  46350. self._assert_equals_($recv($6)._selector(),"asBoolean");
  46351. return self;
  46352. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46353. },
  46354. args: [],
  46355. 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'",
  46356. referencedClasses: ["Object"],
  46357. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46358. }),
  46359. $globals.ASTPCNodeVisitorTest);
  46360. $core.addMethod(
  46361. $core.method({
  46362. selector: "testNoMessageSend",
  46363. protocol: 'tests',
  46364. fn: function (){
  46365. var self=this;
  46366. var ast;
  46367. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46368. return $core.withContext(function($ctx1) {
  46369. var $1,$2;
  46370. ast=self._parse_forClass_("foo ^ self",$Object());
  46371. $1=self._astPCNodeVisitor();
  46372. $recv($1)._visit_(ast);
  46373. $2=$recv($1)._currentNode();
  46374. self._assert_($recv($2)._isNil());
  46375. return self;
  46376. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46377. },
  46378. args: [],
  46379. 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",
  46380. referencedClasses: ["Object"],
  46381. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  46382. }),
  46383. $globals.ASTPCNodeVisitorTest);
  46384. $core.addMethod(
  46385. $core.method({
  46386. selector: "testPC",
  46387. protocol: 'tests',
  46388. fn: function (){
  46389. var self=this;
  46390. var ast,visitor;
  46391. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46392. return $core.withContext(function($ctx1) {
  46393. var $1,$2;
  46394. ast=self._parse_forClass_("foo <console.log(1)>",$Object());
  46395. $1=self._astPCNodeVisitor();
  46396. $recv($1)._visit_(ast);
  46397. $2=$recv($1)._currentNode();
  46398. self._assert_($recv($2)._isJSStatementNode());
  46399. return self;
  46400. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46401. },
  46402. args: [],
  46403. 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",
  46404. referencedClasses: ["Object"],
  46405. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46406. }),
  46407. $globals.ASTPCNodeVisitorTest);
  46408. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  46409. $core.addMethod(
  46410. $core.method({
  46411. selector: "testNodeAtPosition",
  46412. protocol: 'tests',
  46413. fn: function (){
  46414. var self=this;
  46415. var node;
  46416. return $core.withContext(function($ctx1) {
  46417. var $3,$4,$2,$1,$7,$8,$6,$5;
  46418. node=self._parse_("yourself\x0a\x09^ self");
  46419. $ctx1.sendIdx["parse:"]=1;
  46420. $3=node;
  46421. $4=(2).__at((4));
  46422. $ctx1.sendIdx["@"]=1;
  46423. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  46424. return nil;
  46425. }));
  46426. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  46427. $1=$recv($2)._source();
  46428. self._assert_equals_($1,"self");
  46429. $ctx1.sendIdx["assert:equals:"]=1;
  46430. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  46431. $ctx1.sendIdx["parse:"]=2;
  46432. $7=node;
  46433. $8=(2).__at((7));
  46434. $ctx1.sendIdx["@"]=2;
  46435. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  46436. return nil;
  46437. }));
  46438. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  46439. $5=$recv($6)._selector();
  46440. $ctx1.sendIdx["selector"]=1;
  46441. self._assert_equals_($5,"ifTrue:");
  46442. $ctx1.sendIdx["assert:equals:"]=2;
  46443. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  46444. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  46445. return nil;
  46446. })))._selector(),"foo");
  46447. return self;
  46448. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  46449. },
  46450. args: [],
  46451. 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'",
  46452. referencedClasses: [],
  46453. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  46454. }),
  46455. $globals.ASTPositionTest);
  46456. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  46457. $core.addMethod(
  46458. $core.method({
  46459. selector: "codeGeneratorClass",
  46460. protocol: 'accessing',
  46461. fn: function (){
  46462. var self=this;
  46463. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  46464. return $CodeGenerator();
  46465. },
  46466. args: [],
  46467. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  46468. referencedClasses: ["CodeGenerator"],
  46469. messageSends: []
  46470. }),
  46471. $globals.CodeGeneratorTest);
  46472. $core.addMethod(
  46473. $core.method({
  46474. selector: "compiler",
  46475. protocol: 'factory',
  46476. fn: function (){
  46477. var self=this;
  46478. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  46479. return $core.withContext(function($ctx1) {
  46480. var $2,$3,$1;
  46481. $2=$recv($Compiler())._new();
  46482. $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
  46483. $3=$recv($2)._yourself();
  46484. $1=$3;
  46485. return $1;
  46486. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  46487. },
  46488. args: [],
  46489. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  46490. referencedClasses: ["Compiler"],
  46491. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  46492. }),
  46493. $globals.CodeGeneratorTest);
  46494. $core.addMethod(
  46495. $core.method({
  46496. selector: "setUp",
  46497. protocol: 'initialization',
  46498. fn: function (){
  46499. var self=this;
  46500. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  46501. return $core.withContext(function($ctx1) {
  46502. self["@receiver"]=$recv($DoIt())._new();
  46503. return self;
  46504. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  46505. },
  46506. args: [],
  46507. source: "setUp\x0a\x09receiver := DoIt new",
  46508. referencedClasses: ["DoIt"],
  46509. messageSends: ["new"]
  46510. }),
  46511. $globals.CodeGeneratorTest);
  46512. $core.addMethod(
  46513. $core.method({
  46514. selector: "should:receiver:return:",
  46515. protocol: 'testing',
  46516. fn: function (aString,anObject,aResult){
  46517. var self=this;
  46518. var method,result;
  46519. return $core.withContext(function($ctx1) {
  46520. var $1,$2;
  46521. self["@receiver"]=anObject;
  46522. $1=self._compiler();
  46523. $2=$recv(anObject)._class();
  46524. $ctx1.sendIdx["class"]=1;
  46525. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  46526. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  46527. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  46528. self._assert_equals_(aResult,result);
  46529. return self;
  46530. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  46531. },
  46532. args: ["aString", "anObject", "aResult"],
  46533. 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",
  46534. referencedClasses: [],
  46535. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  46536. }),
  46537. $globals.CodeGeneratorTest);
  46538. $core.addMethod(
  46539. $core.method({
  46540. selector: "should:return:",
  46541. protocol: 'testing',
  46542. fn: function (aString,anObject){
  46543. var self=this;
  46544. return $core.withContext(function($ctx1) {
  46545. var $1;
  46546. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  46547. return $1;
  46548. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  46549. },
  46550. args: ["aString", "anObject"],
  46551. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  46552. referencedClasses: [],
  46553. messageSends: ["should:receiver:return:"]
  46554. }),
  46555. $globals.CodeGeneratorTest);
  46556. $core.addMethod(
  46557. $core.method({
  46558. selector: "tearDown",
  46559. protocol: 'initialization',
  46560. fn: function (){
  46561. var self=this;
  46562. return self;
  46563. },
  46564. args: [],
  46565. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  46566. referencedClasses: [],
  46567. messageSends: []
  46568. }),
  46569. $globals.CodeGeneratorTest);
  46570. $core.addMethod(
  46571. $core.method({
  46572. selector: "testAssignment",
  46573. protocol: 'tests',
  46574. fn: function (){
  46575. var self=this;
  46576. return $core.withContext(function($ctx1) {
  46577. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  46578. $ctx1.sendIdx["should:return:"]=1;
  46579. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  46580. $ctx1.sendIdx["should:return:"]=2;
  46581. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  46582. return self;
  46583. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  46584. },
  46585. args: [],
  46586. 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",
  46587. referencedClasses: [],
  46588. messageSends: ["should:return:"]
  46589. }),
  46590. $globals.CodeGeneratorTest);
  46591. $core.addMethod(
  46592. $core.method({
  46593. selector: "testBackslashSelectors",
  46594. protocol: 'tests',
  46595. fn: function (){
  46596. var self=this;
  46597. return $core.withContext(function($ctx1) {
  46598. self._should_return_("\x5c arg ^ 4",(4));
  46599. $ctx1.sendIdx["should:return:"]=1;
  46600. self._should_return_("\x5c\x5c arg ^ 42",(42));
  46601. return self;
  46602. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  46603. },
  46604. args: [],
  46605. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  46606. referencedClasses: [],
  46607. messageSends: ["should:return:"]
  46608. }),
  46609. $globals.CodeGeneratorTest);
  46610. $core.addMethod(
  46611. $core.method({
  46612. selector: "testBlockReturn",
  46613. protocol: 'tests',
  46614. fn: function (){
  46615. var self=this;
  46616. return $core.withContext(function($ctx1) {
  46617. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  46618. $ctx1.sendIdx["should:return:"]=1;
  46619. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  46620. $ctx1.sendIdx["should:return:"]=2;
  46621. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  46622. return self;
  46623. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  46624. },
  46625. args: [],
  46626. 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).",
  46627. referencedClasses: [],
  46628. messageSends: ["should:return:"]
  46629. }),
  46630. $globals.CodeGeneratorTest);
  46631. $core.addMethod(
  46632. $core.method({
  46633. selector: "testCascades",
  46634. protocol: 'tests',
  46635. fn: function (){
  46636. var self=this;
  46637. return $core.withContext(function($ctx1) {
  46638. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  46639. return self;
  46640. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  46641. },
  46642. args: [],
  46643. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  46644. referencedClasses: [],
  46645. messageSends: ["should:return:"]
  46646. }),
  46647. $globals.CodeGeneratorTest);
  46648. $core.addMethod(
  46649. $core.method({
  46650. selector: "testCascadesWithInlining",
  46651. protocol: 'tests',
  46652. fn: function (){
  46653. var self=this;
  46654. return $core.withContext(function($ctx1) {
  46655. self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  46656. $ctx1.sendIdx["should:return:"]=1;
  46657. self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  46658. return self;
  46659. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  46660. },
  46661. args: [],
  46662. source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2",
  46663. referencedClasses: [],
  46664. messageSends: ["should:return:"]
  46665. }),
  46666. $globals.CodeGeneratorTest);
  46667. $core.addMethod(
  46668. $core.method({
  46669. selector: "testDynamicArrayElementsOrdered",
  46670. protocol: 'tests',
  46671. fn: function (){
  46672. var self=this;
  46673. return $core.withContext(function($ctx1) {
  46674. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  46675. $ctx1.sendIdx["should:return:"]=1;
  46676. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  46677. return self;
  46678. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  46679. },
  46680. args: [],
  46681. 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).",
  46682. referencedClasses: [],
  46683. messageSends: ["should:return:"]
  46684. }),
  46685. $globals.CodeGeneratorTest);
  46686. $core.addMethod(
  46687. $core.method({
  46688. selector: "testDynamicDictionaryElementsOrdered",
  46689. protocol: 'tests',
  46690. fn: function (){
  46691. var self=this;
  46692. return $core.withContext(function($ctx1) {
  46693. 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)]));
  46694. return self;
  46695. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  46696. },
  46697. args: [],
  46698. 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}.",
  46699. referencedClasses: [],
  46700. messageSends: ["should:return:"]
  46701. }),
  46702. $globals.CodeGeneratorTest);
  46703. $core.addMethod(
  46704. $core.method({
  46705. selector: "testDynamicDictionaryWithMoreArrows",
  46706. protocol: 'tests',
  46707. fn: function (){
  46708. var self=this;
  46709. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  46710. return $core.withContext(function($ctx1) {
  46711. var $2,$1;
  46712. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  46713. $ctx1.sendIdx["->"]=1;
  46714. $1=$recv($HashedCollection())._with_($2);
  46715. self._should_return_("foo ^ #{1->2->3}",$1);
  46716. return self;
  46717. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  46718. },
  46719. args: [],
  46720. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  46721. referencedClasses: ["HashedCollection"],
  46722. messageSends: ["should:return:", "with:", "->"]
  46723. }),
  46724. $globals.CodeGeneratorTest);
  46725. $core.addMethod(
  46726. $core.method({
  46727. selector: "testGlobalVar",
  46728. protocol: 'tests',
  46729. fn: function (){
  46730. var self=this;
  46731. function $BlockClosure(){return $globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
  46732. return $core.withContext(function($ctx1) {
  46733. self._should_return_("foo ^ eval class",$BlockClosure());
  46734. $ctx1.sendIdx["should:return:"]=1;
  46735. self._should_return_("foo ^ Math cos: 0",(1));
  46736. $ctx1.sendIdx["should:return:"]=2;
  46737. self._should_return_("foo ^ NonExistingVar",nil);
  46738. return self;
  46739. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  46740. },
  46741. args: [],
  46742. 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",
  46743. referencedClasses: ["BlockClosure"],
  46744. messageSends: ["should:return:"]
  46745. }),
  46746. $globals.CodeGeneratorTest);
  46747. $core.addMethod(
  46748. $core.method({
  46749. selector: "testInnerTemporalDependentElementsOrdered",
  46750. protocol: 'tests',
  46751. fn: function (){
  46752. var self=this;
  46753. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  46754. return $core.withContext(function($ctx1) {
  46755. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  46756. $2="foo".__minus_gt($Array());
  46757. $ctx1.sendIdx["->"]=1;
  46758. $3="bar".__minus_gt((2));
  46759. $ctx1.sendIdx["->"]=2;
  46760. $1=[$2,$3];
  46761. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  46762. $ctx1.sendIdx["should:return:"]=1;
  46763. $5="foo".__minus_gt($Array());
  46764. $ctx1.sendIdx["->"]=3;
  46765. $6="bar".__minus_gt((2));
  46766. $ctx1.sendIdx["->"]=4;
  46767. $4=[$5,$6];
  46768. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  46769. $ctx1.sendIdx["should:return:"]=2;
  46770. $8="foo".__minus_gt((1));
  46771. $ctx1.sendIdx["->"]=5;
  46772. $9="bar".__minus_gt((2));
  46773. $ctx1.sendIdx["->"]=6;
  46774. $7=[$8,$9];
  46775. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  46776. $ctx1.sendIdx["should:return:"]=3;
  46777. $11="foo".__minus_gt((1));
  46778. $ctx1.sendIdx["->"]=7;
  46779. $10=[$11,"bar".__minus_gt((2))];
  46780. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  46781. $ctx1.sendIdx["should:return:"]=4;
  46782. 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)]));
  46783. return self;
  46784. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  46785. },
  46786. args: [],
  46787. 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}.",
  46788. referencedClasses: ["Array"],
  46789. messageSends: ["should:return:", "->"]
  46790. }),
  46791. $globals.CodeGeneratorTest);
  46792. $core.addMethod(
  46793. $core.method({
  46794. selector: "testJSStatement",
  46795. protocol: 'tests',
  46796. fn: function (){
  46797. var self=this;
  46798. return $core.withContext(function($ctx1) {
  46799. self._should_return_("foo <return 2+3>",(5));
  46800. return self;
  46801. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  46802. },
  46803. args: [],
  46804. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  46805. referencedClasses: [],
  46806. messageSends: ["should:return:"]
  46807. }),
  46808. $globals.CodeGeneratorTest);
  46809. $core.addMethod(
  46810. $core.method({
  46811. selector: "testLexicalScope",
  46812. protocol: 'tests',
  46813. fn: function (){
  46814. var self=this;
  46815. return $core.withContext(function($ctx1) {
  46816. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  46817. return self;
  46818. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  46819. },
  46820. args: [],
  46821. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  46822. referencedClasses: [],
  46823. messageSends: ["should:return:"]
  46824. }),
  46825. $globals.CodeGeneratorTest);
  46826. $core.addMethod(
  46827. $core.method({
  46828. selector: "testLiterals",
  46829. protocol: 'tests',
  46830. fn: function (){
  46831. var self=this;
  46832. return $core.withContext(function($ctx1) {
  46833. self._should_return_("foo ^ 1",(1));
  46834. $ctx1.sendIdx["should:return:"]=1;
  46835. self._should_return_("foo ^ 'hello'","hello");
  46836. $ctx1.sendIdx["should:return:"]=2;
  46837. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  46838. $ctx1.sendIdx["should:return:"]=3;
  46839. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  46840. $ctx1.sendIdx["should:return:"]=4;
  46841. self._should_return_("foo ^ true",true);
  46842. $ctx1.sendIdx["should:return:"]=5;
  46843. self._should_return_("foo ^ false",false);
  46844. $ctx1.sendIdx["should:return:"]=6;
  46845. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  46846. $ctx1.sendIdx["should:return:"]=7;
  46847. self._should_return_("foo ^ #hello","hello");
  46848. $ctx1.sendIdx["should:return:"]=8;
  46849. self._should_return_("foo ^ $h","h");
  46850. $ctx1.sendIdx["should:return:"]=9;
  46851. self._should_return_("foo ^ -123.456",(-123.456));
  46852. $ctx1.sendIdx["should:return:"]=10;
  46853. self._should_return_("foo ^ -2.5e4",(-25000));
  46854. return self;
  46855. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  46856. },
  46857. args: [],
  46858. 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.",
  46859. referencedClasses: [],
  46860. messageSends: ["should:return:"]
  46861. }),
  46862. $globals.CodeGeneratorTest);
  46863. $core.addMethod(
  46864. $core.method({
  46865. selector: "testLocalReturn",
  46866. protocol: 'tests',
  46867. fn: function (){
  46868. var self=this;
  46869. return $core.withContext(function($ctx1) {
  46870. self._should_return_("foo ^ 1",(1));
  46871. $ctx1.sendIdx["should:return:"]=1;
  46872. self._should_return_("foo ^ 1 + 1",(2));
  46873. $ctx1.sendIdx["should:return:"]=2;
  46874. self._should_return_("foo ",self["@receiver"]);
  46875. $ctx1.sendIdx["should:return:"]=3;
  46876. self._should_return_("foo self asString",self["@receiver"]);
  46877. $ctx1.sendIdx["should:return:"]=4;
  46878. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  46879. return self;
  46880. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  46881. },
  46882. args: [],
  46883. 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",
  46884. referencedClasses: [],
  46885. messageSends: ["should:return:"]
  46886. }),
  46887. $globals.CodeGeneratorTest);
  46888. $core.addMethod(
  46889. $core.method({
  46890. selector: "testMessageSends",
  46891. protocol: 'tests',
  46892. fn: function (){
  46893. var self=this;
  46894. return $core.withContext(function($ctx1) {
  46895. self._should_return_("foo ^ 1 asString","1");
  46896. $ctx1.sendIdx["should:return:"]=1;
  46897. self._should_return_("foo ^ 1 + 1",(2));
  46898. $ctx1.sendIdx["should:return:"]=2;
  46899. self._should_return_("foo ^ 1 + 2 * 3",(9));
  46900. $ctx1.sendIdx["should:return:"]=3;
  46901. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  46902. $ctx1.sendIdx["should:return:"]=4;
  46903. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  46904. return self;
  46905. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  46906. },
  46907. args: [],
  46908. 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)",
  46909. referencedClasses: [],
  46910. messageSends: ["should:return:"]
  46911. }),
  46912. $globals.CodeGeneratorTest);
  46913. $core.addMethod(
  46914. $core.method({
  46915. selector: "testMultipleSequences",
  46916. protocol: 'tests',
  46917. fn: function (){
  46918. var self=this;
  46919. return $core.withContext(function($ctx1) {
  46920. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  46921. return self;
  46922. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  46923. },
  46924. args: [],
  46925. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  46926. referencedClasses: [],
  46927. messageSends: ["should:return:"]
  46928. }),
  46929. $globals.CodeGeneratorTest);
  46930. $core.addMethod(
  46931. $core.method({
  46932. selector: "testMutableLiterals",
  46933. protocol: 'tests',
  46934. fn: function (){
  46935. var self=this;
  46936. return $core.withContext(function($ctx1) {
  46937. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  46938. return self;
  46939. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  46940. },
  46941. args: [],
  46942. source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://github.com/amber-smalltalk/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)",
  46943. referencedClasses: [],
  46944. messageSends: ["should:return:"]
  46945. }),
  46946. $globals.CodeGeneratorTest);
  46947. $core.addMethod(
  46948. $core.method({
  46949. selector: "testNestedIfTrue",
  46950. protocol: 'tests',
  46951. fn: function (){
  46952. var self=this;
  46953. return $core.withContext(function($ctx1) {
  46954. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  46955. $ctx1.sendIdx["should:return:"]=1;
  46956. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  46957. $ctx1.sendIdx["should:return:"]=2;
  46958. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  46959. $ctx1.sendIdx["should:return:"]=3;
  46960. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  46961. return self;
  46962. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  46963. },
  46964. args: [],
  46965. 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.",
  46966. referencedClasses: [],
  46967. messageSends: ["should:return:"]
  46968. }),
  46969. $globals.CodeGeneratorTest);
  46970. $core.addMethod(
  46971. $core.method({
  46972. selector: "testNestedSends",
  46973. protocol: 'tests',
  46974. fn: function (){
  46975. var self=this;
  46976. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  46977. return $core.withContext(function($ctx1) {
  46978. self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($Point())._x_y_((2).__at((3)),(4)))._asString());
  46979. return self;
  46980. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  46981. },
  46982. args: [],
  46983. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  46984. referencedClasses: ["Point"],
  46985. messageSends: ["should:return:", "asString", "x:y:", "@"]
  46986. }),
  46987. $globals.CodeGeneratorTest);
  46988. $core.addMethod(
  46989. $core.method({
  46990. selector: "testNonLocalReturn",
  46991. protocol: 'tests',
  46992. fn: function (){
  46993. var self=this;
  46994. return $core.withContext(function($ctx1) {
  46995. self._should_return_("foo [ ^ 1 ] value",(1));
  46996. $ctx1.sendIdx["should:return:"]=1;
  46997. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  46998. $ctx1.sendIdx["should:return:"]=2;
  46999. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  47000. $ctx1.sendIdx["should:return:"]=3;
  47001. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  47002. return self;
  47003. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  47004. },
  47005. args: [],
  47006. 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",
  47007. referencedClasses: [],
  47008. messageSends: ["should:return:"]
  47009. }),
  47010. $globals.CodeGeneratorTest);
  47011. $core.addMethod(
  47012. $core.method({
  47013. selector: "testPascalCaseGlobal",
  47014. protocol: 'tests',
  47015. fn: function (){
  47016. var self=this;
  47017. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47018. return $core.withContext(function($ctx1) {
  47019. self._should_return_("foo ^Object",$recv($recv($Smalltalk())._globals())._at_("Object"));
  47020. $ctx1.sendIdx["should:return:"]=1;
  47021. self._should_return_("foo ^NonExistent",nil);
  47022. return self;
  47023. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  47024. },
  47025. args: [],
  47026. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  47027. referencedClasses: ["Smalltalk"],
  47028. messageSends: ["should:return:", "at:", "globals"]
  47029. }),
  47030. $globals.CodeGeneratorTest);
  47031. $core.addMethod(
  47032. $core.method({
  47033. selector: "testSendReceiverAndArgumentsOrdered",
  47034. protocol: 'tests',
  47035. fn: function (){
  47036. var self=this;
  47037. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  47038. return $core.withContext(function($ctx1) {
  47039. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  47040. $ctx1.sendIdx["should:return:"]=1;
  47041. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
  47042. return self;
  47043. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  47044. },
  47045. args: [],
  47046. 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}.",
  47047. referencedClasses: ["Array"],
  47048. messageSends: ["should:return:"]
  47049. }),
  47050. $globals.CodeGeneratorTest);
  47051. $core.addMethod(
  47052. $core.method({
  47053. selector: "testSuperSend",
  47054. protocol: 'tests',
  47055. fn: function (){
  47056. var self=this;
  47057. return $core.withContext(function($ctx1) {
  47058. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  47059. return self;
  47060. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  47061. },
  47062. args: [],
  47063. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  47064. referencedClasses: [],
  47065. messageSends: ["should:receiver:return:"]
  47066. }),
  47067. $globals.CodeGeneratorTest);
  47068. $core.addMethod(
  47069. $core.method({
  47070. selector: "testTempVariables",
  47071. protocol: 'tests',
  47072. fn: function (){
  47073. var self=this;
  47074. return $core.withContext(function($ctx1) {
  47075. self._should_return_("foo | a | ^ a",nil);
  47076. $ctx1.sendIdx["should:return:"]=1;
  47077. self._should_return_("foo | AVariable | ^ AVariable",nil);
  47078. $ctx1.sendIdx["should:return:"]=2;
  47079. self._should_return_("foo | a b c | ^ c",nil);
  47080. $ctx1.sendIdx["should:return:"]=3;
  47081. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  47082. $ctx1.sendIdx["should:return:"]=4;
  47083. self._should_return_("foo | a | a:= 1. ^ a",(1));
  47084. $ctx1.sendIdx["should:return:"]=5;
  47085. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  47086. return self;
  47087. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  47088. },
  47089. args: [],
  47090. 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.",
  47091. referencedClasses: [],
  47092. messageSends: ["should:return:"]
  47093. }),
  47094. $globals.CodeGeneratorTest);
  47095. $core.addMethod(
  47096. $core.method({
  47097. selector: "testThisContext",
  47098. protocol: 'tests',
  47099. fn: function (){
  47100. var self=this;
  47101. return $core.withContext(function($ctx1) {
  47102. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  47103. return self;
  47104. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  47105. },
  47106. args: [],
  47107. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  47108. referencedClasses: [],
  47109. messageSends: ["should:return:"]
  47110. }),
  47111. $globals.CodeGeneratorTest);
  47112. $core.addMethod(
  47113. $core.method({
  47114. selector: "testifFalse",
  47115. protocol: 'tests',
  47116. fn: function (){
  47117. var self=this;
  47118. return $core.withContext(function($ctx1) {
  47119. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  47120. $ctx1.sendIdx["should:return:"]=1;
  47121. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  47122. $ctx1.sendIdx["should:return:"]=2;
  47123. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  47124. $ctx1.sendIdx["should:return:"]=3;
  47125. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  47126. return self;
  47127. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  47128. },
  47129. args: [],
  47130. 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.",
  47131. referencedClasses: [],
  47132. messageSends: ["should:return:"]
  47133. }),
  47134. $globals.CodeGeneratorTest);
  47135. $core.addMethod(
  47136. $core.method({
  47137. selector: "testifFalseIfTrue",
  47138. protocol: 'tests',
  47139. fn: function (){
  47140. var self=this;
  47141. return $core.withContext(function($ctx1) {
  47142. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  47143. $ctx1.sendIdx["should:return:"]=1;
  47144. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  47145. $ctx1.sendIdx["should:return:"]=2;
  47146. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  47147. $ctx1.sendIdx["should:return:"]=3;
  47148. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  47149. return self;
  47150. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  47151. },
  47152. args: [],
  47153. 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.",
  47154. referencedClasses: [],
  47155. messageSends: ["should:return:"]
  47156. }),
  47157. $globals.CodeGeneratorTest);
  47158. $core.addMethod(
  47159. $core.method({
  47160. selector: "testifNil",
  47161. protocol: 'tests',
  47162. fn: function (){
  47163. var self=this;
  47164. return $core.withContext(function($ctx1) {
  47165. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  47166. $ctx1.sendIdx["should:return:"]=1;
  47167. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  47168. $ctx1.sendIdx["should:return:"]=2;
  47169. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  47170. $ctx1.sendIdx["should:return:"]=3;
  47171. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  47172. return self;
  47173. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  47174. },
  47175. args: [],
  47176. 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.",
  47177. referencedClasses: [],
  47178. messageSends: ["should:return:"]
  47179. }),
  47180. $globals.CodeGeneratorTest);
  47181. $core.addMethod(
  47182. $core.method({
  47183. selector: "testifNilIfNotNil",
  47184. protocol: 'tests',
  47185. fn: function (){
  47186. var self=this;
  47187. return $core.withContext(function($ctx1) {
  47188. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  47189. $ctx1.sendIdx["should:return:"]=1;
  47190. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  47191. $ctx1.sendIdx["should:return:"]=2;
  47192. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  47193. $ctx1.sendIdx["should:return:"]=3;
  47194. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  47195. return self;
  47196. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  47197. },
  47198. args: [],
  47199. 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.",
  47200. referencedClasses: [],
  47201. messageSends: ["should:return:"]
  47202. }),
  47203. $globals.CodeGeneratorTest);
  47204. $core.addMethod(
  47205. $core.method({
  47206. selector: "testifNotNil",
  47207. protocol: 'tests',
  47208. fn: function (){
  47209. var self=this;
  47210. return $core.withContext(function($ctx1) {
  47211. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  47212. $ctx1.sendIdx["should:return:"]=1;
  47213. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  47214. $ctx1.sendIdx["should:return:"]=2;
  47215. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  47216. $ctx1.sendIdx["should:return:"]=3;
  47217. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  47218. return self;
  47219. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  47220. },
  47221. args: [],
  47222. 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.",
  47223. referencedClasses: [],
  47224. messageSends: ["should:return:"]
  47225. }),
  47226. $globals.CodeGeneratorTest);
  47227. $core.addMethod(
  47228. $core.method({
  47229. selector: "testifNotNilWithArgument",
  47230. protocol: 'tests',
  47231. fn: function (){
  47232. var self=this;
  47233. return $core.withContext(function($ctx1) {
  47234. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  47235. $ctx1.sendIdx["should:return:"]=1;
  47236. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  47237. $ctx1.sendIdx["should:return:"]=2;
  47238. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  47239. $ctx1.sendIdx["should:return:"]=3;
  47240. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  47241. $ctx1.sendIdx["should:return:"]=4;
  47242. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  47243. $ctx1.sendIdx["should:return:"]=5;
  47244. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  47245. return self;
  47246. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  47247. },
  47248. args: [],
  47249. 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",
  47250. referencedClasses: [],
  47251. messageSends: ["should:return:"]
  47252. }),
  47253. $globals.CodeGeneratorTest);
  47254. $core.addMethod(
  47255. $core.method({
  47256. selector: "testifTrue",
  47257. protocol: 'tests',
  47258. fn: function (){
  47259. var self=this;
  47260. return $core.withContext(function($ctx1) {
  47261. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  47262. $ctx1.sendIdx["should:return:"]=1;
  47263. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  47264. $ctx1.sendIdx["should:return:"]=2;
  47265. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  47266. $ctx1.sendIdx["should:return:"]=3;
  47267. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  47268. return self;
  47269. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  47270. },
  47271. args: [],
  47272. 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.",
  47273. referencedClasses: [],
  47274. messageSends: ["should:return:"]
  47275. }),
  47276. $globals.CodeGeneratorTest);
  47277. $core.addMethod(
  47278. $core.method({
  47279. selector: "testifTrueIfFalse",
  47280. protocol: 'tests',
  47281. fn: function (){
  47282. var self=this;
  47283. return $core.withContext(function($ctx1) {
  47284. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  47285. $ctx1.sendIdx["should:return:"]=1;
  47286. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  47287. $ctx1.sendIdx["should:return:"]=2;
  47288. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  47289. $ctx1.sendIdx["should:return:"]=3;
  47290. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  47291. return self;
  47292. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  47293. },
  47294. args: [],
  47295. 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.",
  47296. referencedClasses: [],
  47297. messageSends: ["should:return:"]
  47298. }),
  47299. $globals.CodeGeneratorTest);
  47300. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  47301. $core.addMethod(
  47302. $core.method({
  47303. selector: "analyze:forClass:",
  47304. protocol: 'parsing',
  47305. fn: function (aNode,aClass){
  47306. var self=this;
  47307. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47308. return $core.withContext(function($ctx1) {
  47309. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  47310. return aNode;
  47311. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  47312. },
  47313. args: ["aNode", "aClass"],
  47314. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  47315. referencedClasses: ["SemanticAnalyzer"],
  47316. messageSends: ["visit:", "on:"]
  47317. }),
  47318. $globals.ASTInterpreterTest);
  47319. $core.addMethod(
  47320. $core.method({
  47321. selector: "interpret:receiver:withArguments:",
  47322. protocol: 'private',
  47323. fn: function (aString,anObject,aDictionary){
  47324. var self=this;
  47325. var ctx,ast,interpreter;
  47326. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  47327. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  47328. return $core.withContext(function($ctx1) {
  47329. var $1,$2,$3,$5,$6,$4,$receiver;
  47330. interpreter=$recv($ASTInterpreter())._new();
  47331. $ctx1.sendIdx["new"]=1;
  47332. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  47333. $1=$recv($AIContext())._new();
  47334. $recv($1)._receiver_(anObject);
  47335. $recv($1)._interpreter_(interpreter);
  47336. $2=$recv($1)._yourself();
  47337. ctx=$2;
  47338. $3=$recv(ast)._sequenceNode();
  47339. if(($receiver = $3) == null || $receiver.isNil){
  47340. $3;
  47341. } else {
  47342. var sequence;
  47343. sequence=$receiver;
  47344. $recv($recv(sequence)._temps())._do_((function(each){
  47345. return $core.withContext(function($ctx2) {
  47346. return $recv(ctx)._defineLocal_(each);
  47347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47348. }));
  47349. };
  47350. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  47351. return $core.withContext(function($ctx2) {
  47352. return $recv(ctx)._localAt_put_(key,value);
  47353. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47354. }));
  47355. $5=interpreter;
  47356. $recv($5)._context_(ctx);
  47357. $recv($5)._interpret_($recv(ast)._nextChild());
  47358. $recv($5)._proceed();
  47359. $6=$recv($5)._result();
  47360. $4=$6;
  47361. return $4;
  47362. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  47363. },
  47364. args: ["aString", "anObject", "aDictionary"],
  47365. 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\x09interpret: ast nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  47366. referencedClasses: ["ASTInterpreter", "AIContext"],
  47367. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"]
  47368. }),
  47369. $globals.ASTInterpreterTest);
  47370. $core.addMethod(
  47371. $core.method({
  47372. selector: "parse:",
  47373. protocol: 'parsing',
  47374. fn: function (aString){
  47375. var self=this;
  47376. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47377. return $core.withContext(function($ctx1) {
  47378. var $1;
  47379. $1=$recv($Smalltalk())._parse_(aString);
  47380. return $1;
  47381. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  47382. },
  47383. args: ["aString"],
  47384. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  47385. referencedClasses: ["Smalltalk"],
  47386. messageSends: ["parse:"]
  47387. }),
  47388. $globals.ASTInterpreterTest);
  47389. $core.addMethod(
  47390. $core.method({
  47391. selector: "parse:forClass:",
  47392. protocol: 'parsing',
  47393. fn: function (aString,aClass){
  47394. var self=this;
  47395. return $core.withContext(function($ctx1) {
  47396. var $1;
  47397. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  47398. return $1;
  47399. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  47400. },
  47401. args: ["aString", "aClass"],
  47402. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  47403. referencedClasses: [],
  47404. messageSends: ["analyze:forClass:", "parse:"]
  47405. }),
  47406. $globals.ASTInterpreterTest);
  47407. $core.addMethod(
  47408. $core.method({
  47409. selector: "should:receiver:return:",
  47410. protocol: 'testing',
  47411. fn: function (aString,anObject,aResult){
  47412. var self=this;
  47413. return $core.withContext(function($ctx1) {
  47414. var $1;
  47415. self["@receiver"]=anObject;
  47416. $1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  47417. return $1;
  47418. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  47419. },
  47420. args: ["aString", "anObject", "aResult"],
  47421. 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",
  47422. referencedClasses: [],
  47423. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  47424. }),
  47425. $globals.ASTInterpreterTest);
  47426. $core.addMethod(
  47427. $core.method({
  47428. selector: "should:return:",
  47429. protocol: 'testing',
  47430. fn: function (aString,anObject){
  47431. var self=this;
  47432. return $core.withContext(function($ctx1) {
  47433. var $1;
  47434. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  47435. return $1;
  47436. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.ASTInterpreterTest)});
  47437. },
  47438. args: ["aString", "anObject"],
  47439. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject",
  47440. referencedClasses: [],
  47441. messageSends: ["should:receiver:return:"]
  47442. }),
  47443. $globals.ASTInterpreterTest);
  47444. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  47445. $core.addMethod(
  47446. $core.method({
  47447. selector: "interpret:receiver:withArguments:",
  47448. protocol: 'private',
  47449. fn: function (aString,anObject,aDictionary){
  47450. var self=this;
  47451. var ctx,ast,debugger_;
  47452. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  47453. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  47454. function $ASTDebugger(){return $globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
  47455. return $core.withContext(function($ctx1) {
  47456. var $1,$2,$3,$4,$6,$7,$5,$receiver;
  47457. $1=$recv($AIContext())._new();
  47458. $ctx1.sendIdx["new"]=1;
  47459. $recv($1)._receiver_(anObject);
  47460. $recv($1)._interpreter_($recv($ASTInterpreter())._new());
  47461. $2=$recv($1)._yourself();
  47462. ctx=$2;
  47463. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  47464. $3=$recv(ast)._sequenceNode();
  47465. if(($receiver = $3) == null || $receiver.isNil){
  47466. $3;
  47467. } else {
  47468. var sequence;
  47469. sequence=$receiver;
  47470. $recv($recv(sequence)._temps())._do_((function(each){
  47471. return $core.withContext(function($ctx2) {
  47472. return $recv(ctx)._defineLocal_(each);
  47473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47474. }));
  47475. };
  47476. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  47477. return $core.withContext(function($ctx2) {
  47478. return $recv(ctx)._localAt_put_(key,value);
  47479. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47480. }));
  47481. $4=$recv(ctx)._interpreter();
  47482. $ctx1.sendIdx["interpreter"]=1;
  47483. $recv($4)._context_(ctx);
  47484. $ctx1.sendIdx["context:"]=1;
  47485. $recv($recv(ctx)._interpreter())._node_($recv(ast)._nextChild());
  47486. debugger_=$recv($ASTDebugger())._context_(ctx);
  47487. $6=debugger_;
  47488. $recv($6)._proceed();
  47489. $7=$recv($6)._result();
  47490. $5=$7;
  47491. return $5;
  47492. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  47493. },
  47494. args: ["aString", "anObject", "aDictionary"],
  47495. 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 nextChild.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result",
  47496. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  47497. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"]
  47498. }),
  47499. $globals.ASTDebuggerTest);
  47500. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  47501. $core.addMethod(
  47502. $core.method({
  47503. selector: "codeGeneratorClass",
  47504. protocol: 'accessing',
  47505. fn: function (){
  47506. var self=this;
  47507. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  47508. return $InliningCodeGenerator();
  47509. },
  47510. args: [],
  47511. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  47512. referencedClasses: ["InliningCodeGenerator"],
  47513. messageSends: []
  47514. }),
  47515. $globals.InliningCodeGeneratorTest);
  47516. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  47517. $core.addMethod(
  47518. $core.method({
  47519. selector: "testClassRefVar",
  47520. protocol: 'tests',
  47521. fn: function (){
  47522. var self=this;
  47523. var node;
  47524. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47525. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47526. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47527. return $core.withContext(function($ctx1) {
  47528. var $1,$2,$3,$4;
  47529. $1=$recv($VariableNode())._new();
  47530. $ctx1.sendIdx["new"]=1;
  47531. $recv($1)._value_("Object");
  47532. $2=$recv($1)._yourself();
  47533. node=$2;
  47534. $3=$recv($SemanticAnalyzer())._new();
  47535. $ctx1.sendIdx["new"]=2;
  47536. $recv($3)._pushScope_($recv($MethodLexicalScope())._new());
  47537. $4=$recv($3)._visit_(node);
  47538. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  47539. return self;
  47540. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  47541. },
  47542. args: [],
  47543. 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",
  47544. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  47545. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  47546. }),
  47547. $globals.ScopeVarTest);
  47548. $core.addMethod(
  47549. $core.method({
  47550. selector: "testInstanceVar",
  47551. protocol: 'tests',
  47552. fn: function (){
  47553. var self=this;
  47554. var node,scope;
  47555. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47556. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47557. return $core.withContext(function($ctx1) {
  47558. var $1,$2;
  47559. $1=$recv($VariableNode())._new();
  47560. $ctx1.sendIdx["new"]=1;
  47561. $recv($1)._value_("bzzz");
  47562. $2=$recv($1)._yourself();
  47563. node=$2;
  47564. scope=$recv($MethodLexicalScope())._new();
  47565. $recv(scope)._addIVar_("bzzz");
  47566. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  47567. return self;
  47568. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  47569. },
  47570. args: [],
  47571. 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",
  47572. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47573. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  47574. }),
  47575. $globals.ScopeVarTest);
  47576. $core.addMethod(
  47577. $core.method({
  47578. selector: "testPseudoVar",
  47579. protocol: 'tests',
  47580. fn: function (){
  47581. var self=this;
  47582. var node,pseudoVars;
  47583. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47584. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47585. return $core.withContext(function($ctx1) {
  47586. var $1,$2;
  47587. pseudoVars=["self", "super", "true", "false", "nil"];
  47588. $recv(pseudoVars)._do_((function(each){
  47589. return $core.withContext(function($ctx2) {
  47590. $1=$recv($VariableNode())._new();
  47591. $ctx2.sendIdx["new"]=1;
  47592. $recv($1)._value_(each);
  47593. $2=$recv($1)._yourself();
  47594. node=$2;
  47595. node;
  47596. return self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
  47597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47598. }));
  47599. return self;
  47600. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  47601. },
  47602. args: [],
  47603. 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]",
  47604. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47605. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  47606. }),
  47607. $globals.ScopeVarTest);
  47608. $core.addMethod(
  47609. $core.method({
  47610. selector: "testTempVar",
  47611. protocol: 'tests',
  47612. fn: function (){
  47613. var self=this;
  47614. var node,scope;
  47615. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47616. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47617. return $core.withContext(function($ctx1) {
  47618. var $1,$2;
  47619. $1=$recv($VariableNode())._new();
  47620. $ctx1.sendIdx["new"]=1;
  47621. $recv($1)._value_("bzzz");
  47622. $2=$recv($1)._yourself();
  47623. node=$2;
  47624. scope=$recv($MethodLexicalScope())._new();
  47625. $recv(scope)._addTemp_("bzzz");
  47626. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  47627. return self;
  47628. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  47629. },
  47630. args: [],
  47631. 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",
  47632. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47633. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  47634. }),
  47635. $globals.ScopeVarTest);
  47636. $core.addMethod(
  47637. $core.method({
  47638. selector: "testUnknownVar",
  47639. protocol: 'tests',
  47640. fn: function (){
  47641. var self=this;
  47642. var node;
  47643. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47644. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47645. return $core.withContext(function($ctx1) {
  47646. var $1,$2;
  47647. $1=$recv($VariableNode())._new();
  47648. $ctx1.sendIdx["new"]=1;
  47649. $recv($1)._value_("bzzz");
  47650. $2=$recv($1)._yourself();
  47651. node=$2;
  47652. self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
  47653. return self;
  47654. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  47655. },
  47656. args: [],
  47657. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  47658. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47659. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  47660. }),
  47661. $globals.ScopeVarTest);
  47662. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  47663. $core.addMethod(
  47664. $core.method({
  47665. selector: "setUp",
  47666. protocol: 'running',
  47667. fn: function (){
  47668. var self=this;
  47669. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47670. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  47671. return $core.withContext(function($ctx1) {
  47672. self["@analyzer"]=$recv($SemanticAnalyzer())._on_($Object());
  47673. return self;
  47674. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  47675. },
  47676. args: [],
  47677. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  47678. referencedClasses: ["SemanticAnalyzer", "Object"],
  47679. messageSends: ["on:"]
  47680. }),
  47681. $globals.SemanticAnalyzerTest);
  47682. $core.addMethod(
  47683. $core.method({
  47684. selector: "testAssignment",
  47685. protocol: 'tests',
  47686. fn: function (){
  47687. var self=this;
  47688. var src,ast;
  47689. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47690. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  47691. return $core.withContext(function($ctx1) {
  47692. src="foo self := 1";
  47693. ast=$recv($Smalltalk())._parse_(src);
  47694. self._should_raise_((function(){
  47695. return $core.withContext(function($ctx2) {
  47696. return $recv(self["@analyzer"])._visit_(ast);
  47697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47698. }),$InvalidAssignmentError());
  47699. return self;
  47700. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47701. },
  47702. args: [],
  47703. 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",
  47704. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  47705. messageSends: ["parse:", "should:raise:", "visit:"]
  47706. }),
  47707. $globals.SemanticAnalyzerTest);
  47708. $core.addMethod(
  47709. $core.method({
  47710. selector: "testNonLocalReturn",
  47711. protocol: 'tests',
  47712. fn: function (){
  47713. var self=this;
  47714. var src,ast;
  47715. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47716. return $core.withContext(function($ctx1) {
  47717. src="foo | a | a + 1. ^ a";
  47718. ast=$recv($Smalltalk())._parse_(src);
  47719. $recv(self["@analyzer"])._visit_(ast);
  47720. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  47721. return self;
  47722. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47723. },
  47724. args: [],
  47725. 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",
  47726. referencedClasses: ["Smalltalk"],
  47727. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  47728. }),
  47729. $globals.SemanticAnalyzerTest);
  47730. $core.addMethod(
  47731. $core.method({
  47732. selector: "testNonLocalReturn2",
  47733. protocol: 'tests',
  47734. fn: function (){
  47735. var self=this;
  47736. var src,ast;
  47737. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47738. return $core.withContext(function($ctx1) {
  47739. src="foo | a | a + 1. [ [ ^ a] ]";
  47740. ast=$recv($Smalltalk())._parse_(src);
  47741. $recv(self["@analyzer"])._visit_(ast);
  47742. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  47743. return self;
  47744. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47745. },
  47746. args: [],
  47747. 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",
  47748. referencedClasses: ["Smalltalk"],
  47749. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  47750. }),
  47751. $globals.SemanticAnalyzerTest);
  47752. $core.addMethod(
  47753. $core.method({
  47754. selector: "testScope",
  47755. protocol: 'tests',
  47756. fn: function (){
  47757. var self=this;
  47758. var src,ast;
  47759. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47760. return $core.withContext(function($ctx1) {
  47761. var $4,$3,$2,$1;
  47762. src="foo | a | a + 1. [ | b | b := a ]";
  47763. ast=$recv($Smalltalk())._parse_(src);
  47764. $recv(self["@analyzer"])._visit_(ast);
  47765. $4=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47766. $ctx1.sendIdx["nodes"]=1;
  47767. $3=$recv($4)._last();
  47768. $2=$recv($3)._scope();
  47769. $ctx1.sendIdx["scope"]=1;
  47770. $1=$recv($2).__eq_eq($recv(ast)._scope());
  47771. self._deny_($1);
  47772. return self;
  47773. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47774. },
  47775. args: [],
  47776. 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.",
  47777. referencedClasses: ["Smalltalk"],
  47778. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  47779. }),
  47780. $globals.SemanticAnalyzerTest);
  47781. $core.addMethod(
  47782. $core.method({
  47783. selector: "testScope2",
  47784. protocol: 'tests',
  47785. fn: function (){
  47786. var self=this;
  47787. var src,ast;
  47788. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47789. return $core.withContext(function($ctx1) {
  47790. var $8,$7,$6,$5,$4,$3,$2,$1;
  47791. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  47792. ast=$recv($Smalltalk())._parse_(src);
  47793. $recv(self["@analyzer"])._visit_(ast);
  47794. $8=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47795. $ctx1.sendIdx["nodes"]=3;
  47796. $7=$recv($8)._last();
  47797. $6=$recv($7)._nodes();
  47798. $ctx1.sendIdx["nodes"]=2;
  47799. $5=$recv($6)._first();
  47800. $ctx1.sendIdx["first"]=2;
  47801. $4=$recv($5)._nodes();
  47802. $ctx1.sendIdx["nodes"]=1;
  47803. $3=$recv($4)._first();
  47804. $ctx1.sendIdx["first"]=1;
  47805. $2=$recv($3)._scope();
  47806. $ctx1.sendIdx["scope"]=1;
  47807. $1=$recv($2).__eq_eq($recv(ast)._scope());
  47808. self._deny_($1);
  47809. return self;
  47810. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47811. },
  47812. args: [],
  47813. 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.",
  47814. referencedClasses: ["Smalltalk"],
  47815. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  47816. }),
  47817. $globals.SemanticAnalyzerTest);
  47818. $core.addMethod(
  47819. $core.method({
  47820. selector: "testScopeLevel",
  47821. protocol: 'tests',
  47822. fn: function (){
  47823. var self=this;
  47824. var src,ast;
  47825. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47826. return $core.withContext(function($ctx1) {
  47827. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  47828. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  47829. ast=$recv($Smalltalk())._parse_(src);
  47830. $recv(self["@analyzer"])._visit_(ast);
  47831. $2=$recv(ast)._scope();
  47832. $ctx1.sendIdx["scope"]=1;
  47833. $1=$recv($2)._scopeLevel();
  47834. $ctx1.sendIdx["scopeLevel"]=1;
  47835. self._assert_equals_($1,(1));
  47836. $ctx1.sendIdx["assert:equals:"]=1;
  47837. $10=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47838. $ctx1.sendIdx["nodes"]=3;
  47839. $9=$recv($10)._last();
  47840. $8=$recv($9)._nodes();
  47841. $ctx1.sendIdx["nodes"]=2;
  47842. $7=$recv($8)._first();
  47843. $ctx1.sendIdx["first"]=2;
  47844. $6=$recv($7)._nodes();
  47845. $ctx1.sendIdx["nodes"]=1;
  47846. $5=$recv($6)._first();
  47847. $ctx1.sendIdx["first"]=1;
  47848. $4=$recv($5)._scope();
  47849. $3=$recv($4)._scopeLevel();
  47850. self._assert_equals_($3,(3));
  47851. return self;
  47852. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47853. },
  47854. args: [],
  47855. 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",
  47856. referencedClasses: ["Smalltalk"],
  47857. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  47858. }),
  47859. $globals.SemanticAnalyzerTest);
  47860. $core.addMethod(
  47861. $core.method({
  47862. selector: "testUnknownVariables",
  47863. protocol: 'tests',
  47864. fn: function (){
  47865. var self=this;
  47866. var src,ast;
  47867. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47868. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  47869. return $core.withContext(function($ctx1) {
  47870. src="foo | a | b + a";
  47871. ast=$recv($Smalltalk())._parse_(src);
  47872. self._should_raise_((function(){
  47873. return $core.withContext(function($ctx2) {
  47874. return $recv(self["@analyzer"])._visit_(ast);
  47875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47876. }),$UnknownVariableError());
  47877. return self;
  47878. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47879. },
  47880. args: [],
  47881. 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",
  47882. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47883. messageSends: ["parse:", "should:raise:", "visit:"]
  47884. }),
  47885. $globals.SemanticAnalyzerTest);
  47886. $core.addMethod(
  47887. $core.method({
  47888. selector: "testUnknownVariablesWithScope",
  47889. protocol: 'tests',
  47890. fn: function (){
  47891. var self=this;
  47892. var src,ast;
  47893. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47894. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  47895. return $core.withContext(function($ctx1) {
  47896. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  47897. ast=$recv($Smalltalk())._parse_(src);
  47898. self._should_raise_((function(){
  47899. return $core.withContext(function($ctx2) {
  47900. return $recv(self["@analyzer"])._visit_(ast);
  47901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47902. }),$UnknownVariableError());
  47903. return self;
  47904. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47905. },
  47906. args: [],
  47907. 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",
  47908. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47909. messageSends: ["parse:", "should:raise:", "visit:"]
  47910. }),
  47911. $globals.SemanticAnalyzerTest);
  47912. $core.addMethod(
  47913. $core.method({
  47914. selector: "testVariableShadowing",
  47915. protocol: 'tests',
  47916. fn: function (){
  47917. var self=this;
  47918. var src,ast;
  47919. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47920. return $core.withContext(function($ctx1) {
  47921. src="foo | a | a + 1";
  47922. ast=$recv($Smalltalk())._parse_(src);
  47923. $recv(self["@analyzer"])._visit_(ast);
  47924. return self;
  47925. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47926. },
  47927. args: [],
  47928. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47929. referencedClasses: ["Smalltalk"],
  47930. messageSends: ["parse:", "visit:"]
  47931. }),
  47932. $globals.SemanticAnalyzerTest);
  47933. $core.addMethod(
  47934. $core.method({
  47935. selector: "testVariableShadowing2",
  47936. protocol: 'tests',
  47937. fn: function (){
  47938. var self=this;
  47939. var src,ast;
  47940. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47941. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  47942. return $core.withContext(function($ctx1) {
  47943. src="foo | a | a + 1. [ | a | a := 2 ]";
  47944. ast=$recv($Smalltalk())._parse_(src);
  47945. self._should_raise_((function(){
  47946. return $core.withContext(function($ctx2) {
  47947. return $recv(self["@analyzer"])._visit_(ast);
  47948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47949. }),$ShadowingVariableError());
  47950. return self;
  47951. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47952. },
  47953. args: [],
  47954. 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",
  47955. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  47956. messageSends: ["parse:", "should:raise:", "visit:"]
  47957. }),
  47958. $globals.SemanticAnalyzerTest);
  47959. $core.addMethod(
  47960. $core.method({
  47961. selector: "testVariableShadowing3",
  47962. protocol: 'tests',
  47963. fn: function (){
  47964. var self=this;
  47965. var src,ast;
  47966. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47967. return $core.withContext(function($ctx1) {
  47968. src="foo | a | a + 1. [ | b | b := 2 ]";
  47969. ast=$recv($Smalltalk())._parse_(src);
  47970. $recv(self["@analyzer"])._visit_(ast);
  47971. return self;
  47972. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47973. },
  47974. args: [],
  47975. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47976. referencedClasses: ["Smalltalk"],
  47977. messageSends: ["parse:", "visit:"]
  47978. }),
  47979. $globals.SemanticAnalyzerTest);
  47980. $core.addMethod(
  47981. $core.method({
  47982. selector: "testVariableShadowing4",
  47983. protocol: 'tests',
  47984. fn: function (){
  47985. var self=this;
  47986. var src,ast;
  47987. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47988. return $core.withContext(function($ctx1) {
  47989. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  47990. ast=$recv($Smalltalk())._parse_(src);
  47991. $recv(self["@analyzer"])._visit_(ast);
  47992. return self;
  47993. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47994. },
  47995. args: [],
  47996. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47997. referencedClasses: ["Smalltalk"],
  47998. messageSends: ["parse:", "visit:"]
  47999. }),
  48000. $globals.SemanticAnalyzerTest);
  48001. $core.addMethod(
  48002. $core.method({
  48003. selector: "testVariableShadowing5",
  48004. protocol: 'tests',
  48005. fn: function (){
  48006. var self=this;
  48007. var src,ast;
  48008. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48009. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  48010. return $core.withContext(function($ctx1) {
  48011. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  48012. ast=$recv($Smalltalk())._parse_(src);
  48013. self._should_raise_((function(){
  48014. return $core.withContext(function($ctx2) {
  48015. return $recv(self["@analyzer"])._visit_(ast);
  48016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48017. }),$ShadowingVariableError());
  48018. return self;
  48019. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48020. },
  48021. args: [],
  48022. 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",
  48023. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  48024. messageSends: ["parse:", "should:raise:", "visit:"]
  48025. }),
  48026. $globals.SemanticAnalyzerTest);
  48027. $core.addMethod(
  48028. $core.method({
  48029. selector: "testVariablesLookup",
  48030. protocol: 'tests',
  48031. fn: function (){
  48032. var self=this;
  48033. var src,ast;
  48034. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48035. return $core.withContext(function($ctx1) {
  48036. 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;
  48037. src="foo | a | a + 1. [ | b | b := a ]";
  48038. ast=$recv($Smalltalk())._parse_(src);
  48039. $recv(self["@analyzer"])._visit_(ast);
  48040. $7=$recv(ast)._nodes();
  48041. $ctx1.sendIdx["nodes"]=2;
  48042. $6=$recv($7)._first();
  48043. $ctx1.sendIdx["first"]=2;
  48044. $5=$recv($6)._nodes();
  48045. $ctx1.sendIdx["nodes"]=1;
  48046. $4=$recv($5)._first();
  48047. $ctx1.sendIdx["first"]=1;
  48048. $3=$recv($4)._receiver();
  48049. $ctx1.sendIdx["receiver"]=1;
  48050. $2=$recv($3)._binding();
  48051. $ctx1.sendIdx["binding"]=1;
  48052. $1=$recv($2)._isTempVar();
  48053. $ctx1.sendIdx["isTempVar"]=1;
  48054. self._assert_($1);
  48055. $ctx1.sendIdx["assert:"]=1;
  48056. $15=$recv(ast)._nodes();
  48057. $ctx1.sendIdx["nodes"]=4;
  48058. $14=$recv($15)._first();
  48059. $ctx1.sendIdx["first"]=4;
  48060. $13=$recv($14)._nodes();
  48061. $ctx1.sendIdx["nodes"]=3;
  48062. $12=$recv($13)._first();
  48063. $ctx1.sendIdx["first"]=3;
  48064. $11=$recv($12)._receiver();
  48065. $10=$recv($11)._binding();
  48066. $ctx1.sendIdx["binding"]=2;
  48067. $9=$recv($10)._scope();
  48068. $ctx1.sendIdx["scope"]=1;
  48069. $16=$recv(ast)._scope();
  48070. $ctx1.sendIdx["scope"]=2;
  48071. $8=$recv($9).__eq_eq($16);
  48072. $ctx1.sendIdx["=="]=1;
  48073. self._assert_($8);
  48074. $ctx1.sendIdx["assert:"]=2;
  48075. $27=$recv(ast)._nodes();
  48076. $ctx1.sendIdx["nodes"]=8;
  48077. $26=$recv($27)._first();
  48078. $ctx1.sendIdx["first"]=7;
  48079. $25=$recv($26)._nodes();
  48080. $ctx1.sendIdx["nodes"]=7;
  48081. $24=$recv($25)._last();
  48082. $ctx1.sendIdx["last"]=1;
  48083. $23=$recv($24)._nodes();
  48084. $ctx1.sendIdx["nodes"]=6;
  48085. $22=$recv($23)._first();
  48086. $ctx1.sendIdx["first"]=6;
  48087. $21=$recv($22)._nodes();
  48088. $ctx1.sendIdx["nodes"]=5;
  48089. $20=$recv($21)._first();
  48090. $ctx1.sendIdx["first"]=5;
  48091. $19=$recv($20)._left();
  48092. $ctx1.sendIdx["left"]=1;
  48093. $18=$recv($19)._binding();
  48094. $ctx1.sendIdx["binding"]=3;
  48095. $17=$recv($18)._isTempVar();
  48096. self._assert_($17);
  48097. $ctx1.sendIdx["assert:"]=3;
  48098. $39=$recv(ast)._nodes();
  48099. $ctx1.sendIdx["nodes"]=12;
  48100. $38=$recv($39)._first();
  48101. $ctx1.sendIdx["first"]=10;
  48102. $37=$recv($38)._nodes();
  48103. $ctx1.sendIdx["nodes"]=11;
  48104. $36=$recv($37)._last();
  48105. $ctx1.sendIdx["last"]=2;
  48106. $35=$recv($36)._nodes();
  48107. $ctx1.sendIdx["nodes"]=10;
  48108. $34=$recv($35)._first();
  48109. $ctx1.sendIdx["first"]=9;
  48110. $33=$recv($34)._nodes();
  48111. $ctx1.sendIdx["nodes"]=9;
  48112. $32=$recv($33)._first();
  48113. $ctx1.sendIdx["first"]=8;
  48114. $31=$recv($32)._left();
  48115. $30=$recv($31)._binding();
  48116. $29=$recv($30)._scope();
  48117. $ctx1.sendIdx["scope"]=3;
  48118. $42=$recv($recv($recv(ast)._nodes())._first())._nodes();
  48119. $ctx1.sendIdx["nodes"]=13;
  48120. $41=$recv($42)._last();
  48121. $40=$recv($41)._scope();
  48122. $28=$recv($29).__eq_eq($40);
  48123. self._assert_($28);
  48124. return self;
  48125. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48126. },
  48127. args: [],
  48128. 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.",
  48129. referencedClasses: ["Smalltalk"],
  48130. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  48131. }),
  48132. $globals.SemanticAnalyzerTest);
  48133. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  48134. $core.addMethod(
  48135. $core.method({
  48136. selector: "setUp",
  48137. protocol: 'running',
  48138. fn: function (){
  48139. var self=this;
  48140. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  48141. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48142. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  48143. return $core.withContext(function($ctx1) {
  48144. var $1,$2,$4,$5,$3,$6;
  48145. $1=$recv($AISemanticAnalyzer())._on_($Object());
  48146. $2=$1;
  48147. $4=$recv($AIContext())._new();
  48148. $recv($4)._defineLocal_("local");
  48149. $recv($4)._localAt_put_("local",(3));
  48150. $5=$recv($4)._yourself();
  48151. $ctx1.sendIdx["yourself"]=1;
  48152. $3=$5;
  48153. $recv($2)._context_($3);
  48154. $6=$recv($1)._yourself();
  48155. self["@analyzer"]=$6;
  48156. return self;
  48157. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  48158. },
  48159. args: [],
  48160. 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",
  48161. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  48162. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  48163. }),
  48164. $globals.AISemanticAnalyzerTest);
  48165. $core.addMethod(
  48166. $core.method({
  48167. selector: "testContextVariables",
  48168. protocol: 'tests',
  48169. fn: function (){
  48170. var self=this;
  48171. var src,ast;
  48172. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48173. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  48174. return $core.withContext(function($ctx1) {
  48175. src="foo | a | local + a";
  48176. ast=$recv($Smalltalk())._parse_(src);
  48177. self._shouldnt_raise_((function(){
  48178. return $core.withContext(function($ctx2) {
  48179. return $recv(self["@analyzer"])._visit_(ast);
  48180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48181. }),$UnknownVariableError());
  48182. return self;
  48183. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  48184. },
  48185. args: [],
  48186. 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",
  48187. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48188. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  48189. }),
  48190. $globals.AISemanticAnalyzerTest);
  48191. });
  48192. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){"use strict";
  48193. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  48194. $core.addPackage('Kernel-Tests');
  48195. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  48196. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48197. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  48198. $core.addMethod(
  48199. $core.method({
  48200. selector: "testAddExtensionMethod",
  48201. protocol: 'tests',
  48202. fn: function (){
  48203. var self=this;
  48204. var method,dirty;
  48205. return $core.withContext(function($ctx1) {
  48206. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  48207. $2=self._class();
  48208. $ctx1.sendIdx["class"]=1;
  48209. $1=$recv($2)._package();
  48210. $ctx1.sendIdx["package"]=1;
  48211. dirty=$recv($1)._isDirty();
  48212. $ctx1.sendIdx["isDirty"]=1;
  48213. $4=self._class();
  48214. $ctx1.sendIdx["class"]=2;
  48215. $3=$recv($4)._package();
  48216. $ctx1.sendIdx["package"]=2;
  48217. $recv($3)._beClean();
  48218. $5=self._class();
  48219. $ctx1.sendIdx["class"]=3;
  48220. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  48221. $8=self._class();
  48222. $ctx1.sendIdx["class"]=4;
  48223. $7=$recv($8)._package();
  48224. $ctx1.sendIdx["package"]=3;
  48225. $6=$recv($7)._isDirty();
  48226. self._deny_($6);
  48227. $9=self._class();
  48228. $ctx1.sendIdx["class"]=5;
  48229. $recv($9)._removeCompiledMethod_(method);
  48230. $10=dirty;
  48231. if($core.assert($10)){
  48232. $recv($recv(self._class())._package())._beDirty();
  48233. };
  48234. return self;
  48235. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  48236. },
  48237. args: [],
  48238. 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 ]",
  48239. referencedClasses: [],
  48240. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  48241. }),
  48242. $globals.AnnouncementSubscriptionTest);
  48243. $core.addMethod(
  48244. $core.method({
  48245. selector: "testHandlesAnnouncement",
  48246. protocol: 'tests',
  48247. fn: function (){
  48248. var self=this;
  48249. var subscription,announcementClass1,announcementClass2,classBuilder;
  48250. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  48251. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48252. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  48253. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48254. return $core.withContext(function($ctx1) {
  48255. var $1,$2;
  48256. classBuilder=$recv($ClassBuilder())._new();
  48257. $ctx1.sendIdx["new"]=1;
  48258. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  48259. subscription=$recv($recv($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  48260. $1=$recv(subscription)._handlesAnnouncement_($SystemAnnouncement());
  48261. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  48262. self._assert_equals_($1,true);
  48263. $ctx1.sendIdx["assert:equals:"]=1;
  48264. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  48265. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  48266. self._assert_equals_($2,true);
  48267. $ctx1.sendIdx["assert:equals:"]=2;
  48268. self._assert_equals_($recv(subscription)._handlesAnnouncement_($Object()),false);
  48269. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  48270. return self;
  48271. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  48272. },
  48273. args: [],
  48274. 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.",
  48275. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  48276. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  48277. }),
  48278. $globals.AnnouncementSubscriptionTest);
  48279. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  48280. $core.addMethod(
  48281. $core.method({
  48282. selector: "testOnDo",
  48283. protocol: 'tests',
  48284. fn: function (){
  48285. var self=this;
  48286. var counter,announcer;
  48287. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48288. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48289. return $core.withContext(function($ctx1) {
  48290. var $1,$2;
  48291. counter=(0);
  48292. announcer=$recv($Announcer())._new();
  48293. $ctx1.sendIdx["new"]=1;
  48294. $recv(announcer)._on_do_($SystemAnnouncement(),(function(){
  48295. return $core.withContext(function($ctx2) {
  48296. counter=$recv(counter).__plus((1));
  48297. return counter;
  48298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48299. }));
  48300. $1=announcer;
  48301. $2=$recv($SystemAnnouncement())._new();
  48302. $ctx1.sendIdx["new"]=2;
  48303. $recv($1)._announce_($2);
  48304. $ctx1.sendIdx["announce:"]=1;
  48305. self._assert_equals_(counter,(1));
  48306. $ctx1.sendIdx["assert:equals:"]=1;
  48307. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48308. self._assert_equals_(counter,(2));
  48309. return self;
  48310. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48311. },
  48312. args: [],
  48313. 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.",
  48314. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48315. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  48316. }),
  48317. $globals.AnnouncerTest);
  48318. $core.addMethod(
  48319. $core.method({
  48320. selector: "testOnDoFor",
  48321. protocol: 'tests',
  48322. fn: function (){
  48323. var self=this;
  48324. var counter,announcer;
  48325. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48326. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48327. return $core.withContext(function($ctx1) {
  48328. var $1,$2,$3,$4;
  48329. counter=(0);
  48330. announcer=$recv($Announcer())._new();
  48331. $ctx1.sendIdx["new"]=1;
  48332. $recv(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  48333. return $core.withContext(function($ctx2) {
  48334. counter=$recv(counter).__plus((1));
  48335. return counter;
  48336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48337. }),self);
  48338. $1=announcer;
  48339. $2=$recv($SystemAnnouncement())._new();
  48340. $ctx1.sendIdx["new"]=2;
  48341. $recv($1)._announce_($2);
  48342. $ctx1.sendIdx["announce:"]=1;
  48343. self._assert_equals_(counter,(1));
  48344. $ctx1.sendIdx["assert:equals:"]=1;
  48345. $3=announcer;
  48346. $4=$recv($SystemAnnouncement())._new();
  48347. $ctx1.sendIdx["new"]=3;
  48348. $recv($3)._announce_($4);
  48349. $ctx1.sendIdx["announce:"]=2;
  48350. self._assert_equals_(counter,(2));
  48351. $ctx1.sendIdx["assert:equals:"]=2;
  48352. $recv(announcer)._unsubscribe_(self);
  48353. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48354. self._assert_equals_(counter,(2));
  48355. return self;
  48356. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48357. },
  48358. args: [],
  48359. 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.",
  48360. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48361. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  48362. }),
  48363. $globals.AnnouncerTest);
  48364. $core.addMethod(
  48365. $core.method({
  48366. selector: "testOnDoOnce",
  48367. protocol: 'tests',
  48368. fn: function (){
  48369. var self=this;
  48370. var counter,announcer;
  48371. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48372. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48373. return $core.withContext(function($ctx1) {
  48374. var $1,$2;
  48375. counter=(0);
  48376. announcer=$recv($Announcer())._new();
  48377. $ctx1.sendIdx["new"]=1;
  48378. $recv(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  48379. return $core.withContext(function($ctx2) {
  48380. counter=$recv(counter).__plus((1));
  48381. return counter;
  48382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48383. }));
  48384. $1=announcer;
  48385. $2=$recv($SystemAnnouncement())._new();
  48386. $ctx1.sendIdx["new"]=2;
  48387. $recv($1)._announce_($2);
  48388. $ctx1.sendIdx["announce:"]=1;
  48389. self._assert_equals_(counter,(1));
  48390. $ctx1.sendIdx["assert:equals:"]=1;
  48391. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48392. self._assert_equals_(counter,(1));
  48393. return self;
  48394. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48395. },
  48396. args: [],
  48397. 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.",
  48398. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48399. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  48400. }),
  48401. $globals.AnnouncerTest);
  48402. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  48403. $core.addMethod(
  48404. $core.method({
  48405. selector: "localReturnOnDoCatch",
  48406. protocol: 'fixture',
  48407. fn: function (){
  48408. var self=this;
  48409. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48410. return $core.withContext(function($ctx1) {
  48411. var $early={};
  48412. try {
  48413. $recv((function(){
  48414. throw $early=[(2)];
  48415. }))._on_do_($Error(),(function(){
  48416. }));
  48417. return (3);
  48418. }
  48419. catch(e) {if(e===$early)return e[0]; throw e}
  48420. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  48421. },
  48422. args: [],
  48423. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  48424. referencedClasses: ["Error"],
  48425. messageSends: ["on:do:"]
  48426. }),
  48427. $globals.BlockClosureTest);
  48428. $core.addMethod(
  48429. $core.method({
  48430. selector: "localReturnOnDoMiss",
  48431. protocol: 'fixture',
  48432. fn: function (){
  48433. var self=this;
  48434. function $Class(){return $globals.Class||(typeof Class=="undefined"?nil:Class)}
  48435. return $core.withContext(function($ctx1) {
  48436. var $early={};
  48437. try {
  48438. $recv((function(){
  48439. throw $early=[(2)];
  48440. }))._on_do_($Class(),(function(){
  48441. }));
  48442. return (3);
  48443. }
  48444. catch(e) {if(e===$early)return e[0]; throw e}
  48445. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  48446. },
  48447. args: [],
  48448. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  48449. referencedClasses: ["Class"],
  48450. messageSends: ["on:do:"]
  48451. }),
  48452. $globals.BlockClosureTest);
  48453. $core.addMethod(
  48454. $core.method({
  48455. selector: "testCanClearInterval",
  48456. protocol: 'tests',
  48457. fn: function (){
  48458. var self=this;
  48459. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48460. return $core.withContext(function($ctx1) {
  48461. self._shouldnt_raise_((function(){
  48462. return $core.withContext(function($ctx2) {
  48463. return $recv($recv((function(){
  48464. return $core.withContext(function($ctx3) {
  48465. return $recv($recv($Error())._new())._signal();
  48466. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48467. }))._valueWithInterval_((0)))._clearInterval();
  48468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48469. }),$Error());
  48470. return self;
  48471. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  48472. },
  48473. args: [],
  48474. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  48475. referencedClasses: ["Error"],
  48476. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  48477. }),
  48478. $globals.BlockClosureTest);
  48479. $core.addMethod(
  48480. $core.method({
  48481. selector: "testCanClearTimeout",
  48482. protocol: 'tests',
  48483. fn: function (){
  48484. var self=this;
  48485. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48486. return $core.withContext(function($ctx1) {
  48487. self._shouldnt_raise_((function(){
  48488. return $core.withContext(function($ctx2) {
  48489. return $recv($recv((function(){
  48490. return $core.withContext(function($ctx3) {
  48491. return $recv($recv($Error())._new())._signal();
  48492. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48493. }))._valueWithTimeout_((0)))._clearTimeout();
  48494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48495. }),$Error());
  48496. return self;
  48497. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  48498. },
  48499. args: [],
  48500. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  48501. referencedClasses: ["Error"],
  48502. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  48503. }),
  48504. $globals.BlockClosureTest);
  48505. $core.addMethod(
  48506. $core.method({
  48507. selector: "testCompiledSource",
  48508. protocol: 'tests',
  48509. fn: function (){
  48510. var self=this;
  48511. return $core.withContext(function($ctx1) {
  48512. self._assert_($recv($recv((function(){
  48513. return $core.withContext(function($ctx2) {
  48514. return (1).__plus((1));
  48515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48516. }))._compiledSource())._includesSubString_("function"));
  48517. return self;
  48518. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  48519. },
  48520. args: [],
  48521. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  48522. referencedClasses: [],
  48523. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  48524. }),
  48525. $globals.BlockClosureTest);
  48526. $core.addMethod(
  48527. $core.method({
  48528. selector: "testCurrySelf",
  48529. protocol: 'tests',
  48530. fn: function (){
  48531. var self=this;
  48532. var curriedMethod,array;
  48533. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  48534. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  48535. return $core.withContext(function($ctx1) {
  48536. curriedMethod=$recv($recv((function(selfarg,x){
  48537. return $core.withContext(function($ctx2) {
  48538. return $recv(selfarg)._at_(x);
  48539. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  48540. }))._currySelf())._asCompiledMethod_("foo:");
  48541. array=[(3), (1), (4)];
  48542. $recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  48543. $recv((function(){
  48544. return $core.withContext(function($ctx2) {
  48545. return self._assert_equals_($recv(array)._foo_((2)),(1));
  48546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48547. }))._ensure_((function(){
  48548. return $core.withContext(function($ctx2) {
  48549. return $recv($Array())._removeCompiledMethod_(curriedMethod);
  48550. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48551. }));
  48552. return self;
  48553. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  48554. },
  48555. args: [],
  48556. 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 ]",
  48557. referencedClasses: ["ClassBuilder", "Array"],
  48558. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  48559. }),
  48560. $globals.BlockClosureTest);
  48561. $core.addMethod(
  48562. $core.method({
  48563. selector: "testEnsure",
  48564. protocol: 'tests',
  48565. fn: function (){
  48566. var self=this;
  48567. return $core.withContext(function($ctx1) {
  48568. self._assert_equals_($recv((function(){
  48569. return (3);
  48570. }))._ensure_((function(){
  48571. return (4);
  48572. })),(3));
  48573. return self;
  48574. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  48575. },
  48576. args: [],
  48577. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  48578. referencedClasses: [],
  48579. messageSends: ["assert:equals:", "ensure:"]
  48580. }),
  48581. $globals.BlockClosureTest);
  48582. $core.addMethod(
  48583. $core.method({
  48584. selector: "testEnsureRaises",
  48585. protocol: 'tests',
  48586. fn: function (){
  48587. var self=this;
  48588. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48589. return $core.withContext(function($ctx1) {
  48590. self._should_raise_((function(){
  48591. return $core.withContext(function($ctx2) {
  48592. return $recv((function(){
  48593. return $core.withContext(function($ctx3) {
  48594. return $recv($recv($Error())._new())._signal();
  48595. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48596. }))._ensure_((function(){
  48597. return true;
  48598. }));
  48599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48600. }),$Error());
  48601. return self;
  48602. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  48603. },
  48604. args: [],
  48605. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  48606. referencedClasses: ["Error"],
  48607. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  48608. }),
  48609. $globals.BlockClosureTest);
  48610. $core.addMethod(
  48611. $core.method({
  48612. selector: "testExceptionSemantics",
  48613. protocol: 'tests',
  48614. fn: function (){
  48615. var self=this;
  48616. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48617. return $core.withContext(function($ctx1) {
  48618. self._timeout_((100));
  48619. $recv(self._async_((function(){
  48620. return $core.withContext(function($ctx2) {
  48621. return $recv((function(){
  48622. return $core.withContext(function($ctx3) {
  48623. self._assert_(true);
  48624. $recv($Error())._signal();
  48625. self._deny_(true);
  48626. return self._finished();
  48627. $ctx3.sendIdx["finished"]=1;
  48628. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48629. }))._on_do_($Error(),(function(ex){
  48630. return $core.withContext(function($ctx3) {
  48631. return self._finished();
  48632. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48633. }));
  48634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48635. })))._valueWithTimeout_((0));
  48636. return self;
  48637. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  48638. },
  48639. args: [],
  48640. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  48641. referencedClasses: ["Error"],
  48642. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  48643. }),
  48644. $globals.BlockClosureTest);
  48645. $core.addMethod(
  48646. $core.method({
  48647. selector: "testLocalReturnOnDoCatch",
  48648. protocol: 'tests',
  48649. fn: function (){
  48650. var self=this;
  48651. return $core.withContext(function($ctx1) {
  48652. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  48653. return self;
  48654. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  48655. },
  48656. args: [],
  48657. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  48658. referencedClasses: [],
  48659. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  48660. }),
  48661. $globals.BlockClosureTest);
  48662. $core.addMethod(
  48663. $core.method({
  48664. selector: "testLocalReturnOnDoMiss",
  48665. protocol: 'tests',
  48666. fn: function (){
  48667. var self=this;
  48668. return $core.withContext(function($ctx1) {
  48669. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  48670. return self;
  48671. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  48672. },
  48673. args: [],
  48674. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  48675. referencedClasses: [],
  48676. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  48677. }),
  48678. $globals.BlockClosureTest);
  48679. $core.addMethod(
  48680. $core.method({
  48681. selector: "testNewWithValues",
  48682. protocol: 'tests',
  48683. fn: function (){
  48684. var self=this;
  48685. return $core.withContext(function($ctx1) {
  48686. function TestConstructor(arg1, arg2, arg3) {}
  48687. TestConstructor.prototype.name = 'theTestPrototype';
  48688. var wrappedConstructor = $recv(TestConstructor);
  48689. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  48690. self._assert_(result instanceof TestConstructor);
  48691. self._assert_equals_(result.name, 'theTestPrototype');
  48692. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  48693. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);;
  48694. return self;
  48695. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  48696. },
  48697. args: [],
  48698. 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>",
  48699. referencedClasses: [],
  48700. messageSends: []
  48701. }),
  48702. $globals.BlockClosureTest);
  48703. $core.addMethod(
  48704. $core.method({
  48705. selector: "testNumArgs",
  48706. protocol: 'tests',
  48707. fn: function (){
  48708. var self=this;
  48709. return $core.withContext(function($ctx1) {
  48710. var $1;
  48711. $1=$recv((function(){
  48712. }))._numArgs();
  48713. $ctx1.sendIdx["numArgs"]=1;
  48714. self._assert_equals_($1,(0));
  48715. $ctx1.sendIdx["assert:equals:"]=1;
  48716. self._assert_equals_($recv((function(a,b){
  48717. }))._numArgs(),(2));
  48718. return self;
  48719. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  48720. },
  48721. args: [],
  48722. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  48723. referencedClasses: [],
  48724. messageSends: ["assert:equals:", "numArgs"]
  48725. }),
  48726. $globals.BlockClosureTest);
  48727. $core.addMethod(
  48728. $core.method({
  48729. selector: "testOnDo",
  48730. protocol: 'tests',
  48731. fn: function (){
  48732. var self=this;
  48733. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48734. return $core.withContext(function($ctx1) {
  48735. self._assert_($recv((function(){
  48736. return $core.withContext(function($ctx2) {
  48737. return $recv($recv($Error())._new())._signal();
  48738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48739. }))._on_do_($Error(),(function(ex){
  48740. return true;
  48741. })));
  48742. return self;
  48743. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  48744. },
  48745. args: [],
  48746. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  48747. referencedClasses: ["Error"],
  48748. messageSends: ["assert:", "on:do:", "signal", "new"]
  48749. }),
  48750. $globals.BlockClosureTest);
  48751. $core.addMethod(
  48752. $core.method({
  48753. selector: "testValue",
  48754. protocol: 'tests',
  48755. fn: function (){
  48756. var self=this;
  48757. return $core.withContext(function($ctx1) {
  48758. var $1;
  48759. $1=$recv((function(){
  48760. return $core.withContext(function($ctx2) {
  48761. return (1).__plus((1));
  48762. $ctx2.sendIdx["+"]=1;
  48763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48764. }))._value();
  48765. $ctx1.sendIdx["value"]=1;
  48766. self._assert_equals_($1,(2));
  48767. $ctx1.sendIdx["assert:equals:"]=1;
  48768. self._assert_equals_($recv((function(x){
  48769. return $core.withContext(function($ctx2) {
  48770. return $recv(x).__plus((1));
  48771. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  48772. }))._value_((2)),(3));
  48773. $ctx1.sendIdx["assert:equals:"]=2;
  48774. self._assert_equals_($recv((function(x,y){
  48775. return $core.withContext(function($ctx2) {
  48776. return $recv(x).__star(y);
  48777. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  48778. }))._value_value_((2),(4)),(8));
  48779. $ctx1.sendIdx["assert:equals:"]=3;
  48780. self._assert_equals_($recv((function(a,b,c){
  48781. return (1);
  48782. }))._value(),(1));
  48783. return self;
  48784. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  48785. },
  48786. args: [],
  48787. 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",
  48788. referencedClasses: [],
  48789. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  48790. }),
  48791. $globals.BlockClosureTest);
  48792. $core.addMethod(
  48793. $core.method({
  48794. selector: "testValueWithPossibleArguments",
  48795. protocol: 'tests',
  48796. fn: function (){
  48797. var self=this;
  48798. return $core.withContext(function($ctx1) {
  48799. var $1,$2;
  48800. $1=$recv((function(){
  48801. return (1);
  48802. }))._valueWithPossibleArguments_([(3), (4)]);
  48803. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  48804. self._assert_equals_($1,(1));
  48805. $ctx1.sendIdx["assert:equals:"]=1;
  48806. $2=$recv((function(a){
  48807. return $core.withContext(function($ctx2) {
  48808. return $recv(a).__plus((4));
  48809. $ctx2.sendIdx["+"]=1;
  48810. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  48811. }))._valueWithPossibleArguments_([(3), (4)]);
  48812. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  48813. self._assert_equals_($2,(7));
  48814. $ctx1.sendIdx["assert:equals:"]=2;
  48815. self._assert_equals_($recv((function(a,b){
  48816. return $core.withContext(function($ctx2) {
  48817. return $recv(a).__plus(b);
  48818. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  48819. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  48820. return self;
  48821. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  48822. },
  48823. args: [],
  48824. 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.",
  48825. referencedClasses: [],
  48826. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  48827. }),
  48828. $globals.BlockClosureTest);
  48829. $core.addMethod(
  48830. $core.method({
  48831. selector: "testWhileFalse",
  48832. protocol: 'tests',
  48833. fn: function (){
  48834. var self=this;
  48835. var i;
  48836. return $core.withContext(function($ctx1) {
  48837. i=(0);
  48838. $recv((function(){
  48839. return $core.withContext(function($ctx2) {
  48840. return $recv(i).__gt((5));
  48841. $ctx2.sendIdx[">"]=1;
  48842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48843. }))._whileFalse_((function(){
  48844. return $core.withContext(function($ctx2) {
  48845. i=$recv(i).__plus((1));
  48846. $ctx2.sendIdx["+"]=1;
  48847. return i;
  48848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48849. }));
  48850. self._assert_equals_(i,(6));
  48851. $ctx1.sendIdx["assert:equals:"]=1;
  48852. i=(0);
  48853. $recv((function(){
  48854. return $core.withContext(function($ctx2) {
  48855. i=$recv(i).__plus((1));
  48856. i;
  48857. return $recv(i).__gt((5));
  48858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48859. }))._whileFalse();
  48860. self._assert_equals_(i,(6));
  48861. return self;
  48862. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  48863. },
  48864. args: [],
  48865. 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",
  48866. referencedClasses: [],
  48867. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  48868. }),
  48869. $globals.BlockClosureTest);
  48870. $core.addMethod(
  48871. $core.method({
  48872. selector: "testWhileTrue",
  48873. protocol: 'tests',
  48874. fn: function (){
  48875. var self=this;
  48876. var i;
  48877. return $core.withContext(function($ctx1) {
  48878. i=(0);
  48879. $recv((function(){
  48880. return $core.withContext(function($ctx2) {
  48881. return $recv(i).__lt((5));
  48882. $ctx2.sendIdx["<"]=1;
  48883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48884. }))._whileTrue_((function(){
  48885. return $core.withContext(function($ctx2) {
  48886. i=$recv(i).__plus((1));
  48887. $ctx2.sendIdx["+"]=1;
  48888. return i;
  48889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48890. }));
  48891. self._assert_equals_(i,(5));
  48892. $ctx1.sendIdx["assert:equals:"]=1;
  48893. i=(0);
  48894. $recv((function(){
  48895. return $core.withContext(function($ctx2) {
  48896. i=$recv(i).__plus((1));
  48897. i;
  48898. return $recv(i).__lt((5));
  48899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48900. }))._whileTrue();
  48901. self._assert_equals_(i,(5));
  48902. return self;
  48903. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  48904. },
  48905. args: [],
  48906. 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",
  48907. referencedClasses: [],
  48908. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  48909. }),
  48910. $globals.BlockClosureTest);
  48911. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  48912. $core.addMethod(
  48913. $core.method({
  48914. selector: "testEquality",
  48915. protocol: 'tests',
  48916. fn: function (){
  48917. var self=this;
  48918. return $core.withContext(function($ctx1) {
  48919. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  48920. $1=(0).__eq(false);
  48921. $ctx1.sendIdx["="]=1;
  48922. self._deny_($1);
  48923. $ctx1.sendIdx["deny:"]=1;
  48924. $2=false.__eq((0));
  48925. $ctx1.sendIdx["="]=2;
  48926. self._deny_($2);
  48927. $ctx1.sendIdx["deny:"]=2;
  48928. $3="".__eq(false);
  48929. $ctx1.sendIdx["="]=3;
  48930. self._deny_($3);
  48931. $ctx1.sendIdx["deny:"]=3;
  48932. $4=false.__eq("");
  48933. $ctx1.sendIdx["="]=4;
  48934. self._deny_($4);
  48935. $ctx1.sendIdx["deny:"]=4;
  48936. $5=true.__eq(true);
  48937. $ctx1.sendIdx["="]=5;
  48938. self._assert_($5);
  48939. $ctx1.sendIdx["assert:"]=1;
  48940. $6=false.__eq(true);
  48941. $ctx1.sendIdx["="]=6;
  48942. self._deny_($6);
  48943. $ctx1.sendIdx["deny:"]=5;
  48944. $7=true.__eq(false);
  48945. $ctx1.sendIdx["="]=7;
  48946. self._deny_($7);
  48947. $8=false.__eq(false);
  48948. $ctx1.sendIdx["="]=8;
  48949. self._assert_($8);
  48950. $ctx1.sendIdx["assert:"]=2;
  48951. $10=true._yourself();
  48952. $ctx1.sendIdx["yourself"]=1;
  48953. $9=$recv($10).__eq(true);
  48954. $ctx1.sendIdx["="]=9;
  48955. self._assert_($9);
  48956. $ctx1.sendIdx["assert:"]=3;
  48957. $12=true._yourself();
  48958. $ctx1.sendIdx["yourself"]=2;
  48959. $11=$recv($12).__eq(true._yourself());
  48960. self._assert_($11);
  48961. return self;
  48962. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  48963. },
  48964. args: [],
  48965. 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)",
  48966. referencedClasses: [],
  48967. messageSends: ["deny:", "=", "assert:", "yourself"]
  48968. }),
  48969. $globals.BooleanTest);
  48970. $core.addMethod(
  48971. $core.method({
  48972. selector: "testIdentity",
  48973. protocol: 'tests',
  48974. fn: function (){
  48975. var self=this;
  48976. return $core.withContext(function($ctx1) {
  48977. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  48978. $1=(0).__eq_eq(false);
  48979. $ctx1.sendIdx["=="]=1;
  48980. self._deny_($1);
  48981. $ctx1.sendIdx["deny:"]=1;
  48982. $2=false.__eq_eq((0));
  48983. $ctx1.sendIdx["=="]=2;
  48984. self._deny_($2);
  48985. $ctx1.sendIdx["deny:"]=2;
  48986. $3="".__eq_eq(false);
  48987. $ctx1.sendIdx["=="]=3;
  48988. self._deny_($3);
  48989. $ctx1.sendIdx["deny:"]=3;
  48990. $4=false.__eq_eq("");
  48991. $ctx1.sendIdx["=="]=4;
  48992. self._deny_($4);
  48993. $ctx1.sendIdx["deny:"]=4;
  48994. $5=true.__eq_eq(true);
  48995. $ctx1.sendIdx["=="]=5;
  48996. self._assert_($5);
  48997. $ctx1.sendIdx["assert:"]=1;
  48998. $6=false.__eq_eq(true);
  48999. $ctx1.sendIdx["=="]=6;
  49000. self._deny_($6);
  49001. $ctx1.sendIdx["deny:"]=5;
  49002. $7=true.__eq_eq(false);
  49003. $ctx1.sendIdx["=="]=7;
  49004. self._deny_($7);
  49005. $8=false.__eq_eq(false);
  49006. $ctx1.sendIdx["=="]=8;
  49007. self._assert_($8);
  49008. $ctx1.sendIdx["assert:"]=2;
  49009. $10=true._yourself();
  49010. $ctx1.sendIdx["yourself"]=1;
  49011. $9=$recv($10).__eq_eq(true);
  49012. $ctx1.sendIdx["=="]=9;
  49013. self._assert_($9);
  49014. $ctx1.sendIdx["assert:"]=3;
  49015. $12=true._yourself();
  49016. $ctx1.sendIdx["yourself"]=2;
  49017. $11=$recv($12).__eq_eq(true._yourself());
  49018. self._assert_($11);
  49019. return self;
  49020. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  49021. },
  49022. args: [],
  49023. 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",
  49024. referencedClasses: [],
  49025. messageSends: ["deny:", "==", "assert:", "yourself"]
  49026. }),
  49027. $globals.BooleanTest);
  49028. $core.addMethod(
  49029. $core.method({
  49030. selector: "testIfTrueIfFalse",
  49031. protocol: 'tests',
  49032. fn: function (){
  49033. var self=this;
  49034. return $core.withContext(function($ctx1) {
  49035. var $1,$2,$3,$4,$5,$6,$7,$8;
  49036. if($core.assert(true)){
  49037. $1="alternative block";
  49038. };
  49039. self._assert_equals_($1,"alternative block");
  49040. $ctx1.sendIdx["assert:equals:"]=1;
  49041. if(!$core.assert(true)){
  49042. $2="alternative block";
  49043. };
  49044. self._assert_equals_($2,nil);
  49045. $ctx1.sendIdx["assert:equals:"]=2;
  49046. if($core.assert(false)){
  49047. $3="alternative block";
  49048. };
  49049. self._assert_equals_($3,nil);
  49050. $ctx1.sendIdx["assert:equals:"]=3;
  49051. if(!$core.assert(false)){
  49052. $4="alternative block";
  49053. };
  49054. self._assert_equals_($4,"alternative block");
  49055. $ctx1.sendIdx["assert:equals:"]=4;
  49056. if($core.assert(false)){
  49057. $5="alternative block";
  49058. } else {
  49059. $5="alternative block2";
  49060. };
  49061. self._assert_equals_($5,"alternative block2");
  49062. $ctx1.sendIdx["assert:equals:"]=5;
  49063. if($core.assert(false)){
  49064. $6="alternative block2";
  49065. } else {
  49066. $6="alternative block";
  49067. };
  49068. self._assert_equals_($6,"alternative block");
  49069. $ctx1.sendIdx["assert:equals:"]=6;
  49070. if($core.assert(true)){
  49071. $7="alternative block";
  49072. } else {
  49073. $7="alternative block2";
  49074. };
  49075. self._assert_equals_($7,"alternative block");
  49076. $ctx1.sendIdx["assert:equals:"]=7;
  49077. if($core.assert(true)){
  49078. $8="alternative block2";
  49079. } else {
  49080. $8="alternative block";
  49081. };
  49082. self._assert_equals_($8,"alternative block2");
  49083. return self;
  49084. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  49085. },
  49086. args: [],
  49087. 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'.",
  49088. referencedClasses: [],
  49089. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49090. }),
  49091. $globals.BooleanTest);
  49092. $core.addMethod(
  49093. $core.method({
  49094. selector: "testIfTrueIfFalseWithBoxing",
  49095. protocol: 'tests',
  49096. fn: function (){
  49097. var self=this;
  49098. return $core.withContext(function($ctx1) {
  49099. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  49100. $2=true._yourself();
  49101. $ctx1.sendIdx["yourself"]=1;
  49102. if($core.assert($2)){
  49103. $1="alternative block";
  49104. };
  49105. self._assert_equals_($1,"alternative block");
  49106. $ctx1.sendIdx["assert:equals:"]=1;
  49107. $4=true._yourself();
  49108. $ctx1.sendIdx["yourself"]=2;
  49109. if(!$core.assert($4)){
  49110. $3="alternative block";
  49111. };
  49112. self._assert_equals_($3,nil);
  49113. $ctx1.sendIdx["assert:equals:"]=2;
  49114. $6=false._yourself();
  49115. $ctx1.sendIdx["yourself"]=3;
  49116. if($core.assert($6)){
  49117. $5="alternative block";
  49118. };
  49119. self._assert_equals_($5,nil);
  49120. $ctx1.sendIdx["assert:equals:"]=3;
  49121. $8=false._yourself();
  49122. $ctx1.sendIdx["yourself"]=4;
  49123. if(!$core.assert($8)){
  49124. $7="alternative block";
  49125. };
  49126. self._assert_equals_($7,"alternative block");
  49127. $ctx1.sendIdx["assert:equals:"]=4;
  49128. $10=false._yourself();
  49129. $ctx1.sendIdx["yourself"]=5;
  49130. if($core.assert($10)){
  49131. $9="alternative block";
  49132. } else {
  49133. $9="alternative block2";
  49134. };
  49135. self._assert_equals_($9,"alternative block2");
  49136. $ctx1.sendIdx["assert:equals:"]=5;
  49137. $12=false._yourself();
  49138. $ctx1.sendIdx["yourself"]=6;
  49139. if($core.assert($12)){
  49140. $11="alternative block2";
  49141. } else {
  49142. $11="alternative block";
  49143. };
  49144. self._assert_equals_($11,"alternative block");
  49145. $ctx1.sendIdx["assert:equals:"]=6;
  49146. $14=true._yourself();
  49147. $ctx1.sendIdx["yourself"]=7;
  49148. if($core.assert($14)){
  49149. $13="alternative block";
  49150. } else {
  49151. $13="alternative block2";
  49152. };
  49153. self._assert_equals_($13,"alternative block");
  49154. $ctx1.sendIdx["assert:equals:"]=7;
  49155. $16=true._yourself();
  49156. if($core.assert($16)){
  49157. $15="alternative block2";
  49158. } else {
  49159. $15="alternative block";
  49160. };
  49161. self._assert_equals_($15,"alternative block2");
  49162. return self;
  49163. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  49164. },
  49165. args: [],
  49166. 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'.",
  49167. referencedClasses: [],
  49168. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49169. }),
  49170. $globals.BooleanTest);
  49171. $core.addMethod(
  49172. $core.method({
  49173. selector: "testLogic",
  49174. protocol: 'tests',
  49175. fn: function (){
  49176. var self=this;
  49177. return $core.withContext(function($ctx1) {
  49178. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  49179. $1=true.__and(true);
  49180. $ctx1.sendIdx["&"]=1;
  49181. self._assert_($1);
  49182. $ctx1.sendIdx["assert:"]=1;
  49183. $2=true.__and(false);
  49184. $ctx1.sendIdx["&"]=2;
  49185. self._deny_($2);
  49186. $ctx1.sendIdx["deny:"]=1;
  49187. $3=false.__and(true);
  49188. $ctx1.sendIdx["&"]=3;
  49189. self._deny_($3);
  49190. $ctx1.sendIdx["deny:"]=2;
  49191. $5=false.__and(false);
  49192. $ctx1.sendIdx["&"]=4;
  49193. $4=self._deny_($5);
  49194. $ctx1.sendIdx["deny:"]=3;
  49195. $6=true.__or(true);
  49196. $ctx1.sendIdx["|"]=1;
  49197. self._assert_($6);
  49198. $ctx1.sendIdx["assert:"]=2;
  49199. $7=true.__or(false);
  49200. $ctx1.sendIdx["|"]=2;
  49201. self._assert_($7);
  49202. $ctx1.sendIdx["assert:"]=3;
  49203. $8=false.__or(true);
  49204. $ctx1.sendIdx["|"]=3;
  49205. self._assert_($8);
  49206. $ctx1.sendIdx["assert:"]=4;
  49207. $10=false.__or(false);
  49208. $ctx1.sendIdx["|"]=4;
  49209. $9=self._deny_($10);
  49210. $ctx1.sendIdx["deny:"]=4;
  49211. $12=(1).__gt((0));
  49212. $ctx1.sendIdx[">"]=1;
  49213. $11=true.__and($12);
  49214. $ctx1.sendIdx["&"]=5;
  49215. self._assert_($11);
  49216. $ctx1.sendIdx["assert:"]=5;
  49217. $14=(1).__gt((0));
  49218. $ctx1.sendIdx[">"]=2;
  49219. $13=$recv($14).__and(false);
  49220. $ctx1.sendIdx["&"]=6;
  49221. self._deny_($13);
  49222. $ctx1.sendIdx["deny:"]=5;
  49223. $17=(1).__gt((0));
  49224. $ctx1.sendIdx[">"]=3;
  49225. $18=(1).__gt((2));
  49226. $ctx1.sendIdx[">"]=4;
  49227. $16=$recv($17).__and($18);
  49228. $15=self._deny_($16);
  49229. $20=(1).__gt((0));
  49230. $ctx1.sendIdx[">"]=5;
  49231. $19=false.__or($20);
  49232. $ctx1.sendIdx["|"]=5;
  49233. self._assert_($19);
  49234. $ctx1.sendIdx["assert:"]=6;
  49235. $22=(1).__gt((0));
  49236. $ctx1.sendIdx[">"]=6;
  49237. $21=$recv($22).__or(false);
  49238. $ctx1.sendIdx["|"]=6;
  49239. self._assert_($21);
  49240. $ctx1.sendIdx["assert:"]=7;
  49241. $25=(1).__gt((0));
  49242. $ctx1.sendIdx[">"]=7;
  49243. $24=$recv($25).__or((1).__gt((2)));
  49244. $23=self._assert_($24);
  49245. return self;
  49246. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  49247. },
  49248. args: [],
  49249. 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))",
  49250. referencedClasses: [],
  49251. messageSends: ["assert:", "&", "deny:", "|", ">"]
  49252. }),
  49253. $globals.BooleanTest);
  49254. $core.addMethod(
  49255. $core.method({
  49256. selector: "testLogicKeywords",
  49257. protocol: 'tests',
  49258. fn: function (){
  49259. var self=this;
  49260. return $core.withContext(function($ctx1) {
  49261. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  49262. $1=true._and_((function(){
  49263. return true;
  49264. }));
  49265. $ctx1.sendIdx["and:"]=1;
  49266. self._assert_($1);
  49267. $ctx1.sendIdx["assert:"]=1;
  49268. $2=true._and_((function(){
  49269. return false;
  49270. }));
  49271. $ctx1.sendIdx["and:"]=2;
  49272. self._deny_($2);
  49273. $ctx1.sendIdx["deny:"]=1;
  49274. $3=false._and_((function(){
  49275. return true;
  49276. }));
  49277. $ctx1.sendIdx["and:"]=3;
  49278. self._deny_($3);
  49279. $ctx1.sendIdx["deny:"]=2;
  49280. $5=false._and_((function(){
  49281. return false;
  49282. }));
  49283. $ctx1.sendIdx["and:"]=4;
  49284. $4=self._deny_($5);
  49285. $ctx1.sendIdx["deny:"]=3;
  49286. $6=true._or_((function(){
  49287. return true;
  49288. }));
  49289. $ctx1.sendIdx["or:"]=1;
  49290. self._assert_($6);
  49291. $ctx1.sendIdx["assert:"]=2;
  49292. $7=true._or_((function(){
  49293. return false;
  49294. }));
  49295. $ctx1.sendIdx["or:"]=2;
  49296. self._assert_($7);
  49297. $ctx1.sendIdx["assert:"]=3;
  49298. $8=false._or_((function(){
  49299. return true;
  49300. }));
  49301. $ctx1.sendIdx["or:"]=3;
  49302. self._assert_($8);
  49303. $ctx1.sendIdx["assert:"]=4;
  49304. $10=false._or_((function(){
  49305. return false;
  49306. }));
  49307. $ctx1.sendIdx["or:"]=4;
  49308. $9=self._deny_($10);
  49309. $ctx1.sendIdx["deny:"]=4;
  49310. $11=true._and_((function(){
  49311. return $core.withContext(function($ctx2) {
  49312. return (1).__gt((0));
  49313. $ctx2.sendIdx[">"]=1;
  49314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  49315. }));
  49316. $ctx1.sendIdx["and:"]=5;
  49317. self._assert_($11);
  49318. $ctx1.sendIdx["assert:"]=5;
  49319. $13=(1).__gt((0));
  49320. $ctx1.sendIdx[">"]=2;
  49321. $12=$recv($13)._and_((function(){
  49322. return false;
  49323. }));
  49324. $ctx1.sendIdx["and:"]=6;
  49325. self._deny_($12);
  49326. $ctx1.sendIdx["deny:"]=5;
  49327. $16=(1).__gt((0));
  49328. $ctx1.sendIdx[">"]=3;
  49329. $15=$recv($16)._and_((function(){
  49330. return $core.withContext(function($ctx2) {
  49331. return (1).__gt((2));
  49332. $ctx2.sendIdx[">"]=4;
  49333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  49334. }));
  49335. $14=self._deny_($15);
  49336. $17=false._or_((function(){
  49337. return $core.withContext(function($ctx2) {
  49338. return (1).__gt((0));
  49339. $ctx2.sendIdx[">"]=5;
  49340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  49341. }));
  49342. $ctx1.sendIdx["or:"]=5;
  49343. self._assert_($17);
  49344. $ctx1.sendIdx["assert:"]=6;
  49345. $19=(1).__gt((0));
  49346. $ctx1.sendIdx[">"]=6;
  49347. $18=$recv($19)._or_((function(){
  49348. return false;
  49349. }));
  49350. $ctx1.sendIdx["or:"]=6;
  49351. self._assert_($18);
  49352. $ctx1.sendIdx["assert:"]=7;
  49353. $22=(1).__gt((0));
  49354. $ctx1.sendIdx[">"]=7;
  49355. $21=$recv($22)._or_((function(){
  49356. return $core.withContext(function($ctx2) {
  49357. return (1).__gt((2));
  49358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  49359. }));
  49360. $20=self._assert_($21);
  49361. return self;
  49362. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  49363. },
  49364. args: [],
  49365. 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 ])",
  49366. referencedClasses: [],
  49367. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  49368. }),
  49369. $globals.BooleanTest);
  49370. $core.addMethod(
  49371. $core.method({
  49372. selector: "testNonBooleanError",
  49373. protocol: 'tests',
  49374. fn: function (){
  49375. var self=this;
  49376. function $NonBooleanReceiver(){return $globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  49377. return $core.withContext(function($ctx1) {
  49378. self._should_raise_((function(){
  49379. return $core.withContext(function($ctx2) {
  49380. if($core.assert("")){
  49381. } else {
  49382. };
  49383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49384. }),$NonBooleanReceiver());
  49385. return self;
  49386. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  49387. },
  49388. args: [],
  49389. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  49390. referencedClasses: ["NonBooleanReceiver"],
  49391. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  49392. }),
  49393. $globals.BooleanTest);
  49394. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  49395. $core.addMethod(
  49396. $core.method({
  49397. selector: "setUp",
  49398. protocol: 'running',
  49399. fn: function (){
  49400. var self=this;
  49401. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  49402. return $core.withContext(function($ctx1) {
  49403. self["@builder"]=$recv($ClassBuilder())._new();
  49404. return self;
  49405. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  49406. },
  49407. args: [],
  49408. source: "setUp\x0a\x09builder := ClassBuilder new",
  49409. referencedClasses: ["ClassBuilder"],
  49410. messageSends: ["new"]
  49411. }),
  49412. $globals.ClassBuilderTest);
  49413. $core.addMethod(
  49414. $core.method({
  49415. selector: "tearDown",
  49416. protocol: 'running',
  49417. fn: function (){
  49418. var self=this;
  49419. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49420. return $core.withContext(function($ctx1) {
  49421. var $1,$receiver;
  49422. $1=self["@theClass"];
  49423. if(($receiver = $1) == null || $receiver.isNil){
  49424. $1;
  49425. } else {
  49426. $recv($Smalltalk())._removeClass_(self["@theClass"]);
  49427. self["@theClass"]=nil;
  49428. self["@theClass"];
  49429. };
  49430. return self;
  49431. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  49432. },
  49433. args: [],
  49434. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  49435. referencedClasses: ["Smalltalk"],
  49436. messageSends: ["ifNotNil:", "removeClass:"]
  49437. }),
  49438. $globals.ClassBuilderTest);
  49439. $core.addMethod(
  49440. $core.method({
  49441. selector: "testClassCopy",
  49442. protocol: 'tests',
  49443. fn: function (){
  49444. var self=this;
  49445. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49446. return $core.withContext(function($ctx1) {
  49447. var $2,$1,$4,$3,$6,$5,$8,$7;
  49448. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49449. $2=$recv(self["@theClass"])._superclass();
  49450. $ctx1.sendIdx["superclass"]=1;
  49451. $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
  49452. $ctx1.sendIdx["=="]=1;
  49453. self._assert_($1);
  49454. $ctx1.sendIdx["assert:"]=1;
  49455. $4=$recv(self["@theClass"])._instanceVariableNames();
  49456. $ctx1.sendIdx["instanceVariableNames"]=1;
  49457. $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
  49458. $ctx1.sendIdx["=="]=2;
  49459. self._assert_($3);
  49460. $ctx1.sendIdx["assert:"]=2;
  49461. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  49462. $ctx1.sendIdx["assert:equals:"]=1;
  49463. $6=$recv(self["@theClass"])._package();
  49464. $ctx1.sendIdx["package"]=1;
  49465. $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
  49466. self._assert_($5);
  49467. $8=$recv(self["@theClass"])._methodDictionary();
  49468. $ctx1.sendIdx["methodDictionary"]=1;
  49469. $7=$recv($8)._keys();
  49470. $ctx1.sendIdx["keys"]=1;
  49471. self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
  49472. return self;
  49473. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  49474. },
  49475. args: [],
  49476. 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",
  49477. referencedClasses: ["ObjectMock"],
  49478. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  49479. }),
  49480. $globals.ClassBuilderTest);
  49481. $core.addMethod(
  49482. $core.method({
  49483. selector: "testClassMigration",
  49484. protocol: 'tests',
  49485. fn: function (){
  49486. var self=this;
  49487. var instance,oldClass;
  49488. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49489. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49490. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49491. return $core.withContext(function($ctx1) {
  49492. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  49493. oldClass=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49494. $2=$recv($Smalltalk())._globals();
  49495. $ctx1.sendIdx["globals"]=1;
  49496. $1=$recv($2)._at_("ObjectMock2");
  49497. $ctx1.sendIdx["at:"]=1;
  49498. instance=$recv($1)._new();
  49499. $4=$recv($Smalltalk())._globals();
  49500. $ctx1.sendIdx["globals"]=2;
  49501. $3=$recv($4)._at_("ObjectMock2");
  49502. $ctx1.sendIdx["at:"]=2;
  49503. $recv($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  49504. $5=$recv(oldClass).__eq_eq($ObjectMock2());
  49505. $ctx1.sendIdx["=="]=1;
  49506. self._deny_($5);
  49507. $ctx1.sendIdx["deny:"]=1;
  49508. $6=$recv($recv($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  49509. $ctx1.sendIdx["=="]=2;
  49510. self._assert_($6);
  49511. $ctx1.sendIdx["assert:"]=1;
  49512. self._assert_($recv($recv($ObjectMock2())._instanceVariableNames())._isEmpty());
  49513. $ctx1.sendIdx["assert:"]=2;
  49514. $7=$recv($ObjectMock2())._selectors();
  49515. $ctx1.sendIdx["selectors"]=1;
  49516. self._assert_equals_($7,$recv(oldClass)._selectors());
  49517. $ctx1.sendIdx["assert:equals:"]=1;
  49518. $8=$recv($ObjectMock2())._comment();
  49519. $ctx1.sendIdx["comment"]=1;
  49520. self._assert_equals_($8,$recv(oldClass)._comment());
  49521. $ctx1.sendIdx["assert:equals:"]=2;
  49522. $9=$recv($recv($ObjectMock2())._package())._name();
  49523. $ctx1.sendIdx["name"]=1;
  49524. self._assert_equals_($9,"Kernel-Tests");
  49525. $11=$recv(instance)._class();
  49526. $ctx1.sendIdx["class"]=1;
  49527. $10=$recv($11).__eq_eq($ObjectMock2());
  49528. self._deny_($10);
  49529. self._assert_($recv($recv($recv($Smalltalk())._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  49530. $recv($Smalltalk())._removeClass_($ObjectMock2());
  49531. return self;
  49532. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  49533. },
  49534. args: [],
  49535. 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",
  49536. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  49537. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  49538. }),
  49539. $globals.ClassBuilderTest);
  49540. $core.addMethod(
  49541. $core.method({
  49542. selector: "testClassMigrationWithClassInstanceVariables",
  49543. protocol: 'tests',
  49544. fn: function (){
  49545. var self=this;
  49546. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49547. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49548. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49549. return $core.withContext(function($ctx1) {
  49550. var $1;
  49551. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49552. $1=$recv($ObjectMock2())._class();
  49553. $ctx1.sendIdx["class"]=1;
  49554. $recv($1)._instanceVariableNames_("foo bar");
  49555. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  49556. self._assert_equals_($recv($recv($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  49557. $recv($Smalltalk())._removeClass_($ObjectMock2());
  49558. return self;
  49559. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  49560. },
  49561. args: [],
  49562. 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",
  49563. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  49564. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  49565. }),
  49566. $globals.ClassBuilderTest);
  49567. $core.addMethod(
  49568. $core.method({
  49569. selector: "testClassMigrationWithSubclasses",
  49570. protocol: 'tests',
  49571. fn: function (){
  49572. var self=this;
  49573. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49574. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49575. function $ObjectMock3(){return $globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  49576. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49577. function $ObjectMock4(){return $globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  49578. return $core.withContext(function($ctx1) {
  49579. var $2,$1,$4,$3;
  49580. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49581. $recv($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  49582. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  49583. $recv($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  49584. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  49585. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  49586. $2=$recv($ObjectMock())._subclasses();
  49587. $ctx1.sendIdx["subclasses"]=1;
  49588. $1=$recv($2)._includes_($ObjectMock2());
  49589. $ctx1.sendIdx["includes:"]=1;
  49590. self._assert_($1);
  49591. $ctx1.sendIdx["assert:"]=1;
  49592. $4=$recv($ObjectMock2())._subclasses();
  49593. $ctx1.sendIdx["subclasses"]=2;
  49594. $3=$recv($4)._includes_($ObjectMock3());
  49595. $ctx1.sendIdx["includes:"]=2;
  49596. self._assert_($3);
  49597. $ctx1.sendIdx["assert:"]=2;
  49598. self._assert_($recv($recv($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  49599. $recv($recv($ObjectMock())._allSubclasses())._do_((function(each){
  49600. return $core.withContext(function($ctx2) {
  49601. return $recv($Smalltalk())._removeClass_(each);
  49602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49603. }));
  49604. return self;
  49605. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  49606. },
  49607. args: [],
  49608. 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 ]",
  49609. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  49610. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  49611. }),
  49612. $globals.ClassBuilderTest);
  49613. $core.addMethod(
  49614. $core.method({
  49615. selector: "testInstanceVariableNames",
  49616. protocol: 'tests',
  49617. fn: function (){
  49618. var self=this;
  49619. return $core.withContext(function($ctx1) {
  49620. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  49621. return self;
  49622. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  49623. },
  49624. args: [],
  49625. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  49626. referencedClasses: [],
  49627. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  49628. }),
  49629. $globals.ClassBuilderTest);
  49630. $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  49631. $core.addMethod(
  49632. $core.method({
  49633. selector: "jsConstructor",
  49634. protocol: 'running',
  49635. fn: function (){
  49636. var self=this;
  49637. return $core.withContext(function($ctx1) {
  49638. function Foo(){}
  49639. Foo.prototype.valueOf = function () {return 4;};
  49640. return Foo;
  49641. ;
  49642. return self;
  49643. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  49644. },
  49645. args: [],
  49646. source: "jsConstructor\x0a\x09<\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09>",
  49647. referencedClasses: [],
  49648. messageSends: []
  49649. }),
  49650. $globals.ClassTest);
  49651. $core.addMethod(
  49652. $core.method({
  49653. selector: "setUp",
  49654. protocol: 'running',
  49655. fn: function (){
  49656. var self=this;
  49657. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  49658. return $core.withContext(function($ctx1) {
  49659. self["@builder"]=$recv($ClassBuilder())._new();
  49660. return self;
  49661. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  49662. },
  49663. args: [],
  49664. source: "setUp\x0a\x09builder := ClassBuilder new",
  49665. referencedClasses: ["ClassBuilder"],
  49666. messageSends: ["new"]
  49667. }),
  49668. $globals.ClassTest);
  49669. $core.addMethod(
  49670. $core.method({
  49671. selector: "tearDown",
  49672. protocol: 'running',
  49673. fn: function (){
  49674. var self=this;
  49675. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49676. return $core.withContext(function($ctx1) {
  49677. var $1,$receiver;
  49678. $1=self["@theClass"];
  49679. if(($receiver = $1) == null || $receiver.isNil){
  49680. $1;
  49681. } else {
  49682. $recv($Smalltalk())._removeClass_(self["@theClass"]);
  49683. self["@theClass"]=nil;
  49684. self["@theClass"];
  49685. };
  49686. return self;
  49687. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  49688. },
  49689. args: [],
  49690. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  49691. referencedClasses: ["Smalltalk"],
  49692. messageSends: ["ifNotNil:", "removeClass:"]
  49693. }),
  49694. $globals.ClassTest);
  49695. $core.addMethod(
  49696. $core.method({
  49697. selector: "testSetJavaScriptConstructor",
  49698. protocol: 'tests',
  49699. fn: function (){
  49700. var self=this;
  49701. var instance;
  49702. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49703. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  49704. return $core.withContext(function($ctx1) {
  49705. var $2,$1,$4,$3,$6,$5,$8,$7;
  49706. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49707. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  49708. $2=$recv(self["@theClass"])._superclass();
  49709. $ctx1.sendIdx["superclass"]=1;
  49710. $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
  49711. $ctx1.sendIdx["=="]=1;
  49712. self._assert_($1);
  49713. $ctx1.sendIdx["assert:"]=1;
  49714. $4=$recv(self["@theClass"])._instanceVariableNames();
  49715. $ctx1.sendIdx["instanceVariableNames"]=1;
  49716. $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
  49717. $ctx1.sendIdx["=="]=2;
  49718. self._assert_($3);
  49719. $ctx1.sendIdx["assert:"]=2;
  49720. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  49721. $ctx1.sendIdx["assert:equals:"]=1;
  49722. $6=$recv(self["@theClass"])._package();
  49723. $ctx1.sendIdx["package"]=1;
  49724. $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
  49725. $ctx1.sendIdx["=="]=3;
  49726. self._assert_($5);
  49727. $ctx1.sendIdx["assert:"]=3;
  49728. $8=$recv(self["@theClass"])._methodDictionary();
  49729. $ctx1.sendIdx["methodDictionary"]=1;
  49730. $7=$recv($8)._keys();
  49731. $ctx1.sendIdx["keys"]=1;
  49732. self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
  49733. $ctx1.sendIdx["assert:equals:"]=2;
  49734. instance=$recv(self["@theClass"])._new();
  49735. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  49736. self._assert_equals_($recv(instance)._value(),(4));
  49737. $ctx1.sendIdx["assert:equals:"]=3;
  49738. self._shouldnt_raise_((function(){
  49739. return $core.withContext(function($ctx2) {
  49740. return $recv(instance)._foo_((9));
  49741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49742. }),$Error());
  49743. self._assert_equals_($recv(instance)._foo(),(9));
  49744. return self;
  49745. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  49746. },
  49747. args: [],
  49748. source: "testSetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javascriptConstructor: self jsConstructor.\x0a\x09\x22part took from copy class test\x22\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys.\x0a\x09\x22testing specific to late-wrapped class\x22\x0a\x09instance := theClass new.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  49749. referencedClasses: ["ObjectMock", "Error"],
  49750. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  49751. }),
  49752. $globals.ClassTest);
  49753. $core.addClass('CollectionTest', $globals.TestCase, [], 'Kernel-Tests');
  49754. $core.addMethod(
  49755. $core.method({
  49756. selector: "assertSameContents:as:",
  49757. protocol: 'convenience',
  49758. fn: function (aCollection,anotherCollection){
  49759. var self=this;
  49760. return $core.withContext(function($ctx1) {
  49761. var $2,$1,$4,$3;
  49762. $2=$recv(aCollection)._size();
  49763. $ctx1.sendIdx["size"]=1;
  49764. $1=$recv($2).__eq($recv(anotherCollection)._size());
  49765. $ctx1.sendIdx["="]=1;
  49766. self._assert_($1);
  49767. $ctx1.sendIdx["assert:"]=1;
  49768. $recv(aCollection)._do_((function(each){
  49769. return $core.withContext(function($ctx2) {
  49770. $4=$recv(aCollection)._occurrencesOf_(each);
  49771. $ctx2.sendIdx["occurrencesOf:"]=1;
  49772. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  49773. return self._assert_($3);
  49774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49775. }));
  49776. return self;
  49777. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  49778. },
  49779. args: ["aCollection", "anotherCollection"],
  49780. 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)) ]",
  49781. referencedClasses: [],
  49782. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  49783. }),
  49784. $globals.CollectionTest);
  49785. $core.addMethod(
  49786. $core.method({
  49787. selector: "collection",
  49788. protocol: 'fixture',
  49789. fn: function (){
  49790. var self=this;
  49791. return $core.withContext(function($ctx1) {
  49792. self._subclassResponsibility();
  49793. return self;
  49794. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  49795. },
  49796. args: [],
  49797. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  49798. referencedClasses: [],
  49799. messageSends: ["subclassResponsibility"]
  49800. }),
  49801. $globals.CollectionTest);
  49802. $core.addMethod(
  49803. $core.method({
  49804. selector: "collectionClass",
  49805. protocol: 'fixture',
  49806. fn: function (){
  49807. var self=this;
  49808. return $core.withContext(function($ctx1) {
  49809. var $1;
  49810. $1=$recv(self._class())._collectionClass();
  49811. return $1;
  49812. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  49813. },
  49814. args: [],
  49815. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  49816. referencedClasses: [],
  49817. messageSends: ["collectionClass", "class"]
  49818. }),
  49819. $globals.CollectionTest);
  49820. $core.addMethod(
  49821. $core.method({
  49822. selector: "collectionOfPrintStrings",
  49823. protocol: 'fixture',
  49824. fn: function (){
  49825. var self=this;
  49826. return $core.withContext(function($ctx1) {
  49827. self._subclassResponsibility();
  49828. return self;
  49829. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  49830. },
  49831. args: [],
  49832. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  49833. referencedClasses: [],
  49834. messageSends: ["subclassResponsibility"]
  49835. }),
  49836. $globals.CollectionTest);
  49837. $core.addMethod(
  49838. $core.method({
  49839. selector: "collectionSize",
  49840. protocol: 'fixture',
  49841. fn: function (){
  49842. var self=this;
  49843. return $core.withContext(function($ctx1) {
  49844. self._subclassResponsibility();
  49845. return self;
  49846. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  49847. },
  49848. args: [],
  49849. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  49850. referencedClasses: [],
  49851. messageSends: ["subclassResponsibility"]
  49852. }),
  49853. $globals.CollectionTest);
  49854. $core.addMethod(
  49855. $core.method({
  49856. selector: "collectionWithDuplicates",
  49857. protocol: 'fixture',
  49858. fn: function (){
  49859. var self=this;
  49860. return $core.withContext(function($ctx1) {
  49861. self._subclassResponsibility();
  49862. return self;
  49863. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  49864. },
  49865. args: [],
  49866. 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",
  49867. referencedClasses: [],
  49868. messageSends: ["subclassResponsibility"]
  49869. }),
  49870. $globals.CollectionTest);
  49871. $core.addMethod(
  49872. $core.method({
  49873. selector: "collectionWithNewValue",
  49874. protocol: 'fixture',
  49875. fn: function (){
  49876. var self=this;
  49877. return $core.withContext(function($ctx1) {
  49878. self._subclassResponsibility();
  49879. return self;
  49880. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  49881. },
  49882. args: [],
  49883. 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",
  49884. referencedClasses: [],
  49885. messageSends: ["subclassResponsibility"]
  49886. }),
  49887. $globals.CollectionTest);
  49888. $core.addMethod(
  49889. $core.method({
  49890. selector: "isCollectionReadOnly",
  49891. protocol: 'testing',
  49892. fn: function (){
  49893. var self=this;
  49894. return false;
  49895. },
  49896. args: [],
  49897. source: "isCollectionReadOnly\x0a\x09^ false",
  49898. referencedClasses: [],
  49899. messageSends: []
  49900. }),
  49901. $globals.CollectionTest);
  49902. $core.addMethod(
  49903. $core.method({
  49904. selector: "sampleNewValue",
  49905. protocol: 'fixture',
  49906. fn: function (){
  49907. var self=this;
  49908. return "N";
  49909. },
  49910. args: [],
  49911. 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'",
  49912. referencedClasses: [],
  49913. messageSends: []
  49914. }),
  49915. $globals.CollectionTest);
  49916. $core.addMethod(
  49917. $core.method({
  49918. selector: "sampleNewValueAsCollection",
  49919. protocol: 'fixture',
  49920. fn: function (){
  49921. var self=this;
  49922. return $core.withContext(function($ctx1) {
  49923. var $1;
  49924. $1=$recv(self._collectionClass())._with_(self._sampleNewValue());
  49925. return $1;
  49926. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  49927. },
  49928. args: [],
  49929. 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",
  49930. referencedClasses: [],
  49931. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  49932. }),
  49933. $globals.CollectionTest);
  49934. $core.addMethod(
  49935. $core.method({
  49936. selector: "testAddAll",
  49937. protocol: 'tests',
  49938. fn: function (){
  49939. var self=this;
  49940. return $core.withContext(function($ctx1) {
  49941. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  49942. $2=self._collection();
  49943. $ctx1.sendIdx["collection"]=1;
  49944. $3=$2;
  49945. $5=self._collectionClass();
  49946. $ctx1.sendIdx["collectionClass"]=1;
  49947. $4=$recv($5)._new();
  49948. $ctx1.sendIdx["new"]=1;
  49949. $recv($3)._addAll_($4);
  49950. $ctx1.sendIdx["addAll:"]=1;
  49951. $6=$recv($2)._yourself();
  49952. $ctx1.sendIdx["yourself"]=1;
  49953. $1=$6;
  49954. $7=self._collection();
  49955. $ctx1.sendIdx["collection"]=2;
  49956. self._assert_equals_($1,$7);
  49957. $ctx1.sendIdx["assert:equals:"]=1;
  49958. $10=self._collectionClass();
  49959. $ctx1.sendIdx["collectionClass"]=2;
  49960. $9=$recv($10)._new();
  49961. $ctx1.sendIdx["new"]=2;
  49962. $11=$9;
  49963. $12=self._collection();
  49964. $ctx1.sendIdx["collection"]=3;
  49965. $recv($11)._addAll_($12);
  49966. $ctx1.sendIdx["addAll:"]=2;
  49967. $13=$recv($9)._yourself();
  49968. $ctx1.sendIdx["yourself"]=2;
  49969. $8=$13;
  49970. $14=self._collection();
  49971. $ctx1.sendIdx["collection"]=4;
  49972. self._assert_equals_($8,$14);
  49973. $ctx1.sendIdx["assert:equals:"]=2;
  49974. $17=self._collectionClass();
  49975. $ctx1.sendIdx["collectionClass"]=3;
  49976. $16=$recv($17)._new();
  49977. $ctx1.sendIdx["new"]=3;
  49978. $18=$16;
  49979. $20=self._collectionClass();
  49980. $ctx1.sendIdx["collectionClass"]=4;
  49981. $19=$recv($20)._new();
  49982. $ctx1.sendIdx["new"]=4;
  49983. $recv($18)._addAll_($19);
  49984. $ctx1.sendIdx["addAll:"]=3;
  49985. $21=$recv($16)._yourself();
  49986. $ctx1.sendIdx["yourself"]=3;
  49987. $15=$21;
  49988. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49989. $ctx1.sendIdx["assert:equals:"]=3;
  49990. $23=self._collection();
  49991. $ctx1.sendIdx["collection"]=5;
  49992. $24=$23;
  49993. $25=self._sampleNewValueAsCollection();
  49994. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49995. $recv($24)._addAll_($25);
  49996. $ctx1.sendIdx["addAll:"]=4;
  49997. $26=$recv($23)._yourself();
  49998. $ctx1.sendIdx["yourself"]=4;
  49999. $22=$26;
  50000. $27=self._collectionWithNewValue();
  50001. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50002. self._assert_equals_($22,$27);
  50003. $28=self._sampleNewValueAsCollection();
  50004. $recv($28)._addAll_(self._collection());
  50005. $29=$recv($28)._yourself();
  50006. self._assertSameContents_as_($29,self._collectionWithNewValue());
  50007. return self;
  50008. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  50009. },
  50010. args: [],
  50011. 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",
  50012. referencedClasses: [],
  50013. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  50014. }),
  50015. $globals.CollectionTest);
  50016. $core.addMethod(
  50017. $core.method({
  50018. selector: "testAllSatisfy",
  50019. protocol: 'tests',
  50020. fn: function (){
  50021. var self=this;
  50022. var collection,anyOne;
  50023. return $core.withContext(function($ctx1) {
  50024. var $1;
  50025. collection=self._collection();
  50026. anyOne=$recv(collection)._anyOne();
  50027. $1=$recv(collection)._allSatisfy_((function(each){
  50028. return $core.withContext(function($ctx2) {
  50029. return $recv(collection)._includes_(each);
  50030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50031. }));
  50032. $ctx1.sendIdx["allSatisfy:"]=1;
  50033. self._assert_($1);
  50034. self._deny_($recv(collection)._allSatisfy_((function(each){
  50035. return $core.withContext(function($ctx2) {
  50036. return $recv(each).__tild_eq(anyOne);
  50037. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50038. })));
  50039. return self;
  50040. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  50041. },
  50042. args: [],
  50043. 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 ])",
  50044. referencedClasses: [],
  50045. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  50046. }),
  50047. $globals.CollectionTest);
  50048. $core.addMethod(
  50049. $core.method({
  50050. selector: "testAnyOne",
  50051. protocol: 'tests',
  50052. fn: function (){
  50053. var self=this;
  50054. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50055. return $core.withContext(function($ctx1) {
  50056. var $2,$1;
  50057. self._should_raise_((function(){
  50058. return $core.withContext(function($ctx2) {
  50059. return $recv($recv(self._collectionClass())._new())._anyOne();
  50060. $ctx2.sendIdx["anyOne"]=1;
  50061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50062. }),$Error());
  50063. $2=self._collection();
  50064. $ctx1.sendIdx["collection"]=1;
  50065. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  50066. self._assert_($1);
  50067. return self;
  50068. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  50069. },
  50070. args: [],
  50071. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  50072. referencedClasses: ["Error"],
  50073. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  50074. }),
  50075. $globals.CollectionTest);
  50076. $core.addMethod(
  50077. $core.method({
  50078. selector: "testAnySatisfy",
  50079. protocol: 'tests',
  50080. fn: function (){
  50081. var self=this;
  50082. var anyOne;
  50083. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50084. return $core.withContext(function($ctx1) {
  50085. var $1,$3,$2;
  50086. $1=self._collection();
  50087. $ctx1.sendIdx["collection"]=1;
  50088. anyOne=$recv($1)._anyOne();
  50089. $3=self._collection();
  50090. $ctx1.sendIdx["collection"]=2;
  50091. $2=$recv($3)._anySatisfy_((function(each){
  50092. return $core.withContext(function($ctx2) {
  50093. return $recv(each).__eq(anyOne);
  50094. $ctx2.sendIdx["="]=1;
  50095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50096. }));
  50097. $ctx1.sendIdx["anySatisfy:"]=1;
  50098. self._assert_($2);
  50099. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  50100. return $core.withContext(function($ctx2) {
  50101. return $recv(each).__eq($recv($Object())._new());
  50102. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50103. })));
  50104. return self;
  50105. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  50106. },
  50107. args: [],
  50108. 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 ])",
  50109. referencedClasses: ["Object"],
  50110. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  50111. }),
  50112. $globals.CollectionTest);
  50113. $core.addMethod(
  50114. $core.method({
  50115. selector: "testAsArray",
  50116. protocol: 'tests',
  50117. fn: function (){
  50118. var self=this;
  50119. return $core.withContext(function($ctx1) {
  50120. var $1;
  50121. $1=self._collection();
  50122. $ctx1.sendIdx["collection"]=1;
  50123. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  50124. return self;
  50125. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  50126. },
  50127. args: [],
  50128. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  50129. referencedClasses: [],
  50130. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  50131. }),
  50132. $globals.CollectionTest);
  50133. $core.addMethod(
  50134. $core.method({
  50135. selector: "testAsOrderedCollection",
  50136. protocol: 'tests',
  50137. fn: function (){
  50138. var self=this;
  50139. return $core.withContext(function($ctx1) {
  50140. var $1;
  50141. $1=self._collection();
  50142. $ctx1.sendIdx["collection"]=1;
  50143. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  50144. return self;
  50145. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  50146. },
  50147. args: [],
  50148. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  50149. referencedClasses: [],
  50150. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  50151. }),
  50152. $globals.CollectionTest);
  50153. $core.addMethod(
  50154. $core.method({
  50155. selector: "testAsSet",
  50156. protocol: 'tests',
  50157. fn: function (){
  50158. var self=this;
  50159. var c,set;
  50160. return $core.withContext(function($ctx1) {
  50161. c=self._collectionWithDuplicates();
  50162. set=$recv(c)._asSet();
  50163. self._assert_equals_($recv(set)._size(),(5));
  50164. $recv(c)._do_((function(each){
  50165. return $core.withContext(function($ctx2) {
  50166. return self._assert_($recv(set)._includes_(each));
  50167. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50168. }));
  50169. return self;
  50170. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  50171. },
  50172. args: [],
  50173. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  50174. referencedClasses: [],
  50175. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  50176. }),
  50177. $globals.CollectionTest);
  50178. $core.addMethod(
  50179. $core.method({
  50180. selector: "testCollect",
  50181. protocol: 'tests',
  50182. fn: function (){
  50183. var self=this;
  50184. return $core.withContext(function($ctx1) {
  50185. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  50186. $2=self._collection();
  50187. $ctx1.sendIdx["collection"]=1;
  50188. $1=$recv($2)._collect_((function(each){
  50189. return each;
  50190. }));
  50191. $ctx1.sendIdx["collect:"]=1;
  50192. $3=self._collection();
  50193. $ctx1.sendIdx["collection"]=2;
  50194. self._assert_equals_($1,$3);
  50195. $ctx1.sendIdx["assert:equals:"]=1;
  50196. $5=self._collectionWithNewValue();
  50197. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50198. $4=$recv($5)._collect_((function(each){
  50199. return each;
  50200. }));
  50201. $ctx1.sendIdx["collect:"]=2;
  50202. self._assert_equals_($4,self._collectionWithNewValue());
  50203. $ctx1.sendIdx["assert:equals:"]=2;
  50204. $8=self._collectionClass();
  50205. $ctx1.sendIdx["collectionClass"]=1;
  50206. $7=$recv($8)._new();
  50207. $ctx1.sendIdx["new"]=1;
  50208. $6=$recv($7)._collect_((function(each){
  50209. return $core.withContext(function($ctx2) {
  50210. return $recv(each)._printString();
  50211. $ctx2.sendIdx["printString"]=1;
  50212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  50213. }));
  50214. $ctx1.sendIdx["collect:"]=3;
  50215. self._assert_equals_($6,$recv(self._collectionClass())._new());
  50216. $ctx1.sendIdx["assert:equals:"]=3;
  50217. $11=self._collection();
  50218. $ctx1.sendIdx["collection"]=3;
  50219. $10=$recv($11)._collect_((function(){
  50220. return $core.withContext(function($ctx2) {
  50221. return self._sampleNewValue();
  50222. $ctx2.sendIdx["sampleNewValue"]=1;
  50223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  50224. }));
  50225. $ctx1.sendIdx["collect:"]=4;
  50226. $9=$recv($10)._detect_((function(){
  50227. return true;
  50228. }));
  50229. self._assert_equals_($9,self._sampleNewValue());
  50230. $ctx1.sendIdx["assert:equals:"]=4;
  50231. self._assert_equals_($recv(self._collection())._collect_((function(each){
  50232. return $core.withContext(function($ctx2) {
  50233. return $recv(each)._printString();
  50234. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50235. })),self._collectionOfPrintStrings());
  50236. return self;
  50237. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  50238. },
  50239. args: [],
  50240. 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",
  50241. referencedClasses: [],
  50242. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  50243. }),
  50244. $globals.CollectionTest);
  50245. $core.addMethod(
  50246. $core.method({
  50247. selector: "testComma",
  50248. protocol: 'tests',
  50249. fn: function (){
  50250. var self=this;
  50251. return $core.withContext(function($ctx1) {
  50252. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  50253. $2=self._collection();
  50254. $ctx1.sendIdx["collection"]=1;
  50255. $4=self._collectionClass();
  50256. $ctx1.sendIdx["collectionClass"]=1;
  50257. $3=$recv($4)._new();
  50258. $ctx1.sendIdx["new"]=1;
  50259. $1=$recv($2).__comma($3);
  50260. $ctx1.sendIdx[","]=1;
  50261. $5=self._collection();
  50262. $ctx1.sendIdx["collection"]=2;
  50263. self._assert_equals_($1,$5);
  50264. $ctx1.sendIdx["assert:equals:"]=1;
  50265. $8=self._collectionClass();
  50266. $ctx1.sendIdx["collectionClass"]=2;
  50267. $7=$recv($8)._new();
  50268. $ctx1.sendIdx["new"]=2;
  50269. $9=self._collection();
  50270. $ctx1.sendIdx["collection"]=3;
  50271. $6=$recv($7).__comma($9);
  50272. $ctx1.sendIdx[","]=2;
  50273. $10=self._collection();
  50274. $ctx1.sendIdx["collection"]=4;
  50275. self._assert_equals_($6,$10);
  50276. $ctx1.sendIdx["assert:equals:"]=2;
  50277. $13=self._collectionClass();
  50278. $ctx1.sendIdx["collectionClass"]=3;
  50279. $12=$recv($13)._new();
  50280. $ctx1.sendIdx["new"]=3;
  50281. $15=self._collectionClass();
  50282. $ctx1.sendIdx["collectionClass"]=4;
  50283. $14=$recv($15)._new();
  50284. $ctx1.sendIdx["new"]=4;
  50285. $11=$recv($12).__comma($14);
  50286. $ctx1.sendIdx[","]=3;
  50287. self._assert_equals_($11,$recv(self._collectionClass())._new());
  50288. $ctx1.sendIdx["assert:equals:"]=3;
  50289. $17=self._collection();
  50290. $ctx1.sendIdx["collection"]=5;
  50291. $18=self._sampleNewValueAsCollection();
  50292. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  50293. $16=$recv($17).__comma($18);
  50294. $ctx1.sendIdx[","]=4;
  50295. $19=self._collectionWithNewValue();
  50296. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50297. self._assert_equals_($16,$19);
  50298. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  50299. return self;
  50300. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  50301. },
  50302. args: [],
  50303. 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",
  50304. referencedClasses: [],
  50305. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  50306. }),
  50307. $globals.CollectionTest);
  50308. $core.addMethod(
  50309. $core.method({
  50310. selector: "testDetect",
  50311. protocol: 'tests',
  50312. fn: function (){
  50313. var self=this;
  50314. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50315. return $core.withContext(function($ctx1) {
  50316. var $1,$2,$3,$4,$6,$5,$7;
  50317. self._shouldnt_raise_((function(){
  50318. return $core.withContext(function($ctx2) {
  50319. $1=self._collection();
  50320. $ctx2.sendIdx["collection"]=1;
  50321. return $recv($1)._detect_((function(){
  50322. return true;
  50323. }));
  50324. $ctx2.sendIdx["detect:"]=1;
  50325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50326. }),$Error());
  50327. self._should_raise_((function(){
  50328. return $core.withContext(function($ctx2) {
  50329. $2=self._collection();
  50330. $ctx2.sendIdx["collection"]=2;
  50331. return $recv($2)._detect_((function(){
  50332. return false;
  50333. }));
  50334. $ctx2.sendIdx["detect:"]=2;
  50335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50336. }),$Error());
  50337. $ctx1.sendIdx["should:raise:"]=1;
  50338. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  50339. return true;
  50340. }));
  50341. $ctx1.sendIdx["detect:"]=3;
  50342. $4=self._sampleNewValue();
  50343. $ctx1.sendIdx["sampleNewValue"]=1;
  50344. self._assert_equals_($3,$4);
  50345. $ctx1.sendIdx["assert:equals:"]=1;
  50346. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  50347. return $core.withContext(function($ctx2) {
  50348. $6=self._sampleNewValue();
  50349. $ctx2.sendIdx["sampleNewValue"]=2;
  50350. return $recv(each).__eq($6);
  50351. $ctx2.sendIdx["="]=1;
  50352. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50353. }));
  50354. $ctx1.sendIdx["detect:"]=4;
  50355. $7=self._sampleNewValue();
  50356. $ctx1.sendIdx["sampleNewValue"]=3;
  50357. self._assert_equals_($5,$7);
  50358. self._should_raise_((function(){
  50359. return $core.withContext(function($ctx2) {
  50360. return $recv(self._collection())._detect_((function(each){
  50361. return $core.withContext(function($ctx3) {
  50362. return $recv(each).__eq(self._sampleNewValue());
  50363. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  50364. }));
  50365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  50366. }),$Error());
  50367. return self;
  50368. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  50369. },
  50370. args: [],
  50371. 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",
  50372. referencedClasses: ["Error"],
  50373. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  50374. }),
  50375. $globals.CollectionTest);
  50376. $core.addMethod(
  50377. $core.method({
  50378. selector: "testDetectIfNone",
  50379. protocol: 'tests',
  50380. fn: function (){
  50381. var self=this;
  50382. var sentinel;
  50383. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50384. return $core.withContext(function($ctx1) {
  50385. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  50386. sentinel=$recv($Object())._new();
  50387. $3=self._collection();
  50388. $ctx1.sendIdx["collection"]=1;
  50389. $2=$recv($3)._detect_ifNone_((function(){
  50390. return true;
  50391. }),(function(){
  50392. return sentinel;
  50393. }));
  50394. $ctx1.sendIdx["detect:ifNone:"]=1;
  50395. $1=$recv($2).__tild_eq(sentinel);
  50396. self._assert_($1);
  50397. $5=self._collection();
  50398. $ctx1.sendIdx["collection"]=2;
  50399. $4=$recv($5)._detect_ifNone_((function(){
  50400. return false;
  50401. }),(function(){
  50402. return sentinel;
  50403. }));
  50404. $ctx1.sendIdx["detect:ifNone:"]=2;
  50405. self._assert_equals_($4,sentinel);
  50406. $ctx1.sendIdx["assert:equals:"]=1;
  50407. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  50408. return true;
  50409. }),(function(){
  50410. return sentinel;
  50411. }));
  50412. $ctx1.sendIdx["detect:ifNone:"]=3;
  50413. $7=self._sampleNewValue();
  50414. $ctx1.sendIdx["sampleNewValue"]=1;
  50415. self._assert_equals_($6,$7);
  50416. $ctx1.sendIdx["assert:equals:"]=2;
  50417. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  50418. return $core.withContext(function($ctx2) {
  50419. $9=self._sampleNewValue();
  50420. $ctx2.sendIdx["sampleNewValue"]=2;
  50421. return $recv(each).__eq($9);
  50422. $ctx2.sendIdx["="]=1;
  50423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  50424. }),(function(){
  50425. return sentinel;
  50426. }));
  50427. $ctx1.sendIdx["detect:ifNone:"]=4;
  50428. $10=self._sampleNewValue();
  50429. $ctx1.sendIdx["sampleNewValue"]=3;
  50430. self._assert_equals_($8,$10);
  50431. $ctx1.sendIdx["assert:equals:"]=3;
  50432. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  50433. return $core.withContext(function($ctx2) {
  50434. return $recv(each).__eq(self._sampleNewValue());
  50435. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  50436. }),(function(){
  50437. return sentinel;
  50438. })),sentinel);
  50439. return self;
  50440. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  50441. },
  50442. args: [],
  50443. 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",
  50444. referencedClasses: ["Object"],
  50445. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  50446. }),
  50447. $globals.CollectionTest);
  50448. $core.addMethod(
  50449. $core.method({
  50450. selector: "testDo",
  50451. protocol: 'tests',
  50452. fn: function (){
  50453. var self=this;
  50454. var newCollection;
  50455. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  50456. return $core.withContext(function($ctx1) {
  50457. var $1,$2;
  50458. newCollection=$recv($OrderedCollection())._new();
  50459. $ctx1.sendIdx["new"]=1;
  50460. $1=self._collection();
  50461. $ctx1.sendIdx["collection"]=1;
  50462. $recv($1)._do_((function(each){
  50463. return $core.withContext(function($ctx2) {
  50464. return $recv(newCollection)._add_(each);
  50465. $ctx2.sendIdx["add:"]=1;
  50466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50467. }));
  50468. $ctx1.sendIdx["do:"]=1;
  50469. self._assertSameContents_as_(self._collection(),newCollection);
  50470. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50471. newCollection=$recv($OrderedCollection())._new();
  50472. $2=self._collectionWithDuplicates();
  50473. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  50474. $recv($2)._do_((function(each){
  50475. return $core.withContext(function($ctx2) {
  50476. return $recv(newCollection)._add_(each);
  50477. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50478. }));
  50479. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  50480. return self;
  50481. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  50482. },
  50483. args: [],
  50484. 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",
  50485. referencedClasses: ["OrderedCollection"],
  50486. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  50487. }),
  50488. $globals.CollectionTest);
  50489. $core.addMethod(
  50490. $core.method({
  50491. selector: "testIfEmptyFamily",
  50492. protocol: 'tests',
  50493. fn: function (){
  50494. var self=this;
  50495. return $core.withContext(function($ctx1) {
  50496. 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;
  50497. $3=self._collectionClass();
  50498. $ctx1.sendIdx["collectionClass"]=1;
  50499. $2=$recv($3)._new();
  50500. $ctx1.sendIdx["new"]=1;
  50501. $1=$recv($2)._ifEmpty_((function(){
  50502. return (42);
  50503. }));
  50504. $ctx1.sendIdx["ifEmpty:"]=1;
  50505. self._assert_equals_($1,(42));
  50506. $ctx1.sendIdx["assert:equals:"]=1;
  50507. $5=self._collection();
  50508. $ctx1.sendIdx["collection"]=1;
  50509. $4=$recv($5)._ifEmpty_((function(){
  50510. return (42);
  50511. }));
  50512. $6=self._collection();
  50513. $ctx1.sendIdx["collection"]=2;
  50514. self._assert_equals_($4,$6);
  50515. $ctx1.sendIdx["assert:equals:"]=2;
  50516. $9=self._collectionClass();
  50517. $ctx1.sendIdx["collectionClass"]=2;
  50518. $8=$recv($9)._new();
  50519. $ctx1.sendIdx["new"]=2;
  50520. $7=$recv($8)._ifNotEmpty_((function(){
  50521. return (42);
  50522. }));
  50523. $ctx1.sendIdx["ifNotEmpty:"]=1;
  50524. $11=self._collectionClass();
  50525. $ctx1.sendIdx["collectionClass"]=3;
  50526. $10=$recv($11)._new();
  50527. $ctx1.sendIdx["new"]=3;
  50528. self._assert_equals_($7,$10);
  50529. $ctx1.sendIdx["assert:equals:"]=3;
  50530. $13=self._collection();
  50531. $ctx1.sendIdx["collection"]=3;
  50532. $12=$recv($13)._ifNotEmpty_((function(){
  50533. return (42);
  50534. }));
  50535. $ctx1.sendIdx["ifNotEmpty:"]=2;
  50536. self._assert_equals_($12,(42));
  50537. $ctx1.sendIdx["assert:equals:"]=4;
  50538. $15=self._collection();
  50539. $ctx1.sendIdx["collection"]=4;
  50540. $14=$recv($15)._ifNotEmpty_((function(col){
  50541. return col;
  50542. }));
  50543. $16=self._collection();
  50544. $ctx1.sendIdx["collection"]=5;
  50545. self._assert_equals_($14,$16);
  50546. $ctx1.sendIdx["assert:equals:"]=5;
  50547. $19=self._collectionClass();
  50548. $ctx1.sendIdx["collectionClass"]=4;
  50549. $18=$recv($19)._new();
  50550. $ctx1.sendIdx["new"]=4;
  50551. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  50552. return (42);
  50553. }),(function(){
  50554. return (999);
  50555. }));
  50556. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  50557. self._assert_equals_($17,(42));
  50558. $ctx1.sendIdx["assert:equals:"]=6;
  50559. $21=self._collection();
  50560. $ctx1.sendIdx["collection"]=6;
  50561. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  50562. return (42);
  50563. }),(function(){
  50564. return (999);
  50565. }));
  50566. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  50567. self._assert_equals_($20,(999));
  50568. $ctx1.sendIdx["assert:equals:"]=7;
  50569. $23=self._collection();
  50570. $ctx1.sendIdx["collection"]=7;
  50571. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  50572. return (42);
  50573. }),(function(col){
  50574. return col;
  50575. }));
  50576. $24=self._collection();
  50577. $ctx1.sendIdx["collection"]=8;
  50578. self._assert_equals_($22,$24);
  50579. $ctx1.sendIdx["assert:equals:"]=8;
  50580. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  50581. return (42);
  50582. }),(function(){
  50583. return (999);
  50584. }));
  50585. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  50586. self._assert_equals_($25,(999));
  50587. $ctx1.sendIdx["assert:equals:"]=9;
  50588. $27=self._collection();
  50589. $ctx1.sendIdx["collection"]=9;
  50590. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  50591. return (42);
  50592. }),(function(){
  50593. return (999);
  50594. }));
  50595. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  50596. self._assert_equals_($26,(42));
  50597. $ctx1.sendIdx["assert:equals:"]=10;
  50598. $29=self._collection();
  50599. $ctx1.sendIdx["collection"]=10;
  50600. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  50601. return col;
  50602. }),(function(){
  50603. return (999);
  50604. }));
  50605. self._assert_equals_($28,self._collection());
  50606. return self;
  50607. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  50608. },
  50609. args: [],
  50610. 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.",
  50611. referencedClasses: [],
  50612. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  50613. }),
  50614. $globals.CollectionTest);
  50615. $core.addMethod(
  50616. $core.method({
  50617. selector: "testIsEmpty",
  50618. protocol: 'tests',
  50619. fn: function (){
  50620. var self=this;
  50621. return $core.withContext(function($ctx1) {
  50622. var $1;
  50623. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  50624. $ctx1.sendIdx["isEmpty"]=1;
  50625. self._assert_($1);
  50626. self._deny_($recv(self._collection())._isEmpty());
  50627. return self;
  50628. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  50629. },
  50630. args: [],
  50631. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  50632. referencedClasses: [],
  50633. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  50634. }),
  50635. $globals.CollectionTest);
  50636. $core.addMethod(
  50637. $core.method({
  50638. selector: "testNoneSatisfy",
  50639. protocol: 'tests',
  50640. fn: function (){
  50641. var self=this;
  50642. var anyOne;
  50643. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50644. return $core.withContext(function($ctx1) {
  50645. var $1,$3,$2;
  50646. $1=self._collection();
  50647. $ctx1.sendIdx["collection"]=1;
  50648. anyOne=$recv($1)._anyOne();
  50649. $3=self._collection();
  50650. $ctx1.sendIdx["collection"]=2;
  50651. $2=$recv($3)._noneSatisfy_((function(each){
  50652. return $core.withContext(function($ctx2) {
  50653. return $recv(each).__eq(anyOne);
  50654. $ctx2.sendIdx["="]=1;
  50655. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50656. }));
  50657. $ctx1.sendIdx["noneSatisfy:"]=1;
  50658. self._deny_($2);
  50659. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  50660. return $core.withContext(function($ctx2) {
  50661. return $recv(each).__eq($recv($Object())._new());
  50662. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50663. })));
  50664. return self;
  50665. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  50666. },
  50667. args: [],
  50668. 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 ])",
  50669. referencedClasses: ["Object"],
  50670. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  50671. }),
  50672. $globals.CollectionTest);
  50673. $core.addMethod(
  50674. $core.method({
  50675. selector: "testRemoveAll",
  50676. protocol: 'tests',
  50677. fn: function (){
  50678. var self=this;
  50679. return $core.withContext(function($ctx1) {
  50680. var $1,$2;
  50681. $1=self._collection();
  50682. $recv($1)._removeAll();
  50683. $2=$recv($1)._yourself();
  50684. self._assert_equals_($2,$recv(self._collectionClass())._new());
  50685. return self;
  50686. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  50687. },
  50688. args: [],
  50689. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  50690. referencedClasses: [],
  50691. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  50692. }),
  50693. $globals.CollectionTest);
  50694. $core.addMethod(
  50695. $core.method({
  50696. selector: "testSelect",
  50697. protocol: 'tests',
  50698. fn: function (){
  50699. var self=this;
  50700. return $core.withContext(function($ctx1) {
  50701. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  50702. $2=self._collection();
  50703. $ctx1.sendIdx["collection"]=1;
  50704. $1=$recv($2)._select_((function(){
  50705. return false;
  50706. }));
  50707. $ctx1.sendIdx["select:"]=1;
  50708. $4=self._collectionClass();
  50709. $ctx1.sendIdx["collectionClass"]=1;
  50710. $3=$recv($4)._new();
  50711. $ctx1.sendIdx["new"]=1;
  50712. self._assert_equals_($1,$3);
  50713. $ctx1.sendIdx["assert:equals:"]=1;
  50714. $6=self._collection();
  50715. $ctx1.sendIdx["collection"]=2;
  50716. $5=$recv($6)._select_((function(){
  50717. return true;
  50718. }));
  50719. $ctx1.sendIdx["select:"]=2;
  50720. $7=self._collection();
  50721. $ctx1.sendIdx["collection"]=3;
  50722. self._assert_equals_($5,$7);
  50723. $ctx1.sendIdx["assert:equals:"]=2;
  50724. $9=self._collectionWithNewValue();
  50725. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50726. $8=$recv($9)._select_((function(each){
  50727. return $core.withContext(function($ctx2) {
  50728. $10=self._sampleNewValue();
  50729. $ctx2.sendIdx["sampleNewValue"]=1;
  50730. return $recv(each).__eq($10);
  50731. $ctx2.sendIdx["="]=1;
  50732. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  50733. }));
  50734. $ctx1.sendIdx["select:"]=3;
  50735. self._assert_equals_($8,self._sampleNewValueAsCollection());
  50736. $ctx1.sendIdx["assert:equals:"]=3;
  50737. $12=self._collectionWithNewValue();
  50738. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50739. $11=$recv($12)._select_((function(each){
  50740. return $core.withContext(function($ctx2) {
  50741. $13=self._sampleNewValue();
  50742. $ctx2.sendIdx["sampleNewValue"]=2;
  50743. return $recv(each).__tild_eq($13);
  50744. $ctx2.sendIdx["~="]=1;
  50745. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  50746. }));
  50747. $ctx1.sendIdx["select:"]=4;
  50748. $14=self._collection();
  50749. $ctx1.sendIdx["collection"]=4;
  50750. self._assert_equals_($11,$14);
  50751. $ctx1.sendIdx["assert:equals:"]=4;
  50752. $16=self._collection();
  50753. $ctx1.sendIdx["collection"]=5;
  50754. $15=$recv($16)._select_((function(each){
  50755. return $core.withContext(function($ctx2) {
  50756. $17=self._sampleNewValue();
  50757. $ctx2.sendIdx["sampleNewValue"]=3;
  50758. return $recv(each).__eq($17);
  50759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  50760. }));
  50761. $ctx1.sendIdx["select:"]=5;
  50762. self._assert_equals_($15,$recv(self._collectionClass())._new());
  50763. $ctx1.sendIdx["assert:equals:"]=5;
  50764. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  50765. return $core.withContext(function($ctx2) {
  50766. return $recv(each).__tild_eq(self._sampleNewValue());
  50767. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50768. })),self._collection());
  50769. return self;
  50770. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  50771. },
  50772. args: [],
  50773. 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",
  50774. referencedClasses: [],
  50775. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  50776. }),
  50777. $globals.CollectionTest);
  50778. $core.addMethod(
  50779. $core.method({
  50780. selector: "testSize",
  50781. protocol: 'tests',
  50782. fn: function (){
  50783. var self=this;
  50784. return $core.withContext(function($ctx1) {
  50785. var $1,$2;
  50786. $1=$recv($recv(self._collectionClass())._new())._size();
  50787. $ctx1.sendIdx["size"]=1;
  50788. self._assert_equals_($1,(0));
  50789. $ctx1.sendIdx["assert:equals:"]=1;
  50790. $2=$recv(self._sampleNewValueAsCollection())._size();
  50791. $ctx1.sendIdx["size"]=2;
  50792. self._assert_equals_($2,(1));
  50793. $ctx1.sendIdx["assert:equals:"]=2;
  50794. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  50795. return self;
  50796. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  50797. },
  50798. args: [],
  50799. 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",
  50800. referencedClasses: [],
  50801. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  50802. }),
  50803. $globals.CollectionTest);
  50804. $core.addMethod(
  50805. $core.method({
  50806. selector: "collectionClass",
  50807. protocol: 'fixture',
  50808. fn: function (){
  50809. var self=this;
  50810. return nil;
  50811. },
  50812. args: [],
  50813. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  50814. referencedClasses: [],
  50815. messageSends: []
  50816. }),
  50817. $globals.CollectionTest.klass);
  50818. $core.addMethod(
  50819. $core.method({
  50820. selector: "isAbstract",
  50821. protocol: 'testing',
  50822. fn: function (){
  50823. var self=this;
  50824. return $core.withContext(function($ctx1) {
  50825. var $1;
  50826. $1=$recv(self._collectionClass())._isNil();
  50827. return $1;
  50828. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  50829. },
  50830. args: [],
  50831. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  50832. referencedClasses: [],
  50833. messageSends: ["isNil", "collectionClass"]
  50834. }),
  50835. $globals.CollectionTest.klass);
  50836. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  50837. $core.addMethod(
  50838. $core.method({
  50839. selector: "collectionWithNewValue",
  50840. protocol: 'fixture',
  50841. fn: function (){
  50842. var self=this;
  50843. return $core.withContext(function($ctx1) {
  50844. self._subclassResponsibility();
  50845. return self;
  50846. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  50847. },
  50848. args: [],
  50849. 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",
  50850. referencedClasses: [],
  50851. messageSends: ["subclassResponsibility"]
  50852. }),
  50853. $globals.IndexableCollectionTest);
  50854. $core.addMethod(
  50855. $core.method({
  50856. selector: "sampleNewIndex",
  50857. protocol: 'fixture',
  50858. fn: function (){
  50859. var self=this;
  50860. return $core.withContext(function($ctx1) {
  50861. self._subclassResponsibility();
  50862. return self;
  50863. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  50864. },
  50865. args: [],
  50866. 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",
  50867. referencedClasses: [],
  50868. messageSends: ["subclassResponsibility"]
  50869. }),
  50870. $globals.IndexableCollectionTest);
  50871. $core.addMethod(
  50872. $core.method({
  50873. selector: "sampleNonIndexesDo:",
  50874. protocol: 'fixture',
  50875. fn: function (aBlock){
  50876. var self=this;
  50877. return $core.withContext(function($ctx1) {
  50878. self._subclassResponsibility();
  50879. return self;
  50880. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50881. },
  50882. args: ["aBlock"],
  50883. 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",
  50884. referencedClasses: [],
  50885. messageSends: ["subclassResponsibility"]
  50886. }),
  50887. $globals.IndexableCollectionTest);
  50888. $core.addMethod(
  50889. $core.method({
  50890. selector: "samplesDo:",
  50891. protocol: 'fixture',
  50892. fn: function (aBlock){
  50893. var self=this;
  50894. return $core.withContext(function($ctx1) {
  50895. self._subclassResponsibility();
  50896. return self;
  50897. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50898. },
  50899. args: ["aBlock"],
  50900. 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",
  50901. referencedClasses: [],
  50902. messageSends: ["subclassResponsibility"]
  50903. }),
  50904. $globals.IndexableCollectionTest);
  50905. $core.addMethod(
  50906. $core.method({
  50907. selector: "testAt",
  50908. protocol: 'tests',
  50909. fn: function (){
  50910. var self=this;
  50911. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50912. return $core.withContext(function($ctx1) {
  50913. var $1;
  50914. self._nonIndexesDo_((function(each){
  50915. return $core.withContext(function($ctx2) {
  50916. return self._should_raise_((function(){
  50917. return $core.withContext(function($ctx3) {
  50918. $1=self._collection();
  50919. $ctx3.sendIdx["collection"]=1;
  50920. return $recv($1)._at_(each);
  50921. $ctx3.sendIdx["at:"]=1;
  50922. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50923. }),$Error());
  50924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50925. }));
  50926. self._samplesDo_((function(index,value){
  50927. return $core.withContext(function($ctx2) {
  50928. return self._assert_equals_($recv(self._collection())._at_(index),value);
  50929. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50930. }));
  50931. return self;
  50932. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  50933. },
  50934. args: [],
  50935. 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 ]",
  50936. referencedClasses: ["Error"],
  50937. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  50938. }),
  50939. $globals.IndexableCollectionTest);
  50940. $core.addMethod(
  50941. $core.method({
  50942. selector: "testAtIfAbsent",
  50943. protocol: 'tests',
  50944. fn: function (){
  50945. var self=this;
  50946. return $core.withContext(function($ctx1) {
  50947. var $2,$1,$3;
  50948. self._nonIndexesDo_((function(each){
  50949. return $core.withContext(function($ctx2) {
  50950. $2=self._collection();
  50951. $ctx2.sendIdx["collection"]=1;
  50952. $1=$recv($2)._at_ifAbsent_(each,(function(){
  50953. return $core.withContext(function($ctx3) {
  50954. return self._sampleNewValue();
  50955. $ctx3.sendIdx["sampleNewValue"]=1;
  50956. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50957. }));
  50958. $ctx2.sendIdx["at:ifAbsent:"]=1;
  50959. $3=self._sampleNewValue();
  50960. $ctx2.sendIdx["sampleNewValue"]=2;
  50961. return self._assert_equals_($1,$3);
  50962. $ctx2.sendIdx["assert:equals:"]=1;
  50963. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50964. }));
  50965. self._samplesDo_((function(index,value){
  50966. return $core.withContext(function($ctx2) {
  50967. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  50968. return $core.withContext(function($ctx3) {
  50969. return self._sampleNewValue();
  50970. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50971. })),value);
  50972. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50973. }));
  50974. return self;
  50975. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  50976. },
  50977. args: [],
  50978. 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 ].",
  50979. referencedClasses: [],
  50980. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  50981. }),
  50982. $globals.IndexableCollectionTest);
  50983. $core.addMethod(
  50984. $core.method({
  50985. selector: "testAtIfAbsentPut",
  50986. protocol: 'tests',
  50987. fn: function (){
  50988. var self=this;
  50989. var newCollection;
  50990. return $core.withContext(function($ctx1) {
  50991. var $1;
  50992. newCollection=self._collection();
  50993. $ctx1.sendIdx["collection"]=1;
  50994. self._samplesDo_((function(index,value){
  50995. return $core.withContext(function($ctx2) {
  50996. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  50997. return $core.withContext(function($ctx3) {
  50998. return self._sampleNewValue();
  50999. $ctx3.sendIdx["sampleNewValue"]=1;
  51000. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51001. }));
  51002. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  51003. return self._assert_equals_($1,value);
  51004. $ctx2.sendIdx["assert:equals:"]=1;
  51005. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51006. }));
  51007. self._assert_equals_(newCollection,self._collection());
  51008. $ctx1.sendIdx["assert:equals:"]=2;
  51009. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  51010. return $core.withContext(function($ctx2) {
  51011. return self._sampleNewValue();
  51012. $ctx2.sendIdx["sampleNewValue"]=2;
  51013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51014. })),self._sampleNewValue());
  51015. $ctx1.sendIdx["assert:equals:"]=3;
  51016. self._assert_equals_(newCollection,self._collectionWithNewValue());
  51017. return self;
  51018. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  51019. },
  51020. args: [],
  51021. 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",
  51022. referencedClasses: [],
  51023. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  51024. }),
  51025. $globals.IndexableCollectionTest);
  51026. $core.addMethod(
  51027. $core.method({
  51028. selector: "testAtIfPresent",
  51029. protocol: 'tests',
  51030. fn: function (){
  51031. var self=this;
  51032. var visited,sentinel;
  51033. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  51034. return $core.withContext(function($ctx1) {
  51035. var $2,$1,$4,$3;
  51036. sentinel=$recv($Object())._new();
  51037. self._nonIndexesDo_((function(each){
  51038. return $core.withContext(function($ctx2) {
  51039. visited=nil;
  51040. visited;
  51041. $2=self._collection();
  51042. $ctx2.sendIdx["collection"]=1;
  51043. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  51044. visited=value1;
  51045. visited;
  51046. return sentinel;
  51047. }));
  51048. $ctx2.sendIdx["at:ifPresent:"]=1;
  51049. self._assert_equals_($1,nil);
  51050. $ctx2.sendIdx["assert:equals:"]=1;
  51051. return self._assert_($recv(visited)._isNil());
  51052. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51053. }));
  51054. self._samplesDo_((function(index,value){
  51055. return $core.withContext(function($ctx2) {
  51056. visited=nil;
  51057. visited;
  51058. $4=self._collection();
  51059. $ctx2.sendIdx["collection"]=2;
  51060. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  51061. visited=value2;
  51062. visited;
  51063. return sentinel;
  51064. }));
  51065. self._assert_equals_($3,sentinel);
  51066. $ctx2.sendIdx["assert:equals:"]=2;
  51067. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  51068. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  51069. }));
  51070. return self;
  51071. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  51072. },
  51073. args: [],
  51074. 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) ]",
  51075. referencedClasses: ["Object"],
  51076. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  51077. }),
  51078. $globals.IndexableCollectionTest);
  51079. $core.addMethod(
  51080. $core.method({
  51081. selector: "testAtIfPresentIfAbsent",
  51082. protocol: 'tests',
  51083. fn: function (){
  51084. var self=this;
  51085. var visited,sentinel;
  51086. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  51087. return $core.withContext(function($ctx1) {
  51088. var $2,$1,$3,$5,$4;
  51089. sentinel=$recv($Object())._new();
  51090. self._nonIndexesDo_((function(each){
  51091. return $core.withContext(function($ctx2) {
  51092. visited=nil;
  51093. visited;
  51094. $2=self._collection();
  51095. $ctx2.sendIdx["collection"]=1;
  51096. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  51097. visited=value1;
  51098. visited;
  51099. return sentinel;
  51100. }),(function(){
  51101. return $core.withContext(function($ctx3) {
  51102. return self._sampleNewValue();
  51103. $ctx3.sendIdx["sampleNewValue"]=1;
  51104. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  51105. }));
  51106. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  51107. $3=self._sampleNewValue();
  51108. $ctx2.sendIdx["sampleNewValue"]=2;
  51109. self._assert_equals_($1,$3);
  51110. $ctx2.sendIdx["assert:equals:"]=1;
  51111. return self._assert_($recv(visited)._isNil());
  51112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51113. }));
  51114. self._samplesDo_((function(index,value){
  51115. return $core.withContext(function($ctx2) {
  51116. visited=nil;
  51117. visited;
  51118. $5=self._collection();
  51119. $ctx2.sendIdx["collection"]=2;
  51120. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  51121. visited=value2;
  51122. visited;
  51123. return sentinel;
  51124. }),(function(){
  51125. return $core.withContext(function($ctx3) {
  51126. return self._sampleNewValue();
  51127. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  51128. }));
  51129. self._assert_equals_($4,sentinel);
  51130. $ctx2.sendIdx["assert:equals:"]=2;
  51131. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  51132. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  51133. }));
  51134. return self;
  51135. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  51136. },
  51137. args: [],
  51138. 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) ]",
  51139. referencedClasses: ["Object"],
  51140. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  51141. }),
  51142. $globals.IndexableCollectionTest);
  51143. $core.addMethod(
  51144. $core.method({
  51145. selector: "testAtPut",
  51146. protocol: 'tests',
  51147. fn: function (){
  51148. var self=this;
  51149. var newCollection;
  51150. return $core.withContext(function($ctx1) {
  51151. newCollection=self._collection();
  51152. $ctx1.sendIdx["collection"]=1;
  51153. self._samplesDo_((function(index,value){
  51154. return $core.withContext(function($ctx2) {
  51155. return $recv(newCollection)._at_put_(index,value);
  51156. $ctx2.sendIdx["at:put:"]=1;
  51157. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51158. }));
  51159. self._assert_equals_(newCollection,self._collection());
  51160. $ctx1.sendIdx["assert:equals:"]=1;
  51161. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  51162. self._assert_equals_(newCollection,self._collectionWithNewValue());
  51163. return self;
  51164. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  51165. },
  51166. args: [],
  51167. 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",
  51168. referencedClasses: [],
  51169. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  51170. }),
  51171. $globals.IndexableCollectionTest);
  51172. $core.addMethod(
  51173. $core.method({
  51174. selector: "testEquality",
  51175. protocol: 'tests',
  51176. fn: function (){
  51177. var self=this;
  51178. return $core.withContext(function($ctx1) {
  51179. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  51180. $2=self._collectionClass();
  51181. $ctx1.sendIdx["collectionClass"]=1;
  51182. $1=$recv($2)._new();
  51183. $ctx1.sendIdx["new"]=1;
  51184. $4=self._collectionClass();
  51185. $ctx1.sendIdx["collectionClass"]=2;
  51186. $3=$recv($4)._new();
  51187. $ctx1.sendIdx["new"]=2;
  51188. self._assert_equals_($1,$3);
  51189. $ctx1.sendIdx["assert:equals:"]=1;
  51190. $5=self._collection();
  51191. $ctx1.sendIdx["collection"]=1;
  51192. $6=self._collection();
  51193. $ctx1.sendIdx["collection"]=2;
  51194. self._assert_equals_($5,$6);
  51195. $ctx1.sendIdx["assert:equals:"]=2;
  51196. $7=self._collectionWithNewValue();
  51197. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51198. self._assert_equals_($7,self._collectionWithNewValue());
  51199. $10=self._collectionClass();
  51200. $ctx1.sendIdx["collectionClass"]=3;
  51201. $9=$recv($10)._new();
  51202. $ctx1.sendIdx["new"]=3;
  51203. $11=self._collection();
  51204. $ctx1.sendIdx["collection"]=3;
  51205. $8=$recv($9).__eq($11);
  51206. $ctx1.sendIdx["="]=1;
  51207. self._deny_($8);
  51208. $ctx1.sendIdx["deny:"]=1;
  51209. self._deny_($recv(self._collection()).__eq($recv(self._collectionClass())._new()));
  51210. return self;
  51211. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.IndexableCollectionTest)});
  51212. },
  51213. args: [],
  51214. 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",
  51215. referencedClasses: [],
  51216. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  51217. }),
  51218. $globals.IndexableCollectionTest);
  51219. $core.addMethod(
  51220. $core.method({
  51221. selector: "testIndexOf",
  51222. protocol: 'tests',
  51223. fn: function (){
  51224. var self=this;
  51225. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51226. return $core.withContext(function($ctx1) {
  51227. var $1;
  51228. self._should_raise_((function(){
  51229. return $core.withContext(function($ctx2) {
  51230. $1=self._collection();
  51231. $ctx2.sendIdx["collection"]=1;
  51232. return $recv($1)._indexOf_(self._sampleNewValue());
  51233. $ctx2.sendIdx["indexOf:"]=1;
  51234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51235. }),$Error());
  51236. self._samplesDo_((function(index,value){
  51237. return $core.withContext(function($ctx2) {
  51238. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  51239. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  51240. }));
  51241. return self;
  51242. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  51243. },
  51244. args: [],
  51245. 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 ]",
  51246. referencedClasses: ["Error"],
  51247. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  51248. }),
  51249. $globals.IndexableCollectionTest);
  51250. $core.addMethod(
  51251. $core.method({
  51252. selector: "testIndexOfWithNull",
  51253. protocol: 'tests',
  51254. fn: function (){
  51255. var self=this;
  51256. var jsNull;
  51257. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  51258. return $core.withContext(function($ctx1) {
  51259. var $1,$2;
  51260. jsNull=$recv($JSON())._parse_("null");
  51261. self._samplesDo_((function(index,value){
  51262. return $core.withContext(function($ctx2) {
  51263. $1=self._collection();
  51264. $recv($1)._at_put_(index,jsNull);
  51265. $2=$recv($1)._indexOf_(jsNull);
  51266. return self._assert_equals_($2,index);
  51267. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51268. }));
  51269. return self;
  51270. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  51271. },
  51272. args: [],
  51273. 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 ]",
  51274. referencedClasses: ["JSON"],
  51275. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  51276. }),
  51277. $globals.IndexableCollectionTest);
  51278. $core.addMethod(
  51279. $core.method({
  51280. selector: "testWithIndexDo",
  51281. protocol: 'tests',
  51282. fn: function (){
  51283. var self=this;
  51284. var collection;
  51285. return $core.withContext(function($ctx1) {
  51286. collection=self._collection();
  51287. $ctx1.sendIdx["collection"]=1;
  51288. $recv(self._collection())._withIndexDo_((function(each,index){
  51289. return $core.withContext(function($ctx2) {
  51290. return self._assert_equals_($recv(collection)._at_(index),each);
  51291. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  51292. }));
  51293. return self;
  51294. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  51295. },
  51296. args: [],
  51297. 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 ]",
  51298. referencedClasses: [],
  51299. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  51300. }),
  51301. $globals.IndexableCollectionTest);
  51302. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  51303. $core.addMethod(
  51304. $core.method({
  51305. selector: "collectionKeys",
  51306. protocol: 'fixture',
  51307. fn: function (){
  51308. var self=this;
  51309. return $core.withContext(function($ctx1) {
  51310. self._subclassResponsibility();
  51311. return self;
  51312. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  51313. },
  51314. args: [],
  51315. source: "collectionKeys\x0a\x09self subclassResponsibility",
  51316. referencedClasses: [],
  51317. messageSends: ["subclassResponsibility"]
  51318. }),
  51319. $globals.AssociativeCollectionTest);
  51320. $core.addMethod(
  51321. $core.method({
  51322. selector: "collectionValues",
  51323. protocol: 'fixture',
  51324. fn: function (){
  51325. var self=this;
  51326. return $core.withContext(function($ctx1) {
  51327. self._subclassResponsibility();
  51328. return self;
  51329. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  51330. },
  51331. args: [],
  51332. source: "collectionValues\x0a\x09self subclassResponsibility",
  51333. referencedClasses: [],
  51334. messageSends: ["subclassResponsibility"]
  51335. }),
  51336. $globals.AssociativeCollectionTest);
  51337. $core.addMethod(
  51338. $core.method({
  51339. selector: "nonIndexesDo:",
  51340. protocol: 'fixture',
  51341. fn: function (aBlock){
  51342. var self=this;
  51343. return $core.withContext(function($ctx1) {
  51344. $recv(aBlock)._value_((5));
  51345. $ctx1.sendIdx["value:"]=1;
  51346. $recv(aBlock)._value_("z");
  51347. return self;
  51348. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  51349. },
  51350. args: ["aBlock"],
  51351. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  51352. referencedClasses: [],
  51353. messageSends: ["value:"]
  51354. }),
  51355. $globals.AssociativeCollectionTest);
  51356. $core.addMethod(
  51357. $core.method({
  51358. selector: "sampleNewIndex",
  51359. protocol: 'fixture',
  51360. fn: function (){
  51361. var self=this;
  51362. return "new";
  51363. },
  51364. args: [],
  51365. source: "sampleNewIndex\x0a\x09^ 'new'",
  51366. referencedClasses: [],
  51367. messageSends: []
  51368. }),
  51369. $globals.AssociativeCollectionTest);
  51370. $core.addMethod(
  51371. $core.method({
  51372. selector: "samplesDo:",
  51373. protocol: 'fixture',
  51374. fn: function (aBlock){
  51375. var self=this;
  51376. return $core.withContext(function($ctx1) {
  51377. $recv(aBlock)._value_value_("a",(2));
  51378. return self;
  51379. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  51380. },
  51381. args: ["aBlock"],
  51382. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  51383. referencedClasses: [],
  51384. messageSends: ["value:value:"]
  51385. }),
  51386. $globals.AssociativeCollectionTest);
  51387. $core.addMethod(
  51388. $core.method({
  51389. selector: "testAddAll",
  51390. protocol: 'tests',
  51391. fn: function (){
  51392. var self=this;
  51393. return $core.withContext(function($ctx1) {
  51394. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  51395. (
  51396. $ctx1.supercall = true,
  51397. $globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
  51398. $ctx1.supercall = false;
  51399. $2=self._collection();
  51400. $ctx1.sendIdx["collection"]=1;
  51401. $3=$2;
  51402. $4=self._collection();
  51403. $ctx1.sendIdx["collection"]=2;
  51404. $recv($3)._addAll_($4);
  51405. $ctx1.sendIdx["addAll:"]=1;
  51406. $5=$recv($2)._yourself();
  51407. $ctx1.sendIdx["yourself"]=1;
  51408. $1=$5;
  51409. $6=self._collection();
  51410. $ctx1.sendIdx["collection"]=3;
  51411. self._assert_equals_($1,$6);
  51412. $ctx1.sendIdx["assert:equals:"]=1;
  51413. $8=self._collection();
  51414. $ctx1.sendIdx["collection"]=4;
  51415. $9=$8;
  51416. $10=self._collectionWithNewValue();
  51417. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51418. $recv($9)._addAll_($10);
  51419. $ctx1.sendIdx["addAll:"]=2;
  51420. $11=$recv($8)._yourself();
  51421. $ctx1.sendIdx["yourself"]=2;
  51422. $7=$11;
  51423. $12=self._collectionWithNewValue();
  51424. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51425. self._assert_equals_($7,$12);
  51426. $ctx1.sendIdx["assert:equals:"]=2;
  51427. $14=self._collectionWithNewValue();
  51428. $ctx1.sendIdx["collectionWithNewValue"]=3;
  51429. $recv($14)._addAll_(self._collection());
  51430. $15=$recv($14)._yourself();
  51431. $13=$15;
  51432. self._assert_equals_($13,self._collectionWithNewValue());
  51433. return self;
  51434. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  51435. },
  51436. args: [],
  51437. 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",
  51438. referencedClasses: [],
  51439. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  51440. }),
  51441. $globals.AssociativeCollectionTest);
  51442. $core.addMethod(
  51443. $core.method({
  51444. selector: "testAsDictionary",
  51445. protocol: 'tests',
  51446. fn: function (){
  51447. var self=this;
  51448. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51449. return $core.withContext(function($ctx1) {
  51450. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  51451. return self;
  51452. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  51453. },
  51454. args: [],
  51455. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  51456. referencedClasses: ["Dictionary"],
  51457. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  51458. }),
  51459. $globals.AssociativeCollectionTest);
  51460. $core.addMethod(
  51461. $core.method({
  51462. selector: "testAsHashedCollection",
  51463. protocol: 'tests',
  51464. fn: function (){
  51465. var self=this;
  51466. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  51467. return $core.withContext(function($ctx1) {
  51468. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  51469. return self;
  51470. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  51471. },
  51472. args: [],
  51473. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  51474. referencedClasses: ["HashedCollection"],
  51475. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  51476. }),
  51477. $globals.AssociativeCollectionTest);
  51478. $core.addMethod(
  51479. $core.method({
  51480. selector: "testComma",
  51481. protocol: 'tests',
  51482. fn: function (){
  51483. var self=this;
  51484. return $core.withContext(function($ctx1) {
  51485. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  51486. (
  51487. $ctx1.supercall = true,
  51488. $globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply($recv(self), []));
  51489. $ctx1.supercall = false;
  51490. $2=self._collection();
  51491. $ctx1.sendIdx["collection"]=1;
  51492. $3=self._collection();
  51493. $ctx1.sendIdx["collection"]=2;
  51494. $1=$recv($2).__comma($3);
  51495. $ctx1.sendIdx[","]=1;
  51496. $4=self._collection();
  51497. $ctx1.sendIdx["collection"]=3;
  51498. self._assert_equals_($1,$4);
  51499. $ctx1.sendIdx["assert:equals:"]=1;
  51500. $6=self._collection();
  51501. $ctx1.sendIdx["collection"]=4;
  51502. $7=self._collectionWithNewValue();
  51503. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51504. $5=$recv($6).__comma($7);
  51505. $ctx1.sendIdx[","]=2;
  51506. $8=self._collectionWithNewValue();
  51507. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51508. self._assert_equals_($5,$8);
  51509. $ctx1.sendIdx["assert:equals:"]=2;
  51510. $10=self._collectionWithNewValue();
  51511. $ctx1.sendIdx["collectionWithNewValue"]=3;
  51512. $9=$recv($10).__comma(self._collection());
  51513. self._assert_equals_($9,self._collectionWithNewValue());
  51514. return self;
  51515. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  51516. },
  51517. args: [],
  51518. 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",
  51519. referencedClasses: [],
  51520. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  51521. }),
  51522. $globals.AssociativeCollectionTest);
  51523. $core.addMethod(
  51524. $core.method({
  51525. selector: "testFrom",
  51526. protocol: 'tests',
  51527. fn: function (){
  51528. var self=this;
  51529. var associations;
  51530. return $core.withContext(function($ctx1) {
  51531. var $1;
  51532. $1="a".__minus_gt((1));
  51533. $ctx1.sendIdx["->"]=1;
  51534. associations=[$1,"b".__minus_gt((2))];
  51535. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  51536. return self;
  51537. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  51538. },
  51539. args: [],
  51540. 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 }.",
  51541. referencedClasses: [],
  51542. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  51543. }),
  51544. $globals.AssociativeCollectionTest);
  51545. $core.addMethod(
  51546. $core.method({
  51547. selector: "testKeys",
  51548. protocol: 'tests',
  51549. fn: function (){
  51550. var self=this;
  51551. return $core.withContext(function($ctx1) {
  51552. var $2,$1,$3,$4;
  51553. $2=$recv($recv(self._collectionClass())._new())._keys();
  51554. $ctx1.sendIdx["keys"]=1;
  51555. $1=$recv($2)._isEmpty();
  51556. self._assert_($1);
  51557. $3=$recv(self._collection())._keys();
  51558. $ctx1.sendIdx["keys"]=2;
  51559. $4=self._collectionKeys();
  51560. $ctx1.sendIdx["collectionKeys"]=1;
  51561. self._assertSameContents_as_($3,$4);
  51562. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51563. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  51564. return self;
  51565. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  51566. },
  51567. args: [],
  51568. 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 }",
  51569. referencedClasses: [],
  51570. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  51571. }),
  51572. $globals.AssociativeCollectionTest);
  51573. $core.addMethod(
  51574. $core.method({
  51575. selector: "testNewFromPairs",
  51576. protocol: 'tests',
  51577. fn: function (){
  51578. var self=this;
  51579. var flattenedAssociations;
  51580. return $core.withContext(function($ctx1) {
  51581. flattenedAssociations=["a",(1),"b",(2)];
  51582. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  51583. return self;
  51584. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  51585. },
  51586. args: [],
  51587. 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 }.",
  51588. referencedClasses: [],
  51589. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  51590. }),
  51591. $globals.AssociativeCollectionTest);
  51592. $core.addMethod(
  51593. $core.method({
  51594. selector: "testPrintString",
  51595. protocol: 'tests',
  51596. fn: function (){
  51597. var self=this;
  51598. return $core.withContext(function($ctx1) {
  51599. var $3,$2,$4,$1,$5;
  51600. $3=self._collectionClass();
  51601. $ctx1.sendIdx["collectionClass"]=1;
  51602. $2=$recv($3)._new();
  51603. $recv($2)._at_put_("firstname","James");
  51604. $ctx1.sendIdx["at:put:"]=1;
  51605. $recv($2)._at_put_("lastname","Bond");
  51606. $4=$recv($2)._printString();
  51607. $1=$4;
  51608. $5=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  51609. $ctx1.sendIdx[","]=1;
  51610. self._assert_equals_($1,$5);
  51611. return self;
  51612. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  51613. },
  51614. args: [],
  51615. 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'')'",
  51616. referencedClasses: [],
  51617. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  51618. }),
  51619. $globals.AssociativeCollectionTest);
  51620. $core.addMethod(
  51621. $core.method({
  51622. selector: "testRemoveKey",
  51623. protocol: 'tests',
  51624. fn: function (){
  51625. var self=this;
  51626. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51627. return $core.withContext(function($ctx1) {
  51628. var $1,$2,$3,$5,$6,$4,$7,$8;
  51629. self._nonIndexesDo_((function(each){
  51630. var collection;
  51631. return $core.withContext(function($ctx2) {
  51632. collection=self._collection();
  51633. $ctx2.sendIdx["collection"]=1;
  51634. collection;
  51635. self._should_raise_((function(){
  51636. return $core.withContext(function($ctx3) {
  51637. return $recv(collection)._removeKey_(each);
  51638. $ctx3.sendIdx["removeKey:"]=1;
  51639. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51640. }),$Error());
  51641. $1=collection;
  51642. $2=self._collection();
  51643. $ctx2.sendIdx["collection"]=2;
  51644. return self._assert_equals_($1,$2);
  51645. $ctx2.sendIdx["assert:equals:"]=1;
  51646. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  51647. }));
  51648. self._samplesDo_((function(index,value){
  51649. var collection;
  51650. return $core.withContext(function($ctx2) {
  51651. collection=self._collection();
  51652. $ctx2.sendIdx["collection"]=3;
  51653. collection;
  51654. $3=$recv(collection)._removeKey_(index);
  51655. $ctx2.sendIdx["removeKey:"]=2;
  51656. self._assert_equals_($3,value);
  51657. $ctx2.sendIdx["assert:equals:"]=2;
  51658. $5=collection;
  51659. $6=self._collection();
  51660. $ctx2.sendIdx["collection"]=4;
  51661. $4=$recv($5).__eq($6);
  51662. return self._deny_($4);
  51663. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  51664. }));
  51665. $7=self._collectionWithNewValue();
  51666. $recv($7)._removeKey_(self._sampleNewIndex());
  51667. $8=$recv($7)._yourself();
  51668. self._assert_equals_($8,self._collection());
  51669. return self;
  51670. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  51671. },
  51672. args: [],
  51673. 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",
  51674. referencedClasses: ["Error"],
  51675. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  51676. }),
  51677. $globals.AssociativeCollectionTest);
  51678. $core.addMethod(
  51679. $core.method({
  51680. selector: "testRemoveKeyIfAbsent",
  51681. protocol: 'tests',
  51682. fn: function (){
  51683. var self=this;
  51684. return $core.withContext(function($ctx1) {
  51685. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  51686. self._nonIndexesDo_((function(each){
  51687. var collection;
  51688. return $core.withContext(function($ctx2) {
  51689. collection=self._collection();
  51690. $ctx2.sendIdx["collection"]=1;
  51691. collection;
  51692. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  51693. return $core.withContext(function($ctx3) {
  51694. return self._sampleNewValue();
  51695. $ctx3.sendIdx["sampleNewValue"]=1;
  51696. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51697. }));
  51698. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  51699. $2=self._sampleNewValue();
  51700. $ctx2.sendIdx["sampleNewValue"]=2;
  51701. self._assert_equals_($1,$2);
  51702. $ctx2.sendIdx["assert:equals:"]=1;
  51703. $3=collection;
  51704. $4=self._collection();
  51705. $ctx2.sendIdx["collection"]=2;
  51706. return self._assert_equals_($3,$4);
  51707. $ctx2.sendIdx["assert:equals:"]=2;
  51708. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  51709. }));
  51710. self._samplesDo_((function(index,value){
  51711. var collection;
  51712. return $core.withContext(function($ctx2) {
  51713. collection=self._collection();
  51714. $ctx2.sendIdx["collection"]=3;
  51715. collection;
  51716. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  51717. return $core.withContext(function($ctx3) {
  51718. return self._sampleNewValue();
  51719. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  51720. }));
  51721. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  51722. self._assert_equals_($5,value);
  51723. $ctx2.sendIdx["assert:equals:"]=3;
  51724. $7=collection;
  51725. $8=self._collection();
  51726. $ctx2.sendIdx["collection"]=4;
  51727. $6=$recv($7).__eq($8);
  51728. return self._deny_($6);
  51729. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  51730. }));
  51731. $9=self._collectionWithNewValue();
  51732. $recv($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  51733. return $core.withContext(function($ctx2) {
  51734. return self._assert_(false);
  51735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  51736. }));
  51737. $10=$recv($9)._yourself();
  51738. self._assert_equals_($10,self._collection());
  51739. return self;
  51740. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  51741. },
  51742. args: [],
  51743. 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",
  51744. referencedClasses: [],
  51745. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  51746. }),
  51747. $globals.AssociativeCollectionTest);
  51748. $core.addMethod(
  51749. $core.method({
  51750. selector: "testValues",
  51751. protocol: 'tests',
  51752. fn: function (){
  51753. var self=this;
  51754. return $core.withContext(function($ctx1) {
  51755. var $2,$1,$3,$4;
  51756. $2=$recv($recv(self._collectionClass())._new())._values();
  51757. $ctx1.sendIdx["values"]=1;
  51758. $1=$recv($2)._isEmpty();
  51759. self._assert_($1);
  51760. $3=$recv(self._collection())._values();
  51761. $ctx1.sendIdx["values"]=2;
  51762. $4=self._collectionValues();
  51763. $ctx1.sendIdx["collectionValues"]=1;
  51764. self._assertSameContents_as_($3,$4);
  51765. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51766. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  51767. return self;
  51768. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  51769. },
  51770. args: [],
  51771. 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 }",
  51772. referencedClasses: [],
  51773. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  51774. }),
  51775. $globals.AssociativeCollectionTest);
  51776. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  51777. $core.addMethod(
  51778. $core.method({
  51779. selector: "collection",
  51780. protocol: 'fixture',
  51781. fn: function (){
  51782. var self=this;
  51783. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51784. return $core.withContext(function($ctx1) {
  51785. var $2,$3,$1;
  51786. $2=$recv($Dictionary())._new();
  51787. $recv($2)._at_put_((1),(1));
  51788. $ctx1.sendIdx["at:put:"]=1;
  51789. $recv($2)._at_put_("a",(2));
  51790. $ctx1.sendIdx["at:put:"]=2;
  51791. $recv($2)._at_put_(true,(3));
  51792. $ctx1.sendIdx["at:put:"]=3;
  51793. $recv($2)._at_put_((1).__at((3)),(-4));
  51794. $3=$recv($2)._yourself();
  51795. $1=$3;
  51796. return $1;
  51797. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  51798. },
  51799. args: [],
  51800. 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\x09yourself",
  51801. referencedClasses: ["Dictionary"],
  51802. messageSends: ["at:put:", "new", "@", "yourself"]
  51803. }),
  51804. $globals.DictionaryTest);
  51805. $core.addMethod(
  51806. $core.method({
  51807. selector: "collectionKeys",
  51808. protocol: 'fixture',
  51809. fn: function (){
  51810. var self=this;
  51811. return $core.withContext(function($ctx1) {
  51812. var $1;
  51813. $1=[(1),"a",true,(1).__at((3))];
  51814. return $1;
  51815. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  51816. },
  51817. args: [],
  51818. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  51819. referencedClasses: [],
  51820. messageSends: ["@"]
  51821. }),
  51822. $globals.DictionaryTest);
  51823. $core.addMethod(
  51824. $core.method({
  51825. selector: "collectionOfPrintStrings",
  51826. protocol: 'fixture',
  51827. fn: function (){
  51828. var self=this;
  51829. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51830. return $core.withContext(function($ctx1) {
  51831. var $2,$3,$1;
  51832. $2=$recv($Dictionary())._new();
  51833. $recv($2)._at_put_((1),"1");
  51834. $ctx1.sendIdx["at:put:"]=1;
  51835. $recv($2)._at_put_("a","2");
  51836. $ctx1.sendIdx["at:put:"]=2;
  51837. $recv($2)._at_put_(true,"3");
  51838. $ctx1.sendIdx["at:put:"]=3;
  51839. $recv($2)._at_put_((1).__at((3)),"-4");
  51840. $3=$recv($2)._yourself();
  51841. $1=$3;
  51842. return $1;
  51843. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  51844. },
  51845. args: [],
  51846. 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\x09yourself",
  51847. referencedClasses: ["Dictionary"],
  51848. messageSends: ["at:put:", "new", "@", "yourself"]
  51849. }),
  51850. $globals.DictionaryTest);
  51851. $core.addMethod(
  51852. $core.method({
  51853. selector: "collectionSize",
  51854. protocol: 'fixture',
  51855. fn: function (){
  51856. var self=this;
  51857. return (4);
  51858. },
  51859. args: [],
  51860. source: "collectionSize\x0a\x09^ 4",
  51861. referencedClasses: [],
  51862. messageSends: []
  51863. }),
  51864. $globals.DictionaryTest);
  51865. $core.addMethod(
  51866. $core.method({
  51867. selector: "collectionValues",
  51868. protocol: 'fixture',
  51869. fn: function (){
  51870. var self=this;
  51871. var $1;
  51872. $1=[(1),(2),(3),(-4)];
  51873. return $1;
  51874. },
  51875. args: [],
  51876. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  51877. referencedClasses: [],
  51878. messageSends: []
  51879. }),
  51880. $globals.DictionaryTest);
  51881. $core.addMethod(
  51882. $core.method({
  51883. selector: "collectionWithDuplicates",
  51884. protocol: 'fixture',
  51885. fn: function (){
  51886. var self=this;
  51887. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51888. return $core.withContext(function($ctx1) {
  51889. var $2,$3,$1;
  51890. $2=$recv($Dictionary())._new();
  51891. $recv($2)._at_put_((1),(1));
  51892. $ctx1.sendIdx["at:put:"]=1;
  51893. $recv($2)._at_put_("a",(2));
  51894. $ctx1.sendIdx["at:put:"]=2;
  51895. $recv($2)._at_put_(true,(3));
  51896. $ctx1.sendIdx["at:put:"]=3;
  51897. $recv($2)._at_put_((4),(-4));
  51898. $ctx1.sendIdx["at:put:"]=4;
  51899. $recv($2)._at_put_("b",(1));
  51900. $ctx1.sendIdx["at:put:"]=5;
  51901. $recv($2)._at_put_((3),(3));
  51902. $ctx1.sendIdx["at:put:"]=6;
  51903. $recv($2)._at_put_(false,(12));
  51904. $3=$recv($2)._yourself();
  51905. $1=$3;
  51906. return $1;
  51907. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  51908. },
  51909. args: [],
  51910. 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: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
  51911. referencedClasses: ["Dictionary"],
  51912. messageSends: ["at:put:", "new", "yourself"]
  51913. }),
  51914. $globals.DictionaryTest);
  51915. $core.addMethod(
  51916. $core.method({
  51917. selector: "collectionWithNewValue",
  51918. protocol: 'fixture',
  51919. fn: function (){
  51920. var self=this;
  51921. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51922. return $core.withContext(function($ctx1) {
  51923. var $2,$3,$1;
  51924. $2=$recv($Dictionary())._new();
  51925. $recv($2)._at_put_((1),(1));
  51926. $ctx1.sendIdx["at:put:"]=1;
  51927. $recv($2)._at_put_("a",(2));
  51928. $ctx1.sendIdx["at:put:"]=2;
  51929. $recv($2)._at_put_(true,(3));
  51930. $ctx1.sendIdx["at:put:"]=3;
  51931. $recv($2)._at_put_((1).__at((3)),(-4));
  51932. $ctx1.sendIdx["at:put:"]=4;
  51933. $recv($2)._at_put_("new","N");
  51934. $3=$recv($2)._yourself();
  51935. $1=$3;
  51936. return $1;
  51937. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  51938. },
  51939. args: [],
  51940. 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: 'new' put: 'N';\x0a\x09\x09yourself",
  51941. referencedClasses: ["Dictionary"],
  51942. messageSends: ["at:put:", "new", "@", "yourself"]
  51943. }),
  51944. $globals.DictionaryTest);
  51945. $core.addMethod(
  51946. $core.method({
  51947. selector: "sampleNewValueAsCollection",
  51948. protocol: 'fixture',
  51949. fn: function (){
  51950. var self=this;
  51951. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51952. return $core.withContext(function($ctx1) {
  51953. var $2,$3,$1;
  51954. $2=$recv($Dictionary())._new();
  51955. $recv($2)._at_put_("new","N");
  51956. $3=$recv($2)._yourself();
  51957. $1=$3;
  51958. return $1;
  51959. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  51960. },
  51961. args: [],
  51962. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  51963. referencedClasses: ["Dictionary"],
  51964. messageSends: ["at:put:", "new", "yourself"]
  51965. }),
  51966. $globals.DictionaryTest);
  51967. $core.addMethod(
  51968. $core.method({
  51969. selector: "samplesDo:",
  51970. protocol: 'fixture',
  51971. fn: function (aBlock){
  51972. var self=this;
  51973. return $core.withContext(function($ctx1) {
  51974. (
  51975. $ctx1.supercall = true,
  51976. $globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51977. $ctx1.supercall = false;
  51978. $recv(aBlock)._value_value_(true,(3));
  51979. $ctx1.sendIdx["value:value:"]=1;
  51980. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  51981. return self;
  51982. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  51983. },
  51984. args: ["aBlock"],
  51985. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  51986. referencedClasses: [],
  51987. messageSends: ["samplesDo:", "value:value:", "@"]
  51988. }),
  51989. $globals.DictionaryTest);
  51990. $core.addMethod(
  51991. $core.method({
  51992. selector: "testAccessing",
  51993. protocol: 'tests',
  51994. fn: function (){
  51995. var self=this;
  51996. var d;
  51997. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51998. return $core.withContext(function($ctx1) {
  51999. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  52000. d=$recv($Dictionary())._new();
  52001. $recv(d)._at_put_("hello","world");
  52002. $ctx1.sendIdx["at:put:"]=1;
  52003. $1=$recv(d)._at_("hello");
  52004. $ctx1.sendIdx["at:"]=1;
  52005. self._assert_equals_($1,"world");
  52006. $ctx1.sendIdx["assert:equals:"]=1;
  52007. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  52008. return nil;
  52009. }));
  52010. $ctx1.sendIdx["at:ifAbsent:"]=1;
  52011. self._assert_equals_($2,"world");
  52012. $ctx1.sendIdx["assert:equals:"]=2;
  52013. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  52014. return nil;
  52015. }))).__eq("world"));
  52016. $ctx1.sendIdx["deny:"]=1;
  52017. $3=$recv(d)._includesKey_("hello");
  52018. $ctx1.sendIdx["includesKey:"]=1;
  52019. self._assert_($3);
  52020. $ctx1.sendIdx["assert:"]=1;
  52021. $4=$recv(d)._includesKey_("foo");
  52022. $ctx1.sendIdx["includesKey:"]=2;
  52023. self._deny_($4);
  52024. $ctx1.sendIdx["deny:"]=2;
  52025. $recv(d)._at_put_((1),(2));
  52026. $ctx1.sendIdx["at:put:"]=2;
  52027. $5=$recv(d)._at_((1));
  52028. $ctx1.sendIdx["at:"]=2;
  52029. self._assert_equals_($5,(2));
  52030. $ctx1.sendIdx["assert:equals:"]=3;
  52031. $6=d;
  52032. $7=(1).__at((3));
  52033. $ctx1.sendIdx["@"]=1;
  52034. $recv($6)._at_put_($7,(3));
  52035. $9=d;
  52036. $10=(1).__at((3));
  52037. $ctx1.sendIdx["@"]=2;
  52038. $8=$recv($9)._at_($10);
  52039. self._assert_equals_($8,(3));
  52040. $12=d;
  52041. $13=(1).__at((3));
  52042. $ctx1.sendIdx["@"]=3;
  52043. $11=$recv($12)._includesKey_($13);
  52044. $ctx1.sendIdx["includesKey:"]=3;
  52045. self._assert_($11);
  52046. self._deny_($recv(d)._includesKey_((3).__at((1))));
  52047. return self;
  52048. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  52049. },
  52050. args: [],
  52051. 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)",
  52052. referencedClasses: ["Dictionary"],
  52053. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  52054. }),
  52055. $globals.DictionaryTest);
  52056. $core.addMethod(
  52057. $core.method({
  52058. selector: "testDynamicDictionaries",
  52059. protocol: 'tests',
  52060. fn: function (){
  52061. var self=this;
  52062. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52063. return $core.withContext(function($ctx1) {
  52064. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($Dictionary())._with_("hello".__minus_gt((1))));
  52065. return self;
  52066. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  52067. },
  52068. args: [],
  52069. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  52070. referencedClasses: ["Dictionary"],
  52071. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  52072. }),
  52073. $globals.DictionaryTest);
  52074. $core.addMethod(
  52075. $core.method({
  52076. selector: "collectionClass",
  52077. protocol: 'fixture',
  52078. fn: function (){
  52079. var self=this;
  52080. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52081. return $Dictionary();
  52082. },
  52083. args: [],
  52084. source: "collectionClass\x0a\x09^ Dictionary",
  52085. referencedClasses: ["Dictionary"],
  52086. messageSends: []
  52087. }),
  52088. $globals.DictionaryTest.klass);
  52089. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  52090. $core.addMethod(
  52091. $core.method({
  52092. selector: "collection",
  52093. protocol: 'fixture',
  52094. fn: function (){
  52095. var self=this;
  52096. var $1;
  52097. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  52098. return $1;
  52099. },
  52100. args: [],
  52101. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  52102. referencedClasses: [],
  52103. messageSends: []
  52104. }),
  52105. $globals.HashedCollectionTest);
  52106. $core.addMethod(
  52107. $core.method({
  52108. selector: "collectionKeys",
  52109. protocol: 'fixture',
  52110. fn: function (){
  52111. var self=this;
  52112. var $1;
  52113. $1=["b","a","c","d"];
  52114. return $1;
  52115. },
  52116. args: [],
  52117. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  52118. referencedClasses: [],
  52119. messageSends: []
  52120. }),
  52121. $globals.HashedCollectionTest);
  52122. $core.addMethod(
  52123. $core.method({
  52124. selector: "collectionOfPrintStrings",
  52125. protocol: 'fixture',
  52126. fn: function (){
  52127. var self=this;
  52128. var $1;
  52129. $1=$globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  52130. return $1;
  52131. },
  52132. args: [],
  52133. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  52134. referencedClasses: [],
  52135. messageSends: []
  52136. }),
  52137. $globals.HashedCollectionTest);
  52138. $core.addMethod(
  52139. $core.method({
  52140. selector: "collectionSize",
  52141. protocol: 'fixture',
  52142. fn: function (){
  52143. var self=this;
  52144. return (4);
  52145. },
  52146. args: [],
  52147. source: "collectionSize\x0a\x09^ 4",
  52148. referencedClasses: [],
  52149. messageSends: []
  52150. }),
  52151. $globals.HashedCollectionTest);
  52152. $core.addMethod(
  52153. $core.method({
  52154. selector: "collectionValues",
  52155. protocol: 'fixture',
  52156. fn: function (){
  52157. var self=this;
  52158. var $1;
  52159. $1=[(1),(2),(3),(-4)];
  52160. return $1;
  52161. },
  52162. args: [],
  52163. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  52164. referencedClasses: [],
  52165. messageSends: []
  52166. }),
  52167. $globals.HashedCollectionTest);
  52168. $core.addMethod(
  52169. $core.method({
  52170. selector: "collectionWithDuplicates",
  52171. protocol: 'fixture',
  52172. fn: function (){
  52173. var self=this;
  52174. var $1;
  52175. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  52176. return $1;
  52177. },
  52178. args: [],
  52179. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  52180. referencedClasses: [],
  52181. messageSends: []
  52182. }),
  52183. $globals.HashedCollectionTest);
  52184. $core.addMethod(
  52185. $core.method({
  52186. selector: "collectionWithNewValue",
  52187. protocol: 'fixture',
  52188. fn: function (){
  52189. var self=this;
  52190. var $1;
  52191. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  52192. return $1;
  52193. },
  52194. args: [],
  52195. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  52196. referencedClasses: [],
  52197. messageSends: []
  52198. }),
  52199. $globals.HashedCollectionTest);
  52200. $core.addMethod(
  52201. $core.method({
  52202. selector: "sampleNewValueAsCollection",
  52203. protocol: 'fixture',
  52204. fn: function (){
  52205. var self=this;
  52206. var $1;
  52207. $1=$globals.HashedCollection._newFromPairs_(["new","N"]);
  52208. return $1;
  52209. },
  52210. args: [],
  52211. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  52212. referencedClasses: [],
  52213. messageSends: []
  52214. }),
  52215. $globals.HashedCollectionTest);
  52216. $core.addMethod(
  52217. $core.method({
  52218. selector: "testDynamicDictionaries",
  52219. protocol: 'tests',
  52220. fn: function (){
  52221. var self=this;
  52222. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  52223. return $core.withContext(function($ctx1) {
  52224. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($HashedCollection())._with_("hello".__minus_gt((1))));
  52225. return self;
  52226. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  52227. },
  52228. args: [],
  52229. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  52230. referencedClasses: ["HashedCollection"],
  52231. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  52232. }),
  52233. $globals.HashedCollectionTest);
  52234. $core.addMethod(
  52235. $core.method({
  52236. selector: "collectionClass",
  52237. protocol: 'fixture',
  52238. fn: function (){
  52239. var self=this;
  52240. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  52241. return $HashedCollection();
  52242. },
  52243. args: [],
  52244. source: "collectionClass\x0a\x09^ HashedCollection",
  52245. referencedClasses: ["HashedCollection"],
  52246. messageSends: []
  52247. }),
  52248. $globals.HashedCollectionTest.klass);
  52249. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  52250. $core.addMethod(
  52251. $core.method({
  52252. selector: "collectionFirst",
  52253. protocol: 'fixture',
  52254. fn: function (){
  52255. var self=this;
  52256. return $core.withContext(function($ctx1) {
  52257. self._subclassResponsibility();
  52258. return self;
  52259. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  52260. },
  52261. args: [],
  52262. source: "collectionFirst\x0a\x09self subclassResponsibility",
  52263. referencedClasses: [],
  52264. messageSends: ["subclassResponsibility"]
  52265. }),
  52266. $globals.SequenceableCollectionTest);
  52267. $core.addMethod(
  52268. $core.method({
  52269. selector: "collectionFirstTwo",
  52270. protocol: 'fixture',
  52271. fn: function (){
  52272. var self=this;
  52273. return $core.withContext(function($ctx1) {
  52274. self._subclassResponsibility();
  52275. return self;
  52276. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  52277. },
  52278. args: [],
  52279. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  52280. referencedClasses: [],
  52281. messageSends: ["subclassResponsibility"]
  52282. }),
  52283. $globals.SequenceableCollectionTest);
  52284. $core.addMethod(
  52285. $core.method({
  52286. selector: "collectionLast",
  52287. protocol: 'fixture',
  52288. fn: function (){
  52289. var self=this;
  52290. return $core.withContext(function($ctx1) {
  52291. self._subclassResponsibility();
  52292. return self;
  52293. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  52294. },
  52295. args: [],
  52296. source: "collectionLast\x0a\x09self subclassResponsibility",
  52297. referencedClasses: [],
  52298. messageSends: ["subclassResponsibility"]
  52299. }),
  52300. $globals.SequenceableCollectionTest);
  52301. $core.addMethod(
  52302. $core.method({
  52303. selector: "collectionLastTwo",
  52304. protocol: 'fixture',
  52305. fn: function (){
  52306. var self=this;
  52307. return $core.withContext(function($ctx1) {
  52308. self._subclassResponsibility();
  52309. return self;
  52310. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  52311. },
  52312. args: [],
  52313. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  52314. referencedClasses: [],
  52315. messageSends: ["subclassResponsibility"]
  52316. }),
  52317. $globals.SequenceableCollectionTest);
  52318. $core.addMethod(
  52319. $core.method({
  52320. selector: "nonIndexesDo:",
  52321. protocol: 'fixture',
  52322. fn: function (aBlock){
  52323. var self=this;
  52324. return $core.withContext(function($ctx1) {
  52325. $recv(aBlock)._value_((0));
  52326. $ctx1.sendIdx["value:"]=1;
  52327. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  52328. $ctx1.sendIdx["value:"]=2;
  52329. $recv(aBlock)._value_("z");
  52330. return self;
  52331. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  52332. },
  52333. args: ["aBlock"],
  52334. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  52335. referencedClasses: [],
  52336. messageSends: ["value:", "+", "collectionSize"]
  52337. }),
  52338. $globals.SequenceableCollectionTest);
  52339. $core.addMethod(
  52340. $core.method({
  52341. selector: "samplesDo:",
  52342. protocol: 'fixture',
  52343. fn: function (aBlock){
  52344. var self=this;
  52345. return $core.withContext(function($ctx1) {
  52346. $recv(aBlock)._value_value_((1),self._collectionFirst());
  52347. $ctx1.sendIdx["value:value:"]=1;
  52348. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  52349. return self;
  52350. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  52351. },
  52352. args: ["aBlock"],
  52353. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  52354. referencedClasses: [],
  52355. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  52356. }),
  52357. $globals.SequenceableCollectionTest);
  52358. $core.addMethod(
  52359. $core.method({
  52360. selector: "testBeginsWith",
  52361. protocol: 'tests',
  52362. fn: function (){
  52363. var self=this;
  52364. return $core.withContext(function($ctx1) {
  52365. var $2,$1,$4,$5,$3,$7,$6;
  52366. $2=self._collection();
  52367. $ctx1.sendIdx["collection"]=1;
  52368. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  52369. $ctx1.sendIdx["beginsWith:"]=1;
  52370. self._assert_($1);
  52371. $ctx1.sendIdx["assert:"]=1;
  52372. $4=self._collection();
  52373. $ctx1.sendIdx["collection"]=2;
  52374. $5=self._collection();
  52375. $ctx1.sendIdx["collection"]=3;
  52376. $3=$recv($4)._beginsWith_($5);
  52377. $ctx1.sendIdx["beginsWith:"]=2;
  52378. self._assert_($3);
  52379. $ctx1.sendIdx["assert:"]=2;
  52380. $7=self._collection();
  52381. $ctx1.sendIdx["collection"]=4;
  52382. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  52383. $ctx1.sendIdx["beginsWith:"]=3;
  52384. self._assert_($6);
  52385. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  52386. return self;
  52387. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  52388. },
  52389. args: [],
  52390. 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)",
  52391. referencedClasses: [],
  52392. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  52393. }),
  52394. $globals.SequenceableCollectionTest);
  52395. $core.addMethod(
  52396. $core.method({
  52397. selector: "testEndsWith",
  52398. protocol: 'tests',
  52399. fn: function (){
  52400. var self=this;
  52401. return $core.withContext(function($ctx1) {
  52402. var $2,$1,$4,$5,$3,$7,$6;
  52403. $2=self._collection();
  52404. $ctx1.sendIdx["collection"]=1;
  52405. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  52406. $ctx1.sendIdx["endsWith:"]=1;
  52407. self._assert_($1);
  52408. $ctx1.sendIdx["assert:"]=1;
  52409. $4=self._collection();
  52410. $ctx1.sendIdx["collection"]=2;
  52411. $5=self._collection();
  52412. $ctx1.sendIdx["collection"]=3;
  52413. $3=$recv($4)._endsWith_($5);
  52414. $ctx1.sendIdx["endsWith:"]=2;
  52415. self._assert_($3);
  52416. $ctx1.sendIdx["assert:"]=2;
  52417. $7=self._collection();
  52418. $ctx1.sendIdx["collection"]=4;
  52419. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  52420. $ctx1.sendIdx["endsWith:"]=3;
  52421. self._assert_($6);
  52422. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  52423. return self;
  52424. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  52425. },
  52426. args: [],
  52427. 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)",
  52428. referencedClasses: [],
  52429. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  52430. }),
  52431. $globals.SequenceableCollectionTest);
  52432. $core.addMethod(
  52433. $core.method({
  52434. selector: "testFirst",
  52435. protocol: 'tests',
  52436. fn: function (){
  52437. var self=this;
  52438. return $core.withContext(function($ctx1) {
  52439. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  52440. return self;
  52441. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  52442. },
  52443. args: [],
  52444. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  52445. referencedClasses: [],
  52446. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  52447. }),
  52448. $globals.SequenceableCollectionTest);
  52449. $core.addMethod(
  52450. $core.method({
  52451. selector: "testFirstN",
  52452. protocol: 'tests',
  52453. fn: function (){
  52454. var self=this;
  52455. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52456. return $core.withContext(function($ctx1) {
  52457. var $2,$1,$4,$3,$6,$5,$7;
  52458. $2=self._collection();
  52459. $ctx1.sendIdx["collection"]=1;
  52460. $1=$recv($2)._first_((2));
  52461. $ctx1.sendIdx["first:"]=1;
  52462. self._assert_equals_($1,self._collectionFirstTwo());
  52463. $ctx1.sendIdx["assert:equals:"]=1;
  52464. $4=self._collection();
  52465. $ctx1.sendIdx["collection"]=2;
  52466. $3=$recv($4)._first_((0));
  52467. $ctx1.sendIdx["first:"]=2;
  52468. self._assert_equals_($3,$recv(self._collectionClass())._new());
  52469. $ctx1.sendIdx["assert:equals:"]=2;
  52470. $6=self._collection();
  52471. $ctx1.sendIdx["collection"]=3;
  52472. $5=$recv($6)._first_(self._collectionSize());
  52473. $ctx1.sendIdx["first:"]=3;
  52474. $7=self._collection();
  52475. $ctx1.sendIdx["collection"]=4;
  52476. self._assert_equals_($5,$7);
  52477. self._should_raise_((function(){
  52478. return $core.withContext(function($ctx2) {
  52479. return $recv(self._collection())._first_((33));
  52480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52481. }),$Error());
  52482. return self;
  52483. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  52484. },
  52485. args: [],
  52486. 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",
  52487. referencedClasses: ["Error"],
  52488. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  52489. }),
  52490. $globals.SequenceableCollectionTest);
  52491. $core.addMethod(
  52492. $core.method({
  52493. selector: "testFourth",
  52494. protocol: 'tests',
  52495. fn: function (){
  52496. var self=this;
  52497. return $core.withContext(function($ctx1) {
  52498. var $2,$1;
  52499. $2=self._collection();
  52500. $ctx1.sendIdx["collection"]=1;
  52501. $1=$recv($2)._fourth();
  52502. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  52503. return self;
  52504. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  52505. },
  52506. args: [],
  52507. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  52508. referencedClasses: [],
  52509. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  52510. }),
  52511. $globals.SequenceableCollectionTest);
  52512. $core.addMethod(
  52513. $core.method({
  52514. selector: "testIndexOfStartingAt",
  52515. protocol: 'tests',
  52516. fn: function (){
  52517. var self=this;
  52518. var jsNull;
  52519. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  52520. return $core.withContext(function($ctx1) {
  52521. var $2,$1,$4,$3;
  52522. jsNull=$recv($JSON())._parse_("null");
  52523. self._samplesDo_((function(index,value){
  52524. return $core.withContext(function($ctx2) {
  52525. $2=self._collection();
  52526. $ctx2.sendIdx["collection"]=1;
  52527. $1=$recv($2)._indexOf_startingAt_(value,(1));
  52528. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  52529. self._assert_equals_($1,index);
  52530. $ctx2.sendIdx["assert:equals:"]=1;
  52531. $4=self._collection();
  52532. $ctx2.sendIdx["collection"]=2;
  52533. $3=$recv($4)._indexOf_startingAt_(value,index);
  52534. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  52535. self._assert_equals_($3,index);
  52536. $ctx2.sendIdx["assert:equals:"]=2;
  52537. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  52538. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52539. }));
  52540. return self;
  52541. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  52542. },
  52543. args: [],
  52544. 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 ]",
  52545. referencedClasses: ["JSON"],
  52546. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  52547. }),
  52548. $globals.SequenceableCollectionTest);
  52549. $core.addMethod(
  52550. $core.method({
  52551. selector: "testIndexOfStartingAtWithNull",
  52552. protocol: 'tests',
  52553. fn: function (){
  52554. var self=this;
  52555. var jsNull;
  52556. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  52557. return $core.withContext(function($ctx1) {
  52558. var $1,$2;
  52559. jsNull=$recv($JSON())._parse_("null");
  52560. self._samplesDo_((function(index,value){
  52561. var collection;
  52562. return $core.withContext(function($ctx2) {
  52563. collection=self._collection();
  52564. collection;
  52565. $recv(collection)._at_put_(index,jsNull);
  52566. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  52567. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  52568. self._assert_equals_($1,index);
  52569. $ctx2.sendIdx["assert:equals:"]=1;
  52570. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  52571. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  52572. self._assert_equals_($2,index);
  52573. $ctx2.sendIdx["assert:equals:"]=2;
  52574. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  52575. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  52576. }));
  52577. return self;
  52578. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  52579. },
  52580. args: [],
  52581. 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 ]",
  52582. referencedClasses: ["JSON"],
  52583. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  52584. }),
  52585. $globals.SequenceableCollectionTest);
  52586. $core.addMethod(
  52587. $core.method({
  52588. selector: "testLast",
  52589. protocol: 'tests',
  52590. fn: function (){
  52591. var self=this;
  52592. return $core.withContext(function($ctx1) {
  52593. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  52594. return self;
  52595. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  52596. },
  52597. args: [],
  52598. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  52599. referencedClasses: [],
  52600. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  52601. }),
  52602. $globals.SequenceableCollectionTest);
  52603. $core.addMethod(
  52604. $core.method({
  52605. selector: "testLastN",
  52606. protocol: 'tests',
  52607. fn: function (){
  52608. var self=this;
  52609. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52610. return $core.withContext(function($ctx1) {
  52611. var $2,$1,$4,$3,$6,$5,$7;
  52612. $2=self._collection();
  52613. $ctx1.sendIdx["collection"]=1;
  52614. $1=$recv($2)._last_((2));
  52615. $ctx1.sendIdx["last:"]=1;
  52616. self._assert_equals_($1,self._collectionLastTwo());
  52617. $ctx1.sendIdx["assert:equals:"]=1;
  52618. $4=self._collection();
  52619. $ctx1.sendIdx["collection"]=2;
  52620. $3=$recv($4)._last_((0));
  52621. $ctx1.sendIdx["last:"]=2;
  52622. self._assert_equals_($3,$recv(self._collectionClass())._new());
  52623. $ctx1.sendIdx["assert:equals:"]=2;
  52624. $6=self._collection();
  52625. $ctx1.sendIdx["collection"]=3;
  52626. $5=$recv($6)._last_(self._collectionSize());
  52627. $ctx1.sendIdx["last:"]=3;
  52628. $7=self._collection();
  52629. $ctx1.sendIdx["collection"]=4;
  52630. self._assert_equals_($5,$7);
  52631. self._should_raise_((function(){
  52632. return $core.withContext(function($ctx2) {
  52633. return $recv(self._collection())._last_((33));
  52634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52635. }),$Error());
  52636. return self;
  52637. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  52638. },
  52639. args: [],
  52640. 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",
  52641. referencedClasses: ["Error"],
  52642. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  52643. }),
  52644. $globals.SequenceableCollectionTest);
  52645. $core.addMethod(
  52646. $core.method({
  52647. selector: "testSecond",
  52648. protocol: 'tests',
  52649. fn: function (){
  52650. var self=this;
  52651. return $core.withContext(function($ctx1) {
  52652. var $2,$1;
  52653. $2=self._collection();
  52654. $ctx1.sendIdx["collection"]=1;
  52655. $1=$recv($2)._second();
  52656. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  52657. return self;
  52658. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  52659. },
  52660. args: [],
  52661. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  52662. referencedClasses: [],
  52663. messageSends: ["assert:equals:", "second", "collection", "at:"]
  52664. }),
  52665. $globals.SequenceableCollectionTest);
  52666. $core.addMethod(
  52667. $core.method({
  52668. selector: "testThird",
  52669. protocol: 'tests',
  52670. fn: function (){
  52671. var self=this;
  52672. return $core.withContext(function($ctx1) {
  52673. var $2,$1;
  52674. $2=self._collection();
  52675. $ctx1.sendIdx["collection"]=1;
  52676. $1=$recv($2)._third();
  52677. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  52678. return self;
  52679. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  52680. },
  52681. args: [],
  52682. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  52683. referencedClasses: [],
  52684. messageSends: ["assert:equals:", "third", "collection", "at:"]
  52685. }),
  52686. $globals.SequenceableCollectionTest);
  52687. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  52688. $core.addMethod(
  52689. $core.method({
  52690. selector: "collection",
  52691. protocol: 'fixture',
  52692. fn: function (){
  52693. var self=this;
  52694. var $1;
  52695. $1=[(1), (2), (3), (-4)];
  52696. return $1;
  52697. },
  52698. args: [],
  52699. source: "collection\x0a\x09^ #(1 2 3 -4)",
  52700. referencedClasses: [],
  52701. messageSends: []
  52702. }),
  52703. $globals.ArrayTest);
  52704. $core.addMethod(
  52705. $core.method({
  52706. selector: "collectionFirst",
  52707. protocol: 'fixture',
  52708. fn: function (){
  52709. var self=this;
  52710. return (1);
  52711. },
  52712. args: [],
  52713. source: "collectionFirst\x0a\x09^ 1",
  52714. referencedClasses: [],
  52715. messageSends: []
  52716. }),
  52717. $globals.ArrayTest);
  52718. $core.addMethod(
  52719. $core.method({
  52720. selector: "collectionFirstTwo",
  52721. protocol: 'fixture',
  52722. fn: function (){
  52723. var self=this;
  52724. var $1;
  52725. $1=[(1), (2)];
  52726. return $1;
  52727. },
  52728. args: [],
  52729. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  52730. referencedClasses: [],
  52731. messageSends: []
  52732. }),
  52733. $globals.ArrayTest);
  52734. $core.addMethod(
  52735. $core.method({
  52736. selector: "collectionLast",
  52737. protocol: 'fixture',
  52738. fn: function (){
  52739. var self=this;
  52740. return (-4);
  52741. },
  52742. args: [],
  52743. source: "collectionLast\x0a\x09^ -4",
  52744. referencedClasses: [],
  52745. messageSends: []
  52746. }),
  52747. $globals.ArrayTest);
  52748. $core.addMethod(
  52749. $core.method({
  52750. selector: "collectionLastTwo",
  52751. protocol: 'fixture',
  52752. fn: function (){
  52753. var self=this;
  52754. var $1;
  52755. $1=[(3), (-4)];
  52756. return $1;
  52757. },
  52758. args: [],
  52759. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  52760. referencedClasses: [],
  52761. messageSends: []
  52762. }),
  52763. $globals.ArrayTest);
  52764. $core.addMethod(
  52765. $core.method({
  52766. selector: "collectionOfPrintStrings",
  52767. protocol: 'fixture',
  52768. fn: function (){
  52769. var self=this;
  52770. var $1;
  52771. $1=["1", "2", "3", "-4"];
  52772. return $1;
  52773. },
  52774. args: [],
  52775. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  52776. referencedClasses: [],
  52777. messageSends: []
  52778. }),
  52779. $globals.ArrayTest);
  52780. $core.addMethod(
  52781. $core.method({
  52782. selector: "collectionSize",
  52783. protocol: 'fixture',
  52784. fn: function (){
  52785. var self=this;
  52786. return (4);
  52787. },
  52788. args: [],
  52789. source: "collectionSize\x0a\x09^ 4",
  52790. referencedClasses: [],
  52791. messageSends: []
  52792. }),
  52793. $globals.ArrayTest);
  52794. $core.addMethod(
  52795. $core.method({
  52796. selector: "collectionWithDuplicates",
  52797. protocol: 'fixture',
  52798. fn: function (){
  52799. var self=this;
  52800. var $1;
  52801. $1=["a", "b", "c", (1), (2), (1), "a"];
  52802. return $1;
  52803. },
  52804. args: [],
  52805. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  52806. referencedClasses: [],
  52807. messageSends: []
  52808. }),
  52809. $globals.ArrayTest);
  52810. $core.addMethod(
  52811. $core.method({
  52812. selector: "collectionWithNewValue",
  52813. protocol: 'fixture',
  52814. fn: function (){
  52815. var self=this;
  52816. var $1;
  52817. $1=[(1), (2), (3), (-4), "N"];
  52818. return $1;
  52819. },
  52820. args: [],
  52821. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  52822. referencedClasses: [],
  52823. messageSends: []
  52824. }),
  52825. $globals.ArrayTest);
  52826. $core.addMethod(
  52827. $core.method({
  52828. selector: "sampleNewIndex",
  52829. protocol: 'fixture',
  52830. fn: function (){
  52831. var self=this;
  52832. return (5);
  52833. },
  52834. args: [],
  52835. source: "sampleNewIndex\x0a\x09^ 5",
  52836. referencedClasses: [],
  52837. messageSends: []
  52838. }),
  52839. $globals.ArrayTest);
  52840. $core.addMethod(
  52841. $core.method({
  52842. selector: "samplesDo:",
  52843. protocol: 'fixture',
  52844. fn: function (aBlock){
  52845. var self=this;
  52846. return $core.withContext(function($ctx1) {
  52847. (
  52848. $ctx1.supercall = true,
  52849. $globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  52850. $ctx1.supercall = false;
  52851. $recv(aBlock)._value_value_((3),(3));
  52852. return self;
  52853. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  52854. },
  52855. args: ["aBlock"],
  52856. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  52857. referencedClasses: [],
  52858. messageSends: ["samplesDo:", "value:value:"]
  52859. }),
  52860. $globals.ArrayTest);
  52861. $core.addMethod(
  52862. $core.method({
  52863. selector: "testAdd",
  52864. protocol: 'tests',
  52865. fn: function (){
  52866. var self=this;
  52867. var array;
  52868. return $core.withContext(function($ctx1) {
  52869. array=self._collection();
  52870. $recv(array)._add_((6));
  52871. self._assert_equals_($recv(array)._last(),(6));
  52872. return self;
  52873. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  52874. },
  52875. args: [],
  52876. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  52877. referencedClasses: [],
  52878. messageSends: ["collection", "add:", "assert:equals:", "last"]
  52879. }),
  52880. $globals.ArrayTest);
  52881. $core.addMethod(
  52882. $core.method({
  52883. selector: "testAddFirst",
  52884. protocol: 'tests',
  52885. fn: function (){
  52886. var self=this;
  52887. return $core.withContext(function($ctx1) {
  52888. var $1,$2;
  52889. $1=self._collection();
  52890. $recv($1)._addFirst_((0));
  52891. $2=$recv($1)._yourself();
  52892. self._assert_equals_($recv($2)._first(),(0));
  52893. return self;
  52894. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  52895. },
  52896. args: [],
  52897. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  52898. referencedClasses: [],
  52899. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  52900. }),
  52901. $globals.ArrayTest);
  52902. $core.addMethod(
  52903. $core.method({
  52904. selector: "testPrintString",
  52905. protocol: 'tests',
  52906. fn: function (){
  52907. var self=this;
  52908. var array;
  52909. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  52910. return $core.withContext(function($ctx1) {
  52911. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  52912. array=$recv($Array())._new();
  52913. $1=$recv(array)._printString();
  52914. $ctx1.sendIdx["printString"]=1;
  52915. self._assert_equals_($1,"an Array ()");
  52916. $ctx1.sendIdx["assert:equals:"]=1;
  52917. $2=array;
  52918. $recv($2)._add_((1));
  52919. $ctx1.sendIdx["add:"]=1;
  52920. $3=$recv($2)._add_((3));
  52921. $ctx1.sendIdx["add:"]=2;
  52922. $4=$recv(array)._printString();
  52923. $ctx1.sendIdx["printString"]=2;
  52924. self._assert_equals_($4,"an Array (1 3)");
  52925. $ctx1.sendIdx["assert:equals:"]=2;
  52926. $recv(array)._add_("foo");
  52927. $5=$recv(array)._printString();
  52928. $ctx1.sendIdx["printString"]=3;
  52929. self._assert_equals_($5,"an Array (1 3 'foo')");
  52930. $ctx1.sendIdx["assert:equals:"]=3;
  52931. $6=array;
  52932. $recv($6)._remove_((1));
  52933. $ctx1.sendIdx["remove:"]=1;
  52934. $7=$recv($6)._remove_((3));
  52935. $8=$recv(array)._printString();
  52936. $ctx1.sendIdx["printString"]=4;
  52937. self._assert_equals_($8,"an Array ('foo')");
  52938. $ctx1.sendIdx["assert:equals:"]=4;
  52939. $recv(array)._addLast_((3));
  52940. $ctx1.sendIdx["addLast:"]=1;
  52941. $9=$recv(array)._printString();
  52942. $ctx1.sendIdx["printString"]=5;
  52943. self._assert_equals_($9,"an Array ('foo' 3)");
  52944. $ctx1.sendIdx["assert:equals:"]=5;
  52945. $recv(array)._addLast_((3));
  52946. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  52947. return self;
  52948. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  52949. },
  52950. args: [],
  52951. 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)'.",
  52952. referencedClasses: ["Array"],
  52953. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  52954. }),
  52955. $globals.ArrayTest);
  52956. $core.addMethod(
  52957. $core.method({
  52958. selector: "testRemove",
  52959. protocol: 'tests',
  52960. fn: function (){
  52961. var self=this;
  52962. var array;
  52963. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52964. return $core.withContext(function($ctx1) {
  52965. array=[(1), (2), (3), (4), (5)];
  52966. $recv(array)._remove_((3));
  52967. $ctx1.sendIdx["remove:"]=1;
  52968. self._assert_equals_(array,[(1), (2), (4), (5)]);
  52969. self._should_raise_((function(){
  52970. return $core.withContext(function($ctx2) {
  52971. return $recv(array)._remove_((3));
  52972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52973. }),$Error());
  52974. return self;
  52975. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  52976. },
  52977. args: [],
  52978. 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",
  52979. referencedClasses: ["Error"],
  52980. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  52981. }),
  52982. $globals.ArrayTest);
  52983. $core.addMethod(
  52984. $core.method({
  52985. selector: "testRemoveFromTo",
  52986. protocol: 'tests',
  52987. fn: function (){
  52988. var self=this;
  52989. return $core.withContext(function($ctx1) {
  52990. var $1,$2;
  52991. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  52992. $ctx1.sendIdx["removeFrom:to:"]=1;
  52993. self._assert_equals_($1,[(4)]);
  52994. $ctx1.sendIdx["assert:equals:"]=1;
  52995. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  52996. $ctx1.sendIdx["removeFrom:to:"]=2;
  52997. self._assert_equals_($2,[(1), (4)]);
  52998. $ctx1.sendIdx["assert:equals:"]=2;
  52999. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  53000. return self;
  53001. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  53002. },
  53003. args: [],
  53004. 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)",
  53005. referencedClasses: [],
  53006. messageSends: ["assert:equals:", "removeFrom:to:"]
  53007. }),
  53008. $globals.ArrayTest);
  53009. $core.addMethod(
  53010. $core.method({
  53011. selector: "testRemoveIndex",
  53012. protocol: 'tests',
  53013. fn: function (){
  53014. var self=this;
  53015. return $core.withContext(function($ctx1) {
  53016. var $1,$2;
  53017. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  53018. $ctx1.sendIdx["removeIndex:"]=1;
  53019. self._assert_equals_($1,[(1), (3), (4)]);
  53020. $ctx1.sendIdx["assert:equals:"]=1;
  53021. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  53022. $ctx1.sendIdx["removeIndex:"]=2;
  53023. self._assert_equals_($2,[(2), (3), (4)]);
  53024. $ctx1.sendIdx["assert:equals:"]=2;
  53025. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  53026. return self;
  53027. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  53028. },
  53029. args: [],
  53030. 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: #()",
  53031. referencedClasses: [],
  53032. messageSends: ["assert:equals:", "removeIndex:"]
  53033. }),
  53034. $globals.ArrayTest);
  53035. $core.addMethod(
  53036. $core.method({
  53037. selector: "testRemoveLast",
  53038. protocol: 'tests',
  53039. fn: function (){
  53040. var self=this;
  53041. var array;
  53042. return $core.withContext(function($ctx1) {
  53043. array=[(1), (2)];
  53044. $recv(array)._removeLast();
  53045. self._assert_equals_($recv(array)._last(),(1));
  53046. return self;
  53047. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  53048. },
  53049. args: [],
  53050. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  53051. referencedClasses: [],
  53052. messageSends: ["removeLast", "assert:equals:", "last"]
  53053. }),
  53054. $globals.ArrayTest);
  53055. $core.addMethod(
  53056. $core.method({
  53057. selector: "testReversed",
  53058. protocol: 'tests',
  53059. fn: function (){
  53060. var self=this;
  53061. var array;
  53062. return $core.withContext(function($ctx1) {
  53063. array=[(5), (4), (3), (2), (1)];
  53064. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  53065. return self;
  53066. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  53067. },
  53068. args: [],
  53069. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  53070. referencedClasses: [],
  53071. messageSends: ["assert:equals:", "reversed"]
  53072. }),
  53073. $globals.ArrayTest);
  53074. $core.addMethod(
  53075. $core.method({
  53076. selector: "testSort",
  53077. protocol: 'tests',
  53078. fn: function (){
  53079. var self=this;
  53080. var array;
  53081. return $core.withContext(function($ctx1) {
  53082. array=[(10), (1), (5)];
  53083. $recv(array)._sort();
  53084. self._assert_equals_(array,[(1), (5), (10)]);
  53085. return self;
  53086. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  53087. },
  53088. args: [],
  53089. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  53090. referencedClasses: [],
  53091. messageSends: ["sort", "assert:equals:"]
  53092. }),
  53093. $globals.ArrayTest);
  53094. $core.addMethod(
  53095. $core.method({
  53096. selector: "collectionClass",
  53097. protocol: 'fixture',
  53098. fn: function (){
  53099. var self=this;
  53100. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  53101. return $Array();
  53102. },
  53103. args: [],
  53104. source: "collectionClass\x0a\x09^ Array",
  53105. referencedClasses: ["Array"],
  53106. messageSends: []
  53107. }),
  53108. $globals.ArrayTest.klass);
  53109. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  53110. $core.addMethod(
  53111. $core.method({
  53112. selector: "collection",
  53113. protocol: 'fixture',
  53114. fn: function (){
  53115. var self=this;
  53116. return "helLo";
  53117. },
  53118. args: [],
  53119. source: "collection\x0a\x09^ 'helLo'",
  53120. referencedClasses: [],
  53121. messageSends: []
  53122. }),
  53123. $globals.StringTest);
  53124. $core.addMethod(
  53125. $core.method({
  53126. selector: "collectionFirst",
  53127. protocol: 'fixture',
  53128. fn: function (){
  53129. var self=this;
  53130. return "h";
  53131. },
  53132. args: [],
  53133. source: "collectionFirst\x0a\x09^ 'h'",
  53134. referencedClasses: [],
  53135. messageSends: []
  53136. }),
  53137. $globals.StringTest);
  53138. $core.addMethod(
  53139. $core.method({
  53140. selector: "collectionFirstTwo",
  53141. protocol: 'fixture',
  53142. fn: function (){
  53143. var self=this;
  53144. return "he";
  53145. },
  53146. args: [],
  53147. source: "collectionFirstTwo\x0a\x09^ 'he'",
  53148. referencedClasses: [],
  53149. messageSends: []
  53150. }),
  53151. $globals.StringTest);
  53152. $core.addMethod(
  53153. $core.method({
  53154. selector: "collectionLast",
  53155. protocol: 'fixture',
  53156. fn: function (){
  53157. var self=this;
  53158. return "o";
  53159. },
  53160. args: [],
  53161. source: "collectionLast\x0a\x09^ 'o'",
  53162. referencedClasses: [],
  53163. messageSends: []
  53164. }),
  53165. $globals.StringTest);
  53166. $core.addMethod(
  53167. $core.method({
  53168. selector: "collectionLastTwo",
  53169. protocol: 'fixture',
  53170. fn: function (){
  53171. var self=this;
  53172. return "Lo";
  53173. },
  53174. args: [],
  53175. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  53176. referencedClasses: [],
  53177. messageSends: []
  53178. }),
  53179. $globals.StringTest);
  53180. $core.addMethod(
  53181. $core.method({
  53182. selector: "collectionOfPrintStrings",
  53183. protocol: 'fixture',
  53184. fn: function (){
  53185. var self=this;
  53186. return "'h''e''l''L''o'";
  53187. },
  53188. args: [],
  53189. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  53190. referencedClasses: [],
  53191. messageSends: []
  53192. }),
  53193. $globals.StringTest);
  53194. $core.addMethod(
  53195. $core.method({
  53196. selector: "collectionSize",
  53197. protocol: 'fixture',
  53198. fn: function (){
  53199. var self=this;
  53200. return (5);
  53201. },
  53202. args: [],
  53203. source: "collectionSize\x0a\x09^ 5",
  53204. referencedClasses: [],
  53205. messageSends: []
  53206. }),
  53207. $globals.StringTest);
  53208. $core.addMethod(
  53209. $core.method({
  53210. selector: "collectionWithDuplicates",
  53211. protocol: 'fixture',
  53212. fn: function (){
  53213. var self=this;
  53214. return "abbaerte";
  53215. },
  53216. args: [],
  53217. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  53218. referencedClasses: [],
  53219. messageSends: []
  53220. }),
  53221. $globals.StringTest);
  53222. $core.addMethod(
  53223. $core.method({
  53224. selector: "collectionWithNewValue",
  53225. protocol: 'fixture',
  53226. fn: function (){
  53227. var self=this;
  53228. return "helLoN";
  53229. },
  53230. args: [],
  53231. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  53232. referencedClasses: [],
  53233. messageSends: []
  53234. }),
  53235. $globals.StringTest);
  53236. $core.addMethod(
  53237. $core.method({
  53238. selector: "sampleNewValueAsCollection",
  53239. protocol: 'fixture',
  53240. fn: function (){
  53241. var self=this;
  53242. return "N";
  53243. },
  53244. args: [],
  53245. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  53246. referencedClasses: [],
  53247. messageSends: []
  53248. }),
  53249. $globals.StringTest);
  53250. $core.addMethod(
  53251. $core.method({
  53252. selector: "samplesDo:",
  53253. protocol: 'fixture',
  53254. fn: function (aBlock){
  53255. var self=this;
  53256. return $core.withContext(function($ctx1) {
  53257. (
  53258. $ctx1.supercall = true,
  53259. $globals.StringTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  53260. $ctx1.supercall = false;
  53261. $recv(aBlock)._value_value_((3),"l");
  53262. return self;
  53263. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  53264. },
  53265. args: ["aBlock"],
  53266. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  53267. referencedClasses: [],
  53268. messageSends: ["samplesDo:", "value:value:"]
  53269. }),
  53270. $globals.StringTest);
  53271. $core.addMethod(
  53272. $core.method({
  53273. selector: "testAddAll",
  53274. protocol: 'tests',
  53275. fn: function (){
  53276. var self=this;
  53277. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53278. return $core.withContext(function($ctx1) {
  53279. var $1;
  53280. self._should_raise_((function(){
  53281. return $core.withContext(function($ctx2) {
  53282. $1=self._collection();
  53283. $ctx2.sendIdx["collection"]=1;
  53284. return $recv($1)._addAll_(self._collection());
  53285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53286. }),$Error());
  53287. return self;
  53288. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  53289. },
  53290. args: [],
  53291. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  53292. referencedClasses: ["Error"],
  53293. messageSends: ["should:raise:", "addAll:", "collection"]
  53294. }),
  53295. $globals.StringTest);
  53296. $core.addMethod(
  53297. $core.method({
  53298. selector: "testAddRemove",
  53299. protocol: 'tests',
  53300. fn: function (){
  53301. var self=this;
  53302. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53303. return $core.withContext(function($ctx1) {
  53304. self._should_raise_((function(){
  53305. return $core.withContext(function($ctx2) {
  53306. return "hello"._add_("a");
  53307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53308. }),$Error());
  53309. $ctx1.sendIdx["should:raise:"]=1;
  53310. self._should_raise_((function(){
  53311. return $core.withContext(function($ctx2) {
  53312. return "hello"._remove_("h");
  53313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53314. }),$Error());
  53315. return self;
  53316. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  53317. },
  53318. args: [],
  53319. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  53320. referencedClasses: ["Error"],
  53321. messageSends: ["should:raise:", "add:", "remove:"]
  53322. }),
  53323. $globals.StringTest);
  53324. $core.addMethod(
  53325. $core.method({
  53326. selector: "testAsArray",
  53327. protocol: 'tests',
  53328. fn: function (){
  53329. var self=this;
  53330. return $core.withContext(function($ctx1) {
  53331. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  53332. return self;
  53333. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  53334. },
  53335. args: [],
  53336. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  53337. referencedClasses: [],
  53338. messageSends: ["assert:equals:", "asArray"]
  53339. }),
  53340. $globals.StringTest);
  53341. $core.addMethod(
  53342. $core.method({
  53343. selector: "testAsLowerCase",
  53344. protocol: 'tests',
  53345. fn: function (){
  53346. var self=this;
  53347. return $core.withContext(function($ctx1) {
  53348. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  53349. return self;
  53350. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  53351. },
  53352. args: [],
  53353. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  53354. referencedClasses: [],
  53355. messageSends: ["assert:equals:", "asLowercase"]
  53356. }),
  53357. $globals.StringTest);
  53358. $core.addMethod(
  53359. $core.method({
  53360. selector: "testAsNumber",
  53361. protocol: 'tests',
  53362. fn: function (){
  53363. var self=this;
  53364. return $core.withContext(function($ctx1) {
  53365. var $1,$2;
  53366. $1="3"._asNumber();
  53367. $ctx1.sendIdx["asNumber"]=1;
  53368. self._assert_equals_($1,(3));
  53369. $ctx1.sendIdx["assert:equals:"]=1;
  53370. $2="-3"._asNumber();
  53371. $ctx1.sendIdx["asNumber"]=2;
  53372. self._assert_equals_($2,(-3));
  53373. $ctx1.sendIdx["assert:equals:"]=2;
  53374. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  53375. return self;
  53376. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  53377. },
  53378. args: [],
  53379. 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.",
  53380. referencedClasses: [],
  53381. messageSends: ["assert:equals:", "asNumber"]
  53382. }),
  53383. $globals.StringTest);
  53384. $core.addMethod(
  53385. $core.method({
  53386. selector: "testAsUpperCase",
  53387. protocol: 'tests',
  53388. fn: function (){
  53389. var self=this;
  53390. return $core.withContext(function($ctx1) {
  53391. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  53392. return self;
  53393. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  53394. },
  53395. args: [],
  53396. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  53397. referencedClasses: [],
  53398. messageSends: ["assert:equals:", "asUppercase"]
  53399. }),
  53400. $globals.StringTest);
  53401. $core.addMethod(
  53402. $core.method({
  53403. selector: "testAsciiValue",
  53404. protocol: 'tests',
  53405. fn: function (){
  53406. var self=this;
  53407. var characterA,characterU;
  53408. return $core.withContext(function($ctx1) {
  53409. var $1;
  53410. characterA="A";
  53411. characterU="U";
  53412. $1=$recv(characterA)._asciiValue();
  53413. $ctx1.sendIdx["asciiValue"]=1;
  53414. self._assert_equals_($1,(65));
  53415. $ctx1.sendIdx["assert:equals:"]=1;
  53416. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  53417. return self;
  53418. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  53419. },
  53420. args: [],
  53421. 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",
  53422. referencedClasses: [],
  53423. messageSends: ["assert:equals:", "asciiValue"]
  53424. }),
  53425. $globals.StringTest);
  53426. $core.addMethod(
  53427. $core.method({
  53428. selector: "testAtIfAbsentPut",
  53429. protocol: 'tests',
  53430. fn: function (){
  53431. var self=this;
  53432. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53433. return $core.withContext(function($ctx1) {
  53434. self._should_raise_((function(){
  53435. return $core.withContext(function($ctx2) {
  53436. return "hello"._at_ifAbsentPut_((6),(function(){
  53437. return "a";
  53438. }));
  53439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53440. }),$Error());
  53441. return self;
  53442. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  53443. },
  53444. args: [],
  53445. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  53446. referencedClasses: ["Error"],
  53447. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  53448. }),
  53449. $globals.StringTest);
  53450. $core.addMethod(
  53451. $core.method({
  53452. selector: "testAtPut",
  53453. protocol: 'tests',
  53454. fn: function (){
  53455. var self=this;
  53456. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53457. return $core.withContext(function($ctx1) {
  53458. self._should_raise_((function(){
  53459. return $core.withContext(function($ctx2) {
  53460. return "hello"._at_put_((1),"a");
  53461. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53462. }),$Error());
  53463. return self;
  53464. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  53465. },
  53466. args: [],
  53467. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  53468. referencedClasses: ["Error"],
  53469. messageSends: ["should:raise:", "at:put:"]
  53470. }),
  53471. $globals.StringTest);
  53472. $core.addMethod(
  53473. $core.method({
  53474. selector: "testCapitalized",
  53475. protocol: 'tests',
  53476. fn: function (){
  53477. var self=this;
  53478. return $core.withContext(function($ctx1) {
  53479. var $1,$2,$3;
  53480. $1="test"._capitalized();
  53481. $ctx1.sendIdx["capitalized"]=1;
  53482. self._assert_equals_($1,"Test");
  53483. $ctx1.sendIdx["assert:equals:"]=1;
  53484. $2="Test"._capitalized();
  53485. $ctx1.sendIdx["capitalized"]=2;
  53486. self._assert_equals_($2,"Test");
  53487. $ctx1.sendIdx["assert:equals:"]=2;
  53488. self._assert_equals_(""._capitalized(),"");
  53489. $ctx1.sendIdx["assert:equals:"]=3;
  53490. $3="Test"._isCapitalized();
  53491. $ctx1.sendIdx["isCapitalized"]=1;
  53492. self._assert_equals_($3,true);
  53493. $ctx1.sendIdx["assert:equals:"]=4;
  53494. self._assert_equals_("test"._isCapitalized(),false);
  53495. return self;
  53496. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  53497. },
  53498. args: [],
  53499. 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.",
  53500. referencedClasses: [],
  53501. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  53502. }),
  53503. $globals.StringTest);
  53504. $core.addMethod(
  53505. $core.method({
  53506. selector: "testCharCodeAt",
  53507. protocol: 'tests',
  53508. fn: function (){
  53509. var self=this;
  53510. return $core.withContext(function($ctx1) {
  53511. var $1,$2,$3,$4,$5;
  53512. $1="jackie"._charCodeAt_((1));
  53513. $ctx1.sendIdx["charCodeAt:"]=1;
  53514. self._assert_equals_($1,(106));
  53515. $ctx1.sendIdx["assert:equals:"]=1;
  53516. $2="jackie"._charCodeAt_((2));
  53517. $ctx1.sendIdx["charCodeAt:"]=2;
  53518. self._assert_equals_($2,(97));
  53519. $ctx1.sendIdx["assert:equals:"]=2;
  53520. $3="jackie"._charCodeAt_((3));
  53521. $ctx1.sendIdx["charCodeAt:"]=3;
  53522. self._assert_equals_($3,(99));
  53523. $ctx1.sendIdx["assert:equals:"]=3;
  53524. $4="jackie"._charCodeAt_((4));
  53525. $ctx1.sendIdx["charCodeAt:"]=4;
  53526. self._assert_equals_($4,(107));
  53527. $ctx1.sendIdx["assert:equals:"]=4;
  53528. $5="jackie"._charCodeAt_((5));
  53529. $ctx1.sendIdx["charCodeAt:"]=5;
  53530. self._assert_equals_($5,(105));
  53531. $ctx1.sendIdx["assert:equals:"]=5;
  53532. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  53533. return self;
  53534. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  53535. },
  53536. args: [],
  53537. 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",
  53538. referencedClasses: [],
  53539. messageSends: ["assert:equals:", "charCodeAt:"]
  53540. }),
  53541. $globals.StringTest);
  53542. $core.addMethod(
  53543. $core.method({
  53544. selector: "testCopyFromTo",
  53545. protocol: 'tests',
  53546. fn: function (){
  53547. var self=this;
  53548. return $core.withContext(function($ctx1) {
  53549. var $1;
  53550. $1="jackie"._copyFrom_to_((1),(3));
  53551. $ctx1.sendIdx["copyFrom:to:"]=1;
  53552. self._assert_equals_($1,"jac");
  53553. $ctx1.sendIdx["assert:equals:"]=1;
  53554. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  53555. return self;
  53556. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  53557. },
  53558. args: [],
  53559. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  53560. referencedClasses: [],
  53561. messageSends: ["assert:equals:", "copyFrom:to:"]
  53562. }),
  53563. $globals.StringTest);
  53564. $core.addMethod(
  53565. $core.method({
  53566. selector: "testCopyWithoutAll",
  53567. protocol: 'tests',
  53568. fn: function (){
  53569. var self=this;
  53570. return $core.withContext(function($ctx1) {
  53571. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  53572. return self;
  53573. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  53574. },
  53575. args: [],
  53576. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  53577. referencedClasses: [],
  53578. messageSends: ["assert:equals:", "copyWithoutAll:"]
  53579. }),
  53580. $globals.StringTest);
  53581. $core.addMethod(
  53582. $core.method({
  53583. selector: "testEquality",
  53584. protocol: 'tests',
  53585. fn: function (){
  53586. var self=this;
  53587. return $core.withContext(function($ctx1) {
  53588. var $1,$2,$3;
  53589. self._assert_equals_("hello","hello");
  53590. $ctx1.sendIdx["assert:equals:"]=1;
  53591. $1="hello".__eq("world");
  53592. $ctx1.sendIdx["="]=1;
  53593. self._deny_($1);
  53594. $ctx1.sendIdx["deny:"]=1;
  53595. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  53596. })));
  53597. $ctx1.sendIdx["="]=2;
  53598. self._deny_($2);
  53599. $ctx1.sendIdx["deny:"]=2;
  53600. $3="hello"._yourself();
  53601. $ctx1.sendIdx["yourself"]=1;
  53602. self._assert_equals_("hello",$3);
  53603. $ctx1.sendIdx["assert:equals:"]=2;
  53604. self._assert_equals_("hello"._yourself(),"hello");
  53605. self._deny_("".__eq((0)));
  53606. return self;
  53607. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  53608. },
  53609. args: [],
  53610. 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",
  53611. referencedClasses: [],
  53612. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  53613. }),
  53614. $globals.StringTest);
  53615. $core.addMethod(
  53616. $core.method({
  53617. selector: "testIdentity",
  53618. protocol: 'tests',
  53619. fn: function (){
  53620. var self=this;
  53621. return $core.withContext(function($ctx1) {
  53622. var $1,$2,$4,$3,$5;
  53623. $1="hello".__eq_eq("hello");
  53624. $ctx1.sendIdx["=="]=1;
  53625. self._assert_($1);
  53626. $ctx1.sendIdx["assert:"]=1;
  53627. $2="hello".__eq_eq("world");
  53628. $ctx1.sendIdx["=="]=2;
  53629. self._deny_($2);
  53630. $ctx1.sendIdx["deny:"]=1;
  53631. $4="hello"._yourself();
  53632. $ctx1.sendIdx["yourself"]=1;
  53633. $3="hello".__eq_eq($4);
  53634. $ctx1.sendIdx["=="]=3;
  53635. self._assert_($3);
  53636. $ctx1.sendIdx["assert:"]=2;
  53637. $5=$recv("hello"._yourself()).__eq_eq("hello");
  53638. $ctx1.sendIdx["=="]=4;
  53639. self._assert_($5);
  53640. self._deny_("".__eq_eq((0)));
  53641. return self;
  53642. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  53643. },
  53644. args: [],
  53645. 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",
  53646. referencedClasses: [],
  53647. messageSends: ["assert:", "==", "deny:", "yourself"]
  53648. }),
  53649. $globals.StringTest);
  53650. $core.addMethod(
  53651. $core.method({
  53652. selector: "testIncludesSubString",
  53653. protocol: 'tests',
  53654. fn: function (){
  53655. var self=this;
  53656. return $core.withContext(function($ctx1) {
  53657. var $1;
  53658. $1="amber"._includesSubString_("ber");
  53659. $ctx1.sendIdx["includesSubString:"]=1;
  53660. self._assert_($1);
  53661. self._deny_("amber"._includesSubString_("zork"));
  53662. return self;
  53663. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  53664. },
  53665. args: [],
  53666. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  53667. referencedClasses: [],
  53668. messageSends: ["assert:", "includesSubString:", "deny:"]
  53669. }),
  53670. $globals.StringTest);
  53671. $core.addMethod(
  53672. $core.method({
  53673. selector: "testIndexOfStartingAtWithNull",
  53674. protocol: 'tests',
  53675. fn: function (){
  53676. var self=this;
  53677. return self;
  53678. },
  53679. args: [],
  53680. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  53681. referencedClasses: [],
  53682. messageSends: []
  53683. }),
  53684. $globals.StringTest);
  53685. $core.addMethod(
  53686. $core.method({
  53687. selector: "testIndexOfWithNull",
  53688. protocol: 'tests',
  53689. fn: function (){
  53690. var self=this;
  53691. return self;
  53692. },
  53693. args: [],
  53694. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  53695. referencedClasses: [],
  53696. messageSends: []
  53697. }),
  53698. $globals.StringTest);
  53699. $core.addMethod(
  53700. $core.method({
  53701. selector: "testIsVowel",
  53702. protocol: 'tests',
  53703. fn: function (){
  53704. var self=this;
  53705. var vowel,consonant;
  53706. return $core.withContext(function($ctx1) {
  53707. var $1;
  53708. vowel="u";
  53709. consonant="z";
  53710. $1=$recv(vowel)._isVowel();
  53711. $ctx1.sendIdx["isVowel"]=1;
  53712. self._assert_equals_($1,true);
  53713. $ctx1.sendIdx["assert:equals:"]=1;
  53714. self._assert_equals_($recv(consonant)._isVowel(),false);
  53715. return self;
  53716. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  53717. },
  53718. args: [],
  53719. 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",
  53720. referencedClasses: [],
  53721. messageSends: ["assert:equals:", "isVowel"]
  53722. }),
  53723. $globals.StringTest);
  53724. $core.addMethod(
  53725. $core.method({
  53726. selector: "testJoin",
  53727. protocol: 'tests',
  53728. fn: function (){
  53729. var self=this;
  53730. return $core.withContext(function($ctx1) {
  53731. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  53732. return self;
  53733. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  53734. },
  53735. args: [],
  53736. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  53737. referencedClasses: [],
  53738. messageSends: ["assert:equals:", "join:"]
  53739. }),
  53740. $globals.StringTest);
  53741. $core.addMethod(
  53742. $core.method({
  53743. selector: "testRemoveAll",
  53744. protocol: 'tests',
  53745. fn: function (){
  53746. var self=this;
  53747. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53748. return $core.withContext(function($ctx1) {
  53749. self._should_raise_((function(){
  53750. return $core.withContext(function($ctx2) {
  53751. return $recv(self._collection())._removeAll();
  53752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53753. }),$Error());
  53754. return self;
  53755. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  53756. },
  53757. args: [],
  53758. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  53759. referencedClasses: ["Error"],
  53760. messageSends: ["should:raise:", "removeAll", "collection"]
  53761. }),
  53762. $globals.StringTest);
  53763. $core.addMethod(
  53764. $core.method({
  53765. selector: "testReversed",
  53766. protocol: 'tests',
  53767. fn: function (){
  53768. var self=this;
  53769. return $core.withContext(function($ctx1) {
  53770. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  53771. return self;
  53772. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  53773. },
  53774. args: [],
  53775. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  53776. referencedClasses: [],
  53777. messageSends: ["assert:equals:", "reversed"]
  53778. }),
  53779. $globals.StringTest);
  53780. $core.addMethod(
  53781. $core.method({
  53782. selector: "testStreamContents",
  53783. protocol: 'tests',
  53784. fn: function (){
  53785. var self=this;
  53786. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  53787. return $core.withContext(function($ctx1) {
  53788. var $1;
  53789. self._assert_equals_($recv($String())._streamContents_((function(aStream){
  53790. return $core.withContext(function($ctx2) {
  53791. $recv(aStream)._nextPutAll_("hello");
  53792. $ctx2.sendIdx["nextPutAll:"]=1;
  53793. $recv(aStream)._space();
  53794. $1=$recv(aStream)._nextPutAll_("world");
  53795. return $1;
  53796. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  53797. })),"hello world");
  53798. return self;
  53799. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  53800. },
  53801. args: [],
  53802. 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'",
  53803. referencedClasses: ["String"],
  53804. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  53805. }),
  53806. $globals.StringTest);
  53807. $core.addMethod(
  53808. $core.method({
  53809. selector: "testSubStrings",
  53810. protocol: 'tests',
  53811. fn: function (){
  53812. var self=this;
  53813. return $core.withContext(function($ctx1) {
  53814. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  53815. return self;
  53816. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  53817. },
  53818. args: [],
  53819. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  53820. referencedClasses: [],
  53821. messageSends: ["assert:equals:", "subStrings:"]
  53822. }),
  53823. $globals.StringTest);
  53824. $core.addMethod(
  53825. $core.method({
  53826. selector: "testTrim",
  53827. protocol: 'tests',
  53828. fn: function (){
  53829. var self=this;
  53830. return $core.withContext(function($ctx1) {
  53831. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  53832. $ctx1.sendIdx["assert:equals:"]=1;
  53833. self._assert_equals_("jackie "._trimRight(),"jackie");
  53834. return self;
  53835. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  53836. },
  53837. args: [],
  53838. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  53839. referencedClasses: [],
  53840. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  53841. }),
  53842. $globals.StringTest);
  53843. $core.addMethod(
  53844. $core.method({
  53845. selector: "testValue",
  53846. protocol: 'tests',
  53847. fn: function (){
  53848. var self=this;
  53849. return $core.withContext(function($ctx1) {
  53850. self._assert_equals_("asString"._value_((1)),"1");
  53851. $ctx1.sendIdx["assert:equals:"]=1;
  53852. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  53853. return self;
  53854. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  53855. },
  53856. args: [],
  53857. 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')",
  53858. referencedClasses: [],
  53859. messageSends: ["assert:equals:", "value:", "collect:"]
  53860. }),
  53861. $globals.StringTest);
  53862. $core.addMethod(
  53863. $core.method({
  53864. selector: "collectionClass",
  53865. protocol: 'fixture',
  53866. fn: function (){
  53867. var self=this;
  53868. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  53869. return $String();
  53870. },
  53871. args: [],
  53872. source: "collectionClass\x0a\x09^ String",
  53873. referencedClasses: ["String"],
  53874. messageSends: []
  53875. }),
  53876. $globals.StringTest.klass);
  53877. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  53878. $core.addMethod(
  53879. $core.method({
  53880. selector: "collection",
  53881. protocol: 'fixture',
  53882. fn: function (){
  53883. var self=this;
  53884. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53885. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  53886. return $core.withContext(function($ctx1) {
  53887. var $2,$3,$1;
  53888. $2=$recv($Set())._new();
  53889. $recv($2)._add_($Smalltalk());
  53890. $ctx1.sendIdx["add:"]=1;
  53891. $recv($2)._add_(nil);
  53892. $ctx1.sendIdx["add:"]=2;
  53893. $recv($2)._add_((3).__at((3)));
  53894. $ctx1.sendIdx["add:"]=3;
  53895. $recv($2)._add_(false);
  53896. $3=$recv($2)._yourself();
  53897. $1=$3;
  53898. return $1;
  53899. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  53900. },
  53901. args: [],
  53902. 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\x09yourself",
  53903. referencedClasses: ["Set", "Smalltalk"],
  53904. messageSends: ["add:", "new", "@", "yourself"]
  53905. }),
  53906. $globals.SetTest);
  53907. $core.addMethod(
  53908. $core.method({
  53909. selector: "collectionOfPrintStrings",
  53910. protocol: 'fixture',
  53911. fn: function (){
  53912. var self=this;
  53913. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53914. return $core.withContext(function($ctx1) {
  53915. var $2,$3,$1;
  53916. $2=$recv($Set())._new();
  53917. $recv($2)._add_("a SmalltalkImage");
  53918. $ctx1.sendIdx["add:"]=1;
  53919. $recv($2)._add_("nil");
  53920. $ctx1.sendIdx["add:"]=2;
  53921. $recv($2)._add_("3@3");
  53922. $ctx1.sendIdx["add:"]=3;
  53923. $recv($2)._add_("false");
  53924. $3=$recv($2)._yourself();
  53925. $1=$3;
  53926. return $1;
  53927. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  53928. },
  53929. args: [],
  53930. 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\x09yourself",
  53931. referencedClasses: ["Set"],
  53932. messageSends: ["add:", "new", "yourself"]
  53933. }),
  53934. $globals.SetTest);
  53935. $core.addMethod(
  53936. $core.method({
  53937. selector: "collectionSize",
  53938. protocol: 'fixture',
  53939. fn: function (){
  53940. var self=this;
  53941. return (4);
  53942. },
  53943. args: [],
  53944. source: "collectionSize\x0a\x09^ 4",
  53945. referencedClasses: [],
  53946. messageSends: []
  53947. }),
  53948. $globals.SetTest);
  53949. $core.addMethod(
  53950. $core.method({
  53951. selector: "collectionWithDuplicates",
  53952. protocol: 'fixture',
  53953. fn: function (){
  53954. var self=this;
  53955. return $core.withContext(function($ctx1) {
  53956. var $2,$3,$1;
  53957. $2=self._collection();
  53958. $recv($2)._add_((0));
  53959. $3=$recv($2)._yourself();
  53960. $1=$3;
  53961. return $1;
  53962. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  53963. },
  53964. args: [],
  53965. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  53966. referencedClasses: [],
  53967. messageSends: ["add:", "collection", "yourself"]
  53968. }),
  53969. $globals.SetTest);
  53970. $core.addMethod(
  53971. $core.method({
  53972. selector: "collectionWithNewValue",
  53973. protocol: 'fixture',
  53974. fn: function (){
  53975. var self=this;
  53976. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53977. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  53978. return $core.withContext(function($ctx1) {
  53979. var $2,$3,$1;
  53980. $2=$recv($Set())._new();
  53981. $recv($2)._add_($Smalltalk());
  53982. $ctx1.sendIdx["add:"]=1;
  53983. $recv($2)._add_(nil);
  53984. $ctx1.sendIdx["add:"]=2;
  53985. $recv($2)._add_((3).__at((3)));
  53986. $ctx1.sendIdx["add:"]=3;
  53987. $recv($2)._add_("N");
  53988. $ctx1.sendIdx["add:"]=4;
  53989. $recv($2)._add_(false);
  53990. $3=$recv($2)._yourself();
  53991. $1=$3;
  53992. return $1;
  53993. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  53994. },
  53995. args: [],
  53996. 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\x09yourself",
  53997. referencedClasses: ["Set", "Smalltalk"],
  53998. messageSends: ["add:", "new", "@", "yourself"]
  53999. }),
  54000. $globals.SetTest);
  54001. $core.addMethod(
  54002. $core.method({
  54003. selector: "testAddAll",
  54004. protocol: 'tests',
  54005. fn: function (){
  54006. var self=this;
  54007. return $core.withContext(function($ctx1) {
  54008. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  54009. (
  54010. $ctx1.supercall = true,
  54011. $globals.SetTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
  54012. $ctx1.supercall = false;
  54013. $2=self._collection();
  54014. $ctx1.sendIdx["collection"]=1;
  54015. $3=$2;
  54016. $4=self._collection();
  54017. $ctx1.sendIdx["collection"]=2;
  54018. $recv($3)._addAll_($4);
  54019. $ctx1.sendIdx["addAll:"]=1;
  54020. $5=$recv($2)._yourself();
  54021. $ctx1.sendIdx["yourself"]=1;
  54022. $1=$5;
  54023. $6=self._collection();
  54024. $ctx1.sendIdx["collection"]=3;
  54025. self._assert_equals_($1,$6);
  54026. $ctx1.sendIdx["assert:equals:"]=1;
  54027. $8=self._collection();
  54028. $ctx1.sendIdx["collection"]=4;
  54029. $9=$8;
  54030. $10=self._collectionWithNewValue();
  54031. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54032. $recv($9)._addAll_($10);
  54033. $ctx1.sendIdx["addAll:"]=2;
  54034. $11=$recv($8)._yourself();
  54035. $ctx1.sendIdx["yourself"]=2;
  54036. $7=$11;
  54037. $12=self._collectionWithNewValue();
  54038. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54039. self._assert_equals_($7,$12);
  54040. $ctx1.sendIdx["assert:equals:"]=2;
  54041. $14=self._collectionWithNewValue();
  54042. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54043. $recv($14)._addAll_(self._collection());
  54044. $15=$recv($14)._yourself();
  54045. $13=$15;
  54046. self._assert_equals_($13,self._collectionWithNewValue());
  54047. return self;
  54048. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  54049. },
  54050. args: [],
  54051. 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",
  54052. referencedClasses: [],
  54053. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54054. }),
  54055. $globals.SetTest);
  54056. $core.addMethod(
  54057. $core.method({
  54058. selector: "testAddRemove",
  54059. protocol: 'tests',
  54060. fn: function (){
  54061. var self=this;
  54062. var set;
  54063. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54064. return $core.withContext(function($ctx1) {
  54065. var $1,$2;
  54066. set=$recv($Set())._new();
  54067. self._assert_($recv(set)._isEmpty());
  54068. $ctx1.sendIdx["assert:"]=1;
  54069. $recv(set)._add_((3));
  54070. $ctx1.sendIdx["add:"]=1;
  54071. $1=$recv(set)._includes_((3));
  54072. $ctx1.sendIdx["includes:"]=1;
  54073. self._assert_($1);
  54074. $ctx1.sendIdx["assert:"]=2;
  54075. $recv(set)._add_((5));
  54076. $2=$recv(set)._includes_((5));
  54077. $ctx1.sendIdx["includes:"]=2;
  54078. self._assert_($2);
  54079. $recv(set)._remove_((3));
  54080. self._deny_($recv(set)._includes_((3)));
  54081. return self;
  54082. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  54083. },
  54084. args: [],
  54085. 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)",
  54086. referencedClasses: ["Set"],
  54087. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  54088. }),
  54089. $globals.SetTest);
  54090. $core.addMethod(
  54091. $core.method({
  54092. selector: "testAt",
  54093. protocol: 'tests',
  54094. fn: function (){
  54095. var self=this;
  54096. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54097. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54098. return $core.withContext(function($ctx1) {
  54099. self._should_raise_((function(){
  54100. return $core.withContext(function($ctx2) {
  54101. return $recv($recv($Set())._new())._at_put_((1),(2));
  54102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54103. }),$Error());
  54104. return self;
  54105. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  54106. },
  54107. args: [],
  54108. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  54109. referencedClasses: ["Set", "Error"],
  54110. messageSends: ["should:raise:", "at:put:", "new"]
  54111. }),
  54112. $globals.SetTest);
  54113. $core.addMethod(
  54114. $core.method({
  54115. selector: "testCollect",
  54116. protocol: 'tests',
  54117. fn: function (){
  54118. var self=this;
  54119. return $core.withContext(function($ctx1) {
  54120. var $2,$1;
  54121. (
  54122. $ctx1.supercall = true,
  54123. $globals.SetTest.superclass.fn.prototype._testCollect.apply($recv(self), []));
  54124. $ctx1.supercall = false;
  54125. $2=[(5), (6), (8)]._asSet();
  54126. $ctx1.sendIdx["asSet"]=1;
  54127. $1=$recv($2)._collect_((function(x){
  54128. return $core.withContext(function($ctx2) {
  54129. return $recv(x).__backslash_backslash((3));
  54130. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54131. }));
  54132. self._assert_equals_($1,[(0), (2)]._asSet());
  54133. return self;
  54134. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  54135. },
  54136. args: [],
  54137. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  54138. referencedClasses: [],
  54139. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  54140. }),
  54141. $globals.SetTest);
  54142. $core.addMethod(
  54143. $core.method({
  54144. selector: "testComma",
  54145. protocol: 'tests',
  54146. fn: function (){
  54147. var self=this;
  54148. return $core.withContext(function($ctx1) {
  54149. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54150. (
  54151. $ctx1.supercall = true,
  54152. $globals.SetTest.superclass.fn.prototype._testComma.apply($recv(self), []));
  54153. $ctx1.supercall = false;
  54154. $2=self._collection();
  54155. $ctx1.sendIdx["collection"]=1;
  54156. $3=self._collection();
  54157. $ctx1.sendIdx["collection"]=2;
  54158. $1=$recv($2).__comma($3);
  54159. $ctx1.sendIdx[","]=1;
  54160. $4=self._collection();
  54161. $ctx1.sendIdx["collection"]=3;
  54162. self._assert_equals_($1,$4);
  54163. $ctx1.sendIdx["assert:equals:"]=1;
  54164. $6=self._collection();
  54165. $ctx1.sendIdx["collection"]=4;
  54166. $7=self._collectionWithNewValue();
  54167. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54168. $5=$recv($6).__comma($7);
  54169. $ctx1.sendIdx[","]=2;
  54170. $8=self._collectionWithNewValue();
  54171. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54172. self._assert_equals_($5,$8);
  54173. $ctx1.sendIdx["assert:equals:"]=2;
  54174. $10=self._collectionWithNewValue();
  54175. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54176. $9=$recv($10).__comma(self._collection());
  54177. self._assert_equals_($9,self._collectionWithNewValue());
  54178. return self;
  54179. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  54180. },
  54181. args: [],
  54182. 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",
  54183. referencedClasses: [],
  54184. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54185. }),
  54186. $globals.SetTest);
  54187. $core.addMethod(
  54188. $core.method({
  54189. selector: "testComparing",
  54190. protocol: 'tests',
  54191. fn: function (){
  54192. var self=this;
  54193. return $core.withContext(function($ctx1) {
  54194. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  54195. $1=[(0), (2)]._asSet();
  54196. $ctx1.sendIdx["asSet"]=1;
  54197. $2=[(0), (2)]._asSet();
  54198. $ctx1.sendIdx["asSet"]=2;
  54199. self._assert_equals_($1,$2);
  54200. $ctx1.sendIdx["assert:equals:"]=1;
  54201. $3=[(2), (0)]._asSet();
  54202. $ctx1.sendIdx["asSet"]=3;
  54203. $4=[(0), (2)]._asSet();
  54204. $ctx1.sendIdx["asSet"]=4;
  54205. self._assert_equals_($3,$4);
  54206. $6=[(0), (2), (3)]._asSet();
  54207. $ctx1.sendIdx["asSet"]=5;
  54208. $7=[(0), (2)]._asSet();
  54209. $ctx1.sendIdx["asSet"]=6;
  54210. $5=$recv($6).__eq($7);
  54211. $ctx1.sendIdx["="]=1;
  54212. self._deny_($5);
  54213. $ctx1.sendIdx["deny:"]=1;
  54214. $9=[(1), (2)]._asSet();
  54215. $ctx1.sendIdx["asSet"]=7;
  54216. $8=$recv($9).__eq([(0), (2)]._asSet());
  54217. self._deny_($8);
  54218. return self;
  54219. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  54220. },
  54221. args: [],
  54222. 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",
  54223. referencedClasses: [],
  54224. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  54225. }),
  54226. $globals.SetTest);
  54227. $core.addMethod(
  54228. $core.method({
  54229. selector: "testPrintString",
  54230. protocol: 'tests',
  54231. fn: function (){
  54232. var self=this;
  54233. var set;
  54234. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54235. return $core.withContext(function($ctx1) {
  54236. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  54237. set=$recv($Set())._new();
  54238. $1=$recv(set)._printString();
  54239. $ctx1.sendIdx["printString"]=1;
  54240. self._assert_equals_($1,"a Set ()");
  54241. $ctx1.sendIdx["assert:equals:"]=1;
  54242. $2=set;
  54243. $recv($2)._add_((1));
  54244. $ctx1.sendIdx["add:"]=1;
  54245. $3=$recv($2)._add_((3));
  54246. $ctx1.sendIdx["add:"]=2;
  54247. $4=$recv(set)._printString();
  54248. $ctx1.sendIdx["printString"]=2;
  54249. self._assert_equals_($4,"a Set (1 3)");
  54250. $ctx1.sendIdx["assert:equals:"]=2;
  54251. $recv(set)._add_("foo");
  54252. $ctx1.sendIdx["add:"]=3;
  54253. $5=$recv(set)._printString();
  54254. $ctx1.sendIdx["printString"]=3;
  54255. self._assert_equals_($5,"a Set (1 3 'foo')");
  54256. $ctx1.sendIdx["assert:equals:"]=3;
  54257. $6=set;
  54258. $recv($6)._remove_((1));
  54259. $ctx1.sendIdx["remove:"]=1;
  54260. $7=$recv($6)._remove_((3));
  54261. $8=$recv(set)._printString();
  54262. $ctx1.sendIdx["printString"]=4;
  54263. self._assert_equals_($8,"a Set ('foo')");
  54264. $ctx1.sendIdx["assert:equals:"]=4;
  54265. $recv(set)._add_((3));
  54266. $ctx1.sendIdx["add:"]=4;
  54267. $9=$recv(set)._printString();
  54268. $ctx1.sendIdx["printString"]=5;
  54269. self._assert_equals_($9,"a Set (3 'foo')");
  54270. $ctx1.sendIdx["assert:equals:"]=5;
  54271. $recv(set)._add_((3));
  54272. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  54273. return self;
  54274. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  54275. },
  54276. args: [],
  54277. 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'')'",
  54278. referencedClasses: ["Set"],
  54279. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  54280. }),
  54281. $globals.SetTest);
  54282. $core.addMethod(
  54283. $core.method({
  54284. selector: "testUnboxedObjects",
  54285. protocol: 'tests',
  54286. fn: function (){
  54287. var self=this;
  54288. return $core.withContext(function($ctx1) {
  54289. var $4,$3,$2,$1;
  54290. $4="foo"._yourself();
  54291. $ctx1.sendIdx["yourself"]=1;
  54292. $3=[$4,"foo"._yourself()];
  54293. $2=$recv($3)._asSet();
  54294. $1=$recv($2)._asArray();
  54295. self._assert_equals_($1,["foo"]);
  54296. return self;
  54297. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  54298. },
  54299. args: [],
  54300. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  54301. referencedClasses: [],
  54302. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  54303. }),
  54304. $globals.SetTest);
  54305. $core.addMethod(
  54306. $core.method({
  54307. selector: "testUnicity",
  54308. protocol: 'tests',
  54309. fn: function (){
  54310. var self=this;
  54311. var set;
  54312. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54313. return $core.withContext(function($ctx1) {
  54314. var $1;
  54315. set=$recv($Set())._new();
  54316. $recv(set)._add_((21));
  54317. $ctx1.sendIdx["add:"]=1;
  54318. $recv(set)._add_("hello");
  54319. $ctx1.sendIdx["add:"]=2;
  54320. $recv(set)._add_((21));
  54321. $ctx1.sendIdx["add:"]=3;
  54322. $1=$recv(set)._size();
  54323. $ctx1.sendIdx["size"]=1;
  54324. self._assert_equals_($1,(2));
  54325. $ctx1.sendIdx["assert:equals:"]=1;
  54326. $recv(set)._add_("hello");
  54327. self._assert_equals_($recv(set)._size(),(2));
  54328. $ctx1.sendIdx["assert:equals:"]=2;
  54329. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  54330. return self;
  54331. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  54332. },
  54333. args: [],
  54334. 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')",
  54335. referencedClasses: ["Set"],
  54336. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  54337. }),
  54338. $globals.SetTest);
  54339. $core.addMethod(
  54340. $core.method({
  54341. selector: "collectionClass",
  54342. protocol: 'fixture',
  54343. fn: function (){
  54344. var self=this;
  54345. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54346. return $Set();
  54347. },
  54348. args: [],
  54349. source: "collectionClass\x0a\x09^ Set",
  54350. referencedClasses: ["Set"],
  54351. messageSends: []
  54352. }),
  54353. $globals.SetTest.klass);
  54354. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  54355. $core.addMethod(
  54356. $core.method({
  54357. selector: "testShow",
  54358. protocol: 'tests',
  54359. fn: function (){
  54360. var self=this;
  54361. var originalTranscript;
  54362. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  54363. function $ConsoleTranscript(){return $globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  54364. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54365. return $core.withContext(function($ctx1) {
  54366. originalTranscript=$recv($Transcript())._current();
  54367. $recv($Transcript())._register_($recv($ConsoleTranscript())._new());
  54368. $ctx1.sendIdx["register:"]=1;
  54369. self._shouldnt_raise_((function(){
  54370. return $core.withContext(function($ctx2) {
  54371. return $recv($Transcript())._show_("Hello console!");
  54372. $ctx2.sendIdx["show:"]=1;
  54373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54374. }),$Error());
  54375. $ctx1.sendIdx["shouldnt:raise:"]=1;
  54376. self._shouldnt_raise_((function(){
  54377. return $core.withContext(function($ctx2) {
  54378. return $recv($Transcript())._show_(console);
  54379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54380. }),$Error());
  54381. $recv($Transcript())._register_(originalTranscript);
  54382. return self;
  54383. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  54384. },
  54385. args: [],
  54386. 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.",
  54387. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  54388. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  54389. }),
  54390. $globals.ConsoleTranscriptTest);
  54391. $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
  54392. $core.addMethod(
  54393. $core.method({
  54394. selector: "testEquality",
  54395. protocol: 'tests',
  54396. fn: function (){
  54397. var self=this;
  54398. var now;
  54399. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  54400. return $core.withContext(function($ctx1) {
  54401. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  54402. now=$recv($Date())._new();
  54403. $1=$recv(now).__eq(now);
  54404. $ctx1.sendIdx["="]=1;
  54405. self._assert_($1);
  54406. $ctx1.sendIdx["assert:"]=1;
  54407. $3=now;
  54408. $4=$recv($Date())._fromMilliseconds_((0));
  54409. $ctx1.sendIdx["fromMilliseconds:"]=1;
  54410. $2=$recv($3).__eq($4);
  54411. $ctx1.sendIdx["="]=2;
  54412. self._deny_($2);
  54413. $6=$recv($Date())._fromMilliseconds_((12345678));
  54414. $ctx1.sendIdx["fromMilliseconds:"]=2;
  54415. $7=$recv($Date())._fromMilliseconds_((12345678));
  54416. $ctx1.sendIdx["fromMilliseconds:"]=3;
  54417. $5=$recv($6).__eq($7);
  54418. $ctx1.sendIdx["="]=3;
  54419. self._assert_($5);
  54420. $ctx1.sendIdx["assert:"]=2;
  54421. $9=now;
  54422. $11=$recv(now)._asMilliseconds();
  54423. $ctx1.sendIdx["asMilliseconds"]=1;
  54424. $10=$recv($Date())._fromMilliseconds_($11);
  54425. $ctx1.sendIdx["fromMilliseconds:"]=4;
  54426. $8=$recv($9).__eq($10);
  54427. $ctx1.sendIdx["="]=4;
  54428. self._assert_($8);
  54429. $ctx1.sendIdx["assert:"]=3;
  54430. self._assert_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  54431. return self;
  54432. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  54433. },
  54434. args: [],
  54435. 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",
  54436. referencedClasses: ["Date"],
  54437. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  54438. }),
  54439. $globals.DateTest);
  54440. $core.addMethod(
  54441. $core.method({
  54442. selector: "testIdentity",
  54443. protocol: 'tests',
  54444. fn: function (){
  54445. var self=this;
  54446. var now;
  54447. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  54448. return $core.withContext(function($ctx1) {
  54449. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  54450. now=$recv($Date())._new();
  54451. $1=$recv(now).__eq_eq(now);
  54452. $ctx1.sendIdx["=="]=1;
  54453. self._assert_($1);
  54454. $3=now;
  54455. $4=$recv($Date())._fromMilliseconds_((0));
  54456. $ctx1.sendIdx["fromMilliseconds:"]=1;
  54457. $2=$recv($3).__eq_eq($4);
  54458. $ctx1.sendIdx["=="]=2;
  54459. self._deny_($2);
  54460. $ctx1.sendIdx["deny:"]=1;
  54461. $6=$recv($Date())._fromMilliseconds_((12345678));
  54462. $ctx1.sendIdx["fromMilliseconds:"]=2;
  54463. $7=$recv($Date())._fromMilliseconds_((12345678));
  54464. $ctx1.sendIdx["fromMilliseconds:"]=3;
  54465. $5=$recv($6).__eq_eq($7);
  54466. $ctx1.sendIdx["=="]=3;
  54467. self._deny_($5);
  54468. $ctx1.sendIdx["deny:"]=2;
  54469. $9=now;
  54470. $11=$recv(now)._asMilliseconds();
  54471. $ctx1.sendIdx["asMilliseconds"]=1;
  54472. $10=$recv($Date())._fromMilliseconds_($11);
  54473. $ctx1.sendIdx["fromMilliseconds:"]=4;
  54474. $8=$recv($9).__eq_eq($10);
  54475. $ctx1.sendIdx["=="]=4;
  54476. self._deny_($8);
  54477. $ctx1.sendIdx["deny:"]=3;
  54478. self._deny_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  54479. return self;
  54480. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  54481. },
  54482. args: [],
  54483. 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",
  54484. referencedClasses: ["Date"],
  54485. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  54486. }),
  54487. $globals.DateTest);
  54488. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  54489. $core.addMethod(
  54490. $core.method({
  54491. selector: "jsNull",
  54492. protocol: 'accessing',
  54493. fn: function (){
  54494. var self=this;
  54495. return $core.withContext(function($ctx1) {
  54496. return null;
  54497. return self;
  54498. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  54499. },
  54500. args: [],
  54501. source: "jsNull\x0a\x09<return null>",
  54502. referencedClasses: [],
  54503. messageSends: []
  54504. }),
  54505. $globals.JSObjectProxyTest);
  54506. $core.addMethod(
  54507. $core.method({
  54508. selector: "jsObject",
  54509. protocol: 'accessing',
  54510. fn: function (){
  54511. var self=this;
  54512. return $core.withContext(function($ctx1) {
  54513. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  54514. return self;
  54515. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  54516. },
  54517. args: [],
  54518. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  54519. referencedClasses: [],
  54520. messageSends: []
  54521. }),
  54522. $globals.JSObjectProxyTest);
  54523. $core.addMethod(
  54524. $core.method({
  54525. selector: "jsUndefined",
  54526. protocol: 'accessing',
  54527. fn: function (){
  54528. var self=this;
  54529. return $core.withContext(function($ctx1) {
  54530. return;
  54531. return self;
  54532. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  54533. },
  54534. args: [],
  54535. source: "jsUndefined\x0a\x09<return>",
  54536. referencedClasses: [],
  54537. messageSends: []
  54538. }),
  54539. $globals.JSObjectProxyTest);
  54540. $core.addMethod(
  54541. $core.method({
  54542. selector: "testAtIfAbsent",
  54543. protocol: 'tests',
  54544. fn: function (){
  54545. var self=this;
  54546. var testObject;
  54547. return $core.withContext(function($ctx1) {
  54548. var $1,$2,$3;
  54549. testObject=self._jsObject();
  54550. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  54551. return "Property does not exist";
  54552. }));
  54553. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54554. self._assert_equals_($1,"Property does not exist");
  54555. $ctx1.sendIdx["assert:equals:"]=1;
  54556. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  54557. return "Property does not exist";
  54558. }));
  54559. $ctx1.sendIdx["at:ifAbsent:"]=2;
  54560. self._assert_equals_($2,nil);
  54561. $ctx1.sendIdx["assert:equals:"]=2;
  54562. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  54563. return "Property does not exist";
  54564. }));
  54565. $ctx1.sendIdx["at:ifAbsent:"]=3;
  54566. self._assert_equals_($3,(1));
  54567. $ctx1.sendIdx["assert:equals:"]=3;
  54568. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  54569. return "Property does not exist";
  54570. })),nil);
  54571. return self;
  54572. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54573. },
  54574. args: [],
  54575. 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.",
  54576. referencedClasses: [],
  54577. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  54578. }),
  54579. $globals.JSObjectProxyTest);
  54580. $core.addMethod(
  54581. $core.method({
  54582. selector: "testAtIfPresent",
  54583. protocol: 'tests',
  54584. fn: function (){
  54585. var self=this;
  54586. var testObject;
  54587. return $core.withContext(function($ctx1) {
  54588. var $2,$1,$4,$3,$6,$5;
  54589. testObject=self._jsObject();
  54590. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  54591. return $core.withContext(function($ctx2) {
  54592. $2=$recv(x)._asString();
  54593. $ctx2.sendIdx["asString"]=1;
  54594. return "hello ".__comma($2);
  54595. $ctx2.sendIdx[","]=1;
  54596. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54597. }));
  54598. $ctx1.sendIdx["at:ifPresent:"]=1;
  54599. self._assert_equals_($1,nil);
  54600. $ctx1.sendIdx["assert:equals:"]=1;
  54601. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  54602. return $core.withContext(function($ctx2) {
  54603. $4=$recv(x)._asString();
  54604. $ctx2.sendIdx["asString"]=2;
  54605. return "hello ".__comma($4);
  54606. $ctx2.sendIdx[","]=2;
  54607. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  54608. }));
  54609. $ctx1.sendIdx["at:ifPresent:"]=2;
  54610. self._assert_equals_($3,"hello nil");
  54611. $ctx1.sendIdx["assert:equals:"]=2;
  54612. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  54613. return $core.withContext(function($ctx2) {
  54614. $6=$recv(x)._asString();
  54615. $ctx2.sendIdx["asString"]=3;
  54616. return "hello ".__comma($6);
  54617. $ctx2.sendIdx[","]=3;
  54618. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  54619. }));
  54620. $ctx1.sendIdx["at:ifPresent:"]=3;
  54621. self._assert_equals_($5,"hello 1");
  54622. $ctx1.sendIdx["assert:equals:"]=3;
  54623. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  54624. return $core.withContext(function($ctx2) {
  54625. return "hello ".__comma($recv(x)._asString());
  54626. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  54627. })),"hello nil");
  54628. return self;
  54629. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54630. },
  54631. args: [],
  54632. 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'.",
  54633. referencedClasses: [],
  54634. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  54635. }),
  54636. $globals.JSObjectProxyTest);
  54637. $core.addMethod(
  54638. $core.method({
  54639. selector: "testAtIfPresentIfAbsent",
  54640. protocol: 'tests',
  54641. fn: function (){
  54642. var self=this;
  54643. var testObject;
  54644. return $core.withContext(function($ctx1) {
  54645. var $2,$1,$4,$3,$6,$5;
  54646. testObject=self._jsObject();
  54647. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  54648. return $core.withContext(function($ctx2) {
  54649. $2=$recv(x)._asString();
  54650. $ctx2.sendIdx["asString"]=1;
  54651. return "hello ".__comma($2);
  54652. $ctx2.sendIdx[","]=1;
  54653. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54654. }),(function(){
  54655. return "not present";
  54656. }));
  54657. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  54658. self._assert_equals_($1,"not present");
  54659. $ctx1.sendIdx["assert:equals:"]=1;
  54660. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  54661. return $core.withContext(function($ctx2) {
  54662. $4=$recv(x)._asString();
  54663. $ctx2.sendIdx["asString"]=2;
  54664. return "hello ".__comma($4);
  54665. $ctx2.sendIdx[","]=2;
  54666. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  54667. }),(function(){
  54668. return "not present";
  54669. }));
  54670. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  54671. self._assert_equals_($3,"hello nil");
  54672. $ctx1.sendIdx["assert:equals:"]=2;
  54673. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  54674. return $core.withContext(function($ctx2) {
  54675. $6=$recv(x)._asString();
  54676. $ctx2.sendIdx["asString"]=3;
  54677. return "hello ".__comma($6);
  54678. $ctx2.sendIdx[","]=3;
  54679. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  54680. }),(function(){
  54681. return "not present";
  54682. }));
  54683. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  54684. self._assert_equals_($5,"hello 1");
  54685. $ctx1.sendIdx["assert:equals:"]=3;
  54686. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  54687. return $core.withContext(function($ctx2) {
  54688. return "hello ".__comma($recv(x)._asString());
  54689. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  54690. }),(function(){
  54691. return "not present";
  54692. })),"hello nil");
  54693. return self;
  54694. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54695. },
  54696. args: [],
  54697. 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'.",
  54698. referencedClasses: [],
  54699. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  54700. }),
  54701. $globals.JSObjectProxyTest);
  54702. $core.addMethod(
  54703. $core.method({
  54704. selector: "testAtPut",
  54705. protocol: 'tests',
  54706. fn: function (){
  54707. var self=this;
  54708. var testObject;
  54709. return $core.withContext(function($ctx1) {
  54710. var $2,$1;
  54711. testObject=self._jsObject();
  54712. $2=$recv(testObject)._at_("abc");
  54713. $ctx1.sendIdx["at:"]=1;
  54714. $1=$recv($2).__tild_eq("xyz");
  54715. self._assert_($1);
  54716. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  54717. $ctx1.sendIdx["assert:equals:"]=1;
  54718. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  54719. return self;
  54720. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  54721. },
  54722. args: [],
  54723. 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'",
  54724. referencedClasses: [],
  54725. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  54726. }),
  54727. $globals.JSObjectProxyTest);
  54728. $core.addMethod(
  54729. $core.method({
  54730. selector: "testComparison",
  54731. protocol: 'tests',
  54732. fn: function (){
  54733. var self=this;
  54734. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  54735. return $core.withContext(function($ctx1) {
  54736. var $1,$2;
  54737. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  54738. $1=$recv(console).__eq(console);
  54739. $ctx1.sendIdx["="]=1;
  54740. self._assert_($1);
  54741. $2=$recv(console).__eq($recv($Object())._new());
  54742. $ctx1.sendIdx["="]=2;
  54743. self._deny_($2);
  54744. $ctx1.sendIdx["deny:"]=1;
  54745. self._deny_($recv(console).__eq(self._jsObject()));
  54746. return self;
  54747. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  54748. },
  54749. args: [],
  54750. 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",
  54751. referencedClasses: ["Object"],
  54752. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  54753. }),
  54754. $globals.JSObjectProxyTest);
  54755. $core.addMethod(
  54756. $core.method({
  54757. selector: "testDNU",
  54758. protocol: 'tests',
  54759. fn: function (){
  54760. var self=this;
  54761. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54762. return $core.withContext(function($ctx1) {
  54763. self._should_raise_((function(){
  54764. return $core.withContext(function($ctx2) {
  54765. return $recv(self._jsObject())._foo();
  54766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54767. }),$MessageNotUnderstood());
  54768. return self;
  54769. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  54770. },
  54771. args: [],
  54772. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  54773. referencedClasses: ["MessageNotUnderstood"],
  54774. messageSends: ["should:raise:", "foo", "jsObject"]
  54775. }),
  54776. $globals.JSObjectProxyTest);
  54777. $core.addMethod(
  54778. $core.method({
  54779. selector: "testDNURegression1057",
  54780. protocol: 'tests',
  54781. fn: function (){
  54782. var self=this;
  54783. var jsObject;
  54784. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54785. return $core.withContext(function($ctx1) {
  54786. var $1;
  54787. jsObject=[];
  54788. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54789. $ctx1.sendIdx["basicAt:put:"]=1;
  54790. $recv(jsObject)._basicAt_put_("foo",(3));
  54791. self._shouldnt_raise_((function(){
  54792. return $core.withContext(function($ctx2) {
  54793. return $recv(jsObject)._foo();
  54794. $ctx2.sendIdx["foo"]=1;
  54795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54796. }),$Error());
  54797. $ctx1.sendIdx["shouldnt:raise:"]=1;
  54798. $1=$recv(jsObject)._foo();
  54799. $ctx1.sendIdx["foo"]=2;
  54800. self._assert_equals_($1,(3));
  54801. $ctx1.sendIdx["assert:equals:"]=1;
  54802. self._shouldnt_raise_((function(){
  54803. return $core.withContext(function($ctx2) {
  54804. return $recv(jsObject)._foo_((4));
  54805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54806. }),$Error());
  54807. self._assert_equals_($recv(jsObject)._foo(),(4));
  54808. return self;
  54809. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54810. },
  54811. args: [],
  54812. 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",
  54813. referencedClasses: ["Error"],
  54814. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  54815. }),
  54816. $globals.JSObjectProxyTest);
  54817. $core.addMethod(
  54818. $core.method({
  54819. selector: "testDNURegression1059",
  54820. protocol: 'tests',
  54821. fn: function (){
  54822. var self=this;
  54823. var jsObject;
  54824. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54825. return $core.withContext(function($ctx1) {
  54826. jsObject=[];
  54827. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54828. $ctx1.sendIdx["basicAt:put:"]=1;
  54829. $recv(jsObject)._basicAt_put_("x",(3));
  54830. $ctx1.sendIdx["basicAt:put:"]=2;
  54831. $recv(jsObject)._basicAt_put_("x:",(function(){
  54832. return $core.withContext(function($ctx2) {
  54833. return self._error();
  54834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54835. }));
  54836. self._shouldnt_raise_((function(){
  54837. return $core.withContext(function($ctx2) {
  54838. return $recv(jsObject)._x_((4));
  54839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54840. }),$Error());
  54841. self._assert_equals_($recv(jsObject)._x(),(4));
  54842. return self;
  54843. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54844. },
  54845. args: [],
  54846. 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",
  54847. referencedClasses: ["Error"],
  54848. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  54849. }),
  54850. $globals.JSObjectProxyTest);
  54851. $core.addMethod(
  54852. $core.method({
  54853. selector: "testDNURegression1062",
  54854. protocol: 'tests',
  54855. fn: function (){
  54856. var self=this;
  54857. var jsObject,stored;
  54858. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54859. return $core.withContext(function($ctx1) {
  54860. jsObject=[];
  54861. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54862. $ctx1.sendIdx["basicAt:put:"]=1;
  54863. $recv(jsObject)._basicAt_put_("x",(function(v){
  54864. stored=v;
  54865. return stored;
  54866. }));
  54867. self._shouldnt_raise_((function(){
  54868. return $core.withContext(function($ctx2) {
  54869. return $recv(jsObject)._x_((4));
  54870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54871. }),$Error());
  54872. self._assert_equals_(stored,(4));
  54873. return self;
  54874. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  54875. },
  54876. args: [],
  54877. 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",
  54878. referencedClasses: ["Error"],
  54879. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  54880. }),
  54881. $globals.JSObjectProxyTest);
  54882. $core.addMethod(
  54883. $core.method({
  54884. selector: "testDNUWithAllowJavaScriptCalls",
  54885. protocol: 'tests',
  54886. fn: function (){
  54887. var self=this;
  54888. var jsObject;
  54889. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54890. return $core.withContext(function($ctx1) {
  54891. jsObject=[];
  54892. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54893. self._should_raise_((function(){
  54894. return $core.withContext(function($ctx2) {
  54895. return $recv(jsObject)._foo();
  54896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54897. }),$MessageNotUnderstood());
  54898. return self;
  54899. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54900. },
  54901. args: [],
  54902. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  54903. referencedClasses: ["MessageNotUnderstood"],
  54904. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  54905. }),
  54906. $globals.JSObjectProxyTest);
  54907. $core.addMethod(
  54908. $core.method({
  54909. selector: "testMessageSend",
  54910. protocol: 'tests',
  54911. fn: function (){
  54912. var self=this;
  54913. return $core.withContext(function($ctx1) {
  54914. var $2,$1,$4,$3;
  54915. $2=self._jsObject();
  54916. $ctx1.sendIdx["jsObject"]=1;
  54917. $1=$recv($2)._a();
  54918. self._assert_equals_($1,(1));
  54919. $ctx1.sendIdx["assert:equals:"]=1;
  54920. $4=self._jsObject();
  54921. $ctx1.sendIdx["jsObject"]=2;
  54922. $3=$recv($4)._b();
  54923. self._assert_equals_($3,(2));
  54924. $ctx1.sendIdx["assert:equals:"]=2;
  54925. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  54926. return self;
  54927. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  54928. },
  54929. args: [],
  54930. 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",
  54931. referencedClasses: [],
  54932. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  54933. }),
  54934. $globals.JSObjectProxyTest);
  54935. $core.addMethod(
  54936. $core.method({
  54937. selector: "testMethodWithArguments",
  54938. protocol: 'tests',
  54939. fn: function (){
  54940. var self=this;
  54941. return $core.withContext(function($ctx1) {
  54942. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  54943. return self;
  54944. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  54945. },
  54946. args: [],
  54947. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  54948. referencedClasses: [],
  54949. messageSends: ["assert:equals:", "c:", "jsObject"]
  54950. }),
  54951. $globals.JSObjectProxyTest);
  54952. $core.addMethod(
  54953. $core.method({
  54954. selector: "testPrinting",
  54955. protocol: 'tests',
  54956. fn: function (){
  54957. var self=this;
  54958. return $core.withContext(function($ctx1) {
  54959. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  54960. return self;
  54961. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  54962. },
  54963. args: [],
  54964. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  54965. referencedClasses: [],
  54966. messageSends: ["assert:equals:", "printString", "jsObject"]
  54967. }),
  54968. $globals.JSObjectProxyTest);
  54969. $core.addMethod(
  54970. $core.method({
  54971. selector: "testPropertyThatReturnsEmptyString",
  54972. protocol: 'tests',
  54973. fn: function (){
  54974. var self=this;
  54975. var object;
  54976. return $core.withContext(function($ctx1) {
  54977. var $1;
  54978. object=self._jsObject();
  54979. $1=$recv(object)._d();
  54980. $ctx1.sendIdx["d"]=1;
  54981. self._assert_equals_($1,"");
  54982. $ctx1.sendIdx["assert:equals:"]=1;
  54983. $recv(object)._d_("hello");
  54984. self._assert_equals_($recv(object)._d(),"hello");
  54985. return self;
  54986. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  54987. },
  54988. args: [],
  54989. 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'",
  54990. referencedClasses: [],
  54991. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  54992. }),
  54993. $globals.JSObjectProxyTest);
  54994. $core.addMethod(
  54995. $core.method({
  54996. selector: "testPropertyThatReturnsUndefined",
  54997. protocol: 'tests',
  54998. fn: function (){
  54999. var self=this;
  55000. var object;
  55001. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55002. return $core.withContext(function($ctx1) {
  55003. object=self._jsObject();
  55004. self._shouldnt_raise_((function(){
  55005. return $core.withContext(function($ctx2) {
  55006. return $recv(object)._e();
  55007. $ctx2.sendIdx["e"]=1;
  55008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55009. }),$MessageNotUnderstood());
  55010. self._assert_($recv($recv(object)._e())._isNil());
  55011. return self;
  55012. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  55013. },
  55014. args: [],
  55015. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  55016. referencedClasses: ["MessageNotUnderstood"],
  55017. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  55018. }),
  55019. $globals.JSObjectProxyTest);
  55020. $core.addMethod(
  55021. $core.method({
  55022. selector: "testSetPropertyWithFalsyValue",
  55023. protocol: 'tests',
  55024. fn: function (){
  55025. var self=this;
  55026. var jsObject;
  55027. return $core.withContext(function($ctx1) {
  55028. var $1,$2,$3,$4,$5;
  55029. jsObject=self._jsObject();
  55030. $1=$recv(jsObject)._a();
  55031. $ctx1.sendIdx["a"]=1;
  55032. self._assert_equals_($1,(1));
  55033. $ctx1.sendIdx["assert:equals:"]=1;
  55034. $recv(jsObject)._a_(self._jsNull());
  55035. $ctx1.sendIdx["a:"]=1;
  55036. $2=$recv(jsObject)._a();
  55037. $ctx1.sendIdx["a"]=2;
  55038. self._assert_equals_($2,nil);
  55039. $ctx1.sendIdx["assert:equals:"]=2;
  55040. $recv(jsObject)._a_((0));
  55041. $ctx1.sendIdx["a:"]=2;
  55042. $3=$recv(jsObject)._a();
  55043. $ctx1.sendIdx["a"]=3;
  55044. self._assert_equals_($3,(0));
  55045. $ctx1.sendIdx["assert:equals:"]=3;
  55046. $recv(jsObject)._a_(self._jsUndefined());
  55047. $ctx1.sendIdx["a:"]=3;
  55048. $4=$recv(jsObject)._a();
  55049. $ctx1.sendIdx["a"]=4;
  55050. self._assert_equals_($4,nil);
  55051. $ctx1.sendIdx["assert:equals:"]=4;
  55052. $recv(jsObject)._a_("");
  55053. $ctx1.sendIdx["a:"]=4;
  55054. $5=$recv(jsObject)._a();
  55055. $ctx1.sendIdx["a"]=5;
  55056. self._assert_equals_($5,"");
  55057. $ctx1.sendIdx["assert:equals:"]=5;
  55058. $recv(jsObject)._a_(false);
  55059. self._assert_equals_($recv(jsObject)._a(),false);
  55060. return self;
  55061. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55062. },
  55063. args: [],
  55064. 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",
  55065. referencedClasses: [],
  55066. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  55067. }),
  55068. $globals.JSObjectProxyTest);
  55069. $core.addMethod(
  55070. $core.method({
  55071. selector: "testValue",
  55072. protocol: 'tests',
  55073. fn: function (){
  55074. var self=this;
  55075. var testObject;
  55076. return $core.withContext(function($ctx1) {
  55077. testObject=self._jsObject();
  55078. $recv(testObject)._at_put_("value","aValue");
  55079. self._assert_equals_($recv(testObject)._value(),"aValue");
  55080. return self;
  55081. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  55082. },
  55083. args: [],
  55084. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  55085. referencedClasses: [],
  55086. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  55087. }),
  55088. $globals.JSObjectProxyTest);
  55089. $core.addMethod(
  55090. $core.method({
  55091. selector: "testYourself",
  55092. protocol: 'tests',
  55093. fn: function (){
  55094. var self=this;
  55095. var object;
  55096. return $core.withContext(function($ctx1) {
  55097. var $1,$2;
  55098. $1=self._jsObject();
  55099. $recv($1)._d_("test");
  55100. $2=$recv($1)._yourself();
  55101. object=$2;
  55102. self._assert_equals_($recv(object)._d(),"test");
  55103. return self;
  55104. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  55105. },
  55106. args: [],
  55107. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  55108. referencedClasses: [],
  55109. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  55110. }),
  55111. $globals.JSObjectProxyTest);
  55112. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  55113. $core.addMethod(
  55114. $core.method({
  55115. selector: "testCatchingException",
  55116. protocol: 'tests',
  55117. fn: function (){
  55118. var self=this;
  55119. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55120. return $core.withContext(function($ctx1) {
  55121. $recv((function(){
  55122. return $core.withContext(function($ctx2) {
  55123. return self._throwException();
  55124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55125. }))._on_do_($Error(),(function(error){
  55126. return $core.withContext(function($ctx2) {
  55127. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  55128. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  55129. }));
  55130. return self;
  55131. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  55132. },
  55133. args: [],
  55134. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  55135. referencedClasses: ["Error"],
  55136. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  55137. }),
  55138. $globals.JavaScriptExceptionTest);
  55139. $core.addMethod(
  55140. $core.method({
  55141. selector: "testRaisingException",
  55142. protocol: 'tests',
  55143. fn: function (){
  55144. var self=this;
  55145. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  55146. return $core.withContext(function($ctx1) {
  55147. self._should_raise_((function(){
  55148. return $core.withContext(function($ctx2) {
  55149. return self._throwException();
  55150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55151. }),$JavaScriptException());
  55152. return self;
  55153. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  55154. },
  55155. args: [],
  55156. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  55157. referencedClasses: ["JavaScriptException"],
  55158. messageSends: ["should:raise:", "throwException"]
  55159. }),
  55160. $globals.JavaScriptExceptionTest);
  55161. $core.addMethod(
  55162. $core.method({
  55163. selector: "throwException",
  55164. protocol: 'helpers',
  55165. fn: function (){
  55166. var self=this;
  55167. return $core.withContext(function($ctx1) {
  55168. throw 'test';
  55169. return self;
  55170. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  55171. },
  55172. args: [],
  55173. source: "throwException\x0a\x09<throw 'test'>",
  55174. referencedClasses: [],
  55175. messageSends: []
  55176. }),
  55177. $globals.JavaScriptExceptionTest);
  55178. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  55179. $core.addMethod(
  55180. $core.method({
  55181. selector: "testValue",
  55182. protocol: 'tests',
  55183. fn: function (){
  55184. var self=this;
  55185. var messageSend;
  55186. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  55187. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55188. return $core.withContext(function($ctx1) {
  55189. var $1,$2;
  55190. $1=$recv($MessageSend())._new();
  55191. $ctx1.sendIdx["new"]=1;
  55192. $recv($1)._receiver_($recv($Object())._new());
  55193. $recv($1)._selector_("asString");
  55194. $2=$recv($1)._yourself();
  55195. messageSend=$2;
  55196. self._assert_equals_($recv(messageSend)._value(),"an Object");
  55197. return self;
  55198. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  55199. },
  55200. args: [],
  55201. 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'",
  55202. referencedClasses: ["MessageSend", "Object"],
  55203. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  55204. }),
  55205. $globals.MessageSendTest);
  55206. $core.addMethod(
  55207. $core.method({
  55208. selector: "testValueWithArguments",
  55209. protocol: 'tests',
  55210. fn: function (){
  55211. var self=this;
  55212. var messageSend;
  55213. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  55214. return $core.withContext(function($ctx1) {
  55215. var $1,$2;
  55216. $1=$recv($MessageSend())._new();
  55217. $recv($1)._receiver_((2));
  55218. $recv($1)._selector_("+");
  55219. $2=$recv($1)._yourself();
  55220. messageSend=$2;
  55221. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  55222. $ctx1.sendIdx["assert:equals:"]=1;
  55223. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  55224. return self;
  55225. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  55226. },
  55227. args: [],
  55228. 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",
  55229. referencedClasses: ["MessageSend"],
  55230. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  55231. }),
  55232. $globals.MessageSendTest);
  55233. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  55234. $core.addMethod(
  55235. $core.method({
  55236. selector: "codeGeneratorClass",
  55237. protocol: 'accessing',
  55238. fn: function (){
  55239. var self=this;
  55240. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  55241. return $CodeGenerator();
  55242. },
  55243. args: [],
  55244. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  55245. referencedClasses: ["CodeGenerator"],
  55246. messageSends: []
  55247. }),
  55248. $globals.MethodInheritanceTest);
  55249. $core.addMethod(
  55250. $core.method({
  55251. selector: "compiler",
  55252. protocol: 'factory',
  55253. fn: function (){
  55254. var self=this;
  55255. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  55256. return $core.withContext(function($ctx1) {
  55257. var $2,$3,$1;
  55258. $2=$recv($Compiler())._new();
  55259. $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
  55260. $3=$recv($2)._yourself();
  55261. $1=$3;
  55262. return $1;
  55263. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  55264. },
  55265. args: [],
  55266. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  55267. referencedClasses: ["Compiler"],
  55268. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  55269. }),
  55270. $globals.MethodInheritanceTest);
  55271. $core.addMethod(
  55272. $core.method({
  55273. selector: "deinstallBottom",
  55274. protocol: 'testing',
  55275. fn: function (){
  55276. var self=this;
  55277. return $core.withContext(function($ctx1) {
  55278. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  55279. return self;
  55280. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  55281. },
  55282. args: [],
  55283. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  55284. referencedClasses: [],
  55285. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  55286. }),
  55287. $globals.MethodInheritanceTest);
  55288. $core.addMethod(
  55289. $core.method({
  55290. selector: "deinstallMiddle",
  55291. protocol: 'testing',
  55292. fn: function (){
  55293. var self=this;
  55294. return $core.withContext(function($ctx1) {
  55295. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  55296. return self;
  55297. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  55298. },
  55299. args: [],
  55300. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  55301. referencedClasses: [],
  55302. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  55303. }),
  55304. $globals.MethodInheritanceTest);
  55305. $core.addMethod(
  55306. $core.method({
  55307. selector: "deinstallTop",
  55308. protocol: 'testing',
  55309. fn: function (){
  55310. var self=this;
  55311. return $core.withContext(function($ctx1) {
  55312. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  55313. return self;
  55314. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  55315. },
  55316. args: [],
  55317. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  55318. referencedClasses: [],
  55319. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  55320. }),
  55321. $globals.MethodInheritanceTest);
  55322. $core.addMethod(
  55323. $core.method({
  55324. selector: "installBottom:",
  55325. protocol: 'testing',
  55326. fn: function (aString){
  55327. var self=this;
  55328. return $core.withContext(function($ctx1) {
  55329. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  55330. return self;
  55331. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  55332. },
  55333. args: ["aString"],
  55334. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  55335. referencedClasses: [],
  55336. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  55337. }),
  55338. $globals.MethodInheritanceTest);
  55339. $core.addMethod(
  55340. $core.method({
  55341. selector: "installMiddle:",
  55342. protocol: 'testing',
  55343. fn: function (aString){
  55344. var self=this;
  55345. return $core.withContext(function($ctx1) {
  55346. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  55347. return self;
  55348. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  55349. },
  55350. args: ["aString"],
  55351. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  55352. referencedClasses: [],
  55353. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  55354. }),
  55355. $globals.MethodInheritanceTest);
  55356. $core.addMethod(
  55357. $core.method({
  55358. selector: "installTop:",
  55359. protocol: 'testing',
  55360. fn: function (aString){
  55361. var self=this;
  55362. return $core.withContext(function($ctx1) {
  55363. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  55364. return self;
  55365. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  55366. },
  55367. args: ["aString"],
  55368. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  55369. referencedClasses: [],
  55370. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  55371. }),
  55372. $globals.MethodInheritanceTest);
  55373. $core.addMethod(
  55374. $core.method({
  55375. selector: "setUp",
  55376. protocol: 'initialization',
  55377. fn: function (){
  55378. var self=this;
  55379. return $core.withContext(function($ctx1) {
  55380. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  55381. $ctx1.sendIdx["new"]=1;
  55382. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  55383. $ctx1.sendIdx["new"]=2;
  55384. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  55385. self["@method"]=nil;
  55386. self["@performBlock"]=(function(){
  55387. return $core.withContext(function($ctx2) {
  55388. return self._error_("performBlock not initialized");
  55389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55390. });
  55391. return self;
  55392. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  55393. },
  55394. args: [],
  55395. 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' ]",
  55396. referencedClasses: [],
  55397. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  55398. }),
  55399. $globals.MethodInheritanceTest);
  55400. $core.addMethod(
  55401. $core.method({
  55402. selector: "shouldMNU",
  55403. protocol: 'testing',
  55404. fn: function (){
  55405. var self=this;
  55406. return $core.withContext(function($ctx1) {
  55407. self._shouldMNUTop();
  55408. self._shouldMNUMiddle();
  55409. self._shouldMNUBottom();
  55410. return self;
  55411. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  55412. },
  55413. args: [],
  55414. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  55415. referencedClasses: [],
  55416. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  55417. }),
  55418. $globals.MethodInheritanceTest);
  55419. $core.addMethod(
  55420. $core.method({
  55421. selector: "shouldMNUBottom",
  55422. protocol: 'testing',
  55423. fn: function (){
  55424. var self=this;
  55425. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55426. return $core.withContext(function($ctx1) {
  55427. self._should_raise_((function(){
  55428. return $core.withContext(function($ctx2) {
  55429. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55431. }),$MessageNotUnderstood());
  55432. return self;
  55433. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  55434. },
  55435. args: [],
  55436. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  55437. referencedClasses: ["MessageNotUnderstood"],
  55438. messageSends: ["should:raise:", "value:"]
  55439. }),
  55440. $globals.MethodInheritanceTest);
  55441. $core.addMethod(
  55442. $core.method({
  55443. selector: "shouldMNUMiddle",
  55444. protocol: 'testing',
  55445. fn: function (){
  55446. var self=this;
  55447. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55448. return $core.withContext(function($ctx1) {
  55449. self._should_raise_((function(){
  55450. return $core.withContext(function($ctx2) {
  55451. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55453. }),$MessageNotUnderstood());
  55454. return self;
  55455. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  55456. },
  55457. args: [],
  55458. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  55459. referencedClasses: ["MessageNotUnderstood"],
  55460. messageSends: ["should:raise:", "value:"]
  55461. }),
  55462. $globals.MethodInheritanceTest);
  55463. $core.addMethod(
  55464. $core.method({
  55465. selector: "shouldMNUTop",
  55466. protocol: 'testing',
  55467. fn: function (){
  55468. var self=this;
  55469. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55470. return $core.withContext(function($ctx1) {
  55471. self._should_raise_((function(){
  55472. return $core.withContext(function($ctx2) {
  55473. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55475. }),$MessageNotUnderstood());
  55476. return self;
  55477. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  55478. },
  55479. args: [],
  55480. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  55481. referencedClasses: ["MessageNotUnderstood"],
  55482. messageSends: ["should:raise:", "value:"]
  55483. }),
  55484. $globals.MethodInheritanceTest);
  55485. $core.addMethod(
  55486. $core.method({
  55487. selector: "shouldReturn:",
  55488. protocol: 'testing',
  55489. fn: function (anObject){
  55490. var self=this;
  55491. var result;
  55492. return $core.withContext(function($ctx1) {
  55493. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55494. $ctx1.sendIdx["value:"]=1;
  55495. self._assert_equals_(["top",anObject],["top",result]);
  55496. $ctx1.sendIdx["assert:equals:"]=1;
  55497. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55498. $ctx1.sendIdx["value:"]=2;
  55499. self._assert_equals_(["middle",anObject],["middle",result]);
  55500. $ctx1.sendIdx["assert:equals:"]=2;
  55501. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55502. self._assert_equals_(["bottom",anObject],["bottom",result]);
  55503. return self;
  55504. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  55505. },
  55506. args: ["anObject"],
  55507. 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 }",
  55508. referencedClasses: [],
  55509. messageSends: ["value:", "assert:equals:"]
  55510. }),
  55511. $globals.MethodInheritanceTest);
  55512. $core.addMethod(
  55513. $core.method({
  55514. selector: "shouldReturn:and:and:",
  55515. protocol: 'testing',
  55516. fn: function (anObject,anObject2,anObject3){
  55517. var self=this;
  55518. var result;
  55519. return $core.withContext(function($ctx1) {
  55520. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55521. $ctx1.sendIdx["value:"]=1;
  55522. self._assert_equals_(["top",anObject],["top",result]);
  55523. $ctx1.sendIdx["assert:equals:"]=1;
  55524. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55525. $ctx1.sendIdx["value:"]=2;
  55526. self._assert_equals_(["middle",anObject2],["middle",result]);
  55527. $ctx1.sendIdx["assert:equals:"]=2;
  55528. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55529. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  55530. return self;
  55531. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  55532. },
  55533. args: ["anObject", "anObject2", "anObject3"],
  55534. 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 }",
  55535. referencedClasses: [],
  55536. messageSends: ["value:", "assert:equals:"]
  55537. }),
  55538. $globals.MethodInheritanceTest);
  55539. $core.addMethod(
  55540. $core.method({
  55541. selector: "targetClassBottom",
  55542. protocol: 'accessing',
  55543. fn: function (){
  55544. var self=this;
  55545. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  55546. return $JavaScriptException();
  55547. },
  55548. args: [],
  55549. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  55550. referencedClasses: ["JavaScriptException"],
  55551. messageSends: []
  55552. }),
  55553. $globals.MethodInheritanceTest);
  55554. $core.addMethod(
  55555. $core.method({
  55556. selector: "targetClassMiddle",
  55557. protocol: 'accessing',
  55558. fn: function (){
  55559. var self=this;
  55560. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55561. return $Error();
  55562. },
  55563. args: [],
  55564. source: "targetClassMiddle\x0a\x09^ Error",
  55565. referencedClasses: ["Error"],
  55566. messageSends: []
  55567. }),
  55568. $globals.MethodInheritanceTest);
  55569. $core.addMethod(
  55570. $core.method({
  55571. selector: "targetClassTop",
  55572. protocol: 'accessing',
  55573. fn: function (){
  55574. var self=this;
  55575. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55576. return $Object();
  55577. },
  55578. args: [],
  55579. source: "targetClassTop\x0a\x09^ Object",
  55580. referencedClasses: ["Object"],
  55581. messageSends: []
  55582. }),
  55583. $globals.MethodInheritanceTest);
  55584. $core.addMethod(
  55585. $core.method({
  55586. selector: "tearDown",
  55587. protocol: 'initialization',
  55588. fn: function (){
  55589. var self=this;
  55590. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55591. return $core.withContext(function($ctx1) {
  55592. $recv((function(){
  55593. return $core.withContext(function($ctx2) {
  55594. return self._deinstallTop();
  55595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55596. }))._on_do_($Error(),(function(){
  55597. }));
  55598. $ctx1.sendIdx["on:do:"]=1;
  55599. $recv((function(){
  55600. return $core.withContext(function($ctx2) {
  55601. return self._deinstallMiddle();
  55602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55603. }))._on_do_($Error(),(function(){
  55604. }));
  55605. $ctx1.sendIdx["on:do:"]=2;
  55606. $recv((function(){
  55607. return $core.withContext(function($ctx2) {
  55608. return self._deinstallBottom();
  55609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  55610. }))._on_do_($Error(),(function(){
  55611. }));
  55612. return self;
  55613. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  55614. },
  55615. args: [],
  55616. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  55617. referencedClasses: ["Error"],
  55618. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  55619. }),
  55620. $globals.MethodInheritanceTest);
  55621. $core.addMethod(
  55622. $core.method({
  55623. selector: "testMNU11",
  55624. protocol: 'tests',
  55625. fn: function (){
  55626. var self=this;
  55627. return $core.withContext(function($ctx1) {
  55628. self["@performBlock"]=(function(x){
  55629. return $core.withContext(function($ctx2) {
  55630. return $recv(x)._foo();
  55631. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55632. });
  55633. self._shouldMNU();
  55634. $ctx1.sendIdx["shouldMNU"]=1;
  55635. self._installTop_("foo ^ false");
  55636. $ctx1.sendIdx["installTop:"]=1;
  55637. self._installTop_("foo ^ true");
  55638. self._deinstallTop();
  55639. self._shouldMNU();
  55640. return self;
  55641. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  55642. },
  55643. args: [],
  55644. 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",
  55645. referencedClasses: [],
  55646. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  55647. }),
  55648. $globals.MethodInheritanceTest);
  55649. $core.addMethod(
  55650. $core.method({
  55651. selector: "testMNU22",
  55652. protocol: 'tests',
  55653. fn: function (){
  55654. var self=this;
  55655. return $core.withContext(function($ctx1) {
  55656. self["@performBlock"]=(function(x){
  55657. return $core.withContext(function($ctx2) {
  55658. return $recv(x)._foo();
  55659. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55660. });
  55661. self._shouldMNU();
  55662. $ctx1.sendIdx["shouldMNU"]=1;
  55663. self._installMiddle_("foo ^ false");
  55664. $ctx1.sendIdx["installMiddle:"]=1;
  55665. self._installMiddle_("foo ^ true");
  55666. self._deinstallMiddle();
  55667. self._shouldMNU();
  55668. return self;
  55669. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  55670. },
  55671. args: [],
  55672. 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",
  55673. referencedClasses: [],
  55674. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  55675. }),
  55676. $globals.MethodInheritanceTest);
  55677. $core.addMethod(
  55678. $core.method({
  55679. selector: "testReturns1",
  55680. protocol: 'tests',
  55681. fn: function (){
  55682. var self=this;
  55683. return $core.withContext(function($ctx1) {
  55684. self["@performBlock"]=(function(x){
  55685. return $core.withContext(function($ctx2) {
  55686. return $recv(x)._foo();
  55687. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55688. });
  55689. self._installTop_("foo ^ false");
  55690. $ctx1.sendIdx["installTop:"]=1;
  55691. self._shouldReturn_(false);
  55692. $ctx1.sendIdx["shouldReturn:"]=1;
  55693. self._installTop_("foo ^ true");
  55694. self._shouldReturn_(true);
  55695. return self;
  55696. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  55697. },
  55698. args: [],
  55699. 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",
  55700. referencedClasses: [],
  55701. messageSends: ["foo", "installTop:", "shouldReturn:"]
  55702. }),
  55703. $globals.MethodInheritanceTest);
  55704. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  55705. $core.addMethod(
  55706. $core.method({
  55707. selector: "testAbs",
  55708. protocol: 'tests',
  55709. fn: function (){
  55710. var self=this;
  55711. return $core.withContext(function($ctx1) {
  55712. var $1;
  55713. $1=(4)._abs();
  55714. $ctx1.sendIdx["abs"]=1;
  55715. self._assert_equals_($1,(4));
  55716. $ctx1.sendIdx["assert:equals:"]=1;
  55717. self._assert_equals_((-4)._abs(),(4));
  55718. return self;
  55719. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  55720. },
  55721. args: [],
  55722. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  55723. referencedClasses: [],
  55724. messageSends: ["assert:equals:", "abs"]
  55725. }),
  55726. $globals.NumberTest);
  55727. $core.addMethod(
  55728. $core.method({
  55729. selector: "testArithmetic",
  55730. protocol: 'tests',
  55731. fn: function (){
  55732. var self=this;
  55733. return $core.withContext(function($ctx1) {
  55734. var $1,$2,$3,$5,$4;
  55735. $1=(1.5).__plus((1));
  55736. $ctx1.sendIdx["+"]=1;
  55737. self._assert_equals_($1,(2.5));
  55738. $ctx1.sendIdx["assert:equals:"]=1;
  55739. $2=(2).__minus((1));
  55740. $ctx1.sendIdx["-"]=1;
  55741. self._assert_equals_($2,(1));
  55742. $ctx1.sendIdx["assert:equals:"]=2;
  55743. self._assert_equals_((-2).__minus((1)),(-3));
  55744. $ctx1.sendIdx["assert:equals:"]=3;
  55745. self._assert_equals_((12).__slash((2)),(6));
  55746. $ctx1.sendIdx["assert:equals:"]=4;
  55747. $3=(3).__star((4));
  55748. $ctx1.sendIdx["*"]=1;
  55749. self._assert_equals_($3,(12));
  55750. $ctx1.sendIdx["assert:equals:"]=5;
  55751. self._assert_equals_((7).__slash_slash((2)),(3));
  55752. $ctx1.sendIdx["assert:equals:"]=6;
  55753. self._assert_equals_((7).__backslash_backslash((2)),(1));
  55754. $ctx1.sendIdx["assert:equals:"]=7;
  55755. $5=(1).__plus((2));
  55756. $ctx1.sendIdx["+"]=2;
  55757. $4=$recv($5).__star((3));
  55758. $ctx1.sendIdx["*"]=2;
  55759. self._assert_equals_($4,(9));
  55760. $ctx1.sendIdx["assert:equals:"]=8;
  55761. self._assert_equals_((1).__plus((2).__star((3))),(7));
  55762. return self;
  55763. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  55764. },
  55765. args: [],
  55766. 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",
  55767. referencedClasses: [],
  55768. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  55769. }),
  55770. $globals.NumberTest);
  55771. $core.addMethod(
  55772. $core.method({
  55773. selector: "testAsNumber",
  55774. protocol: 'tests',
  55775. fn: function (){
  55776. var self=this;
  55777. return $core.withContext(function($ctx1) {
  55778. self._assert_equals_((3)._asNumber(),(3));
  55779. return self;
  55780. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  55781. },
  55782. args: [],
  55783. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  55784. referencedClasses: [],
  55785. messageSends: ["assert:equals:", "asNumber"]
  55786. }),
  55787. $globals.NumberTest);
  55788. $core.addMethod(
  55789. $core.method({
  55790. selector: "testCeiling",
  55791. protocol: 'tests',
  55792. fn: function (){
  55793. var self=this;
  55794. return $core.withContext(function($ctx1) {
  55795. var $1,$2;
  55796. $1=(1.2)._ceiling();
  55797. $ctx1.sendIdx["ceiling"]=1;
  55798. self._assert_equals_($1,(2));
  55799. $ctx1.sendIdx["assert:equals:"]=1;
  55800. $2=(-1.2)._ceiling();
  55801. $ctx1.sendIdx["ceiling"]=2;
  55802. self._assert_equals_($2,(-1));
  55803. $ctx1.sendIdx["assert:equals:"]=2;
  55804. self._assert_equals_((1)._ceiling(),(1));
  55805. return self;
  55806. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  55807. },
  55808. args: [],
  55809. 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.",
  55810. referencedClasses: [],
  55811. messageSends: ["assert:equals:", "ceiling"]
  55812. }),
  55813. $globals.NumberTest);
  55814. $core.addMethod(
  55815. $core.method({
  55816. selector: "testComparison",
  55817. protocol: 'tests',
  55818. fn: function (){
  55819. var self=this;
  55820. return $core.withContext(function($ctx1) {
  55821. var $1,$2,$3,$4;
  55822. $1=(3).__gt((2));
  55823. $ctx1.sendIdx[">"]=1;
  55824. self._assert_($1);
  55825. $ctx1.sendIdx["assert:"]=1;
  55826. $2=(2).__lt((3));
  55827. $ctx1.sendIdx["<"]=1;
  55828. self._assert_($2);
  55829. $ctx1.sendIdx["assert:"]=2;
  55830. self._deny_((3).__lt((2)));
  55831. $ctx1.sendIdx["deny:"]=1;
  55832. self._deny_((2).__gt((3)));
  55833. $3=(3).__gt_eq((3));
  55834. $ctx1.sendIdx[">="]=1;
  55835. self._assert_($3);
  55836. $ctx1.sendIdx["assert:"]=3;
  55837. self._assert_((3.1).__gt_eq((3)));
  55838. $ctx1.sendIdx["assert:"]=4;
  55839. $4=(3).__lt_eq((3));
  55840. $ctx1.sendIdx["<="]=1;
  55841. self._assert_($4);
  55842. $ctx1.sendIdx["assert:"]=5;
  55843. self._assert_((3).__lt_eq((3.1)));
  55844. return self;
  55845. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  55846. },
  55847. args: [],
  55848. 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",
  55849. referencedClasses: [],
  55850. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  55851. }),
  55852. $globals.NumberTest);
  55853. $core.addMethod(
  55854. $core.method({
  55855. selector: "testCopying",
  55856. protocol: 'tests',
  55857. fn: function (){
  55858. var self=this;
  55859. return $core.withContext(function($ctx1) {
  55860. var $1;
  55861. $1=$recv((1)._copy()).__eq_eq((1));
  55862. $ctx1.sendIdx["=="]=1;
  55863. self._assert_($1);
  55864. $ctx1.sendIdx["assert:"]=1;
  55865. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  55866. return self;
  55867. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  55868. },
  55869. args: [],
  55870. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  55871. referencedClasses: [],
  55872. messageSends: ["assert:", "==", "copy", "deepCopy"]
  55873. }),
  55874. $globals.NumberTest);
  55875. $core.addMethod(
  55876. $core.method({
  55877. selector: "testEquality",
  55878. protocol: 'tests',
  55879. fn: function (){
  55880. var self=this;
  55881. return $core.withContext(function($ctx1) {
  55882. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  55883. $1=(1).__eq((1));
  55884. $ctx1.sendIdx["="]=1;
  55885. self._assert_($1);
  55886. $ctx1.sendIdx["assert:"]=1;
  55887. $2=(0).__eq((0));
  55888. $ctx1.sendIdx["="]=2;
  55889. self._assert_($2);
  55890. $ctx1.sendIdx["assert:"]=2;
  55891. $3=(1).__eq((0));
  55892. $ctx1.sendIdx["="]=3;
  55893. self._deny_($3);
  55894. $ctx1.sendIdx["deny:"]=1;
  55895. $5=(1)._yourself();
  55896. $ctx1.sendIdx["yourself"]=1;
  55897. $4=$recv($5).__eq((1));
  55898. $ctx1.sendIdx["="]=4;
  55899. self._assert_($4);
  55900. $ctx1.sendIdx["assert:"]=3;
  55901. $7=(1)._yourself();
  55902. $ctx1.sendIdx["yourself"]=2;
  55903. $6=(1).__eq($7);
  55904. $ctx1.sendIdx["="]=5;
  55905. self._assert_($6);
  55906. $ctx1.sendIdx["assert:"]=4;
  55907. $9=(1)._yourself();
  55908. $ctx1.sendIdx["yourself"]=3;
  55909. $8=$recv($9).__eq((1)._yourself());
  55910. $ctx1.sendIdx["="]=6;
  55911. self._assert_($8);
  55912. $10=(0).__eq(false);
  55913. $ctx1.sendIdx["="]=7;
  55914. self._deny_($10);
  55915. $ctx1.sendIdx["deny:"]=2;
  55916. $11=false.__eq((0));
  55917. $ctx1.sendIdx["="]=8;
  55918. self._deny_($11);
  55919. $ctx1.sendIdx["deny:"]=3;
  55920. $12="".__eq((0));
  55921. $ctx1.sendIdx["="]=9;
  55922. self._deny_($12);
  55923. $ctx1.sendIdx["deny:"]=4;
  55924. self._deny_((0).__eq(""));
  55925. return self;
  55926. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  55927. },
  55928. args: [],
  55929. 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 = ''",
  55930. referencedClasses: [],
  55931. messageSends: ["assert:", "=", "deny:", "yourself"]
  55932. }),
  55933. $globals.NumberTest);
  55934. $core.addMethod(
  55935. $core.method({
  55936. selector: "testFloor",
  55937. protocol: 'tests',
  55938. fn: function (){
  55939. var self=this;
  55940. return $core.withContext(function($ctx1) {
  55941. var $1,$2;
  55942. $1=(1.2)._floor();
  55943. $ctx1.sendIdx["floor"]=1;
  55944. self._assert_equals_($1,(1));
  55945. $ctx1.sendIdx["assert:equals:"]=1;
  55946. $2=(-1.2)._floor();
  55947. $ctx1.sendIdx["floor"]=2;
  55948. self._assert_equals_($2,(-2));
  55949. $ctx1.sendIdx["assert:equals:"]=2;
  55950. self._assert_equals_((1)._floor(),(1));
  55951. return self;
  55952. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  55953. },
  55954. args: [],
  55955. 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.",
  55956. referencedClasses: [],
  55957. messageSends: ["assert:equals:", "floor"]
  55958. }),
  55959. $globals.NumberTest);
  55960. $core.addMethod(
  55961. $core.method({
  55962. selector: "testHexNumbers",
  55963. protocol: 'tests',
  55964. fn: function (){
  55965. var self=this;
  55966. return $core.withContext(function($ctx1) {
  55967. var $1,$2,$3,$4,$5;
  55968. self._assert_equals_((9),(9));
  55969. $ctx1.sendIdx["assert:equals:"]=1;
  55970. $1=(10)._truncated();
  55971. $ctx1.sendIdx["truncated"]=1;
  55972. self._assert_equals_($1,(10));
  55973. $ctx1.sendIdx["assert:equals:"]=2;
  55974. $2=(11)._truncated();
  55975. $ctx1.sendIdx["truncated"]=2;
  55976. self._assert_equals_($2,(11));
  55977. $ctx1.sendIdx["assert:equals:"]=3;
  55978. $3=(12)._truncated();
  55979. $ctx1.sendIdx["truncated"]=3;
  55980. self._assert_equals_($3,(12));
  55981. $ctx1.sendIdx["assert:equals:"]=4;
  55982. $4=(13)._truncated();
  55983. $ctx1.sendIdx["truncated"]=4;
  55984. self._assert_equals_($4,(13));
  55985. $ctx1.sendIdx["assert:equals:"]=5;
  55986. $5=(14)._truncated();
  55987. $ctx1.sendIdx["truncated"]=5;
  55988. self._assert_equals_($5,(14));
  55989. $ctx1.sendIdx["assert:equals:"]=6;
  55990. self._assert_equals_((15)._truncated(),(15));
  55991. return self;
  55992. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  55993. },
  55994. args: [],
  55995. 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",
  55996. referencedClasses: [],
  55997. messageSends: ["assert:equals:", "truncated"]
  55998. }),
  55999. $globals.NumberTest);
  56000. $core.addMethod(
  56001. $core.method({
  56002. selector: "testIdentity",
  56003. protocol: 'tests',
  56004. fn: function (){
  56005. var self=this;
  56006. return $core.withContext(function($ctx1) {
  56007. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  56008. $1=(1).__eq_eq((1));
  56009. $ctx1.sendIdx["=="]=1;
  56010. self._assert_($1);
  56011. $ctx1.sendIdx["assert:"]=1;
  56012. $2=(0).__eq_eq((0));
  56013. $ctx1.sendIdx["=="]=2;
  56014. self._assert_($2);
  56015. $ctx1.sendIdx["assert:"]=2;
  56016. $3=(1).__eq_eq((0));
  56017. $ctx1.sendIdx["=="]=3;
  56018. self._deny_($3);
  56019. $ctx1.sendIdx["deny:"]=1;
  56020. $5=(1)._yourself();
  56021. $ctx1.sendIdx["yourself"]=1;
  56022. $4=$recv($5).__eq_eq((1));
  56023. $ctx1.sendIdx["=="]=4;
  56024. self._assert_($4);
  56025. $ctx1.sendIdx["assert:"]=3;
  56026. $7=(1)._yourself();
  56027. $ctx1.sendIdx["yourself"]=2;
  56028. $6=(1).__eq_eq($7);
  56029. $ctx1.sendIdx["=="]=5;
  56030. self._assert_($6);
  56031. $ctx1.sendIdx["assert:"]=4;
  56032. $9=(1)._yourself();
  56033. $ctx1.sendIdx["yourself"]=3;
  56034. $8=$recv($9).__eq_eq((1)._yourself());
  56035. $ctx1.sendIdx["=="]=6;
  56036. self._assert_($8);
  56037. self._deny_((1).__eq_eq((2)));
  56038. return self;
  56039. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  56040. },
  56041. args: [],
  56042. 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",
  56043. referencedClasses: [],
  56044. messageSends: ["assert:", "==", "deny:", "yourself"]
  56045. }),
  56046. $globals.NumberTest);
  56047. $core.addMethod(
  56048. $core.method({
  56049. selector: "testInvalidHexNumbers",
  56050. protocol: 'tests',
  56051. fn: function (){
  56052. var self=this;
  56053. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  56054. return $core.withContext(function($ctx1) {
  56055. self._should_raise_((function(){
  56056. return $core.withContext(function($ctx2) {
  56057. return (16)._rG();
  56058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56059. }),$MessageNotUnderstood());
  56060. $ctx1.sendIdx["should:raise:"]=1;
  56061. self._should_raise_((function(){
  56062. return $core.withContext(function($ctx2) {
  56063. return (16)._rg();
  56064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56065. }),$MessageNotUnderstood());
  56066. $ctx1.sendIdx["should:raise:"]=2;
  56067. self._should_raise_((function(){
  56068. return $core.withContext(function($ctx2) {
  56069. return (16)._rH();
  56070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  56071. }),$MessageNotUnderstood());
  56072. $ctx1.sendIdx["should:raise:"]=3;
  56073. self._should_raise_((function(){
  56074. return $core.withContext(function($ctx2) {
  56075. return (16)._rh();
  56076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  56077. }),$MessageNotUnderstood());
  56078. $ctx1.sendIdx["should:raise:"]=4;
  56079. self._should_raise_((function(){
  56080. return $core.withContext(function($ctx2) {
  56081. return (16)._rI();
  56082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  56083. }),$MessageNotUnderstood());
  56084. $ctx1.sendIdx["should:raise:"]=5;
  56085. self._should_raise_((function(){
  56086. return $core.withContext(function($ctx2) {
  56087. return (16)._ri();
  56088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  56089. }),$MessageNotUnderstood());
  56090. $ctx1.sendIdx["should:raise:"]=6;
  56091. self._should_raise_((function(){
  56092. return $core.withContext(function($ctx2) {
  56093. return (16)._rJ();
  56094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  56095. }),$MessageNotUnderstood());
  56096. $ctx1.sendIdx["should:raise:"]=7;
  56097. self._should_raise_((function(){
  56098. return $core.withContext(function($ctx2) {
  56099. return (16)._rj();
  56100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  56101. }),$MessageNotUnderstood());
  56102. $ctx1.sendIdx["should:raise:"]=8;
  56103. self._should_raise_((function(){
  56104. return $core.withContext(function($ctx2) {
  56105. return (16)._rK();
  56106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  56107. }),$MessageNotUnderstood());
  56108. $ctx1.sendIdx["should:raise:"]=9;
  56109. self._should_raise_((function(){
  56110. return $core.withContext(function($ctx2) {
  56111. return (16)._rk();
  56112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  56113. }),$MessageNotUnderstood());
  56114. $ctx1.sendIdx["should:raise:"]=10;
  56115. self._should_raise_((function(){
  56116. return $core.withContext(function($ctx2) {
  56117. return (16)._rL();
  56118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  56119. }),$MessageNotUnderstood());
  56120. $ctx1.sendIdx["should:raise:"]=11;
  56121. self._should_raise_((function(){
  56122. return $core.withContext(function($ctx2) {
  56123. return (16)._rl();
  56124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  56125. }),$MessageNotUnderstood());
  56126. $ctx1.sendIdx["should:raise:"]=12;
  56127. self._should_raise_((function(){
  56128. return $core.withContext(function($ctx2) {
  56129. return (16)._rM();
  56130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  56131. }),$MessageNotUnderstood());
  56132. $ctx1.sendIdx["should:raise:"]=13;
  56133. self._should_raise_((function(){
  56134. return $core.withContext(function($ctx2) {
  56135. return (16)._rm();
  56136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  56137. }),$MessageNotUnderstood());
  56138. $ctx1.sendIdx["should:raise:"]=14;
  56139. self._should_raise_((function(){
  56140. return $core.withContext(function($ctx2) {
  56141. return (16)._rN();
  56142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  56143. }),$MessageNotUnderstood());
  56144. $ctx1.sendIdx["should:raise:"]=15;
  56145. self._should_raise_((function(){
  56146. return $core.withContext(function($ctx2) {
  56147. return (16)._rn();
  56148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  56149. }),$MessageNotUnderstood());
  56150. $ctx1.sendIdx["should:raise:"]=16;
  56151. self._should_raise_((function(){
  56152. return $core.withContext(function($ctx2) {
  56153. return (16)._rO();
  56154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  56155. }),$MessageNotUnderstood());
  56156. $ctx1.sendIdx["should:raise:"]=17;
  56157. self._should_raise_((function(){
  56158. return $core.withContext(function($ctx2) {
  56159. return (16)._ro();
  56160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  56161. }),$MessageNotUnderstood());
  56162. $ctx1.sendIdx["should:raise:"]=18;
  56163. self._should_raise_((function(){
  56164. return $core.withContext(function($ctx2) {
  56165. return (16)._rP();
  56166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  56167. }),$MessageNotUnderstood());
  56168. $ctx1.sendIdx["should:raise:"]=19;
  56169. self._should_raise_((function(){
  56170. return $core.withContext(function($ctx2) {
  56171. return (16)._rp();
  56172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  56173. }),$MessageNotUnderstood());
  56174. $ctx1.sendIdx["should:raise:"]=20;
  56175. self._should_raise_((function(){
  56176. return $core.withContext(function($ctx2) {
  56177. return (16)._rQ();
  56178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  56179. }),$MessageNotUnderstood());
  56180. $ctx1.sendIdx["should:raise:"]=21;
  56181. self._should_raise_((function(){
  56182. return $core.withContext(function($ctx2) {
  56183. return (16)._rq();
  56184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  56185. }),$MessageNotUnderstood());
  56186. $ctx1.sendIdx["should:raise:"]=22;
  56187. self._should_raise_((function(){
  56188. return $core.withContext(function($ctx2) {
  56189. return (16)._rR();
  56190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  56191. }),$MessageNotUnderstood());
  56192. $ctx1.sendIdx["should:raise:"]=23;
  56193. self._should_raise_((function(){
  56194. return $core.withContext(function($ctx2) {
  56195. return (16)._rr();
  56196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  56197. }),$MessageNotUnderstood());
  56198. $ctx1.sendIdx["should:raise:"]=24;
  56199. self._should_raise_((function(){
  56200. return $core.withContext(function($ctx2) {
  56201. return (16)._rS();
  56202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  56203. }),$MessageNotUnderstood());
  56204. $ctx1.sendIdx["should:raise:"]=25;
  56205. self._should_raise_((function(){
  56206. return $core.withContext(function($ctx2) {
  56207. return (16)._rs();
  56208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  56209. }),$MessageNotUnderstood());
  56210. $ctx1.sendIdx["should:raise:"]=26;
  56211. self._should_raise_((function(){
  56212. return $core.withContext(function($ctx2) {
  56213. return (16)._rT();
  56214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  56215. }),$MessageNotUnderstood());
  56216. $ctx1.sendIdx["should:raise:"]=27;
  56217. self._should_raise_((function(){
  56218. return $core.withContext(function($ctx2) {
  56219. return (16)._rt();
  56220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  56221. }),$MessageNotUnderstood());
  56222. $ctx1.sendIdx["should:raise:"]=28;
  56223. self._should_raise_((function(){
  56224. return $core.withContext(function($ctx2) {
  56225. return (16)._rU();
  56226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  56227. }),$MessageNotUnderstood());
  56228. $ctx1.sendIdx["should:raise:"]=29;
  56229. self._should_raise_((function(){
  56230. return $core.withContext(function($ctx2) {
  56231. return (16)._ru();
  56232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  56233. }),$MessageNotUnderstood());
  56234. $ctx1.sendIdx["should:raise:"]=30;
  56235. self._should_raise_((function(){
  56236. return $core.withContext(function($ctx2) {
  56237. return (16)._rV();
  56238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  56239. }),$MessageNotUnderstood());
  56240. $ctx1.sendIdx["should:raise:"]=31;
  56241. self._should_raise_((function(){
  56242. return $core.withContext(function($ctx2) {
  56243. return (16)._rv();
  56244. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  56245. }),$MessageNotUnderstood());
  56246. $ctx1.sendIdx["should:raise:"]=32;
  56247. self._should_raise_((function(){
  56248. return $core.withContext(function($ctx2) {
  56249. return (16)._rW();
  56250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  56251. }),$MessageNotUnderstood());
  56252. $ctx1.sendIdx["should:raise:"]=33;
  56253. self._should_raise_((function(){
  56254. return $core.withContext(function($ctx2) {
  56255. return (16)._rw();
  56256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  56257. }),$MessageNotUnderstood());
  56258. $ctx1.sendIdx["should:raise:"]=34;
  56259. self._should_raise_((function(){
  56260. return $core.withContext(function($ctx2) {
  56261. return (16)._rX();
  56262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  56263. }),$MessageNotUnderstood());
  56264. $ctx1.sendIdx["should:raise:"]=35;
  56265. self._should_raise_((function(){
  56266. return $core.withContext(function($ctx2) {
  56267. return (16)._rx();
  56268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  56269. }),$MessageNotUnderstood());
  56270. $ctx1.sendIdx["should:raise:"]=36;
  56271. self._should_raise_((function(){
  56272. return $core.withContext(function($ctx2) {
  56273. return (16)._rY();
  56274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  56275. }),$MessageNotUnderstood());
  56276. $ctx1.sendIdx["should:raise:"]=37;
  56277. self._should_raise_((function(){
  56278. return $core.withContext(function($ctx2) {
  56279. return (16)._ry();
  56280. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  56281. }),$MessageNotUnderstood());
  56282. $ctx1.sendIdx["should:raise:"]=38;
  56283. self._should_raise_((function(){
  56284. return $core.withContext(function($ctx2) {
  56285. return (16)._rZ();
  56286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  56287. }),$MessageNotUnderstood());
  56288. $ctx1.sendIdx["should:raise:"]=39;
  56289. self._should_raise_((function(){
  56290. return $core.withContext(function($ctx2) {
  56291. return (16)._rz();
  56292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  56293. }),$MessageNotUnderstood());
  56294. $ctx1.sendIdx["should:raise:"]=40;
  56295. self._should_raise_((function(){
  56296. return $core.withContext(function($ctx2) {
  56297. return (11259375)._Z();
  56298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  56299. }),$MessageNotUnderstood());
  56300. return self;
  56301. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  56302. },
  56303. args: [],
  56304. 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.",
  56305. referencedClasses: ["MessageNotUnderstood"],
  56306. 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"]
  56307. }),
  56308. $globals.NumberTest);
  56309. $core.addMethod(
  56310. $core.method({
  56311. selector: "testLog",
  56312. protocol: 'tests',
  56313. fn: function (){
  56314. var self=this;
  56315. function $Number(){return $globals.Number||(typeof Number=="undefined"?nil:Number)}
  56316. return $core.withContext(function($ctx1) {
  56317. self._assert_equals_((10000)._log(),(4));
  56318. $ctx1.sendIdx["assert:equals:"]=1;
  56319. self._assert_equals_((512)._log_((2)),(9));
  56320. $ctx1.sendIdx["assert:equals:"]=2;
  56321. self._assert_equals_($recv($recv($Number())._e())._ln(),(1));
  56322. return self;
  56323. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  56324. },
  56325. args: [],
  56326. 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.",
  56327. referencedClasses: ["Number"],
  56328. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  56329. }),
  56330. $globals.NumberTest);
  56331. $core.addMethod(
  56332. $core.method({
  56333. selector: "testMinMax",
  56334. protocol: 'tests',
  56335. fn: function (){
  56336. var self=this;
  56337. return $core.withContext(function($ctx1) {
  56338. self._assert_equals_((2)._max_((5)),(5));
  56339. $ctx1.sendIdx["assert:equals:"]=1;
  56340. self._assert_equals_((2)._min_((5)),(2));
  56341. return self;
  56342. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  56343. },
  56344. args: [],
  56345. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  56346. referencedClasses: [],
  56347. messageSends: ["assert:equals:", "max:", "min:"]
  56348. }),
  56349. $globals.NumberTest);
  56350. $core.addMethod(
  56351. $core.method({
  56352. selector: "testNegated",
  56353. protocol: 'tests',
  56354. fn: function (){
  56355. var self=this;
  56356. return $core.withContext(function($ctx1) {
  56357. var $1;
  56358. $1=(3)._negated();
  56359. $ctx1.sendIdx["negated"]=1;
  56360. self._assert_equals_($1,(-3));
  56361. $ctx1.sendIdx["assert:equals:"]=1;
  56362. self._assert_equals_((-3)._negated(),(3));
  56363. return self;
  56364. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  56365. },
  56366. args: [],
  56367. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  56368. referencedClasses: [],
  56369. messageSends: ["assert:equals:", "negated"]
  56370. }),
  56371. $globals.NumberTest);
  56372. $core.addMethod(
  56373. $core.method({
  56374. selector: "testPrintShowingDecimalPlaces",
  56375. protocol: 'tests',
  56376. fn: function (){
  56377. var self=this;
  56378. return $core.withContext(function($ctx1) {
  56379. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  56380. $1=(23)._printShowingDecimalPlaces_((2));
  56381. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  56382. self._assert_equals_($1,"23.00");
  56383. $ctx1.sendIdx["assert:equals:"]=1;
  56384. $2=(23.5698)._printShowingDecimalPlaces_((2));
  56385. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  56386. self._assert_equals_($2,"23.57");
  56387. $ctx1.sendIdx["assert:equals:"]=2;
  56388. $4=(234.567)._negated();
  56389. $ctx1.sendIdx["negated"]=1;
  56390. $3=$recv($4)._printShowingDecimalPlaces_((5));
  56391. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  56392. self._assert_equals_($3,"-234.56700");
  56393. $ctx1.sendIdx["assert:equals:"]=3;
  56394. $5=(23.4567)._printShowingDecimalPlaces_((0));
  56395. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  56396. self._assert_equals_($5,"23");
  56397. $ctx1.sendIdx["assert:equals:"]=4;
  56398. $6=(23.5567)._printShowingDecimalPlaces_((0));
  56399. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  56400. self._assert_equals_($6,"24");
  56401. $ctx1.sendIdx["assert:equals:"]=5;
  56402. $8=(23.4567)._negated();
  56403. $ctx1.sendIdx["negated"]=2;
  56404. $7=$recv($8)._printShowingDecimalPlaces_((0));
  56405. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  56406. self._assert_equals_($7,"-23");
  56407. $ctx1.sendIdx["assert:equals:"]=6;
  56408. $10=(23.5567)._negated();
  56409. $ctx1.sendIdx["negated"]=3;
  56410. $9=$recv($10)._printShowingDecimalPlaces_((0));
  56411. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  56412. self._assert_equals_($9,"-24");
  56413. $ctx1.sendIdx["assert:equals:"]=7;
  56414. $11=(100000000)._printShowingDecimalPlaces_((1));
  56415. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  56416. self._assert_equals_($11,"100000000.0");
  56417. $ctx1.sendIdx["assert:equals:"]=8;
  56418. $12=(0.98)._printShowingDecimalPlaces_((5));
  56419. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  56420. self._assert_equals_($12,"0.98000");
  56421. $ctx1.sendIdx["assert:equals:"]=9;
  56422. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  56423. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  56424. self._assert_equals_($13,"-0.98");
  56425. $ctx1.sendIdx["assert:equals:"]=10;
  56426. $14=(2.567)._printShowingDecimalPlaces_((2));
  56427. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  56428. self._assert_equals_($14,"2.57");
  56429. $ctx1.sendIdx["assert:equals:"]=11;
  56430. $15=(-2.567)._printShowingDecimalPlaces_((2));
  56431. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  56432. self._assert_equals_($15,"-2.57");
  56433. $ctx1.sendIdx["assert:equals:"]=12;
  56434. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  56435. return self;
  56436. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  56437. },
  56438. args: [],
  56439. 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'.",
  56440. referencedClasses: [],
  56441. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  56442. }),
  56443. $globals.NumberTest);
  56444. $core.addMethod(
  56445. $core.method({
  56446. selector: "testRaisedTo",
  56447. protocol: 'tests',
  56448. fn: function (){
  56449. var self=this;
  56450. return $core.withContext(function($ctx1) {
  56451. var $1,$2,$3;
  56452. $1=(2)._raisedTo_((4));
  56453. $ctx1.sendIdx["raisedTo:"]=1;
  56454. self._assert_equals_($1,(16));
  56455. $ctx1.sendIdx["assert:equals:"]=1;
  56456. $2=(2)._raisedTo_((0));
  56457. $ctx1.sendIdx["raisedTo:"]=2;
  56458. self._assert_equals_($2,(1));
  56459. $ctx1.sendIdx["assert:equals:"]=2;
  56460. $3=(2)._raisedTo_((-3));
  56461. $ctx1.sendIdx["raisedTo:"]=3;
  56462. self._assert_equals_($3,(0.125));
  56463. $ctx1.sendIdx["assert:equals:"]=3;
  56464. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  56465. $ctx1.sendIdx["assert:equals:"]=4;
  56466. self._assert_equals_((2).__star_star((4)),(16));
  56467. return self;
  56468. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  56469. },
  56470. args: [],
  56471. 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.",
  56472. referencedClasses: [],
  56473. messageSends: ["assert:equals:", "raisedTo:", "**"]
  56474. }),
  56475. $globals.NumberTest);
  56476. $core.addMethod(
  56477. $core.method({
  56478. selector: "testRounded",
  56479. protocol: 'tests',
  56480. fn: function (){
  56481. var self=this;
  56482. return $core.withContext(function($ctx1) {
  56483. var $1,$2;
  56484. $1=(3)._rounded();
  56485. $ctx1.sendIdx["rounded"]=1;
  56486. self._assert_equals_($1,(3));
  56487. $ctx1.sendIdx["assert:equals:"]=1;
  56488. $2=(3.212)._rounded();
  56489. $ctx1.sendIdx["rounded"]=2;
  56490. self._assert_equals_($2,(3));
  56491. $ctx1.sendIdx["assert:equals:"]=2;
  56492. self._assert_equals_((3.51)._rounded(),(4));
  56493. return self;
  56494. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  56495. },
  56496. args: [],
  56497. 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",
  56498. referencedClasses: [],
  56499. messageSends: ["assert:equals:", "rounded"]
  56500. }),
  56501. $globals.NumberTest);
  56502. $core.addMethod(
  56503. $core.method({
  56504. selector: "testSign",
  56505. protocol: 'tests',
  56506. fn: function (){
  56507. var self=this;
  56508. return $core.withContext(function($ctx1) {
  56509. var $1,$2;
  56510. $1=(5)._sign();
  56511. $ctx1.sendIdx["sign"]=1;
  56512. self._assert_equals_($1,(1));
  56513. $ctx1.sendIdx["assert:equals:"]=1;
  56514. $2=(0)._sign();
  56515. $ctx1.sendIdx["sign"]=2;
  56516. self._assert_equals_($2,(0));
  56517. $ctx1.sendIdx["assert:equals:"]=2;
  56518. self._assert_equals_((-1.4)._sign(),(-1));
  56519. return self;
  56520. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  56521. },
  56522. args: [],
  56523. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  56524. referencedClasses: [],
  56525. messageSends: ["assert:equals:", "sign"]
  56526. }),
  56527. $globals.NumberTest);
  56528. $core.addMethod(
  56529. $core.method({
  56530. selector: "testSqrt",
  56531. protocol: 'tests',
  56532. fn: function (){
  56533. var self=this;
  56534. return $core.withContext(function($ctx1) {
  56535. var $1;
  56536. $1=(4)._sqrt();
  56537. $ctx1.sendIdx["sqrt"]=1;
  56538. self._assert_equals_($1,(2));
  56539. $ctx1.sendIdx["assert:equals:"]=1;
  56540. self._assert_equals_((16)._sqrt(),(4));
  56541. return self;
  56542. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  56543. },
  56544. args: [],
  56545. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  56546. referencedClasses: [],
  56547. messageSends: ["assert:equals:", "sqrt"]
  56548. }),
  56549. $globals.NumberTest);
  56550. $core.addMethod(
  56551. $core.method({
  56552. selector: "testSquared",
  56553. protocol: 'tests',
  56554. fn: function (){
  56555. var self=this;
  56556. return $core.withContext(function($ctx1) {
  56557. self._assert_equals_((4)._squared(),(16));
  56558. return self;
  56559. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  56560. },
  56561. args: [],
  56562. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  56563. referencedClasses: [],
  56564. messageSends: ["assert:equals:", "squared"]
  56565. }),
  56566. $globals.NumberTest);
  56567. $core.addMethod(
  56568. $core.method({
  56569. selector: "testTimesRepeat",
  56570. protocol: 'tests',
  56571. fn: function (){
  56572. var self=this;
  56573. var i;
  56574. return $core.withContext(function($ctx1) {
  56575. i=(0);
  56576. (0)._timesRepeat_((function(){
  56577. return $core.withContext(function($ctx2) {
  56578. i=$recv(i).__plus((1));
  56579. $ctx2.sendIdx["+"]=1;
  56580. return i;
  56581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56582. }));
  56583. $ctx1.sendIdx["timesRepeat:"]=1;
  56584. self._assert_equals_(i,(0));
  56585. $ctx1.sendIdx["assert:equals:"]=1;
  56586. (5)._timesRepeat_((function(){
  56587. return $core.withContext(function($ctx2) {
  56588. i=$recv(i).__plus((1));
  56589. return i;
  56590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56591. }));
  56592. self._assert_equals_(i,(5));
  56593. return self;
  56594. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  56595. },
  56596. args: [],
  56597. 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",
  56598. referencedClasses: [],
  56599. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  56600. }),
  56601. $globals.NumberTest);
  56602. $core.addMethod(
  56603. $core.method({
  56604. selector: "testTo",
  56605. protocol: 'tests',
  56606. fn: function (){
  56607. var self=this;
  56608. return $core.withContext(function($ctx1) {
  56609. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  56610. return self;
  56611. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  56612. },
  56613. args: [],
  56614. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  56615. referencedClasses: [],
  56616. messageSends: ["assert:equals:", "to:"]
  56617. }),
  56618. $globals.NumberTest);
  56619. $core.addMethod(
  56620. $core.method({
  56621. selector: "testToBy",
  56622. protocol: 'tests',
  56623. fn: function (){
  56624. var self=this;
  56625. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56626. return $core.withContext(function($ctx1) {
  56627. var $1;
  56628. $1=(0)._to_by_((6),(2));
  56629. $ctx1.sendIdx["to:by:"]=1;
  56630. self._assert_equals_($1,[(0), (2), (4), (6)]);
  56631. self._should_raise_((function(){
  56632. return $core.withContext(function($ctx2) {
  56633. return (1)._to_by_((4),(0));
  56634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56635. }),$Error());
  56636. return self;
  56637. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  56638. },
  56639. args: [],
  56640. 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",
  56641. referencedClasses: ["Error"],
  56642. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  56643. }),
  56644. $globals.NumberTest);
  56645. $core.addMethod(
  56646. $core.method({
  56647. selector: "testTrigonometry",
  56648. protocol: 'tests',
  56649. fn: function (){
  56650. var self=this;
  56651. return $core.withContext(function($ctx1) {
  56652. self._assert_equals_((0)._cos(),(1));
  56653. $ctx1.sendIdx["assert:equals:"]=1;
  56654. self._assert_equals_((0)._sin(),(0));
  56655. $ctx1.sendIdx["assert:equals:"]=2;
  56656. self._assert_equals_((0)._tan(),(0));
  56657. $ctx1.sendIdx["assert:equals:"]=3;
  56658. self._assert_equals_((1)._arcCos(),(0));
  56659. $ctx1.sendIdx["assert:equals:"]=4;
  56660. self._assert_equals_((0)._arcSin(),(0));
  56661. $ctx1.sendIdx["assert:equals:"]=5;
  56662. self._assert_equals_((0)._arcTan(),(0));
  56663. return self;
  56664. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  56665. },
  56666. args: [],
  56667. 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.",
  56668. referencedClasses: [],
  56669. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  56670. }),
  56671. $globals.NumberTest);
  56672. $core.addMethod(
  56673. $core.method({
  56674. selector: "testTruncated",
  56675. protocol: 'tests',
  56676. fn: function (){
  56677. var self=this;
  56678. return $core.withContext(function($ctx1) {
  56679. var $1,$2;
  56680. $1=(3)._truncated();
  56681. $ctx1.sendIdx["truncated"]=1;
  56682. self._assert_equals_($1,(3));
  56683. $ctx1.sendIdx["assert:equals:"]=1;
  56684. $2=(3.212)._truncated();
  56685. $ctx1.sendIdx["truncated"]=2;
  56686. self._assert_equals_($2,(3));
  56687. $ctx1.sendIdx["assert:equals:"]=2;
  56688. self._assert_equals_((3.51)._truncated(),(3));
  56689. return self;
  56690. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  56691. },
  56692. args: [],
  56693. 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",
  56694. referencedClasses: [],
  56695. messageSends: ["assert:equals:", "truncated"]
  56696. }),
  56697. $globals.NumberTest);
  56698. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  56699. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  56700. $core.addMethod(
  56701. $core.method({
  56702. selector: "foo",
  56703. protocol: 'not yet classified',
  56704. fn: function (){
  56705. var self=this;
  56706. var $1;
  56707. $1=self["@foo"];
  56708. return $1;
  56709. },
  56710. args: [],
  56711. source: "foo\x0a\x09^ foo",
  56712. referencedClasses: [],
  56713. messageSends: []
  56714. }),
  56715. $globals.ObjectMock);
  56716. $core.addMethod(
  56717. $core.method({
  56718. selector: "foo:",
  56719. protocol: 'not yet classified',
  56720. fn: function (anObject){
  56721. var self=this;
  56722. self["@foo"]=anObject;
  56723. return self;
  56724. },
  56725. args: ["anObject"],
  56726. source: "foo: anObject\x0a\x09foo := anObject",
  56727. referencedClasses: [],
  56728. messageSends: []
  56729. }),
  56730. $globals.ObjectMock);
  56731. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  56732. $core.addMethod(
  56733. $core.method({
  56734. selector: "notDefined",
  56735. protocol: 'tests',
  56736. fn: function (){
  56737. var self=this;
  56738. return $core.withContext(function($ctx1) {
  56739. return void 0;;
  56740. return self;
  56741. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  56742. },
  56743. args: [],
  56744. source: "notDefined\x0a\x09<return void 0;>",
  56745. referencedClasses: [],
  56746. messageSends: []
  56747. }),
  56748. $globals.ObjectTest);
  56749. $core.addMethod(
  56750. $core.method({
  56751. selector: "testBasicAccess",
  56752. protocol: 'tests',
  56753. fn: function (){
  56754. var self=this;
  56755. var o;
  56756. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56757. return $core.withContext(function($ctx1) {
  56758. var $1;
  56759. o=$recv($Object())._new();
  56760. $recv(o)._basicAt_put_("a",(1));
  56761. $1=$recv(o)._basicAt_("a");
  56762. $ctx1.sendIdx["basicAt:"]=1;
  56763. self._assert_equals_($1,(1));
  56764. $ctx1.sendIdx["assert:equals:"]=1;
  56765. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  56766. return self;
  56767. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  56768. },
  56769. args: [],
  56770. 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",
  56771. referencedClasses: ["Object"],
  56772. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  56773. }),
  56774. $globals.ObjectTest);
  56775. $core.addMethod(
  56776. $core.method({
  56777. selector: "testBasicPerform",
  56778. protocol: 'tests',
  56779. fn: function (){
  56780. var self=this;
  56781. var o;
  56782. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56783. return $core.withContext(function($ctx1) {
  56784. o=$recv($Object())._new();
  56785. $recv(o)._basicAt_put_("func",(function(){
  56786. return "hello";
  56787. }));
  56788. $ctx1.sendIdx["basicAt:put:"]=1;
  56789. $recv(o)._basicAt_put_("func2",(function(a){
  56790. return $core.withContext(function($ctx2) {
  56791. return $recv(a).__plus((1));
  56792. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  56793. }));
  56794. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  56795. $ctx1.sendIdx["assert:equals:"]=1;
  56796. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  56797. return self;
  56798. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  56799. },
  56800. args: [],
  56801. 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",
  56802. referencedClasses: ["Object"],
  56803. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  56804. }),
  56805. $globals.ObjectTest);
  56806. $core.addMethod(
  56807. $core.method({
  56808. selector: "testDNU",
  56809. protocol: 'tests',
  56810. fn: function (){
  56811. var self=this;
  56812. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56813. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  56814. return $core.withContext(function($ctx1) {
  56815. self._should_raise_((function(){
  56816. return $core.withContext(function($ctx2) {
  56817. return $recv($recv($Object())._new())._foo();
  56818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56819. }),$MessageNotUnderstood());
  56820. return self;
  56821. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  56822. },
  56823. args: [],
  56824. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  56825. referencedClasses: ["Object", "MessageNotUnderstood"],
  56826. messageSends: ["should:raise:", "foo", "new"]
  56827. }),
  56828. $globals.ObjectTest);
  56829. $core.addMethod(
  56830. $core.method({
  56831. selector: "testEquality",
  56832. protocol: 'tests',
  56833. fn: function (){
  56834. var self=this;
  56835. var o;
  56836. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56837. return $core.withContext(function($ctx1) {
  56838. var $1,$2,$4,$3;
  56839. o=$recv($Object())._new();
  56840. $ctx1.sendIdx["new"]=1;
  56841. $1=$recv(o).__eq($recv($Object())._new());
  56842. $ctx1.sendIdx["="]=1;
  56843. self._deny_($1);
  56844. $2=$recv(o).__eq(o);
  56845. $ctx1.sendIdx["="]=2;
  56846. self._assert_($2);
  56847. $ctx1.sendIdx["assert:"]=1;
  56848. $4=$recv(o)._yourself();
  56849. $ctx1.sendIdx["yourself"]=1;
  56850. $3=$recv($4).__eq(o);
  56851. $ctx1.sendIdx["="]=3;
  56852. self._assert_($3);
  56853. $ctx1.sendIdx["assert:"]=2;
  56854. self._assert_($recv(o).__eq($recv(o)._yourself()));
  56855. return self;
  56856. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  56857. },
  56858. args: [],
  56859. 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)",
  56860. referencedClasses: ["Object"],
  56861. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  56862. }),
  56863. $globals.ObjectTest);
  56864. $core.addMethod(
  56865. $core.method({
  56866. selector: "testHalt",
  56867. protocol: 'tests',
  56868. fn: function (){
  56869. var self=this;
  56870. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56871. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56872. return $core.withContext(function($ctx1) {
  56873. self._should_raise_((function(){
  56874. return $core.withContext(function($ctx2) {
  56875. return $recv($recv($Object())._new())._halt();
  56876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56877. }),$Error());
  56878. return self;
  56879. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  56880. },
  56881. args: [],
  56882. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  56883. referencedClasses: ["Object", "Error"],
  56884. messageSends: ["should:raise:", "halt", "new"]
  56885. }),
  56886. $globals.ObjectTest);
  56887. $core.addMethod(
  56888. $core.method({
  56889. selector: "testIdentity",
  56890. protocol: 'tests',
  56891. fn: function (){
  56892. var self=this;
  56893. var o;
  56894. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56895. return $core.withContext(function($ctx1) {
  56896. var $1,$2,$4,$3;
  56897. o=$recv($Object())._new();
  56898. $ctx1.sendIdx["new"]=1;
  56899. $1=$recv(o).__eq_eq($recv($Object())._new());
  56900. $ctx1.sendIdx["=="]=1;
  56901. self._deny_($1);
  56902. $2=$recv(o).__eq_eq(o);
  56903. $ctx1.sendIdx["=="]=2;
  56904. self._assert_($2);
  56905. $ctx1.sendIdx["assert:"]=1;
  56906. $4=$recv(o)._yourself();
  56907. $ctx1.sendIdx["yourself"]=1;
  56908. $3=$recv($4).__eq_eq(o);
  56909. $ctx1.sendIdx["=="]=3;
  56910. self._assert_($3);
  56911. $ctx1.sendIdx["assert:"]=2;
  56912. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  56913. return self;
  56914. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  56915. },
  56916. args: [],
  56917. 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",
  56918. referencedClasses: ["Object"],
  56919. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  56920. }),
  56921. $globals.ObjectTest);
  56922. $core.addMethod(
  56923. $core.method({
  56924. selector: "testIfNil",
  56925. protocol: 'tests',
  56926. fn: function (){
  56927. var self=this;
  56928. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56929. return $core.withContext(function($ctx1) {
  56930. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  56931. $2=$recv($Object())._new();
  56932. $ctx1.sendIdx["new"]=1;
  56933. $1=$recv($2)._isNil();
  56934. self._deny_($1);
  56935. $ctx1.sendIdx["deny:"]=1;
  56936. $5=$recv($Object())._new();
  56937. $ctx1.sendIdx["new"]=2;
  56938. if(($receiver = $5) == null || $receiver.isNil){
  56939. $4=true;
  56940. } else {
  56941. $4=$5;
  56942. };
  56943. $3=$recv($4).__eq(true);
  56944. self._deny_($3);
  56945. $7=$recv($Object())._new();
  56946. $ctx1.sendIdx["new"]=3;
  56947. if(($receiver = $7) == null || $receiver.isNil){
  56948. $6=$7;
  56949. } else {
  56950. $6=true;
  56951. };
  56952. self._assert_equals_($6,true);
  56953. $ctx1.sendIdx["assert:equals:"]=1;
  56954. $9=$recv($Object())._new();
  56955. $ctx1.sendIdx["new"]=4;
  56956. if(($receiver = $9) == null || $receiver.isNil){
  56957. $8=false;
  56958. } else {
  56959. $8=true;
  56960. };
  56961. self._assert_equals_($8,true);
  56962. $ctx1.sendIdx["assert:equals:"]=2;
  56963. $11=$recv($Object())._new();
  56964. if(($receiver = $11) == null || $receiver.isNil){
  56965. $10=false;
  56966. } else {
  56967. $10=true;
  56968. };
  56969. self._assert_equals_($10,true);
  56970. return self;
  56971. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  56972. },
  56973. args: [],
  56974. 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",
  56975. referencedClasses: ["Object"],
  56976. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  56977. }),
  56978. $globals.ObjectTest);
  56979. $core.addMethod(
  56980. $core.method({
  56981. selector: "testInstVars",
  56982. protocol: 'tests',
  56983. fn: function (){
  56984. var self=this;
  56985. var o;
  56986. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  56987. return $core.withContext(function($ctx1) {
  56988. var $1,$2;
  56989. o=$recv($ObjectMock())._new();
  56990. $1=$recv(o)._instVarAt_("foo");
  56991. $ctx1.sendIdx["instVarAt:"]=1;
  56992. self._assert_equals_($1,nil);
  56993. $ctx1.sendIdx["assert:equals:"]=1;
  56994. $recv(o)._instVarAt_put_("foo",(1));
  56995. $2=$recv(o)._instVarAt_("foo");
  56996. $ctx1.sendIdx["instVarAt:"]=2;
  56997. self._assert_equals_($2,(1));
  56998. $ctx1.sendIdx["assert:equals:"]=2;
  56999. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  57000. return self;
  57001. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  57002. },
  57003. args: [],
  57004. 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",
  57005. referencedClasses: ["ObjectMock"],
  57006. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  57007. }),
  57008. $globals.ObjectTest);
  57009. $core.addMethod(
  57010. $core.method({
  57011. selector: "testNilUndefined",
  57012. protocol: 'tests',
  57013. fn: function (){
  57014. var self=this;
  57015. return $core.withContext(function($ctx1) {
  57016. self._assert_equals_(self._notDefined(),nil);
  57017. return self;
  57018. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  57019. },
  57020. args: [],
  57021. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  57022. referencedClasses: [],
  57023. messageSends: ["assert:equals:", "notDefined"]
  57024. }),
  57025. $globals.ObjectTest);
  57026. $core.addMethod(
  57027. $core.method({
  57028. selector: "testYourself",
  57029. protocol: 'tests',
  57030. fn: function (){
  57031. var self=this;
  57032. var o;
  57033. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  57034. return $core.withContext(function($ctx1) {
  57035. o=$recv($ObjectMock())._new();
  57036. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  57037. return self;
  57038. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  57039. },
  57040. args: [],
  57041. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  57042. referencedClasses: ["ObjectMock"],
  57043. messageSends: ["new", "assert:", "==", "yourself"]
  57044. }),
  57045. $globals.ObjectTest);
  57046. $core.addMethod(
  57047. $core.method({
  57048. selector: "testidentityHash",
  57049. protocol: 'tests',
  57050. fn: function (){
  57051. var self=this;
  57052. var o1,o2;
  57053. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  57054. return $core.withContext(function($ctx1) {
  57055. var $2,$3,$1,$5,$4;
  57056. o1=$recv($Object())._new();
  57057. $ctx1.sendIdx["new"]=1;
  57058. o2=$recv($Object())._new();
  57059. $2=$recv(o1)._identityHash();
  57060. $ctx1.sendIdx["identityHash"]=1;
  57061. $3=$recv(o1)._identityHash();
  57062. $ctx1.sendIdx["identityHash"]=2;
  57063. $1=$recv($2).__eq_eq($3);
  57064. $ctx1.sendIdx["=="]=1;
  57065. self._assert_($1);
  57066. $5=$recv(o1)._identityHash();
  57067. $ctx1.sendIdx["identityHash"]=3;
  57068. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  57069. self._deny_($4);
  57070. return self;
  57071. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  57072. },
  57073. args: [],
  57074. 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",
  57075. referencedClasses: ["Object"],
  57076. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  57077. }),
  57078. $globals.ObjectTest);
  57079. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  57080. $core.addMethod(
  57081. $core.method({
  57082. selector: "testAccessing",
  57083. protocol: 'tests',
  57084. fn: function (){
  57085. var self=this;
  57086. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57087. return $core.withContext(function($ctx1) {
  57088. var $2,$1,$3,$6,$5,$4;
  57089. $2=$recv($Point())._x_y_((3),(4));
  57090. $ctx1.sendIdx["x:y:"]=1;
  57091. $1=$recv($2)._x();
  57092. $ctx1.sendIdx["x"]=1;
  57093. self._assert_equals_($1,(3));
  57094. $ctx1.sendIdx["assert:equals:"]=1;
  57095. $3=$recv($recv($Point())._x_y_((3),(4)))._y();
  57096. $ctx1.sendIdx["y"]=1;
  57097. self._assert_equals_($3,(4));
  57098. $ctx1.sendIdx["assert:equals:"]=2;
  57099. $6=$recv($Point())._new();
  57100. $ctx1.sendIdx["new"]=1;
  57101. $5=$recv($6)._x_((3));
  57102. $4=$recv($5)._x();
  57103. self._assert_equals_($4,(3));
  57104. $ctx1.sendIdx["assert:equals:"]=3;
  57105. self._assert_equals_($recv($recv($recv($Point())._new())._y_((4)))._y(),(4));
  57106. return self;
  57107. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  57108. },
  57109. args: [],
  57110. 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",
  57111. referencedClasses: ["Point"],
  57112. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  57113. }),
  57114. $globals.PointTest);
  57115. $core.addMethod(
  57116. $core.method({
  57117. selector: "testArithmetic",
  57118. protocol: 'tests',
  57119. fn: function (){
  57120. var self=this;
  57121. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57122. return $core.withContext(function($ctx1) {
  57123. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  57124. $2=(3).__at((4));
  57125. $ctx1.sendIdx["@"]=1;
  57126. $3=(3).__at((4));
  57127. $ctx1.sendIdx["@"]=2;
  57128. $1=$recv($2).__star($3);
  57129. $4=$recv($Point())._x_y_((9),(16));
  57130. $ctx1.sendIdx["x:y:"]=1;
  57131. self._assert_equals_($1,$4);
  57132. $ctx1.sendIdx["assert:equals:"]=1;
  57133. $6=(3).__at((4));
  57134. $ctx1.sendIdx["@"]=3;
  57135. $7=(3).__at((4));
  57136. $ctx1.sendIdx["@"]=4;
  57137. $5=$recv($6).__plus($7);
  57138. $8=$recv($Point())._x_y_((6),(8));
  57139. $ctx1.sendIdx["x:y:"]=2;
  57140. self._assert_equals_($5,$8);
  57141. $ctx1.sendIdx["assert:equals:"]=2;
  57142. $10=(3).__at((4));
  57143. $ctx1.sendIdx["@"]=5;
  57144. $11=(3).__at((4));
  57145. $ctx1.sendIdx["@"]=6;
  57146. $9=$recv($10).__minus($11);
  57147. $12=$recv($Point())._x_y_((0),(0));
  57148. $ctx1.sendIdx["x:y:"]=3;
  57149. self._assert_equals_($9,$12);
  57150. $ctx1.sendIdx["assert:equals:"]=3;
  57151. $14=(6).__at((8));
  57152. $ctx1.sendIdx["@"]=7;
  57153. $13=$recv($14).__slash((3).__at((4)));
  57154. self._assert_equals_($13,$recv($Point())._x_y_((2),(2)));
  57155. return self;
  57156. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  57157. },
  57158. args: [],
  57159. 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)",
  57160. referencedClasses: ["Point"],
  57161. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  57162. }),
  57163. $globals.PointTest);
  57164. $core.addMethod(
  57165. $core.method({
  57166. selector: "testAt",
  57167. protocol: 'tests',
  57168. fn: function (){
  57169. var self=this;
  57170. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57171. return $core.withContext(function($ctx1) {
  57172. self._assert_equals_((3).__at((4)),$recv($Point())._x_y_((3),(4)));
  57173. return self;
  57174. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  57175. },
  57176. args: [],
  57177. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  57178. referencedClasses: ["Point"],
  57179. messageSends: ["assert:equals:", "@", "x:y:"]
  57180. }),
  57181. $globals.PointTest);
  57182. $core.addMethod(
  57183. $core.method({
  57184. selector: "testComparison",
  57185. protocol: 'tests',
  57186. fn: function (){
  57187. var self=this;
  57188. return $core.withContext(function($ctx1) {
  57189. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  57190. $2=(3).__at((4));
  57191. $ctx1.sendIdx["@"]=1;
  57192. $3=(4).__at((5));
  57193. $ctx1.sendIdx["@"]=2;
  57194. $1=$recv($2).__lt($3);
  57195. $ctx1.sendIdx["<"]=1;
  57196. self._assert_($1);
  57197. $ctx1.sendIdx["assert:"]=1;
  57198. $5=(3).__at((4));
  57199. $ctx1.sendIdx["@"]=3;
  57200. $6=(4).__at((4));
  57201. $ctx1.sendIdx["@"]=4;
  57202. $4=$recv($5).__lt($6);
  57203. self._deny_($4);
  57204. $ctx1.sendIdx["deny:"]=1;
  57205. $8=(4).__at((5));
  57206. $ctx1.sendIdx["@"]=5;
  57207. $9=(4).__at((5));
  57208. $ctx1.sendIdx["@"]=6;
  57209. $7=$recv($8).__lt_eq($9);
  57210. $ctx1.sendIdx["<="]=1;
  57211. self._assert_($7);
  57212. $ctx1.sendIdx["assert:"]=2;
  57213. $11=(4).__at((5));
  57214. $ctx1.sendIdx["@"]=7;
  57215. $12=(3).__at((5));
  57216. $ctx1.sendIdx["@"]=8;
  57217. $10=$recv($11).__lt_eq($12);
  57218. self._deny_($10);
  57219. $ctx1.sendIdx["deny:"]=2;
  57220. $14=(5).__at((6));
  57221. $ctx1.sendIdx["@"]=9;
  57222. $15=(4).__at((5));
  57223. $ctx1.sendIdx["@"]=10;
  57224. $13=$recv($14).__gt($15);
  57225. $ctx1.sendIdx[">"]=1;
  57226. self._assert_($13);
  57227. $ctx1.sendIdx["assert:"]=3;
  57228. $17=(5).__at((6));
  57229. $ctx1.sendIdx["@"]=11;
  57230. $18=(6).__at((6));
  57231. $ctx1.sendIdx["@"]=12;
  57232. $16=$recv($17).__gt($18);
  57233. self._deny_($16);
  57234. $ctx1.sendIdx["deny:"]=3;
  57235. $20=(4).__at((5));
  57236. $ctx1.sendIdx["@"]=13;
  57237. $21=(4).__at((5));
  57238. $ctx1.sendIdx["@"]=14;
  57239. $19=$recv($20).__gt_eq($21);
  57240. $ctx1.sendIdx[">="]=1;
  57241. self._assert_($19);
  57242. $23=(4).__at((5));
  57243. $ctx1.sendIdx["@"]=15;
  57244. $22=$recv($23).__gt_eq((5).__at((5)));
  57245. self._deny_($22);
  57246. return self;
  57247. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  57248. },
  57249. args: [],
  57250. 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)",
  57251. referencedClasses: [],
  57252. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  57253. }),
  57254. $globals.PointTest);
  57255. $core.addMethod(
  57256. $core.method({
  57257. selector: "testEgality",
  57258. protocol: 'tests',
  57259. fn: function (){
  57260. var self=this;
  57261. return $core.withContext(function($ctx1) {
  57262. var $2,$3,$1,$5,$4;
  57263. $2=(3).__at((4));
  57264. $ctx1.sendIdx["@"]=1;
  57265. $3=(3).__at((4));
  57266. $ctx1.sendIdx["@"]=2;
  57267. $1=$recv($2).__eq($3);
  57268. $ctx1.sendIdx["="]=1;
  57269. self._assert_($1);
  57270. $5=(3).__at((5));
  57271. $ctx1.sendIdx["@"]=3;
  57272. $4=$recv($5).__eq((3).__at((6)));
  57273. self._deny_($4);
  57274. return self;
  57275. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  57276. },
  57277. args: [],
  57278. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  57279. referencedClasses: [],
  57280. messageSends: ["assert:", "=", "@", "deny:"]
  57281. }),
  57282. $globals.PointTest);
  57283. $core.addMethod(
  57284. $core.method({
  57285. selector: "testNew",
  57286. protocol: 'tests',
  57287. fn: function (){
  57288. var self=this;
  57289. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57290. return $core.withContext(function($ctx1) {
  57291. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  57292. $3=$recv($Point())._new();
  57293. $ctx1.sendIdx["new"]=1;
  57294. $2=$recv($3)._x_((3));
  57295. $ctx1.sendIdx["x:"]=1;
  57296. $1=$recv($2)._y();
  57297. $ctx1.sendIdx["y"]=1;
  57298. self._assert_equals_($1,nil);
  57299. $ctx1.sendIdx["assert:equals:"]=1;
  57300. $7=$recv($Point())._new();
  57301. $ctx1.sendIdx["new"]=2;
  57302. $6=$recv($7)._x_((3));
  57303. $5=$recv($6)._x();
  57304. $ctx1.sendIdx["x"]=1;
  57305. $4=$recv($5).__eq((0));
  57306. $ctx1.sendIdx["="]=1;
  57307. self._deny_($4);
  57308. $ctx1.sendIdx["deny:"]=1;
  57309. $10=$recv($Point())._new();
  57310. $ctx1.sendIdx["new"]=3;
  57311. $9=$recv($10)._y_((4));
  57312. $ctx1.sendIdx["y:"]=1;
  57313. $8=$recv($9)._x();
  57314. self._assert_equals_($8,nil);
  57315. self._deny_($recv($recv($recv($recv($Point())._new())._y_((4)))._y()).__eq((0)));
  57316. return self;
  57317. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  57318. },
  57319. args: [],
  57320. 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",
  57321. referencedClasses: ["Point"],
  57322. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  57323. }),
  57324. $globals.PointTest);
  57325. $core.addMethod(
  57326. $core.method({
  57327. selector: "testTranslateBy",
  57328. protocol: 'tests',
  57329. fn: function (){
  57330. var self=this;
  57331. return $core.withContext(function($ctx1) {
  57332. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  57333. $2=(3).__at((3));
  57334. $ctx1.sendIdx["@"]=1;
  57335. $3=(0).__at((1));
  57336. $ctx1.sendIdx["@"]=2;
  57337. $1=$recv($2)._translateBy_($3);
  57338. $ctx1.sendIdx["translateBy:"]=1;
  57339. $4=(3).__at((4));
  57340. $ctx1.sendIdx["@"]=3;
  57341. self._assert_equals_($1,$4);
  57342. $ctx1.sendIdx["assert:equals:"]=1;
  57343. $6=(3).__at((3));
  57344. $ctx1.sendIdx["@"]=4;
  57345. $8=(1)._negated();
  57346. $ctx1.sendIdx["negated"]=1;
  57347. $7=(0).__at($8);
  57348. $ctx1.sendIdx["@"]=5;
  57349. $5=$recv($6)._translateBy_($7);
  57350. $ctx1.sendIdx["translateBy:"]=2;
  57351. $9=(3).__at((2));
  57352. $ctx1.sendIdx["@"]=6;
  57353. self._assert_equals_($5,$9);
  57354. $ctx1.sendIdx["assert:equals:"]=2;
  57355. $11=(3).__at((3));
  57356. $ctx1.sendIdx["@"]=7;
  57357. $12=(2).__at((3));
  57358. $ctx1.sendIdx["@"]=8;
  57359. $10=$recv($11)._translateBy_($12);
  57360. $ctx1.sendIdx["translateBy:"]=3;
  57361. $13=(5).__at((6));
  57362. $ctx1.sendIdx["@"]=9;
  57363. self._assert_equals_($10,$13);
  57364. $ctx1.sendIdx["assert:equals:"]=3;
  57365. $15=(3).__at((3));
  57366. $ctx1.sendIdx["@"]=10;
  57367. $16=$recv((3)._negated()).__at((0));
  57368. $ctx1.sendIdx["@"]=11;
  57369. $14=$recv($15)._translateBy_($16);
  57370. self._assert_equals_($14,(0).__at((3)));
  57371. return self;
  57372. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  57373. },
  57374. args: [],
  57375. 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.",
  57376. referencedClasses: [],
  57377. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  57378. }),
  57379. $globals.PointTest);
  57380. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  57381. $core.addMethod(
  57382. $core.method({
  57383. selector: "testNextIfAbsent",
  57384. protocol: 'tests',
  57385. fn: function (){
  57386. var self=this;
  57387. var queue;
  57388. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  57389. return $core.withContext(function($ctx1) {
  57390. var $2,$1;
  57391. queue=$recv($Queue())._new();
  57392. $recv(queue)._nextPut_("index1");
  57393. $2=$recv(queue)._nextIfAbsent_("empty");
  57394. $ctx1.sendIdx["nextIfAbsent:"]=1;
  57395. $1=$recv($2).__eq("index1");
  57396. $ctx1.sendIdx["="]=1;
  57397. self._assert_($1);
  57398. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  57399. return self;
  57400. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  57401. },
  57402. args: [],
  57403. 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'",
  57404. referencedClasses: ["Queue"],
  57405. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  57406. }),
  57407. $globals.QueueTest);
  57408. $core.addMethod(
  57409. $core.method({
  57410. selector: "testQueueNext",
  57411. protocol: 'tests',
  57412. fn: function (){
  57413. var self=this;
  57414. var queue;
  57415. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  57416. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  57417. return $core.withContext(function($ctx1) {
  57418. var $1,$2,$4,$3,$6,$5;
  57419. queue=$recv($Queue())._new();
  57420. $1=queue;
  57421. $recv($1)._nextPut_("index1");
  57422. $ctx1.sendIdx["nextPut:"]=1;
  57423. $2=$recv($1)._nextPut_("index2");
  57424. $4=$recv(queue)._next();
  57425. $ctx1.sendIdx["next"]=1;
  57426. $3=$recv($4).__eq("index1");
  57427. $ctx1.sendIdx["="]=1;
  57428. self._assert_($3);
  57429. $6=$recv(queue)._next();
  57430. $ctx1.sendIdx["next"]=2;
  57431. $5=$recv($6).__eq("index");
  57432. self._deny_($5);
  57433. self._should_raise_((function(){
  57434. return $core.withContext(function($ctx2) {
  57435. return $recv(queue)._next();
  57436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57437. }),$Error());
  57438. return self;
  57439. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  57440. },
  57441. args: [],
  57442. 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",
  57443. referencedClasses: ["Queue", "Error"],
  57444. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  57445. }),
  57446. $globals.QueueTest);
  57447. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  57448. $core.addMethod(
  57449. $core.method({
  57450. selector: "testAtRandomNumber",
  57451. protocol: 'tests',
  57452. fn: function (){
  57453. var self=this;
  57454. var val;
  57455. return $core.withContext(function($ctx1) {
  57456. (100)._timesRepeat_((function(){
  57457. return $core.withContext(function($ctx2) {
  57458. val=(10)._atRandom();
  57459. val;
  57460. self._assert_($recv(val).__gt((0)));
  57461. $ctx2.sendIdx["assert:"]=1;
  57462. return self._assert_($recv(val).__lt((11)));
  57463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57464. }));
  57465. return self;
  57466. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  57467. },
  57468. args: [],
  57469. 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]",
  57470. referencedClasses: [],
  57471. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  57472. }),
  57473. $globals.RandomTest);
  57474. $core.addMethod(
  57475. $core.method({
  57476. selector: "testAtRandomSequenceableCollection",
  57477. protocol: 'tests',
  57478. fn: function (){
  57479. var self=this;
  57480. var val;
  57481. return $core.withContext(function($ctx1) {
  57482. var $3,$4,$2,$1;
  57483. (100)._timesRepeat_((function(){
  57484. return $core.withContext(function($ctx2) {
  57485. val="abc"._atRandom();
  57486. val;
  57487. $3=$recv(val).__eq("a");
  57488. $ctx2.sendIdx["="]=1;
  57489. $4=$recv(val).__eq("b");
  57490. $ctx2.sendIdx["="]=2;
  57491. $2=$recv($3).__or($4);
  57492. $1=$recv($2).__or($recv(val).__eq("c"));
  57493. $ctx2.sendIdx["|"]=1;
  57494. return self._assert_($1);
  57495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57496. }));
  57497. return self;
  57498. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  57499. },
  57500. args: [],
  57501. 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].",
  57502. referencedClasses: [],
  57503. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  57504. }),
  57505. $globals.RandomTest);
  57506. $core.addMethod(
  57507. $core.method({
  57508. selector: "textNext",
  57509. protocol: 'tests',
  57510. fn: function (){
  57511. var self=this;
  57512. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  57513. return $core.withContext(function($ctx1) {
  57514. var $1;
  57515. (10000)._timesRepeat_((function(){
  57516. var current,next;
  57517. return $core.withContext(function($ctx2) {
  57518. next=$recv($recv($Random())._new())._next();
  57519. next;
  57520. self._assert_($recv(next).__gt_eq((0)));
  57521. $ctx2.sendIdx["assert:"]=1;
  57522. self._assert_($recv(next).__lt((1)));
  57523. $1=$recv(current).__eq(next);
  57524. $ctx2.sendIdx["="]=1;
  57525. self._deny_($1);
  57526. return $recv(next).__eq(current);
  57527. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  57528. }));
  57529. return self;
  57530. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  57531. },
  57532. args: [],
  57533. 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 ]",
  57534. referencedClasses: ["Random"],
  57535. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  57536. }),
  57537. $globals.RandomTest);
  57538. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  57539. $core.addMethod(
  57540. $core.method({
  57541. selector: "collectionClass",
  57542. protocol: 'accessing',
  57543. fn: function (){
  57544. var self=this;
  57545. return $core.withContext(function($ctx1) {
  57546. var $1;
  57547. $1=$recv(self._class())._collectionClass();
  57548. return $1;
  57549. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  57550. },
  57551. args: [],
  57552. source: "collectionClass\x0a\x09^ self class collectionClass",
  57553. referencedClasses: [],
  57554. messageSends: ["collectionClass", "class"]
  57555. }),
  57556. $globals.StreamTest);
  57557. $core.addMethod(
  57558. $core.method({
  57559. selector: "newCollection",
  57560. protocol: 'accessing',
  57561. fn: function (){
  57562. var self=this;
  57563. return $core.withContext(function($ctx1) {
  57564. var $1;
  57565. $1=$recv(self._collectionClass())._new();
  57566. return $1;
  57567. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  57568. },
  57569. args: [],
  57570. source: "newCollection\x0a\x09^ self collectionClass new",
  57571. referencedClasses: [],
  57572. messageSends: ["new", "collectionClass"]
  57573. }),
  57574. $globals.StreamTest);
  57575. $core.addMethod(
  57576. $core.method({
  57577. selector: "newStream",
  57578. protocol: 'accessing',
  57579. fn: function (){
  57580. var self=this;
  57581. return $core.withContext(function($ctx1) {
  57582. var $1;
  57583. $1=$recv($recv(self._collectionClass())._new())._stream();
  57584. return $1;
  57585. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  57586. },
  57587. args: [],
  57588. source: "newStream\x0a\x09^ self collectionClass new stream",
  57589. referencedClasses: [],
  57590. messageSends: ["stream", "new", "collectionClass"]
  57591. }),
  57592. $globals.StreamTest);
  57593. $core.addMethod(
  57594. $core.method({
  57595. selector: "testAtStartAtEnd",
  57596. protocol: 'tests',
  57597. fn: function (){
  57598. var self=this;
  57599. var stream;
  57600. return $core.withContext(function($ctx1) {
  57601. var $1,$2,$3,$4;
  57602. stream=self._newStream();
  57603. $1=$recv(stream)._atStart();
  57604. $ctx1.sendIdx["atStart"]=1;
  57605. self._assert_($1);
  57606. $ctx1.sendIdx["assert:"]=1;
  57607. $2=$recv(stream)._atEnd();
  57608. $ctx1.sendIdx["atEnd"]=1;
  57609. self._assert_($2);
  57610. $ctx1.sendIdx["assert:"]=2;
  57611. $recv(stream)._nextPutAll_(self._newCollection());
  57612. $3=$recv(stream)._atEnd();
  57613. $ctx1.sendIdx["atEnd"]=2;
  57614. self._assert_($3);
  57615. $4=$recv(stream)._atStart();
  57616. $ctx1.sendIdx["atStart"]=2;
  57617. self._deny_($4);
  57618. $ctx1.sendIdx["deny:"]=1;
  57619. $recv(stream)._position_((1));
  57620. self._deny_($recv(stream)._atEnd());
  57621. $ctx1.sendIdx["deny:"]=2;
  57622. self._deny_($recv(stream)._atStart());
  57623. return self;
  57624. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  57625. },
  57626. args: [],
  57627. 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",
  57628. referencedClasses: [],
  57629. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  57630. }),
  57631. $globals.StreamTest);
  57632. $core.addMethod(
  57633. $core.method({
  57634. selector: "testContents",
  57635. protocol: 'tests',
  57636. fn: function (){
  57637. var self=this;
  57638. var stream;
  57639. return $core.withContext(function($ctx1) {
  57640. var $1,$2;
  57641. stream=self._newStream();
  57642. $1=stream;
  57643. $2=self._newCollection();
  57644. $ctx1.sendIdx["newCollection"]=1;
  57645. $recv($1)._nextPutAll_($2);
  57646. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  57647. return self;
  57648. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  57649. },
  57650. args: [],
  57651. 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",
  57652. referencedClasses: [],
  57653. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  57654. }),
  57655. $globals.StreamTest);
  57656. $core.addMethod(
  57657. $core.method({
  57658. selector: "testIsEmpty",
  57659. protocol: 'tests',
  57660. fn: function (){
  57661. var self=this;
  57662. var stream;
  57663. return $core.withContext(function($ctx1) {
  57664. var $1;
  57665. stream=self._newStream();
  57666. $1=$recv(stream)._isEmpty();
  57667. $ctx1.sendIdx["isEmpty"]=1;
  57668. self._assert_($1);
  57669. $recv(stream)._nextPutAll_(self._newCollection());
  57670. self._deny_($recv(stream)._isEmpty());
  57671. return self;
  57672. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  57673. },
  57674. args: [],
  57675. 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",
  57676. referencedClasses: [],
  57677. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  57678. }),
  57679. $globals.StreamTest);
  57680. $core.addMethod(
  57681. $core.method({
  57682. selector: "testPosition",
  57683. protocol: 'tests',
  57684. fn: function (){
  57685. var self=this;
  57686. var collection,stream;
  57687. return $core.withContext(function($ctx1) {
  57688. var $1,$2,$3;
  57689. collection=self._newCollection();
  57690. stream=self._newStream();
  57691. $recv(stream)._nextPutAll_(collection);
  57692. $1=$recv(stream)._position();
  57693. $ctx1.sendIdx["position"]=1;
  57694. self._assert_equals_($1,$recv(collection)._size());
  57695. $ctx1.sendIdx["assert:equals:"]=1;
  57696. $recv(stream)._position_((0));
  57697. $2=$recv(stream)._position();
  57698. $ctx1.sendIdx["position"]=2;
  57699. self._assert_equals_($2,(0));
  57700. $ctx1.sendIdx["assert:equals:"]=2;
  57701. $recv(stream)._next();
  57702. $ctx1.sendIdx["next"]=1;
  57703. $3=$recv(stream)._position();
  57704. $ctx1.sendIdx["position"]=3;
  57705. self._assert_equals_($3,(1));
  57706. $ctx1.sendIdx["assert:equals:"]=3;
  57707. $recv(stream)._next();
  57708. self._assert_equals_($recv(stream)._position(),(2));
  57709. return self;
  57710. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  57711. },
  57712. args: [],
  57713. 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",
  57714. referencedClasses: [],
  57715. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  57716. }),
  57717. $globals.StreamTest);
  57718. $core.addMethod(
  57719. $core.method({
  57720. selector: "testReading",
  57721. protocol: 'tests',
  57722. fn: function (){
  57723. var self=this;
  57724. var stream,collection;
  57725. return $core.withContext(function($ctx1) {
  57726. var $1,$2,$3;
  57727. collection=self._newCollection();
  57728. stream=self._newStream();
  57729. $1=stream;
  57730. $recv($1)._nextPutAll_(collection);
  57731. $2=$recv($1)._position_((0));
  57732. $recv(collection)._do_((function(each){
  57733. return $core.withContext(function($ctx2) {
  57734. $3=$recv(stream)._next();
  57735. $ctx2.sendIdx["next"]=1;
  57736. return self._assert_equals_($3,each);
  57737. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57738. }));
  57739. self._assert_($recv($recv(stream)._next())._isNil());
  57740. return self;
  57741. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  57742. },
  57743. args: [],
  57744. 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",
  57745. referencedClasses: [],
  57746. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  57747. }),
  57748. $globals.StreamTest);
  57749. $core.addMethod(
  57750. $core.method({
  57751. selector: "testStreamContents",
  57752. protocol: 'tests',
  57753. fn: function (){
  57754. var self=this;
  57755. return self;
  57756. },
  57757. args: [],
  57758. source: "testStreamContents",
  57759. referencedClasses: [],
  57760. messageSends: []
  57761. }),
  57762. $globals.StreamTest);
  57763. $core.addMethod(
  57764. $core.method({
  57765. selector: "testWrite",
  57766. protocol: 'tests',
  57767. fn: function (){
  57768. var self=this;
  57769. var stream,collection;
  57770. return $core.withContext(function($ctx1) {
  57771. collection=self._newCollection();
  57772. stream=self._newStream();
  57773. $recv(collection)._do_((function(each){
  57774. return $core.withContext(function($ctx2) {
  57775. return $recv(stream).__lt_lt(each);
  57776. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57777. }));
  57778. self._assert_equals_($recv(stream)._contents(),collection);
  57779. return self;
  57780. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  57781. },
  57782. args: [],
  57783. 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",
  57784. referencedClasses: [],
  57785. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  57786. }),
  57787. $globals.StreamTest);
  57788. $core.addMethod(
  57789. $core.method({
  57790. selector: "testWriting",
  57791. protocol: 'tests',
  57792. fn: function (){
  57793. var self=this;
  57794. var stream,collection;
  57795. return $core.withContext(function($ctx1) {
  57796. var $1;
  57797. collection=self._newCollection();
  57798. stream=self._newStream();
  57799. $ctx1.sendIdx["newStream"]=1;
  57800. $recv(collection)._do_((function(each){
  57801. return $core.withContext(function($ctx2) {
  57802. return $recv(stream)._nextPut_(each);
  57803. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57804. }));
  57805. $1=$recv(stream)._contents();
  57806. $ctx1.sendIdx["contents"]=1;
  57807. self._assert_equals_($1,collection);
  57808. $ctx1.sendIdx["assert:equals:"]=1;
  57809. stream=self._newStream();
  57810. $recv(stream)._nextPutAll_(collection);
  57811. self._assert_equals_($recv(stream)._contents(),collection);
  57812. return self;
  57813. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  57814. },
  57815. args: [],
  57816. 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",
  57817. referencedClasses: [],
  57818. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  57819. }),
  57820. $globals.StreamTest);
  57821. $core.addMethod(
  57822. $core.method({
  57823. selector: "collectionClass",
  57824. protocol: 'accessing',
  57825. fn: function (){
  57826. var self=this;
  57827. return nil;
  57828. },
  57829. args: [],
  57830. source: "collectionClass\x0a\x09^ nil",
  57831. referencedClasses: [],
  57832. messageSends: []
  57833. }),
  57834. $globals.StreamTest.klass);
  57835. $core.addMethod(
  57836. $core.method({
  57837. selector: "isAbstract",
  57838. protocol: 'testing',
  57839. fn: function (){
  57840. var self=this;
  57841. return $core.withContext(function($ctx1) {
  57842. var $1;
  57843. $1=$recv(self._collectionClass())._isNil();
  57844. return $1;
  57845. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  57846. },
  57847. args: [],
  57848. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  57849. referencedClasses: [],
  57850. messageSends: ["isNil", "collectionClass"]
  57851. }),
  57852. $globals.StreamTest.klass);
  57853. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  57854. $core.addMethod(
  57855. $core.method({
  57856. selector: "newCollection",
  57857. protocol: 'accessing',
  57858. fn: function (){
  57859. var self=this;
  57860. return $core.withContext(function($ctx1) {
  57861. var $1;
  57862. $1=[true,(1),(3).__at((4)),"foo"];
  57863. return $1;
  57864. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  57865. },
  57866. args: [],
  57867. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  57868. referencedClasses: [],
  57869. messageSends: ["@"]
  57870. }),
  57871. $globals.ArrayStreamTest);
  57872. $core.addMethod(
  57873. $core.method({
  57874. selector: "collectionClass",
  57875. protocol: 'accessing',
  57876. fn: function (){
  57877. var self=this;
  57878. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  57879. return $Array();
  57880. },
  57881. args: [],
  57882. source: "collectionClass\x0a\x09^ Array",
  57883. referencedClasses: ["Array"],
  57884. messageSends: []
  57885. }),
  57886. $globals.ArrayStreamTest.klass);
  57887. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  57888. $core.addMethod(
  57889. $core.method({
  57890. selector: "newCollection",
  57891. protocol: 'accessing',
  57892. fn: function (){
  57893. var self=this;
  57894. return "hello world";
  57895. },
  57896. args: [],
  57897. source: "newCollection\x0a\x09^ 'hello world'",
  57898. referencedClasses: [],
  57899. messageSends: []
  57900. }),
  57901. $globals.StringStreamTest);
  57902. $core.addMethod(
  57903. $core.method({
  57904. selector: "collectionClass",
  57905. protocol: 'accessing',
  57906. fn: function (){
  57907. var self=this;
  57908. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  57909. return $String();
  57910. },
  57911. args: [],
  57912. source: "collectionClass\x0a\x09^ String",
  57913. referencedClasses: ["String"],
  57914. messageSends: []
  57915. }),
  57916. $globals.StringStreamTest.klass);
  57917. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  57918. $core.addMethod(
  57919. $core.method({
  57920. selector: "testCopying",
  57921. protocol: 'tests',
  57922. fn: function (){
  57923. var self=this;
  57924. return $core.withContext(function($ctx1) {
  57925. self._assert_equals_(nil._copy(),nil);
  57926. return self;
  57927. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  57928. },
  57929. args: [],
  57930. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  57931. referencedClasses: [],
  57932. messageSends: ["assert:equals:", "copy"]
  57933. }),
  57934. $globals.UndefinedTest);
  57935. $core.addMethod(
  57936. $core.method({
  57937. selector: "testDeepCopy",
  57938. protocol: 'tests',
  57939. fn: function (){
  57940. var self=this;
  57941. return $core.withContext(function($ctx1) {
  57942. self._assert_($recv(nil._deepCopy()).__eq(nil));
  57943. return self;
  57944. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  57945. },
  57946. args: [],
  57947. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  57948. referencedClasses: [],
  57949. messageSends: ["assert:", "=", "deepCopy"]
  57950. }),
  57951. $globals.UndefinedTest);
  57952. $core.addMethod(
  57953. $core.method({
  57954. selector: "testIfNil",
  57955. protocol: 'tests',
  57956. fn: function (){
  57957. var self=this;
  57958. return $core.withContext(function($ctx1) {
  57959. var $1,$3,$2,$4,$6,$5,$receiver;
  57960. if(($receiver = nil) == null || $receiver.isNil){
  57961. $1=true;
  57962. } else {
  57963. $1=nil;
  57964. };
  57965. self._assert_equals_($1,true);
  57966. $ctx1.sendIdx["assert:equals:"]=1;
  57967. if(($receiver = nil) == null || $receiver.isNil){
  57968. $3=nil;
  57969. } else {
  57970. $3=true;
  57971. };
  57972. $2=$recv($3).__eq(true);
  57973. $ctx1.sendIdx["="]=1;
  57974. self._deny_($2);
  57975. $ctx1.sendIdx["deny:"]=1;
  57976. if(($receiver = nil) == null || $receiver.isNil){
  57977. $4=true;
  57978. } else {
  57979. $4=false;
  57980. };
  57981. self._assert_equals_($4,true);
  57982. if(($receiver = nil) == null || $receiver.isNil){
  57983. $6=false;
  57984. } else {
  57985. $6=true;
  57986. };
  57987. $5=$recv($6).__eq(true);
  57988. self._deny_($5);
  57989. return self;
  57990. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  57991. },
  57992. args: [],
  57993. 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",
  57994. referencedClasses: [],
  57995. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  57996. }),
  57997. $globals.UndefinedTest);
  57998. $core.addMethod(
  57999. $core.method({
  58000. selector: "testIsNil",
  58001. protocol: 'tests',
  58002. fn: function (){
  58003. var self=this;
  58004. return $core.withContext(function($ctx1) {
  58005. self._assert_(nil._isNil());
  58006. self._deny_(nil._notNil());
  58007. return self;
  58008. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  58009. },
  58010. args: [],
  58011. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  58012. referencedClasses: [],
  58013. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  58014. }),
  58015. $globals.UndefinedTest);
  58016. });
  58017. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  58018. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  58019. $core.addPackage('SUnit-Tests');
  58020. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  58021. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  58022. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  58023. $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.";
  58024. $core.addMethod(
  58025. $core.method({
  58026. selector: "setUp",
  58027. protocol: 'running',
  58028. fn: function (){
  58029. var self=this;
  58030. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  58031. return $core.withContext(function($ctx1) {
  58032. self["@empty"]=$recv($Set())._new();
  58033. self["@full"]=$recv($Set())._with_with_((5),"abc");
  58034. return self;
  58035. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  58036. },
  58037. args: [],
  58038. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  58039. referencedClasses: ["Set"],
  58040. messageSends: ["new", "with:with:"]
  58041. }),
  58042. $globals.ExampleSetTest);
  58043. $core.addMethod(
  58044. $core.method({
  58045. selector: "testAdd",
  58046. protocol: 'tests',
  58047. fn: function (){
  58048. var self=this;
  58049. return $core.withContext(function($ctx1) {
  58050. $recv(self["@empty"])._add_((5));
  58051. self._assert_($recv(self["@empty"])._includes_((5)));
  58052. return self;
  58053. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  58054. },
  58055. args: [],
  58056. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  58057. referencedClasses: [],
  58058. messageSends: ["add:", "assert:", "includes:"]
  58059. }),
  58060. $globals.ExampleSetTest);
  58061. $core.addMethod(
  58062. $core.method({
  58063. selector: "testGrow",
  58064. protocol: 'tests',
  58065. fn: function (){
  58066. var self=this;
  58067. return $core.withContext(function($ctx1) {
  58068. $recv(self["@empty"])._addAll_((1)._to_((100)));
  58069. self._assert_equals_($recv(self["@empty"])._size(),(100));
  58070. return self;
  58071. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  58072. },
  58073. args: [],
  58074. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  58075. referencedClasses: [],
  58076. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  58077. }),
  58078. $globals.ExampleSetTest);
  58079. $core.addMethod(
  58080. $core.method({
  58081. selector: "testIllegal",
  58082. protocol: 'tests',
  58083. fn: function (){
  58084. var self=this;
  58085. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58086. return $core.withContext(function($ctx1) {
  58087. self._should_raise_((function(){
  58088. return $core.withContext(function($ctx2) {
  58089. return $recv(self["@empty"])._at_((5));
  58090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58091. }),$Error());
  58092. $ctx1.sendIdx["should:raise:"]=1;
  58093. self._should_raise_((function(){
  58094. return $core.withContext(function($ctx2) {
  58095. return $recv(self["@empty"])._at_put_((5),"abc");
  58096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58097. }),$Error());
  58098. return self;
  58099. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  58100. },
  58101. args: [],
  58102. 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",
  58103. referencedClasses: ["Error"],
  58104. messageSends: ["should:raise:", "at:", "at:put:"]
  58105. }),
  58106. $globals.ExampleSetTest);
  58107. $core.addMethod(
  58108. $core.method({
  58109. selector: "testIncludes",
  58110. protocol: 'tests',
  58111. fn: function (){
  58112. var self=this;
  58113. return $core.withContext(function($ctx1) {
  58114. var $1;
  58115. $1=$recv(self["@full"])._includes_((5));
  58116. $ctx1.sendIdx["includes:"]=1;
  58117. self._assert_($1);
  58118. $ctx1.sendIdx["assert:"]=1;
  58119. self._assert_($recv(self["@full"])._includes_("abc"));
  58120. return self;
  58121. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  58122. },
  58123. args: [],
  58124. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  58125. referencedClasses: [],
  58126. messageSends: ["assert:", "includes:"]
  58127. }),
  58128. $globals.ExampleSetTest);
  58129. $core.addMethod(
  58130. $core.method({
  58131. selector: "testOccurrences",
  58132. protocol: 'tests',
  58133. fn: function (){
  58134. var self=this;
  58135. return $core.withContext(function($ctx1) {
  58136. var $1,$2;
  58137. $1=$recv(self["@empty"])._occurrencesOf_((0));
  58138. $ctx1.sendIdx["occurrencesOf:"]=1;
  58139. self._assert_equals_($1,(0));
  58140. $ctx1.sendIdx["assert:equals:"]=1;
  58141. $2=$recv(self["@full"])._occurrencesOf_((5));
  58142. $ctx1.sendIdx["occurrencesOf:"]=2;
  58143. self._assert_equals_($2,(1));
  58144. $ctx1.sendIdx["assert:equals:"]=2;
  58145. $recv(self["@full"])._add_((5));
  58146. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  58147. return self;
  58148. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  58149. },
  58150. args: [],
  58151. 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",
  58152. referencedClasses: [],
  58153. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  58154. }),
  58155. $globals.ExampleSetTest);
  58156. $core.addMethod(
  58157. $core.method({
  58158. selector: "testRemove",
  58159. protocol: 'tests',
  58160. fn: function (){
  58161. var self=this;
  58162. return $core.withContext(function($ctx1) {
  58163. var $1;
  58164. $recv(self["@full"])._remove_((5));
  58165. $1=$recv(self["@full"])._includes_("abc");
  58166. $ctx1.sendIdx["includes:"]=1;
  58167. self._assert_($1);
  58168. self._deny_($recv(self["@full"])._includes_((5)));
  58169. return self;
  58170. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  58171. },
  58172. args: [],
  58173. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  58174. referencedClasses: [],
  58175. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  58176. }),
  58177. $globals.ExampleSetTest);
  58178. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  58179. $core.addMethod(
  58180. $core.method({
  58181. selector: "fakeError",
  58182. protocol: 'helpers',
  58183. fn: function (){
  58184. var self=this;
  58185. return $core.withContext(function($ctx1) {
  58186. self["@flag"]="bad";
  58187. self._timeout_((30));
  58188. self["@flag"]=$recv(self._async_((function(){
  58189. return $core.withContext(function($ctx2) {
  58190. self["@flag"]="ok";
  58191. self["@flag"];
  58192. return self._error_("Intentional");
  58193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58194. })))._valueWithTimeout_((20));
  58195. return self;
  58196. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  58197. },
  58198. args: [],
  58199. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  58200. referencedClasses: [],
  58201. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  58202. }),
  58203. $globals.SUnitAsyncTest);
  58204. $core.addMethod(
  58205. $core.method({
  58206. selector: "fakeErrorFailingInTearDown",
  58207. protocol: 'helpers',
  58208. fn: function (){
  58209. var self=this;
  58210. return $core.withContext(function($ctx1) {
  58211. self["@flag"]="bad";
  58212. self._timeout_((30));
  58213. self["@flag"]=$recv(self._async_((function(){
  58214. return $core.withContext(function($ctx2) {
  58215. return self._error_("Intentional");
  58216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58217. })))._valueWithTimeout_((20));
  58218. return self;
  58219. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  58220. },
  58221. args: [],
  58222. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  58223. referencedClasses: [],
  58224. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  58225. }),
  58226. $globals.SUnitAsyncTest);
  58227. $core.addMethod(
  58228. $core.method({
  58229. selector: "fakeFailure",
  58230. protocol: 'helpers',
  58231. fn: function (){
  58232. var self=this;
  58233. return $core.withContext(function($ctx1) {
  58234. self["@flag"]="bad";
  58235. self._timeout_((30));
  58236. self["@flag"]=$recv(self._async_((function(){
  58237. return $core.withContext(function($ctx2) {
  58238. self["@flag"]="ok";
  58239. self["@flag"];
  58240. return self._assert_(false);
  58241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58242. })))._valueWithTimeout_((20));
  58243. return self;
  58244. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  58245. },
  58246. args: [],
  58247. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  58248. referencedClasses: [],
  58249. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  58250. }),
  58251. $globals.SUnitAsyncTest);
  58252. $core.addMethod(
  58253. $core.method({
  58254. selector: "fakeMultipleTimeoutFailing",
  58255. protocol: 'helpers',
  58256. fn: function (){
  58257. var self=this;
  58258. return $core.withContext(function($ctx1) {
  58259. var $1;
  58260. self._timeout_((100));
  58261. $ctx1.sendIdx["timeout:"]=1;
  58262. $1=self._async_((function(){
  58263. return $core.withContext(function($ctx2) {
  58264. self._timeout_((20));
  58265. return $recv(self._async_((function(){
  58266. return $core.withContext(function($ctx3) {
  58267. return self._finished();
  58268. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58269. })))._valueWithTimeout_((30));
  58270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58271. }));
  58272. $ctx1.sendIdx["async:"]=1;
  58273. $recv($1)._valueWithTimeout_((20));
  58274. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58275. return self;
  58276. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  58277. },
  58278. args: [],
  58279. 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",
  58280. referencedClasses: [],
  58281. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58282. }),
  58283. $globals.SUnitAsyncTest);
  58284. $core.addMethod(
  58285. $core.method({
  58286. selector: "fakeMultipleTimeoutPassing",
  58287. protocol: 'helpers',
  58288. fn: function (){
  58289. var self=this;
  58290. return $core.withContext(function($ctx1) {
  58291. var $1;
  58292. self._timeout_((20));
  58293. $ctx1.sendIdx["timeout:"]=1;
  58294. $1=self._async_((function(){
  58295. return $core.withContext(function($ctx2) {
  58296. self._timeout_((40));
  58297. return $recv(self._async_((function(){
  58298. return $core.withContext(function($ctx3) {
  58299. return self._finished();
  58300. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58301. })))._valueWithTimeout_((20));
  58302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58303. }));
  58304. $ctx1.sendIdx["async:"]=1;
  58305. $recv($1)._valueWithTimeout_((10));
  58306. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58307. return self;
  58308. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  58309. },
  58310. args: [],
  58311. 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",
  58312. referencedClasses: [],
  58313. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58314. }),
  58315. $globals.SUnitAsyncTest);
  58316. $core.addMethod(
  58317. $core.method({
  58318. selector: "fakeTimeout",
  58319. protocol: 'helpers',
  58320. fn: function (){
  58321. var self=this;
  58322. return $core.withContext(function($ctx1) {
  58323. self._timeout_((10));
  58324. $recv(self._async_((function(){
  58325. return $core.withContext(function($ctx2) {
  58326. return self._finished();
  58327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58328. })))._valueWithTimeout_((20));
  58329. return self;
  58330. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  58331. },
  58332. args: [],
  58333. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  58334. referencedClasses: [],
  58335. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58336. }),
  58337. $globals.SUnitAsyncTest);
  58338. $core.addMethod(
  58339. $core.method({
  58340. selector: "selectorSetOf:",
  58341. protocol: 'private',
  58342. fn: function (aCollection){
  58343. var self=this;
  58344. return $core.withContext(function($ctx1) {
  58345. var $1;
  58346. $1=$recv($recv(aCollection)._collect_((function(each){
  58347. return $core.withContext(function($ctx2) {
  58348. return $recv(each)._selector();
  58349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58350. })))._asSet();
  58351. return $1;
  58352. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  58353. },
  58354. args: ["aCollection"],
  58355. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  58356. referencedClasses: [],
  58357. messageSends: ["asSet", "collect:", "selector"]
  58358. }),
  58359. $globals.SUnitAsyncTest);
  58360. $core.addMethod(
  58361. $core.method({
  58362. selector: "setUp",
  58363. protocol: 'running',
  58364. fn: function (){
  58365. var self=this;
  58366. self["@flag"]="ok";
  58367. return self;
  58368. },
  58369. args: [],
  58370. source: "setUp\x0a\x09flag := 'ok'",
  58371. referencedClasses: [],
  58372. messageSends: []
  58373. }),
  58374. $globals.SUnitAsyncTest);
  58375. $core.addMethod(
  58376. $core.method({
  58377. selector: "tearDown",
  58378. protocol: 'running',
  58379. fn: function (){
  58380. var self=this;
  58381. return $core.withContext(function($ctx1) {
  58382. self._assert_equals_("ok",self["@flag"]);
  58383. return self;
  58384. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  58385. },
  58386. args: [],
  58387. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  58388. referencedClasses: [],
  58389. messageSends: ["assert:equals:"]
  58390. }),
  58391. $globals.SUnitAsyncTest);
  58392. $core.addMethod(
  58393. $core.method({
  58394. selector: "testAsyncErrorsAndFailures",
  58395. protocol: 'tests',
  58396. fn: function (){
  58397. var self=this;
  58398. var suite,runner,result,assertBlock;
  58399. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  58400. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  58401. return $core.withContext(function($ctx1) {
  58402. var $1,$2,$3,$4;
  58403. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  58404. return $core.withContext(function($ctx2) {
  58405. return $recv(self._class())._selector_(each);
  58406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58407. }));
  58408. runner=$recv($TestSuiteRunner())._on_(suite);
  58409. self._timeout_((200));
  58410. result=$recv(runner)._result();
  58411. $ctx1.sendIdx["result"]=1;
  58412. assertBlock=self._async_((function(){
  58413. return $core.withContext(function($ctx2) {
  58414. $1=self._selectorSetOf_($recv(result)._errors());
  58415. $ctx2.sendIdx["selectorSetOf:"]=1;
  58416. $2=["fakeError"]._asSet();
  58417. $ctx2.sendIdx["asSet"]=1;
  58418. self._assert_equals_($1,$2);
  58419. $ctx2.sendIdx["assert:equals:"]=1;
  58420. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  58421. return self._finished();
  58422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58423. }));
  58424. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  58425. return $core.withContext(function($ctx2) {
  58426. $3=$recv($recv(ann)._result()).__eq_eq(result);
  58427. if($core.assert($3)){
  58428. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  58429. return $recv($4)._ifTrue_(assertBlock);
  58430. };
  58431. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  58432. }));
  58433. $recv(runner)._run();
  58434. return self;
  58435. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  58436. },
  58437. args: [],
  58438. 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",
  58439. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  58440. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  58441. }),
  58442. $globals.SUnitAsyncTest);
  58443. $core.addMethod(
  58444. $core.method({
  58445. selector: "testAsyncNeedsTimeout",
  58446. protocol: 'tests',
  58447. fn: function (){
  58448. var self=this;
  58449. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58450. return $core.withContext(function($ctx1) {
  58451. self._should_raise_((function(){
  58452. return $core.withContext(function($ctx2) {
  58453. return self._async_((function(){
  58454. }));
  58455. $ctx2.sendIdx["async:"]=1;
  58456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58457. }),$Error());
  58458. self._timeout_((0));
  58459. self._shouldnt_raise_((function(){
  58460. return $core.withContext(function($ctx2) {
  58461. return self._async_((function(){
  58462. }));
  58463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58464. }),$Error());
  58465. self._finished();
  58466. return self;
  58467. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  58468. },
  58469. args: [],
  58470. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  58471. referencedClasses: ["Error"],
  58472. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  58473. }),
  58474. $globals.SUnitAsyncTest);
  58475. $core.addMethod(
  58476. $core.method({
  58477. selector: "testFinishedNeedsTimeout",
  58478. protocol: 'tests',
  58479. fn: function (){
  58480. var self=this;
  58481. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58482. return $core.withContext(function($ctx1) {
  58483. self._should_raise_((function(){
  58484. return $core.withContext(function($ctx2) {
  58485. return self._finished();
  58486. $ctx2.sendIdx["finished"]=1;
  58487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58488. }),$Error());
  58489. self._timeout_((0));
  58490. self._shouldnt_raise_((function(){
  58491. return $core.withContext(function($ctx2) {
  58492. return self._finished();
  58493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58494. }),$Error());
  58495. return self;
  58496. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  58497. },
  58498. args: [],
  58499. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  58500. referencedClasses: ["Error"],
  58501. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  58502. }),
  58503. $globals.SUnitAsyncTest);
  58504. $core.addMethod(
  58505. $core.method({
  58506. selector: "testIsAsyncReturnsCorrectValues",
  58507. protocol: 'tests',
  58508. fn: function (){
  58509. var self=this;
  58510. return $core.withContext(function($ctx1) {
  58511. var $1,$2;
  58512. $1=self._isAsync();
  58513. $ctx1.sendIdx["isAsync"]=1;
  58514. self._deny_($1);
  58515. $ctx1.sendIdx["deny:"]=1;
  58516. self._timeout_((0));
  58517. $2=self._isAsync();
  58518. $ctx1.sendIdx["isAsync"]=2;
  58519. self._assert_($2);
  58520. self._finished();
  58521. self._deny_(self._isAsync());
  58522. return self;
  58523. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  58524. },
  58525. args: [],
  58526. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  58527. referencedClasses: [],
  58528. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  58529. }),
  58530. $globals.SUnitAsyncTest);
  58531. $core.addMethod(
  58532. $core.method({
  58533. selector: "testPass",
  58534. protocol: 'tests',
  58535. fn: function (){
  58536. var self=this;
  58537. return $core.withContext(function($ctx1) {
  58538. self["@flag"]="bad";
  58539. self._timeout_((10));
  58540. self["@flag"]=$recv(self._async_((function(){
  58541. return $core.withContext(function($ctx2) {
  58542. self._assert_(true);
  58543. self._finished();
  58544. self["@flag"]="ok";
  58545. return self["@flag"];
  58546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58547. })))._valueWithTimeout_((5));
  58548. return self;
  58549. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  58550. },
  58551. args: [],
  58552. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  58553. referencedClasses: [],
  58554. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  58555. }),
  58556. $globals.SUnitAsyncTest);
  58557. $core.addMethod(
  58558. $core.method({
  58559. selector: "testTimeouts",
  58560. protocol: 'tests',
  58561. fn: function (){
  58562. var self=this;
  58563. var suite,runner,result,assertBlock;
  58564. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  58565. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  58566. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  58567. return $core.withContext(function($ctx1) {
  58568. var $1,$2,$3;
  58569. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  58570. return $core.withContext(function($ctx2) {
  58571. return $recv(self._class())._selector_(each);
  58572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58573. }));
  58574. runner=$recv($TestSuiteRunner())._on_(suite);
  58575. self._timeout_((200));
  58576. result=$recv(runner)._result();
  58577. $ctx1.sendIdx["result"]=1;
  58578. assertBlock=self._async_((function(){
  58579. return $core.withContext(function($ctx2) {
  58580. $1=self._selectorSetOf_($recv(result)._errors());
  58581. $ctx2.sendIdx["selectorSetOf:"]=1;
  58582. self._assert_equals_($1,$recv($Set())._new());
  58583. $ctx2.sendIdx["assert:equals:"]=1;
  58584. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  58585. return self._finished();
  58586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58587. }));
  58588. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  58589. return $core.withContext(function($ctx2) {
  58590. $2=$recv($recv(ann)._result()).__eq_eq(result);
  58591. if($core.assert($2)){
  58592. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  58593. return $recv($3)._ifTrue_(assertBlock);
  58594. };
  58595. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  58596. }));
  58597. $recv(runner)._run();
  58598. return self;
  58599. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  58600. },
  58601. args: [],
  58602. 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",
  58603. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  58604. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  58605. }),
  58606. $globals.SUnitAsyncTest);
  58607. $core.addMethod(
  58608. $core.method({
  58609. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  58610. protocol: 'tests',
  58611. fn: function (){
  58612. var self=this;
  58613. var x;
  58614. return $core.withContext(function($ctx1) {
  58615. var $1;
  58616. self["@flag"]="bad";
  58617. self._timeout_((10));
  58618. x=(0);
  58619. $1=self._async_((function(){
  58620. return $core.withContext(function($ctx2) {
  58621. self._finished();
  58622. $ctx2.sendIdx["finished"]=1;
  58623. self["@flag"]="ok";
  58624. self["@flag"];
  58625. x=$recv(x).__plus((1));
  58626. $ctx2.sendIdx["+"]=1;
  58627. x;
  58628. return self._assert_equals_(x,(1));
  58629. $ctx2.sendIdx["assert:equals:"]=1;
  58630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58631. }));
  58632. $ctx1.sendIdx["async:"]=1;
  58633. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  58634. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58635. self["@flag"]=$recv(self._async_((function(){
  58636. return $core.withContext(function($ctx2) {
  58637. self._finished();
  58638. self["@flag"]="ok";
  58639. self["@flag"];
  58640. x=$recv(x).__plus((1));
  58641. x;
  58642. return self._assert_equals_(x,(1));
  58643. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58644. })))._valueWithTimeout_((0));
  58645. return self;
  58646. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  58647. },
  58648. args: [],
  58649. 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.",
  58650. referencedClasses: [],
  58651. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  58652. }),
  58653. $globals.SUnitAsyncTest);
  58654. });
  58655. define('amber/devel',[
  58656. './helpers', // pre-fetch, dep of ./deploy
  58657. './deploy', // pre-fetch, dep of ./lang
  58658. './lang',
  58659. // --- packages of the development only Amber begin here ---
  58660. 'amber_core/SUnit',
  58661. 'amber_core/Compiler-Tests',
  58662. 'amber_core/Kernel-Tests',
  58663. 'amber_core/SUnit-Tests'
  58664. // --- packages of the development only Amber end here ---
  58665. ], function (amber) { return amber; });
  58666. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  58667. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  58668. $core.addPackage('AmberCli');
  58669. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  58670. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  58671. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  58672. $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.";
  58673. $core.addMethod(
  58674. $core.method({
  58675. selector: "commandLineSwitches",
  58676. protocol: 'commandline',
  58677. fn: function (){
  58678. var self=this;
  58679. var switches;
  58680. return $core.withContext(function($ctx1) {
  58681. var $1;
  58682. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  58683. return $core.withContext(function($ctx2) {
  58684. return $recv(each)._selector();
  58685. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58686. }));
  58687. $ctx1.sendIdx["collect:"]=1;
  58688. switches=$recv(switches)._select_((function(each){
  58689. return $core.withContext(function($ctx2) {
  58690. return $recv(each)._match_("^[^:]*:$");
  58691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58692. }));
  58693. switches=$recv(switches)._collect_((function(each){
  58694. return $core.withContext(function($ctx2) {
  58695. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  58696. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  58697. }));
  58698. $1=switches;
  58699. return $1;
  58700. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  58701. },
  58702. args: [],
  58703. 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",
  58704. referencedClasses: [],
  58705. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  58706. }),
  58707. $globals.AmberCli.klass);
  58708. $core.addMethod(
  58709. $core.method({
  58710. selector: "config:",
  58711. protocol: 'commands',
  58712. fn: function (args){
  58713. var self=this;
  58714. function $Configurator(){return $globals.Configurator||(typeof Configurator=="undefined"?nil:Configurator)}
  58715. return $core.withContext(function($ctx1) {
  58716. $recv($recv($Configurator())._new())._start();
  58717. return self;
  58718. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  58719. },
  58720. args: ["args"],
  58721. source: "config: args\x0a\x09Configurator new start",
  58722. referencedClasses: ["Configurator"],
  58723. messageSends: ["start", "new"]
  58724. }),
  58725. $globals.AmberCli.klass);
  58726. $core.addMethod(
  58727. $core.method({
  58728. selector: "handleArguments:",
  58729. protocol: 'commandline',
  58730. fn: function (args){
  58731. var self=this;
  58732. var selector;
  58733. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  58734. return $core.withContext(function($ctx1) {
  58735. var $1;
  58736. $1=$recv(args)._first();
  58737. $ctx1.sendIdx["first"]=1;
  58738. selector=self._selectorForCommandLineSwitch_($1);
  58739. $recv(args)._remove_($recv(args)._first());
  58740. self._perform_withArguments_(selector,$recv($Array())._with_(args));
  58741. return self;
  58742. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  58743. },
  58744. args: ["args"],
  58745. 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)",
  58746. referencedClasses: ["Array"],
  58747. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  58748. }),
  58749. $globals.AmberCli.klass);
  58750. $core.addMethod(
  58751. $core.method({
  58752. selector: "help:",
  58753. protocol: 'commands',
  58754. fn: function (args){
  58755. var self=this;
  58756. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  58757. return $core.withContext(function($ctx1) {
  58758. $recv($Transcript())._show_("Available commands");
  58759. $recv(self._commandLineSwitches())._do_((function(each){
  58760. return $core.withContext(function($ctx2) {
  58761. return $recv(console)._log_(each);
  58762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58763. }));
  58764. return self;
  58765. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  58766. },
  58767. args: ["args"],
  58768. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  58769. referencedClasses: ["Transcript"],
  58770. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  58771. }),
  58772. $globals.AmberCli.klass);
  58773. $core.addMethod(
  58774. $core.method({
  58775. selector: "init:",
  58776. protocol: 'commands',
  58777. fn: function (args){
  58778. var self=this;
  58779. function $Initer(){return $globals.Initer||(typeof Initer=="undefined"?nil:Initer)}
  58780. return $core.withContext(function($ctx1) {
  58781. $recv($recv($Initer())._new())._start();
  58782. return self;
  58783. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  58784. },
  58785. args: ["args"],
  58786. source: "init: args\x0a\x09Initer new start",
  58787. referencedClasses: ["Initer"],
  58788. messageSends: ["start", "new"]
  58789. }),
  58790. $globals.AmberCli.klass);
  58791. $core.addMethod(
  58792. $core.method({
  58793. selector: "main",
  58794. protocol: 'startup',
  58795. fn: function (){
  58796. var self=this;
  58797. var args;
  58798. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  58799. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  58800. return $core.withContext(function($ctx1) {
  58801. var $3,$2,$1,$4,$5;
  58802. $3=$recv("Welcome to Amber version ".__comma($recv($Smalltalk())._version())).__comma(" (NodeJS ");
  58803. $ctx1.sendIdx[","]=3;
  58804. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  58805. $ctx1.sendIdx[","]=2;
  58806. $1=$recv($2).__comma(").");
  58807. $ctx1.sendIdx[","]=1;
  58808. $recv($Transcript())._show_($1);
  58809. args=$recv(process)._argv();
  58810. $recv(args)._removeFrom_to_((1),(2));
  58811. $4=$recv(args)._isEmpty();
  58812. if($core.assert($4)){
  58813. self._help_(nil);
  58814. } else {
  58815. $5=self._handleArguments_(args);
  58816. return $5;
  58817. };
  58818. return self;
  58819. }, function($ctx1) {$ctx1.fill(self,"main",{args:args},$globals.AmberCli.klass)});
  58820. },
  58821. args: [],
  58822. 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]",
  58823. referencedClasses: ["Transcript", "Smalltalk"],
  58824. messageSends: ["show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
  58825. }),
  58826. $globals.AmberCli.klass);
  58827. $core.addMethod(
  58828. $core.method({
  58829. selector: "repl:",
  58830. protocol: 'commands',
  58831. fn: function (args){
  58832. var self=this;
  58833. function $Repl(){return $globals.Repl||(typeof Repl=="undefined"?nil:Repl)}
  58834. return $core.withContext(function($ctx1) {
  58835. var $1;
  58836. $1=$recv($recv($Repl())._new())._createInterface();
  58837. return $1;
  58838. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  58839. },
  58840. args: ["args"],
  58841. source: "repl: args\x0a\x09^ Repl new createInterface",
  58842. referencedClasses: ["Repl"],
  58843. messageSends: ["createInterface", "new"]
  58844. }),
  58845. $globals.AmberCli.klass);
  58846. $core.addMethod(
  58847. $core.method({
  58848. selector: "selectorForCommandLineSwitch:",
  58849. protocol: 'commandline',
  58850. fn: function (aSwitch){
  58851. var self=this;
  58852. var command,selector;
  58853. return $core.withContext(function($ctx1) {
  58854. var $1,$2;
  58855. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  58856. if($core.assert($1)){
  58857. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  58858. return $core.withContext(function($ctx2) {
  58859. return $recv($recv(each)._second())._asUppercase();
  58860. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58861. }))).__comma(":");
  58862. selector;
  58863. } else {
  58864. selector="help:";
  58865. selector;
  58866. };
  58867. $2=selector;
  58868. return $2;
  58869. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  58870. },
  58871. args: ["aSwitch"],
  58872. 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",
  58873. referencedClasses: [],
  58874. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  58875. }),
  58876. $globals.AmberCli.klass);
  58877. $core.addMethod(
  58878. $core.method({
  58879. selector: "serve:",
  58880. protocol: 'commands',
  58881. fn: function (args){
  58882. var self=this;
  58883. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  58884. return $core.withContext(function($ctx1) {
  58885. var $1;
  58886. $1=$recv($recv($FileServer())._createServerWithArguments_(args))._start();
  58887. return $1;
  58888. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  58889. },
  58890. args: ["args"],
  58891. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  58892. referencedClasses: ["FileServer"],
  58893. messageSends: ["start", "createServerWithArguments:"]
  58894. }),
  58895. $globals.AmberCli.klass);
  58896. $core.addMethod(
  58897. $core.method({
  58898. selector: "version:",
  58899. protocol: 'commands',
  58900. fn: function (arguments_){
  58901. var self=this;
  58902. return self;
  58903. },
  58904. args: ["arguments"],
  58905. source: "version: arguments",
  58906. referencedClasses: [],
  58907. messageSends: []
  58908. }),
  58909. $globals.AmberCli.klass);
  58910. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  58911. $core.addMethod(
  58912. $core.method({
  58913. selector: "dirname",
  58914. protocol: 'private',
  58915. fn: function (){
  58916. var self=this;
  58917. return $core.withContext(function($ctx1) {
  58918. return __dirname;
  58919. return self;
  58920. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  58921. },
  58922. args: [],
  58923. source: "dirname\x0a\x09<return __dirname>",
  58924. referencedClasses: [],
  58925. messageSends: []
  58926. }),
  58927. $globals.BaseFileManipulator);
  58928. $core.addMethod(
  58929. $core.method({
  58930. selector: "initialize",
  58931. protocol: 'initialization',
  58932. fn: function (){
  58933. var self=this;
  58934. return $core.withContext(function($ctx1) {
  58935. (
  58936. $ctx1.supercall = true,
  58937. $globals.BaseFileManipulator.superclass.fn.prototype._initialize.apply($recv(self), []));
  58938. $ctx1.supercall = false;
  58939. self["@path"]=$recv(require)._value_("path");
  58940. $ctx1.sendIdx["value:"]=1;
  58941. self["@fs"]=$recv(require)._value_("fs");
  58942. return self;
  58943. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  58944. },
  58945. args: [],
  58946. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  58947. referencedClasses: [],
  58948. messageSends: ["initialize", "value:"]
  58949. }),
  58950. $globals.BaseFileManipulator);
  58951. $core.addMethod(
  58952. $core.method({
  58953. selector: "rootDirname",
  58954. protocol: 'private',
  58955. fn: function (){
  58956. var self=this;
  58957. return $core.withContext(function($ctx1) {
  58958. var $1;
  58959. $1=$recv(self["@path"])._join_with_(self._dirname(),"..");
  58960. return $1;
  58961. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  58962. },
  58963. args: [],
  58964. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  58965. referencedClasses: [],
  58966. messageSends: ["join:with:", "dirname"]
  58967. }),
  58968. $globals.BaseFileManipulator);
  58969. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  58970. $core.addMethod(
  58971. $core.method({
  58972. selector: "initialize",
  58973. protocol: 'initialization',
  58974. fn: function (){
  58975. var self=this;
  58976. return $core.withContext(function($ctx1) {
  58977. (
  58978. $ctx1.supercall = true,
  58979. $globals.Configurator.superclass.fn.prototype._initialize.apply($recv(self), []));
  58980. $ctx1.supercall = false;
  58981. return self;
  58982. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  58983. },
  58984. args: [],
  58985. source: "initialize\x0a\x09super initialize",
  58986. referencedClasses: [],
  58987. messageSends: ["initialize"]
  58988. }),
  58989. $globals.Configurator);
  58990. $core.addMethod(
  58991. $core.method({
  58992. selector: "start",
  58993. protocol: 'action',
  58994. fn: function (){
  58995. var self=this;
  58996. return $core.withContext(function($ctx1) {
  58997. var $receiver;
  58998. self._writeConfigThenDo_((function(err){
  58999. return $core.withContext(function($ctx2) {
  59000. if(($receiver = err) == null || $receiver.isNil){
  59001. return $recv(process)._exit();
  59002. } else {
  59003. return $recv(process)._exit_((111));
  59004. };
  59005. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  59006. }));
  59007. return self;
  59008. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  59009. },
  59010. args: [],
  59011. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  59012. referencedClasses: [],
  59013. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  59014. }),
  59015. $globals.Configurator);
  59016. $core.addMethod(
  59017. $core.method({
  59018. selector: "writeConfigThenDo:",
  59019. protocol: 'action',
  59020. fn: function (aBlock){
  59021. var self=this;
  59022. return $core.withContext(function($ctx1) {
  59023. $recv($recv(require)._value_("amber-dev/lib/config"))._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  59024. return self;
  59025. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  59026. },
  59027. args: ["aBlock"],
  59028. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev/lib/config')\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  59029. referencedClasses: [],
  59030. messageSends: ["writeConfig:toFile:thenDo:", "value:", "cwd"]
  59031. }),
  59032. $globals.Configurator);
  59033. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  59034. $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.";
  59035. $core.addMethod(
  59036. $core.method({
  59037. selector: "base64Decode:",
  59038. protocol: 'private',
  59039. fn: function (aString){
  59040. var self=this;
  59041. return $core.withContext(function($ctx1) {
  59042. return (new Buffer(aString, 'base64').toString());
  59043. return self;
  59044. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  59045. },
  59046. args: ["aString"],
  59047. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  59048. referencedClasses: [],
  59049. messageSends: []
  59050. }),
  59051. $globals.FileServer);
  59052. $core.addMethod(
  59053. $core.method({
  59054. selector: "basePath",
  59055. protocol: 'accessing',
  59056. fn: function (){
  59057. var self=this;
  59058. return $core.withContext(function($ctx1) {
  59059. var $2,$1,$receiver;
  59060. $2=self["@basePath"];
  59061. if(($receiver = $2) == null || $receiver.isNil){
  59062. $1=$recv(self._class())._defaultBasePath();
  59063. } else {
  59064. $1=$2;
  59065. };
  59066. return $1;
  59067. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  59068. },
  59069. args: [],
  59070. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  59071. referencedClasses: [],
  59072. messageSends: ["ifNil:", "defaultBasePath", "class"]
  59073. }),
  59074. $globals.FileServer);
  59075. $core.addMethod(
  59076. $core.method({
  59077. selector: "basePath:",
  59078. protocol: 'accessing',
  59079. fn: function (aString){
  59080. var self=this;
  59081. return $core.withContext(function($ctx1) {
  59082. self["@basePath"]=aString;
  59083. self._validateBasePath();
  59084. return self;
  59085. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  59086. },
  59087. args: ["aString"],
  59088. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  59089. referencedClasses: [],
  59090. messageSends: ["validateBasePath"]
  59091. }),
  59092. $globals.FileServer);
  59093. $core.addMethod(
  59094. $core.method({
  59095. selector: "checkDirectoryLayout",
  59096. protocol: 'initialization',
  59097. fn: function (){
  59098. var self=this;
  59099. return $core.withContext(function($ctx1) {
  59100. var $1;
  59101. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  59102. if(!$core.assert($1)){
  59103. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  59104. $ctx1.sendIdx["warn:"]=1;
  59105. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  59106. $ctx1.sendIdx["warn:"]=2;
  59107. $recv(console)._warn_(" You can also specify a page to be served by default,");
  59108. $ctx1.sendIdx["warn:"]=3;
  59109. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  59110. };
  59111. return self;
  59112. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  59113. },
  59114. args: [],
  59115. 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.'].",
  59116. referencedClasses: [],
  59117. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  59118. }),
  59119. $globals.FileServer);
  59120. $core.addMethod(
  59121. $core.method({
  59122. selector: "fallbackPage",
  59123. protocol: 'accessing',
  59124. fn: function (){
  59125. var self=this;
  59126. var $1;
  59127. $1=self["@fallbackPage"];
  59128. return $1;
  59129. },
  59130. args: [],
  59131. source: "fallbackPage\x0a\x09^ fallbackPage",
  59132. referencedClasses: [],
  59133. messageSends: []
  59134. }),
  59135. $globals.FileServer);
  59136. $core.addMethod(
  59137. $core.method({
  59138. selector: "fallbackPage:",
  59139. protocol: 'accessing',
  59140. fn: function (aString){
  59141. var self=this;
  59142. self["@fallbackPage"]=aString;
  59143. return self;
  59144. },
  59145. args: ["aString"],
  59146. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  59147. referencedClasses: [],
  59148. messageSends: []
  59149. }),
  59150. $globals.FileServer);
  59151. $core.addMethod(
  59152. $core.method({
  59153. selector: "handleGETRequest:respondTo:",
  59154. protocol: 'request handling',
  59155. fn: function (aRequest,aResponse){
  59156. var self=this;
  59157. var uri,filename;
  59158. return $core.withContext(function($ctx1) {
  59159. var $1;
  59160. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  59161. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  59162. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  59163. return $core.withContext(function($ctx2) {
  59164. if($core.assert(aBoolean)){
  59165. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  59166. if($core.assert($1)){
  59167. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  59168. } else {
  59169. return self._respondFileNamed_to_(filename,aResponse);
  59170. };
  59171. } else {
  59172. return self._respondNotFoundTo_(aResponse);
  59173. };
  59174. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  59175. }));
  59176. return self;
  59177. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  59178. },
  59179. args: ["aRequest", "aResponse"],
  59180. 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]]]",
  59181. referencedClasses: [],
  59182. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  59183. }),
  59184. $globals.FileServer);
  59185. $core.addMethod(
  59186. $core.method({
  59187. selector: "handleOPTIONSRequest:respondTo:",
  59188. protocol: 'request handling',
  59189. fn: function (aRequest,aResponse){
  59190. var self=this;
  59191. return $core.withContext(function($ctx1) {
  59192. $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)]));
  59193. $recv(aResponse)._end();
  59194. return self;
  59195. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  59196. },
  59197. args: ["aRequest", "aResponse"],
  59198. 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",
  59199. referencedClasses: [],
  59200. messageSends: ["writeHead:options:", "end"]
  59201. }),
  59202. $globals.FileServer);
  59203. $core.addMethod(
  59204. $core.method({
  59205. selector: "handlePUTRequest:respondTo:",
  59206. protocol: 'request handling',
  59207. fn: function (aRequest,aResponse){
  59208. var self=this;
  59209. var file,stream;
  59210. return $core.withContext(function($ctx1) {
  59211. var $1,$2,$3,$4;
  59212. $1=self._isAuthenticated_(aRequest);
  59213. if(!$core.assert($1)){
  59214. self._respondAuthenticationRequiredTo_(aResponse);
  59215. return nil;
  59216. };
  59217. file=".".__comma($recv(aRequest)._url());
  59218. $ctx1.sendIdx[","]=1;
  59219. stream=$recv(self["@fs"])._createWriteStream_(file);
  59220. $recv(stream)._on_do_("error",(function(error){
  59221. return $core.withContext(function($ctx2) {
  59222. $2=console;
  59223. $3="Error creating WriteStream for file ".__comma(file);
  59224. $ctx2.sendIdx[","]=2;
  59225. $recv($2)._warn_($3);
  59226. $ctx2.sendIdx["warn:"]=1;
  59227. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  59228. $ctx2.sendIdx["warn:"]=2;
  59229. $recv(console)._warn_(" The exact error is: ".__comma(error));
  59230. return self._respondNotCreatedTo_(aResponse);
  59231. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  59232. }));
  59233. $ctx1.sendIdx["on:do:"]=1;
  59234. $recv(stream)._on_do_("close",(function(){
  59235. return $core.withContext(function($ctx2) {
  59236. return self._respondCreatedTo_(aResponse);
  59237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59238. }));
  59239. $ctx1.sendIdx["on:do:"]=2;
  59240. $recv(aRequest)._setEncoding_("utf8");
  59241. $recv(aRequest)._on_do_("data",(function(data){
  59242. return $core.withContext(function($ctx2) {
  59243. return $recv(stream)._write_(data);
  59244. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  59245. }));
  59246. $ctx1.sendIdx["on:do:"]=3;
  59247. $recv(aRequest)._on_do_("end",(function(){
  59248. return $core.withContext(function($ctx2) {
  59249. $4=$recv(stream)._writable();
  59250. if($core.assert($4)){
  59251. return $recv(stream)._end();
  59252. };
  59253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  59254. }));
  59255. return self;
  59256. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  59257. },
  59258. args: ["aRequest", "aResponse"],
  59259. 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]]",
  59260. referencedClasses: [],
  59261. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  59262. }),
  59263. $globals.FileServer);
  59264. $core.addMethod(
  59265. $core.method({
  59266. selector: "handleRequest:respondTo:",
  59267. protocol: 'request handling',
  59268. fn: function (aRequest,aResponse){
  59269. var self=this;
  59270. return $core.withContext(function($ctx1) {
  59271. var $2,$1,$4,$3,$5;
  59272. $2=$recv(aRequest)._method();
  59273. $ctx1.sendIdx["method"]=1;
  59274. $1=$recv($2).__eq("PUT");
  59275. $ctx1.sendIdx["="]=1;
  59276. if($core.assert($1)){
  59277. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  59278. };
  59279. $4=$recv(aRequest)._method();
  59280. $ctx1.sendIdx["method"]=2;
  59281. $3=$recv($4).__eq("GET");
  59282. $ctx1.sendIdx["="]=2;
  59283. if($core.assert($3)){
  59284. self._handleGETRequest_respondTo_(aRequest,aResponse);
  59285. };
  59286. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  59287. if($core.assert($5)){
  59288. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  59289. };
  59290. return self;
  59291. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  59292. },
  59293. args: ["aRequest", "aResponse"],
  59294. 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]",
  59295. referencedClasses: [],
  59296. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  59297. }),
  59298. $globals.FileServer);
  59299. $core.addMethod(
  59300. $core.method({
  59301. selector: "host",
  59302. protocol: 'accessing',
  59303. fn: function (){
  59304. var self=this;
  59305. var $1;
  59306. $1=self["@host"];
  59307. return $1;
  59308. },
  59309. args: [],
  59310. source: "host\x0a\x09^ host",
  59311. referencedClasses: [],
  59312. messageSends: []
  59313. }),
  59314. $globals.FileServer);
  59315. $core.addMethod(
  59316. $core.method({
  59317. selector: "host:",
  59318. protocol: 'accessing',
  59319. fn: function (hostname){
  59320. var self=this;
  59321. self["@host"]=hostname;
  59322. return self;
  59323. },
  59324. args: ["hostname"],
  59325. source: "host: hostname\x0a\x09host := hostname",
  59326. referencedClasses: [],
  59327. messageSends: []
  59328. }),
  59329. $globals.FileServer);
  59330. $core.addMethod(
  59331. $core.method({
  59332. selector: "initialize",
  59333. protocol: 'initialization',
  59334. fn: function (){
  59335. var self=this;
  59336. return $core.withContext(function($ctx1) {
  59337. var $1;
  59338. (
  59339. $ctx1.supercall = true,
  59340. $globals.FileServer.superclass.fn.prototype._initialize.apply($recv(self), []));
  59341. $ctx1.supercall = false;
  59342. self["@http"]=self._require_("http");
  59343. $ctx1.sendIdx["require:"]=1;
  59344. self["@util"]=self._require_("util");
  59345. $ctx1.sendIdx["require:"]=2;
  59346. self["@url"]=self._require_("url");
  59347. $1=self._class();
  59348. $ctx1.sendIdx["class"]=1;
  59349. self["@host"]=$recv($1)._defaultHost();
  59350. self["@port"]=$recv(self._class())._defaultPort();
  59351. self["@username"]=nil;
  59352. self["@password"]=nil;
  59353. self["@fallbackPage"]=nil;
  59354. return self;
  59355. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  59356. },
  59357. args: [],
  59358. 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.",
  59359. referencedClasses: [],
  59360. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  59361. }),
  59362. $globals.FileServer);
  59363. $core.addMethod(
  59364. $core.method({
  59365. selector: "isAuthenticated:",
  59366. protocol: 'private',
  59367. fn: function (aRequest){
  59368. var self=this;
  59369. var header,token,auth,parts;
  59370. return $core.withContext(function($ctx1) {
  59371. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  59372. $2=$recv(self["@username"])._isNil();
  59373. $ctx1.sendIdx["isNil"]=1;
  59374. $1=$recv($2)._and_((function(){
  59375. return $core.withContext(function($ctx2) {
  59376. return $recv(self["@password"])._isNil();
  59377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59378. }));
  59379. $ctx1.sendIdx["and:"]=1;
  59380. if($core.assert($1)){
  59381. return true;
  59382. };
  59383. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  59384. $ctx1.sendIdx["at:"]=1;
  59385. if(($receiver = $3) == null || $receiver.isNil){
  59386. header="";
  59387. } else {
  59388. header=$3;
  59389. };
  59390. $4=$recv(header)._isEmpty();
  59391. if($core.assert($4)){
  59392. return false;
  59393. } else {
  59394. $5=$recv(header)._tokenize_(" ");
  59395. $ctx1.sendIdx["tokenize:"]=1;
  59396. if(($receiver = $5) == null || $receiver.isNil){
  59397. token="";
  59398. } else {
  59399. token=$5;
  59400. };
  59401. token;
  59402. $6=$recv(token)._at_((2));
  59403. $ctx1.sendIdx["at:"]=2;
  59404. auth=self._base64Decode_($6);
  59405. auth;
  59406. parts=$recv(auth)._tokenize_(":");
  59407. parts;
  59408. $9=self["@username"];
  59409. $10=$recv(parts)._at_((1));
  59410. $ctx1.sendIdx["at:"]=3;
  59411. $8=$recv($9).__eq($10);
  59412. $ctx1.sendIdx["="]=1;
  59413. $7=$recv($8)._and_((function(){
  59414. return $core.withContext(function($ctx2) {
  59415. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  59416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  59417. }));
  59418. if($core.assert($7)){
  59419. return true;
  59420. } else {
  59421. return false;
  59422. };
  59423. };
  59424. return self;
  59425. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  59426. },
  59427. args: ["aRequest"],
  59428. 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].",
  59429. referencedClasses: [],
  59430. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
  59431. }),
  59432. $globals.FileServer);
  59433. $core.addMethod(
  59434. $core.method({
  59435. selector: "password:",
  59436. protocol: 'accessing',
  59437. fn: function (aPassword){
  59438. var self=this;
  59439. self["@password"]=aPassword;
  59440. return self;
  59441. },
  59442. args: ["aPassword"],
  59443. source: "password: aPassword\x0a\x09password := aPassword.",
  59444. referencedClasses: [],
  59445. messageSends: []
  59446. }),
  59447. $globals.FileServer);
  59448. $core.addMethod(
  59449. $core.method({
  59450. selector: "port",
  59451. protocol: 'accessing',
  59452. fn: function (){
  59453. var self=this;
  59454. var $1;
  59455. $1=self["@port"];
  59456. return $1;
  59457. },
  59458. args: [],
  59459. source: "port\x0a\x09^ port",
  59460. referencedClasses: [],
  59461. messageSends: []
  59462. }),
  59463. $globals.FileServer);
  59464. $core.addMethod(
  59465. $core.method({
  59466. selector: "port:",
  59467. protocol: 'accessing',
  59468. fn: function (aNumber){
  59469. var self=this;
  59470. self["@port"]=aNumber;
  59471. return self;
  59472. },
  59473. args: ["aNumber"],
  59474. source: "port: aNumber\x0a\x09port := aNumber",
  59475. referencedClasses: [],
  59476. messageSends: []
  59477. }),
  59478. $globals.FileServer);
  59479. $core.addMethod(
  59480. $core.method({
  59481. selector: "require:",
  59482. protocol: 'private',
  59483. fn: function (aModuleString){
  59484. var self=this;
  59485. return $core.withContext(function($ctx1) {
  59486. var $1;
  59487. $1=$recv(require)._value_(aModuleString);
  59488. return $1;
  59489. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  59490. },
  59491. args: ["aModuleString"],
  59492. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  59493. referencedClasses: [],
  59494. messageSends: ["value:"]
  59495. }),
  59496. $globals.FileServer);
  59497. $core.addMethod(
  59498. $core.method({
  59499. selector: "respondAuthenticationRequiredTo:",
  59500. protocol: 'request handling',
  59501. fn: function (aResponse){
  59502. var self=this;
  59503. return $core.withContext(function($ctx1) {
  59504. var $1;
  59505. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  59506. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  59507. $1=$recv(aResponse)._end();
  59508. return self;
  59509. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  59510. },
  59511. args: ["aResponse"],
  59512. 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.",
  59513. referencedClasses: [],
  59514. messageSends: ["writeHead:options:", "write:", "end"]
  59515. }),
  59516. $globals.FileServer);
  59517. $core.addMethod(
  59518. $core.method({
  59519. selector: "respondCreatedTo:",
  59520. protocol: 'request handling',
  59521. fn: function (aResponse){
  59522. var self=this;
  59523. return $core.withContext(function($ctx1) {
  59524. var $1;
  59525. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  59526. $1=$recv(aResponse)._end();
  59527. return self;
  59528. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  59529. },
  59530. args: ["aResponse"],
  59531. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  59532. referencedClasses: [],
  59533. messageSends: ["writeHead:options:", "end"]
  59534. }),
  59535. $globals.FileServer);
  59536. $core.addMethod(
  59537. $core.method({
  59538. selector: "respondDirectoryNamed:from:to:",
  59539. protocol: 'request handling',
  59540. fn: function (aDirname,aUrl,aResponse){
  59541. var self=this;
  59542. return $core.withContext(function($ctx1) {
  59543. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  59544. $2=$recv(aUrl)._pathname();
  59545. $ctx1.sendIdx["pathname"]=1;
  59546. $1=$recv($2)._endsWith_("/");
  59547. if($core.assert($1)){
  59548. $3=$recv(aDirname).__comma("index.html");
  59549. $ctx1.sendIdx[","]=1;
  59550. self._respondFileNamed_to_($3,aResponse);
  59551. } else {
  59552. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  59553. $7=$recv(aUrl)._search();
  59554. if(($receiver = $7) == null || $receiver.isNil){
  59555. $6="";
  59556. } else {
  59557. $6=$7;
  59558. };
  59559. $4=$recv($5).__comma($6);
  59560. $ctx1.sendIdx[","]=2;
  59561. self._respondRedirect_to_($4,aResponse);
  59562. };
  59563. return self;
  59564. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  59565. },
  59566. args: ["aDirname", "aUrl", "aResponse"],
  59567. 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]",
  59568. referencedClasses: [],
  59569. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  59570. }),
  59571. $globals.FileServer);
  59572. $core.addMethod(
  59573. $core.method({
  59574. selector: "respondFileNamed:to:",
  59575. protocol: 'request handling',
  59576. fn: function (aFilename,aResponse){
  59577. var self=this;
  59578. var type,filename;
  59579. return $core.withContext(function($ctx1) {
  59580. var $1,$2,$3,$4,$5;
  59581. filename=aFilename;
  59582. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  59583. return $core.withContext(function($ctx2) {
  59584. $1=$recv(ex)._notNil();
  59585. if($core.assert($1)){
  59586. $2=console;
  59587. $3=$recv(filename).__comma(" does not exist");
  59588. $ctx2.sendIdx[","]=1;
  59589. $recv($2)._log_($3);
  59590. return self._respondNotFoundTo_(aResponse);
  59591. } else {
  59592. type=$recv(self._class())._mimeTypeFor_(filename);
  59593. type;
  59594. $4=$recv(type).__eq("application/javascript");
  59595. if($core.assert($4)){
  59596. type=$recv(type).__comma(";charset=utf-8");
  59597. type;
  59598. };
  59599. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  59600. $recv(aResponse)._write_encoding_(file,"binary");
  59601. $5=$recv(aResponse)._end();
  59602. return $5;
  59603. };
  59604. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  59605. }));
  59606. return self;
  59607. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  59608. },
  59609. args: ["aFilename", "aResponse"],
  59610. 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]]",
  59611. referencedClasses: [],
  59612. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  59613. }),
  59614. $globals.FileServer);
  59615. $core.addMethod(
  59616. $core.method({
  59617. selector: "respondInternalErrorTo:",
  59618. protocol: 'request handling',
  59619. fn: function (aResponse){
  59620. var self=this;
  59621. return $core.withContext(function($ctx1) {
  59622. var $1;
  59623. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  59624. $recv(aResponse)._write_("500 Internal server error");
  59625. $1=$recv(aResponse)._end();
  59626. return self;
  59627. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  59628. },
  59629. args: ["aResponse"],
  59630. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  59631. referencedClasses: [],
  59632. messageSends: ["writeHead:options:", "write:", "end"]
  59633. }),
  59634. $globals.FileServer);
  59635. $core.addMethod(
  59636. $core.method({
  59637. selector: "respondNotCreatedTo:",
  59638. protocol: 'request handling',
  59639. fn: function (aResponse){
  59640. var self=this;
  59641. return $core.withContext(function($ctx1) {
  59642. var $1;
  59643. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  59644. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  59645. $1=$recv(aResponse)._end();
  59646. return self;
  59647. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  59648. },
  59649. args: ["aResponse"],
  59650. 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.",
  59651. referencedClasses: [],
  59652. messageSends: ["writeHead:options:", "write:", "end"]
  59653. }),
  59654. $globals.FileServer);
  59655. $core.addMethod(
  59656. $core.method({
  59657. selector: "respondNotFoundTo:",
  59658. protocol: 'request handling',
  59659. fn: function (aResponse){
  59660. var self=this;
  59661. return $core.withContext(function($ctx1) {
  59662. var $2,$1,$3,$4;
  59663. $2=self._fallbackPage();
  59664. $ctx1.sendIdx["fallbackPage"]=1;
  59665. $1=$recv($2)._isNil();
  59666. if(!$core.assert($1)){
  59667. $3=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  59668. return $3;
  59669. };
  59670. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  59671. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  59672. $ctx1.sendIdx["write:"]=1;
  59673. $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>");
  59674. $ctx1.sendIdx["write:"]=2;
  59675. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  59676. $ctx1.sendIdx["write:"]=3;
  59677. $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>");
  59678. $ctx1.sendIdx["write:"]=4;
  59679. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  59680. $ctx1.sendIdx["write:"]=5;
  59681. $recv(aResponse)._write_("</ul></p></body></html>");
  59682. $4=$recv(aResponse)._end();
  59683. return self;
  59684. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  59685. },
  59686. args: ["aResponse"],
  59687. 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",
  59688. referencedClasses: [],
  59689. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  59690. }),
  59691. $globals.FileServer);
  59692. $core.addMethod(
  59693. $core.method({
  59694. selector: "respondOKTo:",
  59695. protocol: 'request handling',
  59696. fn: function (aResponse){
  59697. var self=this;
  59698. return $core.withContext(function($ctx1) {
  59699. var $1;
  59700. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  59701. $1=$recv(aResponse)._end();
  59702. return self;
  59703. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  59704. },
  59705. args: ["aResponse"],
  59706. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  59707. referencedClasses: [],
  59708. messageSends: ["writeHead:options:", "end"]
  59709. }),
  59710. $globals.FileServer);
  59711. $core.addMethod(
  59712. $core.method({
  59713. selector: "respondRedirect:to:",
  59714. protocol: 'request handling',
  59715. fn: function (aString,aResponse){
  59716. var self=this;
  59717. return $core.withContext(function($ctx1) {
  59718. var $1;
  59719. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  59720. $1=$recv(aResponse)._end();
  59721. return self;
  59722. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  59723. },
  59724. args: ["aString", "aResponse"],
  59725. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  59726. referencedClasses: [],
  59727. messageSends: ["writeHead:options:", "end"]
  59728. }),
  59729. $globals.FileServer);
  59730. $core.addMethod(
  59731. $core.method({
  59732. selector: "start",
  59733. protocol: 'starting',
  59734. fn: function (){
  59735. var self=this;
  59736. return $core.withContext(function($ctx1) {
  59737. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$11;
  59738. self._checkDirectoryLayout();
  59739. $1=$recv(self["@http"])._createServer_((function(request,response){
  59740. return $core.withContext(function($ctx2) {
  59741. return self._handleRequest_respondTo_(request,response);
  59742. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  59743. }));
  59744. $recv($1)._on_do_("error",(function(error){
  59745. return $core.withContext(function($ctx2) {
  59746. $2=console;
  59747. $3="Error starting server: ".__comma(error);
  59748. $ctx2.sendIdx[","]=1;
  59749. return $recv($2)._log_($3);
  59750. $ctx2.sendIdx["log:"]=1;
  59751. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  59752. }));
  59753. $ctx1.sendIdx["on:do:"]=1;
  59754. $recv($1)._on_do_("listening",(function(){
  59755. return $core.withContext(function($ctx2) {
  59756. $4=console;
  59757. $8=self._host();
  59758. $ctx2.sendIdx["host"]=1;
  59759. $7="Starting file server on http://".__comma($8);
  59760. $6=$recv($7).__comma(":");
  59761. $ctx2.sendIdx[","]=3;
  59762. $10=self._port();
  59763. $ctx2.sendIdx["port"]=1;
  59764. $9=$recv($10)._asString();
  59765. $5=$recv($6).__comma($9);
  59766. $ctx2.sendIdx[","]=2;
  59767. return $recv($4)._log_($5);
  59768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59769. }));
  59770. $11=$recv($1)._listen_host_(self._port(),self._host());
  59771. return self;
  59772. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  59773. },
  59774. args: [],
  59775. 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.",
  59776. referencedClasses: [],
  59777. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  59778. }),
  59779. $globals.FileServer);
  59780. $core.addMethod(
  59781. $core.method({
  59782. selector: "startOn:",
  59783. protocol: 'starting',
  59784. fn: function (aPort){
  59785. var self=this;
  59786. return $core.withContext(function($ctx1) {
  59787. self._port_(aPort);
  59788. self._start();
  59789. return self;
  59790. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  59791. },
  59792. args: ["aPort"],
  59793. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  59794. referencedClasses: [],
  59795. messageSends: ["port:", "start"]
  59796. }),
  59797. $globals.FileServer);
  59798. $core.addMethod(
  59799. $core.method({
  59800. selector: "username:",
  59801. protocol: 'accessing',
  59802. fn: function (aUsername){
  59803. var self=this;
  59804. self["@username"]=aUsername;
  59805. return self;
  59806. },
  59807. args: ["aUsername"],
  59808. source: "username: aUsername\x0a\x09username := aUsername.",
  59809. referencedClasses: [],
  59810. messageSends: []
  59811. }),
  59812. $globals.FileServer);
  59813. $core.addMethod(
  59814. $core.method({
  59815. selector: "validateBasePath",
  59816. protocol: 'private',
  59817. fn: function (){
  59818. var self=this;
  59819. return $core.withContext(function($ctx1) {
  59820. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  59821. $1=self["@fs"];
  59822. $2=self._basePath();
  59823. $ctx1.sendIdx["basePath"]=1;
  59824. $recv($1)._stat_then_($2,(function(err,stat){
  59825. return $core.withContext(function($ctx2) {
  59826. if(($receiver = err) == null || $receiver.isNil){
  59827. $3=$recv(stat)._isDirectory();
  59828. if(!$core.assert($3)){
  59829. $4=console;
  59830. $7=self._basePath();
  59831. $ctx2.sendIdx["basePath"]=2;
  59832. $6="Warning: --base-path parameter ".__comma($7);
  59833. $ctx2.sendIdx[","]=2;
  59834. $5=$recv($6).__comma(" is not a directory.");
  59835. $ctx2.sendIdx[","]=1;
  59836. return $recv($4)._warn_($5);
  59837. $ctx2.sendIdx["warn:"]=1;
  59838. };
  59839. } else {
  59840. $8=console;
  59841. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  59842. $ctx2.sendIdx[","]=3;
  59843. return $recv($8)._warn_($9);
  59844. };
  59845. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  59846. }));
  59847. return self;
  59848. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  59849. },
  59850. args: [],
  59851. 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.' ]].",
  59852. referencedClasses: [],
  59853. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  59854. }),
  59855. $globals.FileServer);
  59856. $core.addMethod(
  59857. $core.method({
  59858. selector: "withBasePath:",
  59859. protocol: 'private',
  59860. fn: function (aBaseRelativePath){
  59861. var self=this;
  59862. return $core.withContext(function($ctx1) {
  59863. var $1;
  59864. $1=$recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  59865. return $1;
  59866. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  59867. },
  59868. args: ["aBaseRelativePath"],
  59869. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  59870. referencedClasses: [],
  59871. messageSends: ["join:with:", "basePath"]
  59872. }),
  59873. $globals.FileServer);
  59874. $core.addMethod(
  59875. $core.method({
  59876. selector: "writeData:toFileNamed:",
  59877. protocol: 'private',
  59878. fn: function (data,aFilename){
  59879. var self=this;
  59880. return $core.withContext(function($ctx1) {
  59881. $recv(console)._log_(aFilename);
  59882. return self;
  59883. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  59884. },
  59885. args: ["data", "aFilename"],
  59886. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  59887. referencedClasses: [],
  59888. messageSends: ["log:"]
  59889. }),
  59890. $globals.FileServer);
  59891. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  59892. $core.addMethod(
  59893. $core.method({
  59894. selector: "commandLineSwitches",
  59895. protocol: 'accessing',
  59896. fn: function (){
  59897. var self=this;
  59898. var switches;
  59899. return $core.withContext(function($ctx1) {
  59900. var $1;
  59901. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  59902. return $core.withContext(function($ctx2) {
  59903. return $recv(each)._selector();
  59904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59905. }));
  59906. $ctx1.sendIdx["collect:"]=1;
  59907. switches=$recv(switches)._select_((function(each){
  59908. return $core.withContext(function($ctx2) {
  59909. return $recv(each)._match_("^[^:]*:$");
  59910. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  59911. }));
  59912. switches=$recv(switches)._collect_((function(each){
  59913. return $core.withContext(function($ctx2) {
  59914. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  59915. $ctx2.sendIdx["replace:with:"]=1;
  59916. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  59917. }));
  59918. $1=switches;
  59919. return $1;
  59920. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  59921. },
  59922. args: [],
  59923. 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",
  59924. referencedClasses: [],
  59925. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  59926. }),
  59927. $globals.FileServer.klass);
  59928. $core.addMethod(
  59929. $core.method({
  59930. selector: "createServerWithArguments:",
  59931. protocol: 'initialization',
  59932. fn: function (options){
  59933. var self=this;
  59934. var server,popFront,front,optionName,optionValue,switches;
  59935. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  59936. return $core.withContext(function($ctx1) {
  59937. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11;
  59938. var $early={};
  59939. try {
  59940. switches=self._commandLineSwitches();
  59941. server=self._new();
  59942. $recv(options)._ifEmpty_((function(){
  59943. $1=server;
  59944. throw $early=[$1];
  59945. }));
  59946. $2=$recv($recv(options)._size())._even();
  59947. if(!$core.assert($2)){
  59948. $recv(console)._log_("Using default parameters.");
  59949. $ctx1.sendIdx["log:"]=1;
  59950. $3=console;
  59951. $4="Wrong commandline options or not enough arguments for: ".__comma(options);
  59952. $ctx1.sendIdx[","]=1;
  59953. $recv($3)._log_($4);
  59954. $ctx1.sendIdx["log:"]=2;
  59955. $5=console;
  59956. $6="Use any of the following ones: ".__comma(switches);
  59957. $ctx1.sendIdx[","]=2;
  59958. $recv($5)._log_($6);
  59959. $ctx1.sendIdx["log:"]=3;
  59960. $7=server;
  59961. return $7;
  59962. };
  59963. popFront=(function(args){
  59964. return $core.withContext(function($ctx2) {
  59965. front=$recv(args)._first();
  59966. front;
  59967. $recv(args)._remove_(front);
  59968. return front;
  59969. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  59970. });
  59971. $recv((function(){
  59972. return $core.withContext(function($ctx2) {
  59973. return $recv(options)._notEmpty();
  59974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  59975. }))._whileTrue_((function(){
  59976. return $core.withContext(function($ctx2) {
  59977. optionName=$recv(popFront)._value_(options);
  59978. $ctx2.sendIdx["value:"]=1;
  59979. optionName;
  59980. optionValue=$recv(popFront)._value_(options);
  59981. optionValue;
  59982. $8=$recv(switches)._includes_(optionName);
  59983. if($core.assert($8)){
  59984. optionName=self._selectorForCommandLineSwitch_(optionName);
  59985. optionName;
  59986. return $recv(server)._perform_withArguments_(optionName,$recv($Array())._with_(optionValue));
  59987. } else {
  59988. $9=console;
  59989. $10=$recv(optionName).__comma(" is not a valid commandline option");
  59990. $ctx2.sendIdx[","]=3;
  59991. $recv($9)._log_($10);
  59992. $ctx2.sendIdx["log:"]=4;
  59993. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  59994. };
  59995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  59996. }));
  59997. $11=server;
  59998. return $11;
  59999. }
  60000. catch(e) {if(e===$early)return e[0]; throw e}
  60001. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  60002. },
  60003. args: ["options"],
  60004. 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.",
  60005. referencedClasses: ["Array"],
  60006. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  60007. }),
  60008. $globals.FileServer.klass);
  60009. $core.addMethod(
  60010. $core.method({
  60011. selector: "defaultBasePath",
  60012. protocol: 'accessing',
  60013. fn: function (){
  60014. var self=this;
  60015. return "./";
  60016. },
  60017. args: [],
  60018. source: "defaultBasePath\x0a\x09^ './'",
  60019. referencedClasses: [],
  60020. messageSends: []
  60021. }),
  60022. $globals.FileServer.klass);
  60023. $core.addMethod(
  60024. $core.method({
  60025. selector: "defaultHost",
  60026. protocol: 'accessing',
  60027. fn: function (){
  60028. var self=this;
  60029. return "127.0.0.1";
  60030. },
  60031. args: [],
  60032. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  60033. referencedClasses: [],
  60034. messageSends: []
  60035. }),
  60036. $globals.FileServer.klass);
  60037. $core.addMethod(
  60038. $core.method({
  60039. selector: "defaultMimeTypes",
  60040. protocol: 'accessing',
  60041. fn: function (){
  60042. var self=this;
  60043. var $1;
  60044. $1=$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"]);
  60045. return $1;
  60046. },
  60047. args: [],
  60048. 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}",
  60049. referencedClasses: [],
  60050. messageSends: []
  60051. }),
  60052. $globals.FileServer.klass);
  60053. $core.addMethod(
  60054. $core.method({
  60055. selector: "defaultPort",
  60056. protocol: 'accessing',
  60057. fn: function (){
  60058. var self=this;
  60059. return (4000);
  60060. },
  60061. args: [],
  60062. source: "defaultPort\x0a\x09^ 4000",
  60063. referencedClasses: [],
  60064. messageSends: []
  60065. }),
  60066. $globals.FileServer.klass);
  60067. $core.addMethod(
  60068. $core.method({
  60069. selector: "main",
  60070. protocol: 'initialization',
  60071. fn: function (){
  60072. var self=this;
  60073. var fileServer,args;
  60074. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  60075. return $core.withContext(function($ctx1) {
  60076. var $1,$2;
  60077. var $early={};
  60078. try {
  60079. args=$recv(process)._argv();
  60080. $recv(args)._removeFrom_to_((1),(3));
  60081. $recv(args)._detect_ifNone_((function(each){
  60082. return $core.withContext(function($ctx2) {
  60083. $1=$recv(each).__eq("--help");
  60084. if($core.assert($1)){
  60085. return $recv($FileServer())._printHelp();
  60086. };
  60087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60088. }),(function(){
  60089. return $core.withContext(function($ctx2) {
  60090. fileServer=$recv($FileServer())._createServerWithArguments_(args);
  60091. fileServer;
  60092. $2=$recv(fileServer)._start();
  60093. throw $early=[$2];
  60094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  60095. }));
  60096. return self;
  60097. }
  60098. catch(e) {if(e===$early)return e[0]; throw e}
  60099. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  60100. },
  60101. args: [],
  60102. 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]",
  60103. referencedClasses: ["FileServer"],
  60104. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  60105. }),
  60106. $globals.FileServer.klass);
  60107. $core.addMethod(
  60108. $core.method({
  60109. selector: "mimeTypeFor:",
  60110. protocol: 'accessing',
  60111. fn: function (aString){
  60112. var self=this;
  60113. return $core.withContext(function($ctx1) {
  60114. var $1;
  60115. $1=$recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  60116. return "text/plain";
  60117. }));
  60118. return $1;
  60119. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  60120. },
  60121. args: ["aString"],
  60122. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  60123. referencedClasses: [],
  60124. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  60125. }),
  60126. $globals.FileServer.klass);
  60127. $core.addMethod(
  60128. $core.method({
  60129. selector: "mimeTypes",
  60130. protocol: 'accessing',
  60131. fn: function (){
  60132. var self=this;
  60133. return $core.withContext(function($ctx1) {
  60134. var $2,$1,$receiver;
  60135. $2=self["@mimeTypes"];
  60136. if(($receiver = $2) == null || $receiver.isNil){
  60137. self["@mimeTypes"]=self._defaultMimeTypes();
  60138. $1=self["@mimeTypes"];
  60139. } else {
  60140. $1=$2;
  60141. };
  60142. return $1;
  60143. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  60144. },
  60145. args: [],
  60146. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  60147. referencedClasses: [],
  60148. messageSends: ["ifNil:", "defaultMimeTypes"]
  60149. }),
  60150. $globals.FileServer.klass);
  60151. $core.addMethod(
  60152. $core.method({
  60153. selector: "printHelp",
  60154. protocol: 'accessing',
  60155. fn: function (){
  60156. var self=this;
  60157. return $core.withContext(function($ctx1) {
  60158. $recv(console)._log_("Available commandline options are:");
  60159. $ctx1.sendIdx["log:"]=1;
  60160. $recv(console)._log_("--help");
  60161. $ctx1.sendIdx["log:"]=2;
  60162. $recv(self._commandLineSwitches())._do_((function(each){
  60163. return $core.withContext(function($ctx2) {
  60164. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  60165. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60166. }));
  60167. return self;
  60168. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  60169. },
  60170. args: [],
  60171. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  60172. referencedClasses: [],
  60173. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  60174. }),
  60175. $globals.FileServer.klass);
  60176. $core.addMethod(
  60177. $core.method({
  60178. selector: "selectorForCommandLineSwitch:",
  60179. protocol: 'accessing',
  60180. fn: function (aSwitch){
  60181. var self=this;
  60182. return $core.withContext(function($ctx1) {
  60183. var $2,$1;
  60184. $2=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  60185. return $core.withContext(function($ctx2) {
  60186. return $recv($recv(each)._second())._asUppercase();
  60187. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60188. }));
  60189. $ctx1.sendIdx["replace:with:"]=1;
  60190. $1=$recv($2).__comma(":");
  60191. return $1;
  60192. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  60193. },
  60194. args: ["aSwitch"],
  60195. 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 ]), ':'",
  60196. referencedClasses: [],
  60197. messageSends: [",", "replace:with:", "asUppercase", "second"]
  60198. }),
  60199. $globals.FileServer.klass);
  60200. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  60201. $core.addMethod(
  60202. $core.method({
  60203. selector: "bowerInstallThenDo:",
  60204. protocol: 'action',
  60205. fn: function (aBlock){
  60206. var self=this;
  60207. var child;
  60208. return $core.withContext(function($ctx1) {
  60209. var $1,$4,$3,$2;
  60210. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  60211. $1=child;
  60212. $recv($1)._on_do_("error",aBlock);
  60213. $ctx1.sendIdx["on:do:"]=1;
  60214. $2=$recv($1)._on_do_("close",(function(code){
  60215. return $core.withContext(function($ctx2) {
  60216. $4=$recv(code).__eq((0));
  60217. if($core.assert($4)){
  60218. $3=nil;
  60219. } else {
  60220. $3=code;
  60221. };
  60222. return $recv(aBlock)._value_($3);
  60223. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60224. }));
  60225. return self;
  60226. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60227. },
  60228. args: ["aBlock"],
  60229. 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 ]) ]",
  60230. referencedClasses: [],
  60231. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60232. }),
  60233. $globals.Initer);
  60234. $core.addMethod(
  60235. $core.method({
  60236. selector: "finishMessage",
  60237. protocol: 'action',
  60238. fn: function (){
  60239. var self=this;
  60240. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  60241. return $core.withContext(function($ctx1) {
  60242. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($String())._lf()));
  60243. $recv((function(){
  60244. }))._valueWithTimeout_((600));
  60245. return self;
  60246. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  60247. },
  60248. args: [],
  60249. 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",
  60250. referencedClasses: ["String"],
  60251. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  60252. }),
  60253. $globals.Initer);
  60254. $core.addMethod(
  60255. $core.method({
  60256. selector: "gruntInitThenDo:",
  60257. protocol: 'action',
  60258. fn: function (aBlock){
  60259. var self=this;
  60260. var child,sanitizedTemplatePath;
  60261. return $core.withContext(function($ctx1) {
  60262. var $1,$4,$3,$2;
  60263. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  60264. $ctx1.sendIdx["replace:with:"]=1;
  60265. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  60266. $1=child;
  60267. $recv($1)._on_do_("error",aBlock);
  60268. $ctx1.sendIdx["on:do:"]=1;
  60269. $2=$recv($1)._on_do_("close",(function(code){
  60270. return $core.withContext(function($ctx2) {
  60271. $4=$recv(code).__eq((0));
  60272. if($core.assert($4)){
  60273. $3=nil;
  60274. } else {
  60275. $3=code;
  60276. };
  60277. return $recv(aBlock)._value_($3);
  60278. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60279. }));
  60280. return self;
  60281. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  60282. },
  60283. args: ["aBlock"],
  60284. 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 ]) ]",
  60285. referencedClasses: [],
  60286. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60287. }),
  60288. $globals.Initer);
  60289. $core.addMethod(
  60290. $core.method({
  60291. selector: "gruntThenDo:",
  60292. protocol: 'action',
  60293. fn: function (aBlock){
  60294. var self=this;
  60295. var child;
  60296. return $core.withContext(function($ctx1) {
  60297. var $1,$4,$3,$2;
  60298. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  60299. $1=child;
  60300. $recv($1)._on_do_("error",aBlock);
  60301. $ctx1.sendIdx["on:do:"]=1;
  60302. $2=$recv($1)._on_do_("close",(function(code){
  60303. return $core.withContext(function($ctx2) {
  60304. $4=$recv(code).__eq((0));
  60305. if($core.assert($4)){
  60306. $3=nil;
  60307. } else {
  60308. $3=code;
  60309. };
  60310. return $recv(aBlock)._value_($3);
  60311. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60312. }));
  60313. return self;
  60314. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60315. },
  60316. args: ["aBlock"],
  60317. 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 ]) ]",
  60318. referencedClasses: [],
  60319. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60320. }),
  60321. $globals.Initer);
  60322. $core.addMethod(
  60323. $core.method({
  60324. selector: "initialize",
  60325. protocol: 'initialization',
  60326. fn: function (){
  60327. var self=this;
  60328. return $core.withContext(function($ctx1) {
  60329. (
  60330. $ctx1.supercall = true,
  60331. $globals.Initer.superclass.fn.prototype._initialize.apply($recv(self), []));
  60332. $ctx1.supercall = false;
  60333. self["@childProcess"]=$recv(require)._value_("child_process");
  60334. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  60335. return self;
  60336. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  60337. },
  60338. args: [],
  60339. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  60340. referencedClasses: [],
  60341. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  60342. }),
  60343. $globals.Initer);
  60344. $core.addMethod(
  60345. $core.method({
  60346. selector: "npmInstallThenDo:",
  60347. protocol: 'action',
  60348. fn: function (aBlock){
  60349. var self=this;
  60350. var child;
  60351. return $core.withContext(function($ctx1) {
  60352. var $1;
  60353. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  60354. $1=$recv(child)._stdout();
  60355. $ctx1.sendIdx["stdout"]=1;
  60356. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  60357. return self;
  60358. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60359. },
  60360. args: ["aBlock"],
  60361. 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 }",
  60362. referencedClasses: [],
  60363. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  60364. }),
  60365. $globals.Initer);
  60366. $core.addMethod(
  60367. $core.method({
  60368. selector: "npmScriptForModule:named:",
  60369. protocol: 'npm',
  60370. fn: function (aString,anotherString){
  60371. var self=this;
  60372. var modulePath,packageJson,binSection,scriptPath;
  60373. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  60374. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60375. return $core.withContext(function($ctx1) {
  60376. var $1,$3,$4,$2,$5,$6;
  60377. $1=self["@path"];
  60378. $3=$recv($JSObjectProxy())._on_(require);
  60379. $4=$recv(aString).__comma("/package.json");
  60380. $ctx1.sendIdx[","]=1;
  60381. $2=$recv($3)._resolve_($4);
  60382. modulePath=$recv($1)._dirname_($2);
  60383. packageJson=$recv($Smalltalk())._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  60384. binSection=$recv(packageJson)._at_("bin");
  60385. $ctx1.sendIdx["at:"]=1;
  60386. $5=$recv(binSection)._isString();
  60387. if($core.assert($5)){
  60388. scriptPath=binSection;
  60389. } else {
  60390. scriptPath=$recv(binSection)._at_(anotherString);
  60391. };
  60392. $6=$recv(self["@path"])._join_with_(modulePath,scriptPath);
  60393. return $6;
  60394. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  60395. },
  60396. args: ["aString", "anotherString"],
  60397. 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",
  60398. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  60399. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  60400. }),
  60401. $globals.Initer);
  60402. $core.addMethod(
  60403. $core.method({
  60404. selector: "start",
  60405. protocol: 'action',
  60406. fn: function (){
  60407. var self=this;
  60408. return $core.withContext(function($ctx1) {
  60409. var $1,$2,$3,$4,$5,$6,$7,$8,$receiver;
  60410. self._gruntInitThenDo_((function(error){
  60411. return $core.withContext(function($ctx2) {
  60412. if(($receiver = error) == null || $receiver.isNil){
  60413. return self._bowerInstallThenDo_((function(error2){
  60414. return $core.withContext(function($ctx3) {
  60415. if(($receiver = error2) == null || $receiver.isNil){
  60416. return self._npmInstallThenDo_((function(error3){
  60417. return $core.withContext(function($ctx4) {
  60418. if(($receiver = error3) == null || $receiver.isNil){
  60419. return self._gruntThenDo_((function(error4){
  60420. return $core.withContext(function($ctx5) {
  60421. if(($receiver = error4) == null || $receiver.isNil){
  60422. self._finishMessage();
  60423. return $recv(process)._exit();
  60424. } else {
  60425. $7=console;
  60426. $recv($7)._log_("grunt exec error:");
  60427. $ctx5.sendIdx["log:"]=7;
  60428. $8=$recv($7)._log_(error4);
  60429. $8;
  60430. return $recv(process)._exit_((104));
  60431. };
  60432. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  60433. }));
  60434. } else {
  60435. $5=console;
  60436. $recv($5)._log_("npm install exec error:");
  60437. $ctx4.sendIdx["log:"]=5;
  60438. $6=$recv($5)._log_(error3);
  60439. $ctx4.sendIdx["log:"]=6;
  60440. $6;
  60441. return $recv(process)._exit_((103));
  60442. $ctx4.sendIdx["exit:"]=3;
  60443. };
  60444. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  60445. }));
  60446. } else {
  60447. $3=console;
  60448. $recv($3)._log_("bower install exec error:");
  60449. $ctx3.sendIdx["log:"]=3;
  60450. $4=$recv($3)._log_(error2);
  60451. $ctx3.sendIdx["log:"]=4;
  60452. $4;
  60453. return $recv(process)._exit_((102));
  60454. $ctx3.sendIdx["exit:"]=2;
  60455. };
  60456. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  60457. }));
  60458. } else {
  60459. $1=console;
  60460. $recv($1)._log_("grunt-init exec error:");
  60461. $ctx2.sendIdx["log:"]=1;
  60462. $2=$recv($1)._log_(error);
  60463. $ctx2.sendIdx["log:"]=2;
  60464. $2;
  60465. return $recv(process)._exit_((101));
  60466. $ctx2.sendIdx["exit:"]=1;
  60467. };
  60468. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  60469. }));
  60470. return self;
  60471. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  60472. },
  60473. args: [],
  60474. 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 ]]]]]]]]",
  60475. referencedClasses: [],
  60476. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  60477. }),
  60478. $globals.Initer);
  60479. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  60480. $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.";
  60481. $core.addMethod(
  60482. $core.method({
  60483. selector: "addVariableNamed:to:",
  60484. protocol: 'private',
  60485. fn: function (aString,anObject){
  60486. var self=this;
  60487. var newClass,newObject;
  60488. return $core.withContext(function($ctx1) {
  60489. var $1;
  60490. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  60491. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  60492. newObject=$recv(newClass)._new();
  60493. self._setPreviousVariablesFor_from_(newObject,anObject);
  60494. $1=newObject;
  60495. return $1;
  60496. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  60497. },
  60498. args: ["aString", "anObject"],
  60499. 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",
  60500. referencedClasses: [],
  60501. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  60502. }),
  60503. $globals.Repl);
  60504. $core.addMethod(
  60505. $core.method({
  60506. selector: "assignNewVariable:do:",
  60507. protocol: 'private',
  60508. fn: function (buffer,aBlock){
  60509. var self=this;
  60510. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  60511. function $ConsoleErrorHandler(){return $globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)}
  60512. return $core.withContext(function($ctx1) {
  60513. var $3,$4,$2,$1,$receiver;
  60514. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  60515. var varName,value;
  60516. return $core.withContext(function($ctx2) {
  60517. if(($receiver = name) == null || $receiver.isNil){
  60518. varName=self._nextResultName();
  60519. } else {
  60520. varName=name;
  60521. };
  60522. varName;
  60523. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  60524. self["@session"];
  60525. $recv((function(){
  60526. return $core.withContext(function($ctx3) {
  60527. $3=$recv(varName).__comma(" := ");
  60528. if(($receiver = expr) == null || $receiver.isNil){
  60529. $4=buffer;
  60530. } else {
  60531. $4=expr;
  60532. };
  60533. $2=$recv($3).__comma($4);
  60534. $ctx3.sendIdx[","]=1;
  60535. value=self._eval_on_($2,self["@session"]);
  60536. return value;
  60537. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  60538. }))._on_do_($Error(),(function(e){
  60539. return $core.withContext(function($ctx3) {
  60540. $recv($recv($ConsoleErrorHandler())._new())._logError_(e);
  60541. value=nil;
  60542. return value;
  60543. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  60544. }));
  60545. return $recv(aBlock)._value_value_(varName,value);
  60546. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  60547. }));
  60548. return $1;
  60549. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  60550. },
  60551. args: ["buffer", "aBlock"],
  60552. 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]",
  60553. referencedClasses: ["Error", "ConsoleErrorHandler"],
  60554. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  60555. }),
  60556. $globals.Repl);
  60557. $core.addMethod(
  60558. $core.method({
  60559. selector: "clearScreen",
  60560. protocol: 'actions',
  60561. fn: function (){
  60562. var self=this;
  60563. var esc,cls;
  60564. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  60565. return $core.withContext(function($ctx1) {
  60566. var $1;
  60567. esc=$recv($String())._fromCharCode_((27));
  60568. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  60569. $ctx1.sendIdx[","]=2;
  60570. cls=$recv($1).__comma("[0;0f");
  60571. $ctx1.sendIdx[","]=1;
  60572. $recv($recv(process)._stdout())._write_(cls);
  60573. $recv(self["@interface"])._prompt();
  60574. return self;
  60575. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  60576. },
  60577. args: [],
  60578. 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",
  60579. referencedClasses: ["String"],
  60580. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  60581. }),
  60582. $globals.Repl);
  60583. $core.addMethod(
  60584. $core.method({
  60585. selector: "close",
  60586. protocol: 'actions',
  60587. fn: function (){
  60588. var self=this;
  60589. return $core.withContext(function($ctx1) {
  60590. $recv($recv(process)._stdin())._destroy();
  60591. return self;
  60592. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  60593. },
  60594. args: [],
  60595. source: "close\x0a\x09process stdin destroy",
  60596. referencedClasses: [],
  60597. messageSends: ["destroy", "stdin"]
  60598. }),
  60599. $globals.Repl);
  60600. $core.addMethod(
  60601. $core.method({
  60602. selector: "commands",
  60603. protocol: 'accessing',
  60604. fn: function (){
  60605. var self=this;
  60606. var $1;
  60607. $1=self["@commands"];
  60608. return $1;
  60609. },
  60610. args: [],
  60611. source: "commands\x0a\x09^ commands",
  60612. referencedClasses: [],
  60613. messageSends: []
  60614. }),
  60615. $globals.Repl);
  60616. $core.addMethod(
  60617. $core.method({
  60618. selector: "createInterface",
  60619. protocol: 'actions',
  60620. fn: function (){
  60621. var self=this;
  60622. return $core.withContext(function($ctx1) {
  60623. var $1;
  60624. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  60625. $recv(self["@interface"])._on_do_("line",(function(buffer){
  60626. return $core.withContext(function($ctx2) {
  60627. return self._processLine_(buffer);
  60628. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  60629. }));
  60630. $ctx1.sendIdx["on:do:"]=1;
  60631. $recv(self["@interface"])._on_do_("close",(function(){
  60632. return $core.withContext(function($ctx2) {
  60633. return self._close();
  60634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60635. }));
  60636. self._printWelcome();
  60637. self._setupHotkeys();
  60638. $1=self._setPrompt();
  60639. $recv(self["@interface"])._prompt();
  60640. return self;
  60641. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  60642. },
  60643. args: [],
  60644. 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",
  60645. referencedClasses: [],
  60646. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  60647. }),
  60648. $globals.Repl);
  60649. $core.addMethod(
  60650. $core.method({
  60651. selector: "encapsulateVariable:withValue:in:",
  60652. protocol: 'private',
  60653. fn: function (aString,anObject,aClass){
  60654. var self=this;
  60655. var compiler;
  60656. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  60657. return $core.withContext(function($ctx1) {
  60658. var $1,$4,$3,$2,$5,$6;
  60659. compiler=$recv($Compiler())._new();
  60660. $1=compiler;
  60661. $4=$recv(aString).__comma(": anObject ^ ");
  60662. $ctx1.sendIdx[","]=3;
  60663. $3=$recv($4).__comma(aString);
  60664. $ctx1.sendIdx[","]=2;
  60665. $2=$recv($3).__comma(" := anObject");
  60666. $ctx1.sendIdx[","]=1;
  60667. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  60668. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  60669. $5=compiler;
  60670. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  60671. $ctx1.sendIdx[","]=4;
  60672. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  60673. return self;
  60674. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  60675. },
  60676. args: ["aString", "anObject", "aClass"],
  60677. 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'.",
  60678. referencedClasses: ["Compiler"],
  60679. messageSends: ["new", "install:forClass:protocol:", ","]
  60680. }),
  60681. $globals.Repl);
  60682. $core.addMethod(
  60683. $core.method({
  60684. selector: "eval:",
  60685. protocol: 'actions',
  60686. fn: function (buffer){
  60687. var self=this;
  60688. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  60689. return $core.withContext(function($ctx1) {
  60690. var $1;
  60691. $1=self._eval_on_(buffer,$recv($DoIt())._new());
  60692. return $1;
  60693. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  60694. },
  60695. args: ["buffer"],
  60696. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  60697. referencedClasses: ["DoIt"],
  60698. messageSends: ["eval:on:", "new"]
  60699. }),
  60700. $globals.Repl);
  60701. $core.addMethod(
  60702. $core.method({
  60703. selector: "eval:on:",
  60704. protocol: 'actions',
  60705. fn: function (buffer,anObject){
  60706. var self=this;
  60707. var result;
  60708. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  60709. return $core.withContext(function($ctx1) {
  60710. var $1,$2,$3;
  60711. $1=$recv(buffer)._isEmpty();
  60712. if(!$core.assert($1)){
  60713. $recv((function(){
  60714. return $core.withContext(function($ctx2) {
  60715. result=$recv($recv($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  60716. return result;
  60717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60718. }))._tryCatch_((function(e){
  60719. return $core.withContext(function($ctx2) {
  60720. $2=$recv(e)._isSmalltalkError();
  60721. if($core.assert($2)){
  60722. return $recv(e)._resignal();
  60723. } else {
  60724. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  60725. };
  60726. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
  60727. }));
  60728. };
  60729. $3=result;
  60730. return $3;
  60731. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  60732. },
  60733. args: ["buffer", "anObject"],
  60734. 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",
  60735. referencedClasses: ["Compiler"],
  60736. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  60737. }),
  60738. $globals.Repl);
  60739. $core.addMethod(
  60740. $core.method({
  60741. selector: "executeCommand:",
  60742. protocol: 'private',
  60743. fn: function (aString){
  60744. var self=this;
  60745. return $core.withContext(function($ctx1) {
  60746. var $1;
  60747. var $early={};
  60748. try {
  60749. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  60750. return $core.withContext(function($ctx2) {
  60751. $1=$recv(names)._includes_(aString);
  60752. if($core.assert($1)){
  60753. $recv(cmd)._value();
  60754. throw $early=[true];
  60755. };
  60756. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  60757. }));
  60758. return false;
  60759. }
  60760. catch(e) {if(e===$early)return e[0]; throw e}
  60761. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  60762. },
  60763. args: ["aString"],
  60764. 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",
  60765. referencedClasses: [],
  60766. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  60767. }),
  60768. $globals.Repl);
  60769. $core.addMethod(
  60770. $core.method({
  60771. selector: "initialize",
  60772. protocol: 'initialization',
  60773. fn: function (){
  60774. var self=this;
  60775. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  60776. return $core.withContext(function($ctx1) {
  60777. (
  60778. $ctx1.supercall = true,
  60779. $globals.Repl.superclass.fn.prototype._initialize.apply($recv(self), []));
  60780. $ctx1.supercall = false;
  60781. self["@session"]=$recv($DoIt())._new();
  60782. self["@readline"]=$recv(require)._value_("readline");
  60783. $ctx1.sendIdx["value:"]=1;
  60784. self["@util"]=$recv(require)._value_("util");
  60785. self._setupCommands();
  60786. return self;
  60787. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  60788. },
  60789. args: [],
  60790. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  60791. referencedClasses: ["DoIt"],
  60792. messageSends: ["initialize", "new", "value:", "setupCommands"]
  60793. }),
  60794. $globals.Repl);
  60795. $core.addMethod(
  60796. $core.method({
  60797. selector: "instanceVariableNamesFor:",
  60798. protocol: 'private',
  60799. fn: function (aClass){
  60800. var self=this;
  60801. return $core.withContext(function($ctx1) {
  60802. var $2,$3,$1,$receiver;
  60803. $2=$recv(aClass)._superclass();
  60804. $ctx1.sendIdx["superclass"]=1;
  60805. if(($receiver = $2) == null || $receiver.isNil){
  60806. $1=$recv(aClass)._instanceVariableNames();
  60807. } else {
  60808. $3=$recv(aClass)._instanceVariableNames();
  60809. $ctx1.sendIdx["instanceVariableNames"]=1;
  60810. $1=$recv($3)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  60811. };
  60812. return $1;
  60813. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  60814. },
  60815. args: ["aClass"],
  60816. 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]",
  60817. referencedClasses: [],
  60818. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  60819. }),
  60820. $globals.Repl);
  60821. $core.addMethod(
  60822. $core.method({
  60823. selector: "isIdentifier:",
  60824. protocol: 'private',
  60825. fn: function (aString){
  60826. var self=this;
  60827. return $core.withContext(function($ctx1) {
  60828. var $1;
  60829. $1=$recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  60830. return $1;
  60831. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  60832. },
  60833. args: ["aString"],
  60834. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  60835. referencedClasses: [],
  60836. messageSends: ["match:", "asRegexp"]
  60837. }),
  60838. $globals.Repl);
  60839. $core.addMethod(
  60840. $core.method({
  60841. selector: "isVariableDefined:",
  60842. protocol: 'private',
  60843. fn: function (aString){
  60844. var self=this;
  60845. return $core.withContext(function($ctx1) {
  60846. var $1;
  60847. $1=$recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  60848. return $1;
  60849. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  60850. },
  60851. args: ["aString"],
  60852. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  60853. referencedClasses: [],
  60854. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  60855. }),
  60856. $globals.Repl);
  60857. $core.addMethod(
  60858. $core.method({
  60859. selector: "nextResultName",
  60860. protocol: 'private',
  60861. fn: function (){
  60862. var self=this;
  60863. return $core.withContext(function($ctx1) {
  60864. var $1,$2,$receiver;
  60865. $1=self["@resultCount"];
  60866. if(($receiver = $1) == null || $receiver.isNil){
  60867. self["@resultCount"]=(1);
  60868. } else {
  60869. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  60870. };
  60871. $2="res".__comma($recv(self["@resultCount"])._asString());
  60872. return $2;
  60873. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  60874. },
  60875. args: [],
  60876. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  60877. referencedClasses: [],
  60878. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  60879. }),
  60880. $globals.Repl);
  60881. $core.addMethod(
  60882. $core.method({
  60883. selector: "onKeyPress:",
  60884. protocol: 'private',
  60885. fn: function (key){
  60886. var self=this;
  60887. return $core.withContext(function($ctx1) {
  60888. var $1;
  60889. $1=$recv($recv(key)._ctrl())._and_((function(){
  60890. return $core.withContext(function($ctx2) {
  60891. return $recv($recv(key)._name()).__eq("l");
  60892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60893. }));
  60894. if($core.assert($1)){
  60895. self._clearScreen();
  60896. };
  60897. return self;
  60898. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  60899. },
  60900. args: ["key"],
  60901. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  60902. referencedClasses: [],
  60903. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  60904. }),
  60905. $globals.Repl);
  60906. $core.addMethod(
  60907. $core.method({
  60908. selector: "parseAssignment:do:",
  60909. protocol: 'private',
  60910. fn: function (aString,aBlock){
  60911. var self=this;
  60912. var assignment;
  60913. return $core.withContext(function($ctx1) {
  60914. var $3,$2,$1;
  60915. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  60916. return $core.withContext(function($ctx2) {
  60917. return $recv(s)._trimBoth();
  60918. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  60919. }));
  60920. $2=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  60921. return $core.withContext(function($ctx2) {
  60922. $3=$recv(assignment)._first();
  60923. $ctx2.sendIdx["first"]=1;
  60924. return self._isIdentifier_($3);
  60925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60926. }));
  60927. if($core.assert($2)){
  60928. $1=$recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  60929. $ctx1.sendIdx["value:value:"]=1;
  60930. } else {
  60931. $1=$recv(aBlock)._value_value_(nil,nil);
  60932. };
  60933. return $1;
  60934. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  60935. },
  60936. args: ["aString", "aBlock"],
  60937. 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 ]",
  60938. referencedClasses: [],
  60939. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  60940. }),
  60941. $globals.Repl);
  60942. $core.addMethod(
  60943. $core.method({
  60944. selector: "presentResultNamed:withValue:",
  60945. protocol: 'private',
  60946. fn: function (varName,value){
  60947. var self=this;
  60948. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  60949. return $core.withContext(function($ctx1) {
  60950. var $3,$2,$1,$4;
  60951. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  60952. $ctx1.sendIdx[","]=3;
  60953. $2=$recv($3).__comma(" = ");
  60954. $ctx1.sendIdx[","]=2;
  60955. $1=$recv($2).__comma($recv(value)._asString());
  60956. $ctx1.sendIdx[","]=1;
  60957. $recv($Transcript())._show_($1);
  60958. $4=$recv($Transcript())._cr();
  60959. $recv(self["@interface"])._prompt();
  60960. return self;
  60961. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  60962. },
  60963. args: ["varName", "value"],
  60964. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  60965. referencedClasses: ["Transcript"],
  60966. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  60967. }),
  60968. $globals.Repl);
  60969. $core.addMethod(
  60970. $core.method({
  60971. selector: "printWelcome",
  60972. protocol: 'actions',
  60973. fn: function (){
  60974. var self=this;
  60975. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  60976. return $core.withContext(function($ctx1) {
  60977. var $1;
  60978. $recv($Transcript())._show_("Type :q to exit.");
  60979. $1=$recv($Transcript())._cr();
  60980. return self;
  60981. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  60982. },
  60983. args: [],
  60984. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  60985. referencedClasses: ["Transcript"],
  60986. messageSends: ["show:", "cr"]
  60987. }),
  60988. $globals.Repl);
  60989. $core.addMethod(
  60990. $core.method({
  60991. selector: "processLine:",
  60992. protocol: 'private',
  60993. fn: function (buffer){
  60994. var self=this;
  60995. var show;
  60996. return $core.withContext(function($ctx1) {
  60997. var $1,$2;
  60998. show=(function(varName,value){
  60999. return $core.withContext(function($ctx2) {
  61000. return self._presentResultNamed_withValue_(varName,value);
  61001. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  61002. });
  61003. $1=self._executeCommand_(buffer);
  61004. if(!$core.assert($1)){
  61005. $2=self._isVariableDefined_(buffer);
  61006. if($core.assert($2)){
  61007. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  61008. } else {
  61009. self._assignNewVariable_do_(buffer,show);
  61010. };
  61011. };
  61012. return self;
  61013. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  61014. },
  61015. args: ["buffer"],
  61016. 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]]",
  61017. referencedClasses: [],
  61018. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  61019. }),
  61020. $globals.Repl);
  61021. $core.addMethod(
  61022. $core.method({
  61023. selector: "prompt",
  61024. protocol: 'accessing',
  61025. fn: function (){
  61026. var self=this;
  61027. return "amber >> ";
  61028. },
  61029. args: [],
  61030. source: "prompt\x0a\x09^ 'amber >> '",
  61031. referencedClasses: [],
  61032. messageSends: []
  61033. }),
  61034. $globals.Repl);
  61035. $core.addMethod(
  61036. $core.method({
  61037. selector: "setPreviousVariablesFor:from:",
  61038. protocol: 'private',
  61039. fn: function (newObject,oldObject){
  61040. var self=this;
  61041. return $core.withContext(function($ctx1) {
  61042. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  61043. return $core.withContext(function($ctx2) {
  61044. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  61045. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61046. }));
  61047. return self;
  61048. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  61049. },
  61050. args: ["newObject", "oldObject"],
  61051. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  61052. referencedClasses: [],
  61053. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  61054. }),
  61055. $globals.Repl);
  61056. $core.addMethod(
  61057. $core.method({
  61058. selector: "setPrompt",
  61059. protocol: 'actions',
  61060. fn: function (){
  61061. var self=this;
  61062. return $core.withContext(function($ctx1) {
  61063. $recv(self["@interface"])._setPrompt_(self._prompt());
  61064. return self;
  61065. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  61066. },
  61067. args: [],
  61068. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  61069. referencedClasses: [],
  61070. messageSends: ["setPrompt:", "prompt"]
  61071. }),
  61072. $globals.Repl);
  61073. $core.addMethod(
  61074. $core.method({
  61075. selector: "setupCommands",
  61076. protocol: 'initialization',
  61077. fn: function (){
  61078. var self=this;
  61079. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  61080. return $core.withContext(function($ctx1) {
  61081. var $2,$1;
  61082. $2=$recv([":q"]).__minus_gt((function(){
  61083. return $core.withContext(function($ctx2) {
  61084. return $recv(process)._exit();
  61085. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61086. }));
  61087. $ctx1.sendIdx["->"]=1;
  61088. $1=[$2,$recv([""]).__minus_gt((function(){
  61089. return $core.withContext(function($ctx2) {
  61090. return $recv(self["@interface"])._prompt();
  61091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61092. }))];
  61093. self["@commands"]=$recv($Dictionary())._from_($1);
  61094. return self;
  61095. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  61096. },
  61097. args: [],
  61098. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  61099. referencedClasses: ["Dictionary"],
  61100. messageSends: ["from:", "->", "exit", "prompt"]
  61101. }),
  61102. $globals.Repl);
  61103. $core.addMethod(
  61104. $core.method({
  61105. selector: "setupHotkeys",
  61106. protocol: 'initialization',
  61107. fn: function (){
  61108. var self=this;
  61109. return $core.withContext(function($ctx1) {
  61110. var $receiver;
  61111. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  61112. return $core.withContext(function($ctx2) {
  61113. if(($receiver = key) == null || $receiver.isNil){
  61114. return key;
  61115. } else {
  61116. return self._onKeyPress_(key);
  61117. };
  61118. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  61119. }));
  61120. return self;
  61121. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  61122. },
  61123. args: [],
  61124. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  61125. referencedClasses: [],
  61126. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  61127. }),
  61128. $globals.Repl);
  61129. $core.addMethod(
  61130. $core.method({
  61131. selector: "subclass:withVariable:",
  61132. protocol: 'private',
  61133. fn: function (aClass,varName){
  61134. var self=this;
  61135. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  61136. return $core.withContext(function($ctx1) {
  61137. var $1;
  61138. $1=$recv($recv($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  61139. return $1;
  61140. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  61141. },
  61142. args: ["aClass", "varName"],
  61143. 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'",
  61144. referencedClasses: ["ClassBuilder"],
  61145. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  61146. }),
  61147. $globals.Repl);
  61148. $core.addMethod(
  61149. $core.method({
  61150. selector: "subclassNameFor:",
  61151. protocol: 'private',
  61152. fn: function (aClass){
  61153. var self=this;
  61154. return $core.withContext(function($ctx1) {
  61155. var $3,$2,$7,$6,$5,$4,$8,$1,$receiver;
  61156. $3=$recv(aClass)._name();
  61157. $ctx1.sendIdx["name"]=1;
  61158. $2=$recv($3)._matchesOf_("\x5cd+$");
  61159. $ctx1.sendIdx["matchesOf:"]=1;
  61160. if(($receiver = $2) == null || $receiver.isNil){
  61161. $1=$recv($recv(aClass)._name()).__comma("2");
  61162. } else {
  61163. var counter;
  61164. $7=$recv(aClass)._name();
  61165. $ctx1.sendIdx["name"]=2;
  61166. $6=$recv($7)._matchesOf_("\x5cd+$");
  61167. $5=$recv($6)._first();
  61168. $4=$recv($5)._asNumber();
  61169. counter=$recv($4).__plus((1));
  61170. counter;
  61171. $8=$recv(aClass)._name();
  61172. $ctx1.sendIdx["name"]=3;
  61173. $1=$recv($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  61174. };
  61175. return $1;
  61176. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  61177. },
  61178. args: ["aClass"],
  61179. 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'].",
  61180. referencedClasses: [],
  61181. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  61182. }),
  61183. $globals.Repl);
  61184. $core.addMethod(
  61185. $core.method({
  61186. selector: "main",
  61187. protocol: 'initialization',
  61188. fn: function (){
  61189. var self=this;
  61190. return $core.withContext(function($ctx1) {
  61191. $recv(self._new())._createInterface();
  61192. return self;
  61193. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  61194. },
  61195. args: [],
  61196. source: "main\x0a\x09self new createInterface",
  61197. referencedClasses: [],
  61198. messageSends: ["createInterface", "new"]
  61199. }),
  61200. $globals.Repl.klass);
  61201. });
  61202. (function () {
  61203. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  61204. amber.initialize();
  61205. amber.globals.AmberCli._main();
  61206. });
  61207. }());
  61208. require(["app"]);
  61209. });
  61210. define.require('__wrap__');
  61211. }((function amdefine(module, requireFn) {
  61212. 'use strict';
  61213. var defineCache = {},
  61214. loaderCache = {},
  61215. alreadyCalled = false,
  61216. path = require('path'),
  61217. makeRequire, stringRequire;
  61218. /**
  61219. * Trims the . and .. from an array of path segments.
  61220. * It will keep a leading path segment if a .. will become
  61221. * the first path segment, to help with module name lookups,
  61222. * which act like paths, but can be remapped. But the end result,
  61223. * all paths that use this function should look normalized.
  61224. * NOTE: this method MODIFIES the input array.
  61225. * @param {Array} ary the array of path segments.
  61226. */
  61227. function trimDots(ary) {
  61228. var i, part;
  61229. for (i = 0; ary[i]; i+= 1) {
  61230. part = ary[i];
  61231. if (part === '.') {
  61232. ary.splice(i, 1);
  61233. i -= 1;
  61234. } else if (part === '..') {
  61235. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  61236. //End of the line. Keep at least one non-dot
  61237. //path segment at the front so it can be mapped
  61238. //correctly to disk. Otherwise, there is likely
  61239. //no path mapping for a path starting with '..'.
  61240. //This can still fail, but catches the most reasonable
  61241. //uses of ..
  61242. break;
  61243. } else if (i > 0) {
  61244. ary.splice(i - 1, 2);
  61245. i -= 2;
  61246. }
  61247. }
  61248. }
  61249. }
  61250. function normalize(name, baseName) {
  61251. var baseParts;
  61252. //Adjust any relative paths.
  61253. if (name && name.charAt(0) === '.') {
  61254. //If have a base name, try to normalize against it,
  61255. //otherwise, assume it is a top-level require that will
  61256. //be relative to baseUrl in the end.
  61257. if (baseName) {
  61258. baseParts = baseName.split('/');
  61259. baseParts = baseParts.slice(0, baseParts.length - 1);
  61260. baseParts = baseParts.concat(name.split('/'));
  61261. trimDots(baseParts);
  61262. name = baseParts.join('/');
  61263. }
  61264. }
  61265. return name;
  61266. }
  61267. /**
  61268. * Create the normalize() function passed to a loader plugin's
  61269. * normalize method.
  61270. */
  61271. function makeNormalize(relName) {
  61272. return function (name) {
  61273. return normalize(name, relName);
  61274. };
  61275. }
  61276. function makeLoad(id) {
  61277. function load(value) {
  61278. loaderCache[id] = value;
  61279. }
  61280. load.fromText = function (id, text) {
  61281. //This one is difficult because the text can/probably uses
  61282. //define, and any relative paths and requires should be relative
  61283. //to that id was it would be found on disk. But this would require
  61284. //bootstrapping a module/require fairly deeply from node core.
  61285. //Not sure how best to go about that yet.
  61286. throw new Error('amdefine does not implement load.fromText');
  61287. };
  61288. return load;
  61289. }
  61290. makeRequire = function (systemRequire, exports, module, relId) {
  61291. function amdRequire(deps, callback) {
  61292. if (typeof deps === 'string') {
  61293. //Synchronous, single module require('')
  61294. return stringRequire(systemRequire, exports, module, deps, relId);
  61295. } else {
  61296. //Array of dependencies with a callback.
  61297. //Convert the dependencies to modules.
  61298. deps = deps.map(function (depName) {
  61299. return stringRequire(systemRequire, exports, module, depName, relId);
  61300. });
  61301. //Wait for next tick to call back the require call.
  61302. if (callback) {
  61303. process.nextTick(function () {
  61304. callback.apply(null, deps);
  61305. });
  61306. }
  61307. }
  61308. }
  61309. amdRequire.toUrl = function (filePath) {
  61310. if (filePath.indexOf('.') === 0) {
  61311. return normalize(filePath, path.dirname(module.filename));
  61312. } else {
  61313. return filePath;
  61314. }
  61315. };
  61316. return amdRequire;
  61317. };
  61318. //Favor explicit value, passed in if the module wants to support Node 0.4.
  61319. requireFn = requireFn || function req() {
  61320. return module.require.apply(module, arguments);
  61321. };
  61322. function runFactory(id, deps, factory) {
  61323. var r, e, m, result;
  61324. if (id) {
  61325. e = loaderCache[id] = {};
  61326. m = {
  61327. id: id,
  61328. uri: __filename,
  61329. exports: e
  61330. };
  61331. r = makeRequire(requireFn, e, m, id);
  61332. } else {
  61333. //Only support one define call per file
  61334. if (alreadyCalled) {
  61335. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  61336. }
  61337. alreadyCalled = true;
  61338. //Use the real variables from node
  61339. //Use module.exports for exports, since
  61340. //the exports in here is amdefine exports.
  61341. e = module.exports;
  61342. m = module;
  61343. r = makeRequire(requireFn, e, m, module.id);
  61344. }
  61345. //If there are dependencies, they are strings, so need
  61346. //to convert them to dependency values.
  61347. if (deps) {
  61348. deps = deps.map(function (depName) {
  61349. return r(depName);
  61350. });
  61351. }
  61352. //Call the factory with the right dependencies.
  61353. if (typeof factory === 'function') {
  61354. result = factory.apply(m.exports, deps);
  61355. } else {
  61356. result = factory;
  61357. }
  61358. if (result !== undefined) {
  61359. m.exports = result;
  61360. if (id) {
  61361. loaderCache[id] = m.exports;
  61362. }
  61363. }
  61364. }
  61365. stringRequire = function (systemRequire, exports, module, id, relId) {
  61366. //Split the ID by a ! so that
  61367. var index = id.indexOf('!'),
  61368. originalId = id,
  61369. prefix, plugin;
  61370. if (index === -1) {
  61371. id = normalize(id, relId);
  61372. //Straight module lookup. If it is one of the special dependencies,
  61373. //deal with it, otherwise, delegate to node.
  61374. if (id === 'require') {
  61375. return makeRequire(systemRequire, exports, module, relId);
  61376. } else if (id === 'exports') {
  61377. return exports;
  61378. } else if (id === 'module') {
  61379. return module;
  61380. } else if (loaderCache.hasOwnProperty(id)) {
  61381. return loaderCache[id];
  61382. } else if (defineCache[id]) {
  61383. runFactory.apply(null, defineCache[id]);
  61384. return loaderCache[id];
  61385. } else {
  61386. if(systemRequire) {
  61387. return systemRequire(originalId);
  61388. } else {
  61389. throw new Error('No module with ID: ' + id);
  61390. }
  61391. }
  61392. } else {
  61393. //There is a plugin in play.
  61394. prefix = id.substring(0, index);
  61395. id = id.substring(index + 1, id.length);
  61396. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  61397. if (plugin.normalize) {
  61398. id = plugin.normalize(id, makeNormalize(relId));
  61399. } else {
  61400. //Normalize the ID normally.
  61401. id = normalize(id, relId);
  61402. }
  61403. if (loaderCache[id]) {
  61404. return loaderCache[id];
  61405. } else {
  61406. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  61407. return loaderCache[id];
  61408. }
  61409. }
  61410. };
  61411. //Create a define function specific to the module asking for amdefine.
  61412. function define(id, deps, factory) {
  61413. if (Array.isArray(id)) {
  61414. factory = deps;
  61415. deps = id;
  61416. id = undefined;
  61417. } else if (typeof id !== 'string') {
  61418. factory = id;
  61419. id = deps = undefined;
  61420. }
  61421. if (deps && !Array.isArray(deps)) {
  61422. factory = deps;
  61423. deps = undefined;
  61424. }
  61425. if (!deps) {
  61426. deps = ['require', 'exports', 'module'];
  61427. }
  61428. //Set up properties for this module. If an ID, then use
  61429. //internal cache. If no ID, then use the external variables
  61430. //for this node module.
  61431. if (id) {
  61432. //Put the module in deep freeze until there is a
  61433. //require call for it.
  61434. defineCache[id] = [id, deps, factory];
  61435. } else {
  61436. runFactory(id, deps, factory);
  61437. }
  61438. }
  61439. //define.require, which has access to all the values in the
  61440. //cache. Useful for AMD modules that all have IDs in the file,
  61441. //but need to finally export a value to node based on one of those
  61442. //IDs.
  61443. define.require = function (id) {
  61444. if (loaderCache[id]) {
  61445. return loaderCache[id];
  61446. }
  61447. if (defineCache[id]) {
  61448. runFactory.apply(null, defineCache[id]);
  61449. return loaderCache[id];
  61450. }
  61451. };
  61452. define.amd = {};
  61453. return define;
  61454. }(module)), require));