amber-cli.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865
  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. if (js == null)
  653. return null;
  654. var readObject = js.constructor === Object;
  655. var readArray = js.constructor === Array;
  656. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  657. for (var i in js) {
  658. if (readObject) {
  659. object._at_put_(i, st.readJSObject(js[i]));
  660. }
  661. if (readArray) {
  662. object[i] = st.readJSObject(js[i]);
  663. }
  664. }
  665. return object;
  666. };
  667. /* Boolean assertion */
  668. st.assert = function (shouldBeBoolean) {
  669. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  670. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  671. shouldBeBoolean = shouldBeBoolean.valueOf();
  672. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  673. }
  674. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  675. };
  676. /* List of all reserved words in JavaScript. They may not be used as variables
  677. in Smalltalk. */
  678. // list of reserved JavaScript keywords as of
  679. // http://es5.github.com/#x7.6.1.1
  680. // and
  681. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  682. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  683. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  684. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  685. 'try', 'typeof', 'var', 'void', 'while', 'with',
  686. // Amber protected words: these should not be compiled as-is when in code
  687. 'arguments',
  688. // ES5: future use: http://es5.github.com/#x7.6.1.2
  689. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  690. // ES5: future use in strict mode
  691. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  692. 'public', 'static', 'yield'];
  693. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  694. }
  695. function RuntimeBrik(brikz, st) {
  696. brikz.ensure("selectorConversion");
  697. var root = brikz.ensure("root");
  698. var nil = root.nil;
  699. var SmalltalkObject = root.Object;
  700. function SmalltalkMethodContext(home, setup) {
  701. this.sendIdx = {};
  702. this.homeContext = home;
  703. this.setup = setup || function () {
  704. };
  705. this.supercall = false;
  706. }
  707. inherits(SmalltalkMethodContext, SmalltalkObject);
  708. this.__init__ = function () {
  709. st.addPackage("Kernel-Methods");
  710. st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, globals.Object, false);
  711. // Fallbacks
  712. SmalltalkMethodContext.prototype.locals = {};
  713. SmalltalkMethodContext.prototype.receiver = null;
  714. SmalltalkMethodContext.prototype.selector = null;
  715. SmalltalkMethodContext.prototype.lookupClass = null;
  716. SmalltalkMethodContext.prototype.fill = function (receiver, selector, locals, lookupClass) {
  717. this.receiver = receiver;
  718. this.selector = selector;
  719. this.locals = locals || {};
  720. this.lookupClass = lookupClass;
  721. if (this.homeContext) {
  722. this.homeContext.evaluatedSelector = selector;
  723. }
  724. };
  725. SmalltalkMethodContext.prototype.fillBlock = function (locals, ctx, index) {
  726. this.locals = locals || {};
  727. this.outerContext = ctx;
  728. this.index = index || 0;
  729. };
  730. SmalltalkMethodContext.prototype.init = function () {
  731. var home = this.homeContext;
  732. if (home) {
  733. home.init();
  734. }
  735. this.setup(this);
  736. };
  737. SmalltalkMethodContext.prototype.method = function () {
  738. var method;
  739. var lookup = this.lookupClass || this.receiver.klass;
  740. while (!method && lookup) {
  741. method = lookup.methods[st.js2st(this.selector)];
  742. lookup = lookup.superclass;
  743. }
  744. return method;
  745. };
  746. };
  747. /* This is the current call context object. While it is publicly available,
  748. Use smalltalk.getThisContext() instead which will answer a safe copy of
  749. the current context */
  750. var thisContext = null;
  751. st.withContext = function (worker, setup) {
  752. if (thisContext) {
  753. return inContext(worker, setup);
  754. } else {
  755. return inContextWithErrorHandling(worker, setup);
  756. }
  757. };
  758. function inContextWithErrorHandling(worker, setup) {
  759. try {
  760. return inContext(worker, setup);
  761. } catch (error) {
  762. handleError(error);
  763. thisContext = null;
  764. // Rethrow the error in any case.
  765. error.amberHandled = true;
  766. throw error;
  767. }
  768. }
  769. function inContext(worker, setup) {
  770. var oldContext = thisContext;
  771. thisContext = new SmalltalkMethodContext(thisContext, setup);
  772. var result = worker(thisContext);
  773. thisContext = oldContext;
  774. return result;
  775. }
  776. /* Wrap a JavaScript exception in a Smalltalk Exception.
  777. In case of a RangeError, stub the stack after 100 contexts to
  778. avoid another RangeError later when the stack is manipulated. */
  779. function wrappedError(error) {
  780. var errorWrapper = globals.JavaScriptException._on_(error);
  781. // Add the error to the context, so it is visible in the stack
  782. try {
  783. errorWrapper._signal();
  784. } catch (ex) {
  785. }
  786. var context = st.getThisContext();
  787. if (isRangeError(error)) {
  788. stubContextStack(context);
  789. }
  790. errorWrapper._context_(context);
  791. return errorWrapper;
  792. }
  793. /* Stub the context stack after 100 contexts */
  794. function stubContextStack(context) {
  795. var currentContext = context;
  796. var contexts = 0;
  797. while (contexts < 100) {
  798. if (currentContext) {
  799. currentContext = currentContext.homeContext;
  800. }
  801. contexts++;
  802. }
  803. if (currentContext) {
  804. currentContext.homeContext = undefined;
  805. }
  806. }
  807. function isRangeError(error) {
  808. return error instanceof RangeError;
  809. }
  810. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  811. (See the Smalltalk class ErrorHandler and its subclasses */
  812. function handleError(error) {
  813. if (!error.smalltalkError) {
  814. error = wrappedError(error);
  815. }
  816. globals.ErrorHandler._handleError_(error);
  817. }
  818. /* Handle thisContext pseudo variable */
  819. st.getThisContext = function () {
  820. if (thisContext) {
  821. thisContext.init();
  822. return thisContext;
  823. } else {
  824. return nil;
  825. }
  826. };
  827. }
  828. function MessageSendBrik(brikz, st) {
  829. brikz.ensure("selectorConversion");
  830. var nil = brikz.ensure("root").nil;
  831. /* Handles unhandled errors during message sends */
  832. // simply send the message and handle #dnu:
  833. st.send = function (receiver, jsSelector, args, klass) {
  834. var method;
  835. if (receiver == null) {
  836. receiver = nil;
  837. }
  838. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  839. if (method) {
  840. return method.apply(receiver, args || []);
  841. } else {
  842. return messageNotUnderstood(receiver, st.js2st(jsSelector), args);
  843. }
  844. };
  845. function invokeDnuMethod(receiver, stSelector, args) {
  846. return receiver._doesNotUnderstand_(
  847. globals.Message._new()
  848. ._selector_(stSelector)
  849. ._arguments_([].slice.call(args))
  850. );
  851. }
  852. /* Handles #dnu: *and* JavaScript method calls.
  853. if the receiver has no klass, we consider it a JS object (outside of the
  854. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  855. function messageNotUnderstood(receiver, stSelector, args) {
  856. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  857. return invokeDnuMethod(receiver, stSelector, args);
  858. }
  859. /* Call a method of a JS object, or answer a property if it exists.
  860. Else try wrapping a JSObjectProxy around the receiver. */
  861. var propertyName = st.st2prop(stSelector);
  862. if (!(propertyName in receiver)) {
  863. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  864. }
  865. return accessJavaScript(receiver, propertyName, args);
  866. }
  867. /* If the object property is a function, then call it, except if it starts with
  868. an uppercase character (we probably want to answer the function itself in this
  869. case and send it #new from Amber).
  870. Converts keyword-based selectors by using the first
  871. keyword only, but keeping all message arguments.
  872. Example:
  873. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  874. function accessJavaScript(receiver, propertyName, args) {
  875. var propertyValue = receiver[propertyName];
  876. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  877. return propertyValue.apply(receiver, args || []);
  878. } else if (args.length > 0) {
  879. receiver[propertyName] = args[0];
  880. return nil;
  881. } else {
  882. return propertyValue;
  883. }
  884. }
  885. st.accessJavaScript = accessJavaScript;
  886. this.messageNotUnderstood = messageNotUnderstood;
  887. }
  888. function SelectorConversionBrik(brikz, st) {
  889. /* Convert a Smalltalk selector into a JS selector */
  890. st.st2js = function (string) {
  891. var selector = '_' + string;
  892. selector = selector.replace(/:/g, '_');
  893. selector = selector.replace(/[\&]/g, '_and');
  894. selector = selector.replace(/[\|]/g, '_or');
  895. selector = selector.replace(/[+]/g, '_plus');
  896. selector = selector.replace(/-/g, '_minus');
  897. selector = selector.replace(/[*]/g, '_star');
  898. selector = selector.replace(/[\/]/g, '_slash');
  899. selector = selector.replace(/[\\]/g, '_backslash');
  900. selector = selector.replace(/[\~]/g, '_tild');
  901. selector = selector.replace(/>/g, '_gt');
  902. selector = selector.replace(/</g, '_lt');
  903. selector = selector.replace(/=/g, '_eq');
  904. selector = selector.replace(/,/g, '_comma');
  905. selector = selector.replace(/[@]/g, '_at');
  906. return selector;
  907. };
  908. /* Convert a string to a valid smalltalk selector.
  909. if you modify the following functions, also change st2js
  910. accordingly */
  911. st.js2st = function (selector) {
  912. if (selector.match(/__/)) {
  913. return binaryJsToSt(selector);
  914. } else {
  915. return keywordJsToSt(selector);
  916. }
  917. };
  918. function keywordJsToSt(selector) {
  919. return selector.replace(/^_/, '').replace(/_/g, ':');
  920. }
  921. function binaryJsToSt(selector) {
  922. return selector
  923. .replace(/^_/, '')
  924. .replace(/_and/g, '&')
  925. .replace(/_or/g, '|')
  926. .replace(/_plus/g, '+')
  927. .replace(/_minus/g, '-')
  928. .replace(/_star/g, '*')
  929. .replace(/_slash/g, '/')
  930. .replace(/_backslash/g, '\\')
  931. .replace(/_tild/g, '~')
  932. .replace(/_gt/g, '>')
  933. .replace(/_lt/g, '<')
  934. .replace(/_eq/g, '=')
  935. .replace(/_comma/g, ',')
  936. .replace(/_at/g, '@');
  937. }
  938. st.st2prop = function (stSelector) {
  939. var colonPosition = stSelector.indexOf(':');
  940. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  941. };
  942. }
  943. /* Adds AMD and requirejs related methods to the smalltalk object */
  944. function AMDBrik(brikz, st) {
  945. this.__init__ = function () {
  946. st.amdRequire = require;
  947. st.defaultTransportType = st.defaultTransportType || "amd";
  948. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  949. };
  950. }
  951. /* Defines asReceiver to be present at load time */
  952. /* (logically it belongs more to PrimitiveBrik) */
  953. function AsReceiverBrik(brikz, st) {
  954. var nil = brikz.ensure("root").nil;
  955. /**
  956. * This function is used all over the compiled amber code.
  957. * It takes any value (JavaScript or Smalltalk)
  958. * and returns a proper Amber Smalltalk receiver.
  959. *
  960. * null or undefined -> nil,
  961. * plain JS object -> wrapped JS object,
  962. * otherwise unchanged
  963. */
  964. this.asReceiver = function (o) {
  965. if (o == null) return nil;
  966. if (typeof o === "object" || typeof o === "function") {
  967. return o.klass != null ? o : globals.JSObjectProxy._on_(o);
  968. }
  969. // IMPORTANT: This optimization (return o if typeof !== "object")
  970. // assumes all primitive types are wrapped by some Smalltalk class
  971. // so they can be returned as-is, without boxing and looking for .klass.
  972. // KEEP THE primitives-are-wrapped INVARIANT!
  973. return o;
  974. };
  975. }
  976. /* Making smalltalk that can load */
  977. brikz.root = RootBrik;
  978. brikz.dnu = DNUBrik;
  979. brikz.organize = OrganizeBrik;
  980. brikz.selectorConversion = SelectorConversionBrik;
  981. brikz.classInit = ClassInitBrik;
  982. brikz.manipulation = ManipulationBrik;
  983. brikz.packages = PackagesBrik;
  984. brikz.classes = ClassesBrik;
  985. brikz.methods = MethodsBrik;
  986. brikz.stInit = SmalltalkInitBrik;
  987. brikz.augments = AugmentsBrik;
  988. brikz.asReceiver = AsReceiverBrik;
  989. brikz.amd = AMDBrik;
  990. brikz.rebuild();
  991. /* Making smalltalk that can run */
  992. function runnable() {
  993. brikz.messageSend = MessageSendBrik;
  994. brikz.runtime = RuntimeBrik;
  995. brikz.primitives = PrimitivesBrik;
  996. brikz.rebuild();
  997. }
  998. return {api: api, nil: brikz.root.nil, globals: globals, asReceiver: brikz.asReceiver.asReceiver};
  999. });
  1000. define("amber/helpers", ["amber/boot", "require"], function (boot, require) {
  1001. var globals = boot.globals,
  1002. exports = {},
  1003. api = boot.api,
  1004. nil = boot.nil;
  1005. // API
  1006. exports.popupHelios = function () {
  1007. require(['helios/index'], function (helios) {
  1008. helios.popup();
  1009. }, function (err) {
  1010. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1011. });
  1012. };
  1013. Object.defineProperty(exports, "api", {
  1014. value: api,
  1015. enumerable: true, configurable: true, writable: false
  1016. });
  1017. Object.defineProperty(exports, "globals", {
  1018. value: globals,
  1019. enumerable: true, configurable: true, writable: false
  1020. });
  1021. Object.defineProperty(exports, "nil", {
  1022. value: nil,
  1023. enumerable: true, configurable: true, writable: false
  1024. });
  1025. function mixinToSettings(source) {
  1026. var settings = globals.SmalltalkSettings;
  1027. Object.keys(source).forEach(function (key) {
  1028. settings[key] = source[key];
  1029. });
  1030. }
  1031. function settingsInLocalStorage() {
  1032. //jshint evil:true
  1033. var global = new Function('return this')(),
  1034. storage = 'localStorage' in global && global.localStorage;
  1035. if (storage) {
  1036. var fromStorage;
  1037. try {
  1038. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1039. } catch (ex) {
  1040. // pass
  1041. }
  1042. mixinToSettings(fromStorage || {});
  1043. if (typeof window !== "undefined") {
  1044. requirejs(['jquery'], function ($) {
  1045. $(window).on('beforeunload', function () {
  1046. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1047. });
  1048. });
  1049. }
  1050. }
  1051. }
  1052. exports.initialize = function (options) {
  1053. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1054. settingsInLocalStorage();
  1055. mixinToSettings(options || {});
  1056. return api.initialize();
  1057. };
  1058. // Exports
  1059. return exports;
  1060. });
  1061. define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){"use strict";
  1062. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  1063. $core.addPackage('Kernel-Objects');
  1064. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  1065. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1066. $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1067. $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.";
  1068. $core.addMethod(
  1069. $core.method({
  1070. selector: "=",
  1071. protocol: 'comparing',
  1072. fn: function (anObject){
  1073. var self=this;
  1074. return $core.withContext(function($ctx1) {
  1075. var $1;
  1076. $1=self.__eq_eq(anObject);
  1077. return $1;
  1078. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  1079. },
  1080. args: ["anObject"],
  1081. source: "= anObject\x0a\x09^ self == anObject",
  1082. referencedClasses: [],
  1083. messageSends: ["=="]
  1084. }),
  1085. $globals.ProtoObject);
  1086. $core.addMethod(
  1087. $core.method({
  1088. selector: "==",
  1089. protocol: 'comparing',
  1090. fn: function (anObject){
  1091. var self=this;
  1092. return $core.withContext(function($ctx1) {
  1093. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  1094. return self;
  1095. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  1096. },
  1097. args: ["anObject"],
  1098. source: "== anObject\x0a<return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)>",
  1099. referencedClasses: [],
  1100. messageSends: []
  1101. }),
  1102. $globals.ProtoObject);
  1103. $core.addMethod(
  1104. $core.method({
  1105. selector: "asString",
  1106. protocol: 'converting',
  1107. fn: function (){
  1108. var self=this;
  1109. return $core.withContext(function($ctx1) {
  1110. var $1;
  1111. $1=self._printString();
  1112. return $1;
  1113. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  1114. },
  1115. args: [],
  1116. source: "asString\x0a\x09^ self printString",
  1117. referencedClasses: [],
  1118. messageSends: ["printString"]
  1119. }),
  1120. $globals.ProtoObject);
  1121. $core.addMethod(
  1122. $core.method({
  1123. selector: "class",
  1124. protocol: 'accessing',
  1125. fn: function (){
  1126. var self=this;
  1127. return $core.withContext(function($ctx1) {
  1128. return self.klass;
  1129. return self;
  1130. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  1131. },
  1132. args: [],
  1133. source: "class\x0a\x09<return self.klass>",
  1134. referencedClasses: [],
  1135. messageSends: []
  1136. }),
  1137. $globals.ProtoObject);
  1138. $core.addMethod(
  1139. $core.method({
  1140. selector: "doesNotUnderstand:",
  1141. protocol: 'error handling',
  1142. fn: function (aMessage){
  1143. var self=this;
  1144. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1145. return $core.withContext(function($ctx1) {
  1146. var $1,$2;
  1147. $1=$recv($MessageNotUnderstood())._new();
  1148. $recv($1)._receiver_(self);
  1149. $recv($1)._message_(aMessage);
  1150. $2=$recv($1)._signal();
  1151. return self;
  1152. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  1153. },
  1154. args: ["aMessage"],
  1155. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1156. referencedClasses: ["MessageNotUnderstood"],
  1157. messageSends: ["receiver:", "new", "message:", "signal"]
  1158. }),
  1159. $globals.ProtoObject);
  1160. $core.addMethod(
  1161. $core.method({
  1162. selector: "evaluate:on:",
  1163. protocol: 'evaluating',
  1164. fn: function (aString,anEvaluator){
  1165. var self=this;
  1166. return $core.withContext(function($ctx1) {
  1167. var $1;
  1168. $1=$recv(anEvaluator)._evaluate_receiver_(aString,self);
  1169. return $1;
  1170. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  1171. },
  1172. args: ["aString", "anEvaluator"],
  1173. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1174. referencedClasses: [],
  1175. messageSends: ["evaluate:receiver:"]
  1176. }),
  1177. $globals.ProtoObject);
  1178. $core.addMethod(
  1179. $core.method({
  1180. selector: "identityHash",
  1181. protocol: 'accessing',
  1182. fn: function (){
  1183. var self=this;
  1184. return $core.withContext(function($ctx1) {
  1185. var hash=self.identityHash;
  1186. if (hash) return hash;
  1187. hash=$core.nextId();
  1188. Object.defineProperty(self, 'identityHash', {value:hash});
  1189. return hash;
  1190. ;
  1191. return self;
  1192. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  1193. },
  1194. args: [],
  1195. 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>",
  1196. referencedClasses: [],
  1197. messageSends: []
  1198. }),
  1199. $globals.ProtoObject);
  1200. $core.addMethod(
  1201. $core.method({
  1202. selector: "ifNil:",
  1203. protocol: 'testing',
  1204. fn: function (aBlock){
  1205. var self=this;
  1206. return self;
  1207. },
  1208. args: ["aBlock"],
  1209. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1210. referencedClasses: [],
  1211. messageSends: []
  1212. }),
  1213. $globals.ProtoObject);
  1214. $core.addMethod(
  1215. $core.method({
  1216. selector: "ifNil:ifNotNil:",
  1217. protocol: 'testing',
  1218. fn: function (aBlock,anotherBlock){
  1219. var self=this;
  1220. return $core.withContext(function($ctx1) {
  1221. var $1;
  1222. $1=$recv(anotherBlock)._value_(self);
  1223. return $1;
  1224. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1225. },
  1226. args: ["aBlock", "anotherBlock"],
  1227. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1228. referencedClasses: [],
  1229. messageSends: ["value:"]
  1230. }),
  1231. $globals.ProtoObject);
  1232. $core.addMethod(
  1233. $core.method({
  1234. selector: "ifNotNil:",
  1235. protocol: 'testing',
  1236. fn: function (aBlock){
  1237. var self=this;
  1238. return $core.withContext(function($ctx1) {
  1239. var $1;
  1240. $1=$recv(aBlock)._value_(self);
  1241. return $1;
  1242. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  1243. },
  1244. args: ["aBlock"],
  1245. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1246. referencedClasses: [],
  1247. messageSends: ["value:"]
  1248. }),
  1249. $globals.ProtoObject);
  1250. $core.addMethod(
  1251. $core.method({
  1252. selector: "ifNotNil:ifNil:",
  1253. protocol: 'testing',
  1254. fn: function (aBlock,anotherBlock){
  1255. var self=this;
  1256. return $core.withContext(function($ctx1) {
  1257. var $1;
  1258. $1=$recv(aBlock)._value_(self);
  1259. return $1;
  1260. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1261. },
  1262. args: ["aBlock", "anotherBlock"],
  1263. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1264. referencedClasses: [],
  1265. messageSends: ["value:"]
  1266. }),
  1267. $globals.ProtoObject);
  1268. $core.addMethod(
  1269. $core.method({
  1270. selector: "initialize",
  1271. protocol: 'initialization',
  1272. fn: function (){
  1273. var self=this;
  1274. return self;
  1275. },
  1276. args: [],
  1277. source: "initialize",
  1278. referencedClasses: [],
  1279. messageSends: []
  1280. }),
  1281. $globals.ProtoObject);
  1282. $core.addMethod(
  1283. $core.method({
  1284. selector: "inspect",
  1285. protocol: 'inspecting',
  1286. fn: function (){
  1287. var self=this;
  1288. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1289. return $core.withContext(function($ctx1) {
  1290. $recv($Inspector())._inspect_(self);
  1291. return self;
  1292. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  1293. },
  1294. args: [],
  1295. source: "inspect\x0a\x09Inspector inspect: self",
  1296. referencedClasses: ["Inspector"],
  1297. messageSends: ["inspect:"]
  1298. }),
  1299. $globals.ProtoObject);
  1300. $core.addMethod(
  1301. $core.method({
  1302. selector: "inspectOn:",
  1303. protocol: 'inspecting',
  1304. fn: function (anInspector){
  1305. var self=this;
  1306. return self;
  1307. },
  1308. args: ["anInspector"],
  1309. source: "inspectOn: anInspector",
  1310. referencedClasses: [],
  1311. messageSends: []
  1312. }),
  1313. $globals.ProtoObject);
  1314. $core.addMethod(
  1315. $core.method({
  1316. selector: "instVarAt:",
  1317. protocol: 'accessing',
  1318. fn: function (aString){
  1319. var self=this;
  1320. return $core.withContext(function($ctx1) {
  1321. return self['@'+aString] ;
  1322. return self;
  1323. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  1324. },
  1325. args: ["aString"],
  1326. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1327. referencedClasses: [],
  1328. messageSends: []
  1329. }),
  1330. $globals.ProtoObject);
  1331. $core.addMethod(
  1332. $core.method({
  1333. selector: "instVarAt:put:",
  1334. protocol: 'accessing',
  1335. fn: function (aString,anObject){
  1336. var self=this;
  1337. return $core.withContext(function($ctx1) {
  1338. self['@' + aString] = anObject ;
  1339. return self;
  1340. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  1341. },
  1342. args: ["aString", "anObject"],
  1343. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1344. referencedClasses: [],
  1345. messageSends: []
  1346. }),
  1347. $globals.ProtoObject);
  1348. $core.addMethod(
  1349. $core.method({
  1350. selector: "isKindOf:",
  1351. protocol: 'testing',
  1352. fn: function (aClass){
  1353. var self=this;
  1354. return $core.withContext(function($ctx1) {
  1355. var $2,$1;
  1356. $2=self._isMemberOf_(aClass);
  1357. if($core.assert($2)){
  1358. $1=true;
  1359. } else {
  1360. $1=$recv(self._class())._inheritsFrom_(aClass);
  1361. };
  1362. return $1;
  1363. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  1364. },
  1365. args: ["aClass"],
  1366. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1367. referencedClasses: [],
  1368. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1369. }),
  1370. $globals.ProtoObject);
  1371. $core.addMethod(
  1372. $core.method({
  1373. selector: "isNil",
  1374. protocol: 'testing',
  1375. fn: function (){
  1376. var self=this;
  1377. return false;
  1378. },
  1379. args: [],
  1380. source: "isNil\x0a\x09^ false",
  1381. referencedClasses: [],
  1382. messageSends: []
  1383. }),
  1384. $globals.ProtoObject);
  1385. $core.addMethod(
  1386. $core.method({
  1387. selector: "isSameInstanceAs:",
  1388. protocol: 'comparing',
  1389. fn: function (anObject){
  1390. var self=this;
  1391. return $core.withContext(function($ctx1) {
  1392. var $2,$1;
  1393. $2=self._identityHash();
  1394. $ctx1.sendIdx["identityHash"]=1;
  1395. $1=$recv($2).__eq($recv(anObject)._identityHash());
  1396. return $1;
  1397. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  1398. },
  1399. args: ["anObject"],
  1400. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  1401. referencedClasses: [],
  1402. messageSends: ["=", "identityHash"]
  1403. }),
  1404. $globals.ProtoObject);
  1405. $core.addMethod(
  1406. $core.method({
  1407. selector: "notNil",
  1408. protocol: 'testing',
  1409. fn: function (){
  1410. var self=this;
  1411. return $core.withContext(function($ctx1) {
  1412. var $1;
  1413. $1=$recv(self._isNil())._not();
  1414. return $1;
  1415. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  1416. },
  1417. args: [],
  1418. source: "notNil\x0a\x09^ self isNil not",
  1419. referencedClasses: [],
  1420. messageSends: ["not", "isNil"]
  1421. }),
  1422. $globals.ProtoObject);
  1423. $core.addMethod(
  1424. $core.method({
  1425. selector: "perform:",
  1426. protocol: 'message handling',
  1427. fn: function (aString){
  1428. var self=this;
  1429. return $core.withContext(function($ctx1) {
  1430. var $1;
  1431. $1=self._perform_withArguments_(aString,[]);
  1432. return $1;
  1433. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  1434. },
  1435. args: ["aString"],
  1436. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  1437. referencedClasses: [],
  1438. messageSends: ["perform:withArguments:"]
  1439. }),
  1440. $globals.ProtoObject);
  1441. $core.addMethod(
  1442. $core.method({
  1443. selector: "perform:withArguments:",
  1444. protocol: 'message handling',
  1445. fn: function (aString,aCollection){
  1446. var self=this;
  1447. return $core.withContext(function($ctx1) {
  1448. return $core.send(self, aString._asJavaScriptMethodName(), aCollection);
  1449. return self;
  1450. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  1451. },
  1452. args: ["aString", "aCollection"],
  1453. source: "perform: aString withArguments: aCollection\x0a\x09<return $core.send(self, aString._asJavaScriptMethodName(), aCollection)>",
  1454. referencedClasses: [],
  1455. messageSends: []
  1456. }),
  1457. $globals.ProtoObject);
  1458. $core.addMethod(
  1459. $core.method({
  1460. selector: "printOn:",
  1461. protocol: 'printing',
  1462. fn: function (aStream){
  1463. var self=this;
  1464. return $core.withContext(function($ctx1) {
  1465. var $5,$4,$3,$2,$1;
  1466. $5=self._class();
  1467. $ctx1.sendIdx["class"]=1;
  1468. $4=$recv($5)._name();
  1469. $ctx1.sendIdx["name"]=1;
  1470. $3=$recv($4)._first();
  1471. $2=$recv($3)._isVowel();
  1472. if($core.assert($2)){
  1473. $1="an ";
  1474. } else {
  1475. $1="a ";
  1476. };
  1477. $recv(aStream)._nextPutAll_($1);
  1478. $ctx1.sendIdx["nextPutAll:"]=1;
  1479. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  1480. return self;
  1481. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  1482. },
  1483. args: ["aStream"],
  1484. 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",
  1485. referencedClasses: [],
  1486. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  1487. }),
  1488. $globals.ProtoObject);
  1489. $core.addMethod(
  1490. $core.method({
  1491. selector: "printString",
  1492. protocol: 'printing',
  1493. fn: function (){
  1494. var self=this;
  1495. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  1496. return $core.withContext(function($ctx1) {
  1497. var $1;
  1498. $1=$recv($String())._streamContents_((function(str){
  1499. return $core.withContext(function($ctx2) {
  1500. return self._printOn_(str);
  1501. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  1502. }));
  1503. return $1;
  1504. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  1505. },
  1506. args: [],
  1507. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  1508. referencedClasses: ["String"],
  1509. messageSends: ["streamContents:", "printOn:"]
  1510. }),
  1511. $globals.ProtoObject);
  1512. $core.addMethod(
  1513. $core.method({
  1514. selector: "yourself",
  1515. protocol: 'accessing',
  1516. fn: function (){
  1517. var self=this;
  1518. return self;
  1519. },
  1520. args: [],
  1521. source: "yourself\x0a\x09^ self",
  1522. referencedClasses: [],
  1523. messageSends: []
  1524. }),
  1525. $globals.ProtoObject);
  1526. $core.addMethod(
  1527. $core.method({
  1528. selector: "~=",
  1529. protocol: 'comparing',
  1530. fn: function (anObject){
  1531. var self=this;
  1532. return $core.withContext(function($ctx1) {
  1533. var $1;
  1534. $1=$recv(self.__eq(anObject)).__eq(false);
  1535. $ctx1.sendIdx["="]=1;
  1536. return $1;
  1537. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  1538. },
  1539. args: ["anObject"],
  1540. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  1541. referencedClasses: [],
  1542. messageSends: ["="]
  1543. }),
  1544. $globals.ProtoObject);
  1545. $core.addMethod(
  1546. $core.method({
  1547. selector: "~~",
  1548. protocol: 'comparing',
  1549. fn: function (anObject){
  1550. var self=this;
  1551. return $core.withContext(function($ctx1) {
  1552. var $1;
  1553. $1=$recv(self.__eq_eq(anObject)).__eq(false);
  1554. return $1;
  1555. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  1556. },
  1557. args: ["anObject"],
  1558. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  1559. referencedClasses: [],
  1560. messageSends: ["=", "=="]
  1561. }),
  1562. $globals.ProtoObject);
  1563. $core.addMethod(
  1564. $core.method({
  1565. selector: "initialize",
  1566. protocol: 'initialization',
  1567. fn: function (){
  1568. var self=this;
  1569. return self;
  1570. },
  1571. args: [],
  1572. source: "initialize",
  1573. referencedClasses: [],
  1574. messageSends: []
  1575. }),
  1576. $globals.ProtoObject.klass);
  1577. $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
  1578. $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.";
  1579. $core.addMethod(
  1580. $core.method({
  1581. selector: "->",
  1582. protocol: 'converting',
  1583. fn: function (anObject){
  1584. var self=this;
  1585. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  1586. return $core.withContext(function($ctx1) {
  1587. var $1;
  1588. $1=$recv($Association())._key_value_(self,anObject);
  1589. return $1;
  1590. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  1591. },
  1592. args: ["anObject"],
  1593. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  1594. referencedClasses: ["Association"],
  1595. messageSends: ["key:value:"]
  1596. }),
  1597. $globals.Object);
  1598. $core.addMethod(
  1599. $core.method({
  1600. selector: "asJSON",
  1601. protocol: 'converting',
  1602. fn: function (){
  1603. var self=this;
  1604. var variables;
  1605. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1606. return $core.withContext(function($ctx1) {
  1607. var $1;
  1608. variables=$recv($HashedCollection())._new();
  1609. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  1610. return $core.withContext(function($ctx2) {
  1611. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
  1612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1613. }));
  1614. $1=variables;
  1615. return $1;
  1616. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
  1617. },
  1618. args: [],
  1619. 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",
  1620. referencedClasses: ["HashedCollection"],
  1621. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  1622. }),
  1623. $globals.Object);
  1624. $core.addMethod(
  1625. $core.method({
  1626. selector: "asJSONString",
  1627. protocol: 'converting',
  1628. fn: function (){
  1629. var self=this;
  1630. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  1631. return $core.withContext(function($ctx1) {
  1632. var $1;
  1633. $1=$recv($JSON())._stringify_(self._asJSON());
  1634. return $1;
  1635. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  1636. },
  1637. args: [],
  1638. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  1639. referencedClasses: ["JSON"],
  1640. messageSends: ["stringify:", "asJSON"]
  1641. }),
  1642. $globals.Object);
  1643. $core.addMethod(
  1644. $core.method({
  1645. selector: "asJavascript",
  1646. protocol: 'converting',
  1647. fn: function (){
  1648. var self=this;
  1649. return $core.withContext(function($ctx1) {
  1650. var $1;
  1651. $1=self._asString();
  1652. return $1;
  1653. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
  1654. },
  1655. args: [],
  1656. source: "asJavascript\x0a\x09^ self asString",
  1657. referencedClasses: [],
  1658. messageSends: ["asString"]
  1659. }),
  1660. $globals.Object);
  1661. $core.addMethod(
  1662. $core.method({
  1663. selector: "basicAt:",
  1664. protocol: 'accessing',
  1665. fn: function (aString){
  1666. var self=this;
  1667. return $core.withContext(function($ctx1) {
  1668. return self[aString];
  1669. return self;
  1670. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  1671. },
  1672. args: ["aString"],
  1673. source: "basicAt: aString\x0a\x09<return self[aString]>",
  1674. referencedClasses: [],
  1675. messageSends: []
  1676. }),
  1677. $globals.Object);
  1678. $core.addMethod(
  1679. $core.method({
  1680. selector: "basicAt:put:",
  1681. protocol: 'accessing',
  1682. fn: function (aString,anObject){
  1683. var self=this;
  1684. return $core.withContext(function($ctx1) {
  1685. return self[aString] = anObject;
  1686. return self;
  1687. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  1688. },
  1689. args: ["aString", "anObject"],
  1690. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  1691. referencedClasses: [],
  1692. messageSends: []
  1693. }),
  1694. $globals.Object);
  1695. $core.addMethod(
  1696. $core.method({
  1697. selector: "basicDelete:",
  1698. protocol: 'accessing',
  1699. fn: function (aString){
  1700. var self=this;
  1701. return $core.withContext(function($ctx1) {
  1702. delete self[aString]; return aString;
  1703. return self;
  1704. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  1705. },
  1706. args: ["aString"],
  1707. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  1708. referencedClasses: [],
  1709. messageSends: []
  1710. }),
  1711. $globals.Object);
  1712. $core.addMethod(
  1713. $core.method({
  1714. selector: "basicPerform:",
  1715. protocol: 'message handling',
  1716. fn: function (aString){
  1717. var self=this;
  1718. return $core.withContext(function($ctx1) {
  1719. var $1;
  1720. $1=self._basicPerform_withArguments_(aString,[]);
  1721. return $1;
  1722. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  1723. },
  1724. args: ["aString"],
  1725. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  1726. referencedClasses: [],
  1727. messageSends: ["basicPerform:withArguments:"]
  1728. }),
  1729. $globals.Object);
  1730. $core.addMethod(
  1731. $core.method({
  1732. selector: "basicPerform:withArguments:",
  1733. protocol: 'message handling',
  1734. fn: function (aString,aCollection){
  1735. var self=this;
  1736. return $core.withContext(function($ctx1) {
  1737. return self[aString].apply(self, aCollection);;
  1738. return self;
  1739. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  1740. },
  1741. args: ["aString", "aCollection"],
  1742. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  1743. referencedClasses: [],
  1744. messageSends: []
  1745. }),
  1746. $globals.Object);
  1747. $core.addMethod(
  1748. $core.method({
  1749. selector: "browse",
  1750. protocol: 'browsing',
  1751. fn: function (){
  1752. var self=this;
  1753. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  1754. return $core.withContext(function($ctx1) {
  1755. $recv($Finder())._findClass_(self._class());
  1756. return self;
  1757. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  1758. },
  1759. args: [],
  1760. source: "browse\x0a\x09Finder findClass: self class",
  1761. referencedClasses: ["Finder"],
  1762. messageSends: ["findClass:", "class"]
  1763. }),
  1764. $globals.Object);
  1765. $core.addMethod(
  1766. $core.method({
  1767. selector: "copy",
  1768. protocol: 'copying',
  1769. fn: function (){
  1770. var self=this;
  1771. return $core.withContext(function($ctx1) {
  1772. var $1;
  1773. $1=$recv(self._shallowCopy())._postCopy();
  1774. return $1;
  1775. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  1776. },
  1777. args: [],
  1778. source: "copy\x0a\x09^ self shallowCopy postCopy",
  1779. referencedClasses: [],
  1780. messageSends: ["postCopy", "shallowCopy"]
  1781. }),
  1782. $globals.Object);
  1783. $core.addMethod(
  1784. $core.method({
  1785. selector: "deepCopy",
  1786. protocol: 'copying',
  1787. fn: function (){
  1788. var self=this;
  1789. return $core.withContext(function($ctx1) {
  1790. var copy = self.klass._new();
  1791. Object.keys(self).forEach(function (i) {
  1792. if(/^@.+/.test(i)) {
  1793. copy[i] = self[i]._deepCopy();
  1794. }
  1795. });
  1796. return copy;
  1797. ;
  1798. return self;
  1799. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  1800. },
  1801. args: [],
  1802. 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>",
  1803. referencedClasses: [],
  1804. messageSends: []
  1805. }),
  1806. $globals.Object);
  1807. $core.addMethod(
  1808. $core.method({
  1809. selector: "deprecatedAPI",
  1810. protocol: 'error handling',
  1811. fn: function (){
  1812. var self=this;
  1813. return $core.withContext(function($ctx1) {
  1814. var $1,$6,$5,$4,$8,$7,$3,$2;
  1815. $1=console;
  1816. $6=$core.getThisContext()._home();
  1817. $ctx1.sendIdx["home"]=1;
  1818. $5=$recv($6)._asString();
  1819. $ctx1.sendIdx["asString"]=1;
  1820. $4=$recv($5).__comma(" is deprecated! (in ");
  1821. $8=$recv($core.getThisContext()._home())._home();
  1822. $ctx1.sendIdx["home"]=2;
  1823. $7=$recv($8)._asString();
  1824. $3=$recv($4).__comma($7);
  1825. $ctx1.sendIdx[","]=2;
  1826. $2=$recv($3).__comma(")");
  1827. $ctx1.sendIdx[","]=1;
  1828. $recv($1)._warn_($2);
  1829. return self;
  1830. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  1831. },
  1832. args: [],
  1833. 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, ')'.",
  1834. referencedClasses: [],
  1835. messageSends: ["warn:", ",", "asString", "home"]
  1836. }),
  1837. $globals.Object);
  1838. $core.addMethod(
  1839. $core.method({
  1840. selector: "deprecatedAPI:",
  1841. protocol: 'error handling',
  1842. fn: function (aString){
  1843. var self=this;
  1844. return $core.withContext(function($ctx1) {
  1845. var $1,$6,$5,$4,$8,$7,$3,$2;
  1846. $1=console;
  1847. $6=$core.getThisContext()._home();
  1848. $ctx1.sendIdx["home"]=1;
  1849. $5=$recv($6)._asString();
  1850. $ctx1.sendIdx["asString"]=1;
  1851. $4=$recv($5).__comma(" is deprecated! (in ");
  1852. $8=$recv($core.getThisContext()._home())._home();
  1853. $ctx1.sendIdx["home"]=2;
  1854. $7=$recv($8)._asString();
  1855. $3=$recv($4).__comma($7);
  1856. $ctx1.sendIdx[","]=2;
  1857. $2=$recv($3).__comma(")");
  1858. $ctx1.sendIdx[","]=1;
  1859. $recv($1)._warn_($2);
  1860. $ctx1.sendIdx["warn:"]=1;
  1861. $recv(console)._warn_(aString);
  1862. return self;
  1863. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  1864. },
  1865. args: ["aString"],
  1866. 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",
  1867. referencedClasses: [],
  1868. messageSends: ["warn:", ",", "asString", "home"]
  1869. }),
  1870. $globals.Object);
  1871. $core.addMethod(
  1872. $core.method({
  1873. selector: "error:",
  1874. protocol: 'error handling',
  1875. fn: function (aString){
  1876. var self=this;
  1877. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  1878. return $core.withContext(function($ctx1) {
  1879. $recv($Error())._signal_(aString);
  1880. return self;
  1881. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  1882. },
  1883. args: ["aString"],
  1884. source: "error: aString\x0a\x09Error signal: aString",
  1885. referencedClasses: ["Error"],
  1886. messageSends: ["signal:"]
  1887. }),
  1888. $globals.Object);
  1889. $core.addMethod(
  1890. $core.method({
  1891. selector: "halt",
  1892. protocol: 'error handling',
  1893. fn: function (){
  1894. var self=this;
  1895. function $Halt(){return $globals.Halt||(typeof Halt=="undefined"?nil:Halt)}
  1896. return $core.withContext(function($ctx1) {
  1897. $recv($Halt())._signal();
  1898. return self;
  1899. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  1900. },
  1901. args: [],
  1902. source: "halt\x0a\x09Halt signal",
  1903. referencedClasses: ["Halt"],
  1904. messageSends: ["signal"]
  1905. }),
  1906. $globals.Object);
  1907. $core.addMethod(
  1908. $core.method({
  1909. selector: "in:",
  1910. protocol: 'evaluating',
  1911. fn: function (aValuable){
  1912. var self=this;
  1913. return $core.withContext(function($ctx1) {
  1914. var $1;
  1915. $1=$recv(aValuable)._value_(self);
  1916. return $1;
  1917. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  1918. },
  1919. args: ["aValuable"],
  1920. source: "in: aValuable\x0a\x09^ aValuable value: self",
  1921. referencedClasses: [],
  1922. messageSends: ["value:"]
  1923. }),
  1924. $globals.Object);
  1925. $core.addMethod(
  1926. $core.method({
  1927. selector: "isBehavior",
  1928. protocol: 'testing',
  1929. fn: function (){
  1930. var self=this;
  1931. return false;
  1932. },
  1933. args: [],
  1934. source: "isBehavior\x0a\x09^ false",
  1935. referencedClasses: [],
  1936. messageSends: []
  1937. }),
  1938. $globals.Object);
  1939. $core.addMethod(
  1940. $core.method({
  1941. selector: "isBoolean",
  1942. protocol: 'testing',
  1943. fn: function (){
  1944. var self=this;
  1945. return false;
  1946. },
  1947. args: [],
  1948. source: "isBoolean\x0a\x09^ false",
  1949. referencedClasses: [],
  1950. messageSends: []
  1951. }),
  1952. $globals.Object);
  1953. $core.addMethod(
  1954. $core.method({
  1955. selector: "isClass",
  1956. protocol: 'testing',
  1957. fn: function (){
  1958. var self=this;
  1959. return false;
  1960. },
  1961. args: [],
  1962. source: "isClass\x0a\x09^ false",
  1963. referencedClasses: [],
  1964. messageSends: []
  1965. }),
  1966. $globals.Object);
  1967. $core.addMethod(
  1968. $core.method({
  1969. selector: "isCompiledMethod",
  1970. protocol: 'testing',
  1971. fn: function (){
  1972. var self=this;
  1973. return false;
  1974. },
  1975. args: [],
  1976. source: "isCompiledMethod\x0a\x09^ false",
  1977. referencedClasses: [],
  1978. messageSends: []
  1979. }),
  1980. $globals.Object);
  1981. $core.addMethod(
  1982. $core.method({
  1983. selector: "isImmutable",
  1984. protocol: 'testing',
  1985. fn: function (){
  1986. var self=this;
  1987. return false;
  1988. },
  1989. args: [],
  1990. source: "isImmutable\x0a\x09^ false",
  1991. referencedClasses: [],
  1992. messageSends: []
  1993. }),
  1994. $globals.Object);
  1995. $core.addMethod(
  1996. $core.method({
  1997. selector: "isMemberOf:",
  1998. protocol: 'testing',
  1999. fn: function (aClass){
  2000. var self=this;
  2001. return $core.withContext(function($ctx1) {
  2002. var $1;
  2003. $1=$recv(self._class()).__eq(aClass);
  2004. return $1;
  2005. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  2006. },
  2007. args: ["aClass"],
  2008. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2009. referencedClasses: [],
  2010. messageSends: ["=", "class"]
  2011. }),
  2012. $globals.Object);
  2013. $core.addMethod(
  2014. $core.method({
  2015. selector: "isMetaclass",
  2016. protocol: 'testing',
  2017. fn: function (){
  2018. var self=this;
  2019. return false;
  2020. },
  2021. args: [],
  2022. source: "isMetaclass\x0a\x09^ false",
  2023. referencedClasses: [],
  2024. messageSends: []
  2025. }),
  2026. $globals.Object);
  2027. $core.addMethod(
  2028. $core.method({
  2029. selector: "isNumber",
  2030. protocol: 'testing',
  2031. fn: function (){
  2032. var self=this;
  2033. return false;
  2034. },
  2035. args: [],
  2036. source: "isNumber\x0a\x09^ false",
  2037. referencedClasses: [],
  2038. messageSends: []
  2039. }),
  2040. $globals.Object);
  2041. $core.addMethod(
  2042. $core.method({
  2043. selector: "isPackage",
  2044. protocol: 'testing',
  2045. fn: function (){
  2046. var self=this;
  2047. return false;
  2048. },
  2049. args: [],
  2050. source: "isPackage\x0a\x09^ false",
  2051. referencedClasses: [],
  2052. messageSends: []
  2053. }),
  2054. $globals.Object);
  2055. $core.addMethod(
  2056. $core.method({
  2057. selector: "isParseFailure",
  2058. protocol: 'testing',
  2059. fn: function (){
  2060. var self=this;
  2061. return false;
  2062. },
  2063. args: [],
  2064. source: "isParseFailure\x0a\x09^ false",
  2065. referencedClasses: [],
  2066. messageSends: []
  2067. }),
  2068. $globals.Object);
  2069. $core.addMethod(
  2070. $core.method({
  2071. selector: "isString",
  2072. protocol: 'testing',
  2073. fn: function (){
  2074. var self=this;
  2075. return false;
  2076. },
  2077. args: [],
  2078. source: "isString\x0a\x09^ false",
  2079. referencedClasses: [],
  2080. messageSends: []
  2081. }),
  2082. $globals.Object);
  2083. $core.addMethod(
  2084. $core.method({
  2085. selector: "isSymbol",
  2086. protocol: 'testing',
  2087. fn: function (){
  2088. var self=this;
  2089. return false;
  2090. },
  2091. args: [],
  2092. source: "isSymbol\x0a\x09^ false",
  2093. referencedClasses: [],
  2094. messageSends: []
  2095. }),
  2096. $globals.Object);
  2097. $core.addMethod(
  2098. $core.method({
  2099. selector: "postCopy",
  2100. protocol: 'copying',
  2101. fn: function (){
  2102. var self=this;
  2103. return self;
  2104. },
  2105. args: [],
  2106. source: "postCopy",
  2107. referencedClasses: [],
  2108. messageSends: []
  2109. }),
  2110. $globals.Object);
  2111. $core.addMethod(
  2112. $core.method({
  2113. selector: "putOn:",
  2114. protocol: 'streaming',
  2115. fn: function (aStream){
  2116. var self=this;
  2117. return $core.withContext(function($ctx1) {
  2118. $recv(aStream)._nextPut_(self);
  2119. return self;
  2120. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  2121. },
  2122. args: ["aStream"],
  2123. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2124. referencedClasses: [],
  2125. messageSends: ["nextPut:"]
  2126. }),
  2127. $globals.Object);
  2128. $core.addMethod(
  2129. $core.method({
  2130. selector: "respondsTo:",
  2131. protocol: 'testing',
  2132. fn: function (aSelector){
  2133. var self=this;
  2134. return $core.withContext(function($ctx1) {
  2135. var $1;
  2136. $1=$recv(self._class())._canUnderstand_(aSelector);
  2137. return $1;
  2138. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  2139. },
  2140. args: ["aSelector"],
  2141. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2142. referencedClasses: [],
  2143. messageSends: ["canUnderstand:", "class"]
  2144. }),
  2145. $globals.Object);
  2146. $core.addMethod(
  2147. $core.method({
  2148. selector: "shallowCopy",
  2149. protocol: 'copying',
  2150. fn: function (){
  2151. var self=this;
  2152. return $core.withContext(function($ctx1) {
  2153. var copy = self.klass._new();
  2154. Object.keys(self).forEach(function(i) {
  2155. if(/^@.+/.test(i)) {
  2156. copy[i] = self[i];
  2157. }
  2158. });
  2159. return copy;
  2160. ;
  2161. return self;
  2162. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  2163. },
  2164. args: [],
  2165. 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>",
  2166. referencedClasses: [],
  2167. messageSends: []
  2168. }),
  2169. $globals.Object);
  2170. $core.addMethod(
  2171. $core.method({
  2172. selector: "shouldNotImplement",
  2173. protocol: 'error handling',
  2174. fn: function (){
  2175. var self=this;
  2176. return $core.withContext(function($ctx1) {
  2177. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  2178. return self;
  2179. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  2180. },
  2181. args: [],
  2182. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2183. referencedClasses: [],
  2184. messageSends: ["error:", ",", "name", "class"]
  2185. }),
  2186. $globals.Object);
  2187. $core.addMethod(
  2188. $core.method({
  2189. selector: "size",
  2190. protocol: 'accessing',
  2191. fn: function (){
  2192. var self=this;
  2193. return $core.withContext(function($ctx1) {
  2194. self._error_("Object not indexable");
  2195. return self;
  2196. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  2197. },
  2198. args: [],
  2199. source: "size\x0a\x09self error: 'Object not indexable'",
  2200. referencedClasses: [],
  2201. messageSends: ["error:"]
  2202. }),
  2203. $globals.Object);
  2204. $core.addMethod(
  2205. $core.method({
  2206. selector: "subclassResponsibility",
  2207. protocol: 'error handling',
  2208. fn: function (){
  2209. var self=this;
  2210. return $core.withContext(function($ctx1) {
  2211. self._error_("This method is a responsibility of a subclass");
  2212. return self;
  2213. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  2214. },
  2215. args: [],
  2216. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2217. referencedClasses: [],
  2218. messageSends: ["error:"]
  2219. }),
  2220. $globals.Object);
  2221. $core.addMethod(
  2222. $core.method({
  2223. selector: "throw:",
  2224. protocol: 'error handling',
  2225. fn: function (anObject){
  2226. var self=this;
  2227. return $core.withContext(function($ctx1) {
  2228. throw anObject ;
  2229. return self;
  2230. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)});
  2231. },
  2232. args: ["anObject"],
  2233. source: "throw: anObject\x0a\x09< throw anObject >",
  2234. referencedClasses: [],
  2235. messageSends: []
  2236. }),
  2237. $globals.Object);
  2238. $core.addMethod(
  2239. $core.method({
  2240. selector: "value",
  2241. protocol: 'evaluating',
  2242. fn: function (){
  2243. var self=this;
  2244. return $core.withContext(function($ctx1) {
  2245. return self.valueOf();
  2246. return self;
  2247. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  2248. },
  2249. args: [],
  2250. source: "value\x0a\x09<return self.valueOf()>",
  2251. referencedClasses: [],
  2252. messageSends: []
  2253. }),
  2254. $globals.Object);
  2255. $core.addMethod(
  2256. $core.method({
  2257. selector: "accessorProtocolWith:",
  2258. protocol: 'helios',
  2259. fn: function (aGenerator){
  2260. var self=this;
  2261. return $core.withContext(function($ctx1) {
  2262. $recv(aGenerator)._accessorProtocolForObject();
  2263. return self;
  2264. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2265. },
  2266. args: ["aGenerator"],
  2267. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2268. referencedClasses: [],
  2269. messageSends: ["accessorProtocolForObject"]
  2270. }),
  2271. $globals.Object.klass);
  2272. $core.addMethod(
  2273. $core.method({
  2274. selector: "accessorsSourceCodesWith:",
  2275. protocol: 'helios',
  2276. fn: function (aGenerator){
  2277. var self=this;
  2278. return $core.withContext(function($ctx1) {
  2279. $recv(aGenerator)._accessorsForObject();
  2280. return self;
  2281. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2282. },
  2283. args: ["aGenerator"],
  2284. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2285. referencedClasses: [],
  2286. messageSends: ["accessorsForObject"]
  2287. }),
  2288. $globals.Object.klass);
  2289. $core.addMethod(
  2290. $core.method({
  2291. selector: "initialize",
  2292. protocol: 'initialization',
  2293. fn: function (){
  2294. var self=this;
  2295. return self;
  2296. },
  2297. args: [],
  2298. source: "initialize\x0a\x09\x22no op\x22",
  2299. referencedClasses: [],
  2300. messageSends: []
  2301. }),
  2302. $globals.Object.klass);
  2303. $core.addMethod(
  2304. $core.method({
  2305. selector: "initializeProtocolWith:",
  2306. protocol: 'helios',
  2307. fn: function (aGenerator){
  2308. var self=this;
  2309. return $core.withContext(function($ctx1) {
  2310. $recv(aGenerator)._initializeProtocolForObject();
  2311. return self;
  2312. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2313. },
  2314. args: ["aGenerator"],
  2315. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2316. referencedClasses: [],
  2317. messageSends: ["initializeProtocolForObject"]
  2318. }),
  2319. $globals.Object.klass);
  2320. $core.addMethod(
  2321. $core.method({
  2322. selector: "initializeSourceCodesWith:",
  2323. protocol: 'helios',
  2324. fn: function (aGenerator){
  2325. var self=this;
  2326. return $core.withContext(function($ctx1) {
  2327. $recv(aGenerator)._initializeForObject();
  2328. return self;
  2329. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2330. },
  2331. args: ["aGenerator"],
  2332. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2333. referencedClasses: [],
  2334. messageSends: ["initializeForObject"]
  2335. }),
  2336. $globals.Object.klass);
  2337. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  2338. $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: [ ... ]";
  2339. $core.addMethod(
  2340. $core.method({
  2341. selector: "&",
  2342. protocol: 'controlling',
  2343. fn: function (aBoolean){
  2344. var self=this;
  2345. return $core.withContext(function($ctx1) {
  2346. if(self == true) {
  2347. return aBoolean;
  2348. } else {
  2349. return false;
  2350. }
  2351. ;
  2352. return self;
  2353. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  2354. },
  2355. args: ["aBoolean"],
  2356. 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>",
  2357. referencedClasses: [],
  2358. messageSends: []
  2359. }),
  2360. $globals.Boolean);
  2361. $core.addMethod(
  2362. $core.method({
  2363. selector: "==",
  2364. protocol: 'comparing',
  2365. fn: function (aBoolean){
  2366. var self=this;
  2367. return $core.withContext(function($ctx1) {
  2368. return aBoolean != null && self.valueOf() === (typeof aBoolean === "boolean" ? aBoolean : aBoolean.valueOf());
  2369. return self;
  2370. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  2371. },
  2372. args: ["aBoolean"],
  2373. source: "== aBoolean\x0a<return aBoolean != null && self.valueOf() === (typeof aBoolean === \x22boolean\x22 ? aBoolean : aBoolean.valueOf())>",
  2374. referencedClasses: [],
  2375. messageSends: []
  2376. }),
  2377. $globals.Boolean);
  2378. $core.addMethod(
  2379. $core.method({
  2380. selector: "and:",
  2381. protocol: 'controlling',
  2382. fn: function (aBlock){
  2383. var self=this;
  2384. return $core.withContext(function($ctx1) {
  2385. var $2,$1;
  2386. $2=self.__eq(true);
  2387. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  2388. return false;
  2389. }));
  2390. return $1;
  2391. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  2392. },
  2393. args: ["aBlock"],
  2394. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  2395. referencedClasses: [],
  2396. messageSends: ["ifTrue:ifFalse:", "="]
  2397. }),
  2398. $globals.Boolean);
  2399. $core.addMethod(
  2400. $core.method({
  2401. selector: "asBit",
  2402. protocol: 'converting',
  2403. fn: function (){
  2404. var self=this;
  2405. return $core.withContext(function($ctx1) {
  2406. var $1;
  2407. if($core.assert(self)){
  2408. $1=(1);
  2409. } else {
  2410. $1=(0);
  2411. };
  2412. return $1;
  2413. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  2414. },
  2415. args: [],
  2416. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  2417. referencedClasses: [],
  2418. messageSends: ["ifTrue:ifFalse:"]
  2419. }),
  2420. $globals.Boolean);
  2421. $core.addMethod(
  2422. $core.method({
  2423. selector: "asJSON",
  2424. protocol: 'converting',
  2425. fn: function (){
  2426. var self=this;
  2427. return self;
  2428. },
  2429. args: [],
  2430. source: "asJSON\x0a\x09^ self",
  2431. referencedClasses: [],
  2432. messageSends: []
  2433. }),
  2434. $globals.Boolean);
  2435. $core.addMethod(
  2436. $core.method({
  2437. selector: "asString",
  2438. protocol: 'converting',
  2439. fn: function (){
  2440. var self=this;
  2441. return $core.withContext(function($ctx1) {
  2442. return self.toString() ;
  2443. return self;
  2444. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  2445. },
  2446. args: [],
  2447. source: "asString\x0a\x09< return self.toString() >",
  2448. referencedClasses: [],
  2449. messageSends: []
  2450. }),
  2451. $globals.Boolean);
  2452. $core.addMethod(
  2453. $core.method({
  2454. selector: "deepCopy",
  2455. protocol: 'copying',
  2456. fn: function (){
  2457. var self=this;
  2458. return self;
  2459. },
  2460. args: [],
  2461. source: "deepCopy\x0a\x09^ self",
  2462. referencedClasses: [],
  2463. messageSends: []
  2464. }),
  2465. $globals.Boolean);
  2466. $core.addMethod(
  2467. $core.method({
  2468. selector: "ifFalse:",
  2469. protocol: 'controlling',
  2470. fn: function (aBlock){
  2471. var self=this;
  2472. return $core.withContext(function($ctx1) {
  2473. var $1;
  2474. $1=self._ifTrue_ifFalse_((function(){
  2475. }),aBlock);
  2476. return $1;
  2477. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  2478. },
  2479. args: ["aBlock"],
  2480. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  2481. referencedClasses: [],
  2482. messageSends: ["ifTrue:ifFalse:"]
  2483. }),
  2484. $globals.Boolean);
  2485. $core.addMethod(
  2486. $core.method({
  2487. selector: "ifFalse:ifTrue:",
  2488. protocol: 'controlling',
  2489. fn: function (aBlock,anotherBlock){
  2490. var self=this;
  2491. return $core.withContext(function($ctx1) {
  2492. var $1;
  2493. $1=self._ifTrue_ifFalse_(anotherBlock,aBlock);
  2494. return $1;
  2495. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2496. },
  2497. args: ["aBlock", "anotherBlock"],
  2498. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  2499. referencedClasses: [],
  2500. messageSends: ["ifTrue:ifFalse:"]
  2501. }),
  2502. $globals.Boolean);
  2503. $core.addMethod(
  2504. $core.method({
  2505. selector: "ifTrue:",
  2506. protocol: 'controlling',
  2507. fn: function (aBlock){
  2508. var self=this;
  2509. return $core.withContext(function($ctx1) {
  2510. var $1;
  2511. $1=self._ifTrue_ifFalse_(aBlock,(function(){
  2512. }));
  2513. return $1;
  2514. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  2515. },
  2516. args: ["aBlock"],
  2517. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  2518. referencedClasses: [],
  2519. messageSends: ["ifTrue:ifFalse:"]
  2520. }),
  2521. $globals.Boolean);
  2522. $core.addMethod(
  2523. $core.method({
  2524. selector: "ifTrue:ifFalse:",
  2525. protocol: 'controlling',
  2526. fn: function (aBlock,anotherBlock){
  2527. var self=this;
  2528. return $core.withContext(function($ctx1) {
  2529. if(self == true) {
  2530. return aBlock._value();
  2531. } else {
  2532. return anotherBlock._value();
  2533. }
  2534. ;
  2535. return self;
  2536. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2537. },
  2538. args: ["aBlock", "anotherBlock"],
  2539. 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>",
  2540. referencedClasses: [],
  2541. messageSends: []
  2542. }),
  2543. $globals.Boolean);
  2544. $core.addMethod(
  2545. $core.method({
  2546. selector: "isBoolean",
  2547. protocol: 'testing',
  2548. fn: function (){
  2549. var self=this;
  2550. return true;
  2551. },
  2552. args: [],
  2553. source: "isBoolean\x0a\x09^ true",
  2554. referencedClasses: [],
  2555. messageSends: []
  2556. }),
  2557. $globals.Boolean);
  2558. $core.addMethod(
  2559. $core.method({
  2560. selector: "isImmutable",
  2561. protocol: 'testing',
  2562. fn: function (){
  2563. var self=this;
  2564. return true;
  2565. },
  2566. args: [],
  2567. source: "isImmutable\x0a\x09^ true",
  2568. referencedClasses: [],
  2569. messageSends: []
  2570. }),
  2571. $globals.Boolean);
  2572. $core.addMethod(
  2573. $core.method({
  2574. selector: "not",
  2575. protocol: 'controlling',
  2576. fn: function (){
  2577. var self=this;
  2578. return $core.withContext(function($ctx1) {
  2579. var $1;
  2580. $1=self.__eq(false);
  2581. return $1;
  2582. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  2583. },
  2584. args: [],
  2585. source: "not\x0a\x09^ self = false",
  2586. referencedClasses: [],
  2587. messageSends: ["="]
  2588. }),
  2589. $globals.Boolean);
  2590. $core.addMethod(
  2591. $core.method({
  2592. selector: "or:",
  2593. protocol: 'controlling',
  2594. fn: function (aBlock){
  2595. var self=this;
  2596. return $core.withContext(function($ctx1) {
  2597. var $2,$1;
  2598. $2=self.__eq(true);
  2599. $1=$recv($2)._ifTrue_ifFalse_((function(){
  2600. return true;
  2601. }),aBlock);
  2602. return $1;
  2603. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  2604. },
  2605. args: ["aBlock"],
  2606. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  2607. referencedClasses: [],
  2608. messageSends: ["ifTrue:ifFalse:", "="]
  2609. }),
  2610. $globals.Boolean);
  2611. $core.addMethod(
  2612. $core.method({
  2613. selector: "printOn:",
  2614. protocol: 'printing',
  2615. fn: function (aStream){
  2616. var self=this;
  2617. return $core.withContext(function($ctx1) {
  2618. $recv(aStream)._nextPutAll_(self._asString());
  2619. return self;
  2620. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  2621. },
  2622. args: ["aStream"],
  2623. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2624. referencedClasses: [],
  2625. messageSends: ["nextPutAll:", "asString"]
  2626. }),
  2627. $globals.Boolean);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "shallowCopy",
  2631. protocol: 'copying',
  2632. fn: function (){
  2633. var self=this;
  2634. return self;
  2635. },
  2636. args: [],
  2637. source: "shallowCopy\x0a\x09^ self",
  2638. referencedClasses: [],
  2639. messageSends: []
  2640. }),
  2641. $globals.Boolean);
  2642. $core.addMethod(
  2643. $core.method({
  2644. selector: "|",
  2645. protocol: 'controlling',
  2646. fn: function (aBoolean){
  2647. var self=this;
  2648. return $core.withContext(function($ctx1) {
  2649. if(self == true) {
  2650. return true;
  2651. } else {
  2652. return aBoolean;
  2653. }
  2654. ;
  2655. return self;
  2656. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  2657. },
  2658. args: ["aBoolean"],
  2659. 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>",
  2660. referencedClasses: [],
  2661. messageSends: []
  2662. }),
  2663. $globals.Boolean);
  2664. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  2665. $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.).";
  2666. $core.addMethod(
  2667. $core.method({
  2668. selector: "+",
  2669. protocol: 'arithmetic',
  2670. fn: function (aDate){
  2671. var self=this;
  2672. return $core.withContext(function($ctx1) {
  2673. return self + aDate;
  2674. return self;
  2675. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  2676. },
  2677. args: ["aDate"],
  2678. source: "+ aDate\x0a\x09<return self + aDate>",
  2679. referencedClasses: [],
  2680. messageSends: []
  2681. }),
  2682. $globals.Date);
  2683. $core.addMethod(
  2684. $core.method({
  2685. selector: "-",
  2686. protocol: 'arithmetic',
  2687. fn: function (aDate){
  2688. var self=this;
  2689. return $core.withContext(function($ctx1) {
  2690. return self - aDate;
  2691. return self;
  2692. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  2693. },
  2694. args: ["aDate"],
  2695. source: "- aDate\x0a\x09<return self - aDate>",
  2696. referencedClasses: [],
  2697. messageSends: []
  2698. }),
  2699. $globals.Date);
  2700. $core.addMethod(
  2701. $core.method({
  2702. selector: "<",
  2703. protocol: 'comparing',
  2704. fn: function (aDate){
  2705. var self=this;
  2706. return $core.withContext(function($ctx1) {
  2707. return self < aDate;
  2708. return self;
  2709. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  2710. },
  2711. args: ["aDate"],
  2712. source: "< aDate\x0a\x09<return self < aDate>",
  2713. referencedClasses: [],
  2714. messageSends: []
  2715. }),
  2716. $globals.Date);
  2717. $core.addMethod(
  2718. $core.method({
  2719. selector: "<=",
  2720. protocol: 'comparing',
  2721. fn: function (aDate){
  2722. var self=this;
  2723. return $core.withContext(function($ctx1) {
  2724. return self <= aDate;
  2725. return self;
  2726. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  2727. },
  2728. args: ["aDate"],
  2729. source: "<= aDate\x0a\x09<return self <= aDate>",
  2730. referencedClasses: [],
  2731. messageSends: []
  2732. }),
  2733. $globals.Date);
  2734. $core.addMethod(
  2735. $core.method({
  2736. selector: "=",
  2737. protocol: 'comparing',
  2738. fn: function (aDate){
  2739. var self=this;
  2740. return $core.withContext(function($ctx1) {
  2741. var $3,$2,$4,$1;
  2742. $3=$recv(aDate)._class();
  2743. $ctx1.sendIdx["class"]=1;
  2744. $2=$recv($3).__eq_eq(self._class());
  2745. $ctx1.sendIdx["=="]=1;
  2746. $1=$recv($2)._and_((function(){
  2747. return $core.withContext(function($ctx2) {
  2748. $4=self._asMilliseconds();
  2749. $ctx2.sendIdx["asMilliseconds"]=1;
  2750. return $recv($4).__eq_eq($recv(aDate)._asMilliseconds());
  2751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2752. }));
  2753. return $1;
  2754. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  2755. },
  2756. args: ["aDate"],
  2757. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  2758. referencedClasses: [],
  2759. messageSends: ["and:", "==", "class", "asMilliseconds"]
  2760. }),
  2761. $globals.Date);
  2762. $core.addMethod(
  2763. $core.method({
  2764. selector: ">",
  2765. protocol: 'comparing',
  2766. fn: function (aDate){
  2767. var self=this;
  2768. return $core.withContext(function($ctx1) {
  2769. return self > aDate;
  2770. return self;
  2771. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  2772. },
  2773. args: ["aDate"],
  2774. source: "> aDate\x0a\x09<return self >> aDate>",
  2775. referencedClasses: [],
  2776. messageSends: []
  2777. }),
  2778. $globals.Date);
  2779. $core.addMethod(
  2780. $core.method({
  2781. selector: ">=",
  2782. protocol: 'comparing',
  2783. fn: function (aDate){
  2784. var self=this;
  2785. return $core.withContext(function($ctx1) {
  2786. return self >= aDate;
  2787. return self;
  2788. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  2789. },
  2790. args: ["aDate"],
  2791. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2792. referencedClasses: [],
  2793. messageSends: []
  2794. }),
  2795. $globals.Date);
  2796. $core.addMethod(
  2797. $core.method({
  2798. selector: "asDateString",
  2799. protocol: 'converting',
  2800. fn: function (){
  2801. var self=this;
  2802. return $core.withContext(function($ctx1) {
  2803. return self.toDateString();
  2804. return self;
  2805. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  2806. },
  2807. args: [],
  2808. source: "asDateString\x0a\x09<return self.toDateString()>",
  2809. referencedClasses: [],
  2810. messageSends: []
  2811. }),
  2812. $globals.Date);
  2813. $core.addMethod(
  2814. $core.method({
  2815. selector: "asLocaleString",
  2816. protocol: 'converting',
  2817. fn: function (){
  2818. var self=this;
  2819. return $core.withContext(function($ctx1) {
  2820. return self.toLocaleString();
  2821. return self;
  2822. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  2823. },
  2824. args: [],
  2825. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2826. referencedClasses: [],
  2827. messageSends: []
  2828. }),
  2829. $globals.Date);
  2830. $core.addMethod(
  2831. $core.method({
  2832. selector: "asMilliseconds",
  2833. protocol: 'converting',
  2834. fn: function (){
  2835. var self=this;
  2836. return $core.withContext(function($ctx1) {
  2837. var $1;
  2838. $1=self._time();
  2839. return $1;
  2840. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  2841. },
  2842. args: [],
  2843. source: "asMilliseconds\x0a\x09^ self time",
  2844. referencedClasses: [],
  2845. messageSends: ["time"]
  2846. }),
  2847. $globals.Date);
  2848. $core.addMethod(
  2849. $core.method({
  2850. selector: "asNumber",
  2851. protocol: 'converting',
  2852. fn: function (){
  2853. var self=this;
  2854. return $core.withContext(function($ctx1) {
  2855. var $1;
  2856. $1=self._asMilliseconds();
  2857. return $1;
  2858. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  2859. },
  2860. args: [],
  2861. source: "asNumber\x0a\x09^ self asMilliseconds",
  2862. referencedClasses: [],
  2863. messageSends: ["asMilliseconds"]
  2864. }),
  2865. $globals.Date);
  2866. $core.addMethod(
  2867. $core.method({
  2868. selector: "asString",
  2869. protocol: 'converting',
  2870. fn: function (){
  2871. var self=this;
  2872. return $core.withContext(function($ctx1) {
  2873. return self.toString();
  2874. return self;
  2875. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  2876. },
  2877. args: [],
  2878. source: "asString\x0a\x09<return self.toString()>",
  2879. referencedClasses: [],
  2880. messageSends: []
  2881. }),
  2882. $globals.Date);
  2883. $core.addMethod(
  2884. $core.method({
  2885. selector: "asTimeString",
  2886. protocol: 'converting',
  2887. fn: function (){
  2888. var self=this;
  2889. return $core.withContext(function($ctx1) {
  2890. return self.toTimeString();
  2891. return self;
  2892. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  2893. },
  2894. args: [],
  2895. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2896. referencedClasses: [],
  2897. messageSends: []
  2898. }),
  2899. $globals.Date);
  2900. $core.addMethod(
  2901. $core.method({
  2902. selector: "day",
  2903. protocol: 'accessing',
  2904. fn: function (){
  2905. var self=this;
  2906. return $core.withContext(function($ctx1) {
  2907. var $1;
  2908. $1=self._dayOfWeek();
  2909. return $1;
  2910. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  2911. },
  2912. args: [],
  2913. source: "day\x0a\x09^ self dayOfWeek",
  2914. referencedClasses: [],
  2915. messageSends: ["dayOfWeek"]
  2916. }),
  2917. $globals.Date);
  2918. $core.addMethod(
  2919. $core.method({
  2920. selector: "day:",
  2921. protocol: 'accessing',
  2922. fn: function (aNumber){
  2923. var self=this;
  2924. return $core.withContext(function($ctx1) {
  2925. self._dayOfWeek_(aNumber);
  2926. return self;
  2927. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  2928. },
  2929. args: ["aNumber"],
  2930. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2931. referencedClasses: [],
  2932. messageSends: ["dayOfWeek:"]
  2933. }),
  2934. $globals.Date);
  2935. $core.addMethod(
  2936. $core.method({
  2937. selector: "dayOfMonth",
  2938. protocol: 'accessing',
  2939. fn: function (){
  2940. var self=this;
  2941. return $core.withContext(function($ctx1) {
  2942. return self.getDate();
  2943. return self;
  2944. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  2945. },
  2946. args: [],
  2947. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2948. referencedClasses: [],
  2949. messageSends: []
  2950. }),
  2951. $globals.Date);
  2952. $core.addMethod(
  2953. $core.method({
  2954. selector: "dayOfMonth:",
  2955. protocol: 'accessing',
  2956. fn: function (aNumber){
  2957. var self=this;
  2958. return $core.withContext(function($ctx1) {
  2959. self.setDate(aNumber);
  2960. return self;
  2961. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  2962. },
  2963. args: ["aNumber"],
  2964. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2965. referencedClasses: [],
  2966. messageSends: []
  2967. }),
  2968. $globals.Date);
  2969. $core.addMethod(
  2970. $core.method({
  2971. selector: "dayOfWeek",
  2972. protocol: 'accessing',
  2973. fn: function (){
  2974. var self=this;
  2975. return $core.withContext(function($ctx1) {
  2976. return self.getDay() + 1;
  2977. return self;
  2978. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  2979. },
  2980. args: [],
  2981. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2982. referencedClasses: [],
  2983. messageSends: []
  2984. }),
  2985. $globals.Date);
  2986. $core.addMethod(
  2987. $core.method({
  2988. selector: "dayOfWeek:",
  2989. protocol: 'accessing',
  2990. fn: function (aNumber){
  2991. var self=this;
  2992. return $core.withContext(function($ctx1) {
  2993. return self.setDay(aNumber - 1);
  2994. return self;
  2995. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  2996. },
  2997. args: ["aNumber"],
  2998. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2999. referencedClasses: [],
  3000. messageSends: []
  3001. }),
  3002. $globals.Date);
  3003. $core.addMethod(
  3004. $core.method({
  3005. selector: "hours",
  3006. protocol: 'accessing',
  3007. fn: function (){
  3008. var self=this;
  3009. return $core.withContext(function($ctx1) {
  3010. return self.getHours();
  3011. return self;
  3012. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3013. },
  3014. args: [],
  3015. source: "hours\x0a\x09<return self.getHours()>",
  3016. referencedClasses: [],
  3017. messageSends: []
  3018. }),
  3019. $globals.Date);
  3020. $core.addMethod(
  3021. $core.method({
  3022. selector: "hours:",
  3023. protocol: 'accessing',
  3024. fn: function (aNumber){
  3025. var self=this;
  3026. return $core.withContext(function($ctx1) {
  3027. self.setHours(aNumber);
  3028. return self;
  3029. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3030. },
  3031. args: ["aNumber"],
  3032. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  3033. referencedClasses: [],
  3034. messageSends: []
  3035. }),
  3036. $globals.Date);
  3037. $core.addMethod(
  3038. $core.method({
  3039. selector: "milliseconds",
  3040. protocol: 'accessing',
  3041. fn: function (){
  3042. var self=this;
  3043. return $core.withContext(function($ctx1) {
  3044. return self.getMilliseconds();
  3045. return self;
  3046. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3047. },
  3048. args: [],
  3049. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  3050. referencedClasses: [],
  3051. messageSends: []
  3052. }),
  3053. $globals.Date);
  3054. $core.addMethod(
  3055. $core.method({
  3056. selector: "milliseconds:",
  3057. protocol: 'accessing',
  3058. fn: function (aNumber){
  3059. var self=this;
  3060. return $core.withContext(function($ctx1) {
  3061. self.setMilliseconds(aNumber);
  3062. return self;
  3063. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3064. },
  3065. args: ["aNumber"],
  3066. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3067. referencedClasses: [],
  3068. messageSends: []
  3069. }),
  3070. $globals.Date);
  3071. $core.addMethod(
  3072. $core.method({
  3073. selector: "minutes",
  3074. protocol: 'accessing',
  3075. fn: function (){
  3076. var self=this;
  3077. return $core.withContext(function($ctx1) {
  3078. return self.getMinutes();
  3079. return self;
  3080. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3081. },
  3082. args: [],
  3083. source: "minutes\x0a\x09<return self.getMinutes()>",
  3084. referencedClasses: [],
  3085. messageSends: []
  3086. }),
  3087. $globals.Date);
  3088. $core.addMethod(
  3089. $core.method({
  3090. selector: "minutes:",
  3091. protocol: 'accessing',
  3092. fn: function (aNumber){
  3093. var self=this;
  3094. return $core.withContext(function($ctx1) {
  3095. self.setMinutes(aNumber);
  3096. return self;
  3097. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3098. },
  3099. args: ["aNumber"],
  3100. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3101. referencedClasses: [],
  3102. messageSends: []
  3103. }),
  3104. $globals.Date);
  3105. $core.addMethod(
  3106. $core.method({
  3107. selector: "month",
  3108. protocol: 'accessing',
  3109. fn: function (){
  3110. var self=this;
  3111. return $core.withContext(function($ctx1) {
  3112. return self.getMonth() + 1;
  3113. return self;
  3114. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3115. },
  3116. args: [],
  3117. source: "month\x0a\x09<return self.getMonth() + 1>",
  3118. referencedClasses: [],
  3119. messageSends: []
  3120. }),
  3121. $globals.Date);
  3122. $core.addMethod(
  3123. $core.method({
  3124. selector: "month:",
  3125. protocol: 'accessing',
  3126. fn: function (aNumber){
  3127. var self=this;
  3128. return $core.withContext(function($ctx1) {
  3129. self.setMonth(aNumber - 1);
  3130. return self;
  3131. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3132. },
  3133. args: ["aNumber"],
  3134. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3135. referencedClasses: [],
  3136. messageSends: []
  3137. }),
  3138. $globals.Date);
  3139. $core.addMethod(
  3140. $core.method({
  3141. selector: "printOn:",
  3142. protocol: 'printing',
  3143. fn: function (aStream){
  3144. var self=this;
  3145. return $core.withContext(function($ctx1) {
  3146. $recv(aStream)._nextPutAll_(self._asString());
  3147. return self;
  3148. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3149. },
  3150. args: ["aStream"],
  3151. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3152. referencedClasses: [],
  3153. messageSends: ["nextPutAll:", "asString"]
  3154. }),
  3155. $globals.Date);
  3156. $core.addMethod(
  3157. $core.method({
  3158. selector: "seconds",
  3159. protocol: 'accessing',
  3160. fn: function (){
  3161. var self=this;
  3162. return $core.withContext(function($ctx1) {
  3163. return self.getSeconds();
  3164. return self;
  3165. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3166. },
  3167. args: [],
  3168. source: "seconds\x0a\x09<return self.getSeconds()>",
  3169. referencedClasses: [],
  3170. messageSends: []
  3171. }),
  3172. $globals.Date);
  3173. $core.addMethod(
  3174. $core.method({
  3175. selector: "seconds:",
  3176. protocol: 'accessing',
  3177. fn: function (aNumber){
  3178. var self=this;
  3179. return $core.withContext(function($ctx1) {
  3180. self.setSeconds(aNumber);
  3181. return self;
  3182. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3183. },
  3184. args: ["aNumber"],
  3185. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3186. referencedClasses: [],
  3187. messageSends: []
  3188. }),
  3189. $globals.Date);
  3190. $core.addMethod(
  3191. $core.method({
  3192. selector: "time",
  3193. protocol: 'accessing',
  3194. fn: function (){
  3195. var self=this;
  3196. return $core.withContext(function($ctx1) {
  3197. return self.getTime();
  3198. return self;
  3199. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3200. },
  3201. args: [],
  3202. source: "time\x0a\x09<return self.getTime()>",
  3203. referencedClasses: [],
  3204. messageSends: []
  3205. }),
  3206. $globals.Date);
  3207. $core.addMethod(
  3208. $core.method({
  3209. selector: "time:",
  3210. protocol: 'accessing',
  3211. fn: function (aNumber){
  3212. var self=this;
  3213. return $core.withContext(function($ctx1) {
  3214. self.setTime(aNumber);
  3215. return self;
  3216. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3217. },
  3218. args: ["aNumber"],
  3219. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3220. referencedClasses: [],
  3221. messageSends: []
  3222. }),
  3223. $globals.Date);
  3224. $core.addMethod(
  3225. $core.method({
  3226. selector: "year",
  3227. protocol: 'accessing',
  3228. fn: function (){
  3229. var self=this;
  3230. return $core.withContext(function($ctx1) {
  3231. return self.getFullYear();
  3232. return self;
  3233. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3234. },
  3235. args: [],
  3236. source: "year\x0a\x09<return self.getFullYear()>",
  3237. referencedClasses: [],
  3238. messageSends: []
  3239. }),
  3240. $globals.Date);
  3241. $core.addMethod(
  3242. $core.method({
  3243. selector: "year:",
  3244. protocol: 'accessing',
  3245. fn: function (aNumber){
  3246. var self=this;
  3247. return $core.withContext(function($ctx1) {
  3248. self.setFullYear(aNumber);
  3249. return self;
  3250. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  3251. },
  3252. args: ["aNumber"],
  3253. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3254. referencedClasses: [],
  3255. messageSends: []
  3256. }),
  3257. $globals.Date);
  3258. $core.addMethod(
  3259. $core.method({
  3260. selector: "classTag",
  3261. protocol: 'accessing',
  3262. fn: function (){
  3263. var self=this;
  3264. return "magnitude";
  3265. },
  3266. args: [],
  3267. 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'",
  3268. referencedClasses: [],
  3269. messageSends: []
  3270. }),
  3271. $globals.Date.klass);
  3272. $core.addMethod(
  3273. $core.method({
  3274. selector: "fromMilliseconds:",
  3275. protocol: 'instance creation',
  3276. fn: function (aNumber){
  3277. var self=this;
  3278. return $core.withContext(function($ctx1) {
  3279. var $1;
  3280. $1=self._new_(aNumber);
  3281. return $1;
  3282. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  3283. },
  3284. args: ["aNumber"],
  3285. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3286. referencedClasses: [],
  3287. messageSends: ["new:"]
  3288. }),
  3289. $globals.Date.klass);
  3290. $core.addMethod(
  3291. $core.method({
  3292. selector: "fromSeconds:",
  3293. protocol: 'instance creation',
  3294. fn: function (aNumber){
  3295. var self=this;
  3296. return $core.withContext(function($ctx1) {
  3297. var $1;
  3298. $1=self._fromMilliseconds_($recv(aNumber).__star((1000)));
  3299. return $1;
  3300. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  3301. },
  3302. args: ["aNumber"],
  3303. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3304. referencedClasses: [],
  3305. messageSends: ["fromMilliseconds:", "*"]
  3306. }),
  3307. $globals.Date.klass);
  3308. $core.addMethod(
  3309. $core.method({
  3310. selector: "fromString:",
  3311. protocol: 'instance creation',
  3312. fn: function (aString){
  3313. var self=this;
  3314. return $core.withContext(function($ctx1) {
  3315. var $1;
  3316. $1=self._new_(aString);
  3317. return $1;
  3318. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  3319. },
  3320. args: ["aString"],
  3321. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3322. referencedClasses: [],
  3323. messageSends: ["new:"]
  3324. }),
  3325. $globals.Date.klass);
  3326. $core.addMethod(
  3327. $core.method({
  3328. selector: "millisecondsToRun:",
  3329. protocol: 'instance creation',
  3330. fn: function (aBlock){
  3331. var self=this;
  3332. var t;
  3333. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  3334. return $core.withContext(function($ctx1) {
  3335. var $1;
  3336. t=$recv($Date())._now();
  3337. $ctx1.sendIdx["now"]=1;
  3338. $recv(aBlock)._value();
  3339. $1=$recv($recv($Date())._now()).__minus(t);
  3340. return $1;
  3341. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  3342. },
  3343. args: ["aBlock"],
  3344. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3345. referencedClasses: ["Date"],
  3346. messageSends: ["now", "value", "-"]
  3347. }),
  3348. $globals.Date.klass);
  3349. $core.addMethod(
  3350. $core.method({
  3351. selector: "new:",
  3352. protocol: 'instance creation',
  3353. fn: function (anObject){
  3354. var self=this;
  3355. return $core.withContext(function($ctx1) {
  3356. return new Date(anObject);
  3357. return self;
  3358. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  3359. },
  3360. args: ["anObject"],
  3361. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3362. referencedClasses: [],
  3363. messageSends: []
  3364. }),
  3365. $globals.Date.klass);
  3366. $core.addMethod(
  3367. $core.method({
  3368. selector: "now",
  3369. protocol: 'instance creation',
  3370. fn: function (){
  3371. var self=this;
  3372. return $core.withContext(function($ctx1) {
  3373. var $1;
  3374. $1=self._today();
  3375. return $1;
  3376. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  3377. },
  3378. args: [],
  3379. source: "now\x0a\x09^ self today",
  3380. referencedClasses: [],
  3381. messageSends: ["today"]
  3382. }),
  3383. $globals.Date.klass);
  3384. $core.addMethod(
  3385. $core.method({
  3386. selector: "today",
  3387. protocol: 'instance creation',
  3388. fn: function (){
  3389. var self=this;
  3390. return $core.withContext(function($ctx1) {
  3391. var $1;
  3392. $1=self._new();
  3393. return $1;
  3394. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  3395. },
  3396. args: [],
  3397. source: "today\x0a\x09^ self new",
  3398. referencedClasses: [],
  3399. messageSends: ["new"]
  3400. }),
  3401. $globals.Date.klass);
  3402. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  3403. $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 ].";
  3404. $core.addMethod(
  3405. $core.method({
  3406. selector: "&",
  3407. protocol: 'converting',
  3408. fn: function (aNumber){
  3409. var self=this;
  3410. return $core.withContext(function($ctx1) {
  3411. return self & aNumber;
  3412. return self;
  3413. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  3414. },
  3415. args: ["aNumber"],
  3416. source: "& aNumber\x0a\x09<return self & aNumber>",
  3417. referencedClasses: [],
  3418. messageSends: []
  3419. }),
  3420. $globals.Number);
  3421. $core.addMethod(
  3422. $core.method({
  3423. selector: "*",
  3424. protocol: 'arithmetic',
  3425. fn: function (aNumber){
  3426. var self=this;
  3427. return $core.withContext(function($ctx1) {
  3428. return self * aNumber;
  3429. return self;
  3430. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  3431. },
  3432. args: ["aNumber"],
  3433. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3434. referencedClasses: [],
  3435. messageSends: []
  3436. }),
  3437. $globals.Number);
  3438. $core.addMethod(
  3439. $core.method({
  3440. selector: "**",
  3441. protocol: 'mathematical functions',
  3442. fn: function (exponent){
  3443. var self=this;
  3444. return $core.withContext(function($ctx1) {
  3445. var $1;
  3446. $1=self._raisedTo_(exponent);
  3447. return $1;
  3448. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  3449. },
  3450. args: ["exponent"],
  3451. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  3452. referencedClasses: [],
  3453. messageSends: ["raisedTo:"]
  3454. }),
  3455. $globals.Number);
  3456. $core.addMethod(
  3457. $core.method({
  3458. selector: "+",
  3459. protocol: 'arithmetic',
  3460. fn: function (aNumber){
  3461. var self=this;
  3462. return $core.withContext(function($ctx1) {
  3463. return self + aNumber;
  3464. return self;
  3465. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  3466. },
  3467. args: ["aNumber"],
  3468. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3469. referencedClasses: [],
  3470. messageSends: []
  3471. }),
  3472. $globals.Number);
  3473. $core.addMethod(
  3474. $core.method({
  3475. selector: "-",
  3476. protocol: 'arithmetic',
  3477. fn: function (aNumber){
  3478. var self=this;
  3479. return $core.withContext(function($ctx1) {
  3480. return self - aNumber;
  3481. return self;
  3482. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  3483. },
  3484. args: ["aNumber"],
  3485. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3486. referencedClasses: [],
  3487. messageSends: []
  3488. }),
  3489. $globals.Number);
  3490. $core.addMethod(
  3491. $core.method({
  3492. selector: "/",
  3493. protocol: 'arithmetic',
  3494. fn: function (aNumber){
  3495. var self=this;
  3496. return $core.withContext(function($ctx1) {
  3497. return self / aNumber;
  3498. return self;
  3499. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  3500. },
  3501. args: ["aNumber"],
  3502. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3503. referencedClasses: [],
  3504. messageSends: []
  3505. }),
  3506. $globals.Number);
  3507. $core.addMethod(
  3508. $core.method({
  3509. selector: "//",
  3510. protocol: 'arithmetic',
  3511. fn: function (aNumber){
  3512. var self=this;
  3513. return $core.withContext(function($ctx1) {
  3514. var $1;
  3515. $1=$recv(self.__slash(aNumber))._floor();
  3516. return $1;
  3517. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  3518. },
  3519. args: ["aNumber"],
  3520. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  3521. referencedClasses: [],
  3522. messageSends: ["floor", "/"]
  3523. }),
  3524. $globals.Number);
  3525. $core.addMethod(
  3526. $core.method({
  3527. selector: "<",
  3528. protocol: 'comparing',
  3529. fn: function (aNumber){
  3530. var self=this;
  3531. return $core.withContext(function($ctx1) {
  3532. return self < aNumber;
  3533. return self;
  3534. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  3535. },
  3536. args: ["aNumber"],
  3537. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3538. referencedClasses: [],
  3539. messageSends: []
  3540. }),
  3541. $globals.Number);
  3542. $core.addMethod(
  3543. $core.method({
  3544. selector: "<=",
  3545. protocol: 'comparing',
  3546. fn: function (aNumber){
  3547. var self=this;
  3548. return $core.withContext(function($ctx1) {
  3549. return self <= aNumber;
  3550. return self;
  3551. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  3552. },
  3553. args: ["aNumber"],
  3554. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3555. referencedClasses: [],
  3556. messageSends: []
  3557. }),
  3558. $globals.Number);
  3559. $core.addMethod(
  3560. $core.method({
  3561. selector: "==",
  3562. protocol: 'comparing',
  3563. fn: function (aNumber){
  3564. var self=this;
  3565. return $core.withContext(function($ctx1) {
  3566. return aNumber != null && Number(self) === (typeof aNumber === "number" ? aNumber : aNumber.valueOf());
  3567. return self;
  3568. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  3569. },
  3570. args: ["aNumber"],
  3571. source: "== aNumber\x0a<return aNumber != null && Number(self) === (typeof aNumber === \x22number\x22 ? aNumber : aNumber.valueOf())>",
  3572. referencedClasses: [],
  3573. messageSends: []
  3574. }),
  3575. $globals.Number);
  3576. $core.addMethod(
  3577. $core.method({
  3578. selector: ">",
  3579. protocol: 'comparing',
  3580. fn: function (aNumber){
  3581. var self=this;
  3582. return $core.withContext(function($ctx1) {
  3583. return self > aNumber;
  3584. return self;
  3585. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  3586. },
  3587. args: ["aNumber"],
  3588. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3589. referencedClasses: [],
  3590. messageSends: []
  3591. }),
  3592. $globals.Number);
  3593. $core.addMethod(
  3594. $core.method({
  3595. selector: ">=",
  3596. protocol: 'comparing',
  3597. fn: function (aNumber){
  3598. var self=this;
  3599. return $core.withContext(function($ctx1) {
  3600. return self >= aNumber;
  3601. return self;
  3602. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  3603. },
  3604. args: ["aNumber"],
  3605. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3606. referencedClasses: [],
  3607. messageSends: []
  3608. }),
  3609. $globals.Number);
  3610. $core.addMethod(
  3611. $core.method({
  3612. selector: "@",
  3613. protocol: 'converting',
  3614. fn: function (aNumber){
  3615. var self=this;
  3616. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3617. return $core.withContext(function($ctx1) {
  3618. var $1;
  3619. $1=$recv($Point())._x_y_(self,aNumber);
  3620. return $1;
  3621. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  3622. },
  3623. args: ["aNumber"],
  3624. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  3625. referencedClasses: ["Point"],
  3626. messageSends: ["x:y:"]
  3627. }),
  3628. $globals.Number);
  3629. $core.addMethod(
  3630. $core.method({
  3631. selector: "\x5c\x5c",
  3632. protocol: 'arithmetic',
  3633. fn: function (aNumber){
  3634. var self=this;
  3635. return $core.withContext(function($ctx1) {
  3636. return self % aNumber;
  3637. return self;
  3638. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  3639. },
  3640. args: ["aNumber"],
  3641. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3642. referencedClasses: [],
  3643. messageSends: []
  3644. }),
  3645. $globals.Number);
  3646. $core.addMethod(
  3647. $core.method({
  3648. selector: "abs",
  3649. protocol: 'arithmetic',
  3650. fn: function (){
  3651. var self=this;
  3652. return $core.withContext(function($ctx1) {
  3653. return Math.abs(self);;
  3654. return self;
  3655. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  3656. },
  3657. args: [],
  3658. source: "abs\x0a\x09<return Math.abs(self);>",
  3659. referencedClasses: [],
  3660. messageSends: []
  3661. }),
  3662. $globals.Number);
  3663. $core.addMethod(
  3664. $core.method({
  3665. selector: "arcCos",
  3666. protocol: 'mathematical functions',
  3667. fn: function (){
  3668. var self=this;
  3669. return $core.withContext(function($ctx1) {
  3670. return Math.acos(self);;
  3671. return self;
  3672. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  3673. },
  3674. args: [],
  3675. source: "arcCos\x0a\x09<return Math.acos(self);>",
  3676. referencedClasses: [],
  3677. messageSends: []
  3678. }),
  3679. $globals.Number);
  3680. $core.addMethod(
  3681. $core.method({
  3682. selector: "arcSin",
  3683. protocol: 'mathematical functions',
  3684. fn: function (){
  3685. var self=this;
  3686. return $core.withContext(function($ctx1) {
  3687. return Math.asin(self);;
  3688. return self;
  3689. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  3690. },
  3691. args: [],
  3692. source: "arcSin\x0a\x09<return Math.asin(self);>",
  3693. referencedClasses: [],
  3694. messageSends: []
  3695. }),
  3696. $globals.Number);
  3697. $core.addMethod(
  3698. $core.method({
  3699. selector: "arcTan",
  3700. protocol: 'mathematical functions',
  3701. fn: function (){
  3702. var self=this;
  3703. return $core.withContext(function($ctx1) {
  3704. return Math.atan(self);;
  3705. return self;
  3706. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  3707. },
  3708. args: [],
  3709. source: "arcTan\x0a\x09<return Math.atan(self);>",
  3710. referencedClasses: [],
  3711. messageSends: []
  3712. }),
  3713. $globals.Number);
  3714. $core.addMethod(
  3715. $core.method({
  3716. selector: "asJSON",
  3717. protocol: 'converting',
  3718. fn: function (){
  3719. var self=this;
  3720. return self;
  3721. },
  3722. args: [],
  3723. source: "asJSON\x0a\x09^ self",
  3724. referencedClasses: [],
  3725. messageSends: []
  3726. }),
  3727. $globals.Number);
  3728. $core.addMethod(
  3729. $core.method({
  3730. selector: "asJavascript",
  3731. protocol: 'converting',
  3732. fn: function (){
  3733. var self=this;
  3734. return $core.withContext(function($ctx1) {
  3735. var $1;
  3736. $1=$recv("(".__comma(self._printString())).__comma(")");
  3737. $ctx1.sendIdx[","]=1;
  3738. return $1;
  3739. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  3740. },
  3741. args: [],
  3742. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  3743. referencedClasses: [],
  3744. messageSends: [",", "printString"]
  3745. }),
  3746. $globals.Number);
  3747. $core.addMethod(
  3748. $core.method({
  3749. selector: "asNumber",
  3750. protocol: 'converting',
  3751. fn: function (){
  3752. var self=this;
  3753. return self;
  3754. },
  3755. args: [],
  3756. source: "asNumber\x0a\x09^ self",
  3757. referencedClasses: [],
  3758. messageSends: []
  3759. }),
  3760. $globals.Number);
  3761. $core.addMethod(
  3762. $core.method({
  3763. selector: "asPoint",
  3764. protocol: 'converting',
  3765. fn: function (){
  3766. var self=this;
  3767. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3768. return $core.withContext(function($ctx1) {
  3769. var $1;
  3770. $1=$recv($Point())._x_y_(self,self);
  3771. return $1;
  3772. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  3773. },
  3774. args: [],
  3775. source: "asPoint\x0a\x09^ Point x: self y: self",
  3776. referencedClasses: ["Point"],
  3777. messageSends: ["x:y:"]
  3778. }),
  3779. $globals.Number);
  3780. $core.addMethod(
  3781. $core.method({
  3782. selector: "asString",
  3783. protocol: 'converting',
  3784. fn: function (){
  3785. var self=this;
  3786. return $core.withContext(function($ctx1) {
  3787. return String(self) ;
  3788. return self;
  3789. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  3790. },
  3791. args: [],
  3792. source: "asString\x0a\x09< return String(self) >",
  3793. referencedClasses: [],
  3794. messageSends: []
  3795. }),
  3796. $globals.Number);
  3797. $core.addMethod(
  3798. $core.method({
  3799. selector: "atRandom",
  3800. protocol: 'converting',
  3801. fn: function (){
  3802. var self=this;
  3803. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  3804. return $core.withContext(function($ctx1) {
  3805. var $1;
  3806. $1=$recv($recv($recv($recv($recv($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  3807. return $1;
  3808. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  3809. },
  3810. args: [],
  3811. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  3812. referencedClasses: ["Random"],
  3813. messageSends: ["+", "truncated", "*", "next", "new"]
  3814. }),
  3815. $globals.Number);
  3816. $core.addMethod(
  3817. $core.method({
  3818. selector: "ceiling",
  3819. protocol: 'converting',
  3820. fn: function (){
  3821. var self=this;
  3822. return $core.withContext(function($ctx1) {
  3823. return Math.ceil(self);;
  3824. return self;
  3825. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  3826. },
  3827. args: [],
  3828. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  3829. referencedClasses: [],
  3830. messageSends: []
  3831. }),
  3832. $globals.Number);
  3833. $core.addMethod(
  3834. $core.method({
  3835. selector: "copy",
  3836. protocol: 'copying',
  3837. fn: function (){
  3838. var self=this;
  3839. return self;
  3840. },
  3841. args: [],
  3842. source: "copy\x0a\x09^ self",
  3843. referencedClasses: [],
  3844. messageSends: []
  3845. }),
  3846. $globals.Number);
  3847. $core.addMethod(
  3848. $core.method({
  3849. selector: "cos",
  3850. protocol: 'mathematical functions',
  3851. fn: function (){
  3852. var self=this;
  3853. return $core.withContext(function($ctx1) {
  3854. return Math.cos(self);;
  3855. return self;
  3856. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  3857. },
  3858. args: [],
  3859. source: "cos\x0a\x09<return Math.cos(self);>",
  3860. referencedClasses: [],
  3861. messageSends: []
  3862. }),
  3863. $globals.Number);
  3864. $core.addMethod(
  3865. $core.method({
  3866. selector: "deepCopy",
  3867. protocol: 'copying',
  3868. fn: function (){
  3869. var self=this;
  3870. return $core.withContext(function($ctx1) {
  3871. var $1;
  3872. $1=self._copy();
  3873. return $1;
  3874. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  3875. },
  3876. args: [],
  3877. source: "deepCopy\x0a\x09^ self copy",
  3878. referencedClasses: [],
  3879. messageSends: ["copy"]
  3880. }),
  3881. $globals.Number);
  3882. $core.addMethod(
  3883. $core.method({
  3884. selector: "even",
  3885. protocol: 'testing',
  3886. fn: function (){
  3887. var self=this;
  3888. return $core.withContext(function($ctx1) {
  3889. var $1;
  3890. $1=(0).__eq(self.__backslash_backslash((2)));
  3891. return $1;
  3892. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  3893. },
  3894. args: [],
  3895. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3896. referencedClasses: [],
  3897. messageSends: ["=", "\x5c\x5c"]
  3898. }),
  3899. $globals.Number);
  3900. $core.addMethod(
  3901. $core.method({
  3902. selector: "floor",
  3903. protocol: 'converting',
  3904. fn: function (){
  3905. var self=this;
  3906. return $core.withContext(function($ctx1) {
  3907. return Math.floor(self);;
  3908. return self;
  3909. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  3910. },
  3911. args: [],
  3912. source: "floor\x0a\x09<return Math.floor(self);>",
  3913. referencedClasses: [],
  3914. messageSends: []
  3915. }),
  3916. $globals.Number);
  3917. $core.addMethod(
  3918. $core.method({
  3919. selector: "isImmutable",
  3920. protocol: 'testing',
  3921. fn: function (){
  3922. var self=this;
  3923. return true;
  3924. },
  3925. args: [],
  3926. source: "isImmutable\x0a\x09^ true",
  3927. referencedClasses: [],
  3928. messageSends: []
  3929. }),
  3930. $globals.Number);
  3931. $core.addMethod(
  3932. $core.method({
  3933. selector: "isNumber",
  3934. protocol: 'testing',
  3935. fn: function (){
  3936. var self=this;
  3937. return true;
  3938. },
  3939. args: [],
  3940. source: "isNumber\x0a\x09^ true",
  3941. referencedClasses: [],
  3942. messageSends: []
  3943. }),
  3944. $globals.Number);
  3945. $core.addMethod(
  3946. $core.method({
  3947. selector: "isZero",
  3948. protocol: 'testing',
  3949. fn: function (){
  3950. var self=this;
  3951. return $core.withContext(function($ctx1) {
  3952. var $1;
  3953. $1=self.__eq((0));
  3954. return $1;
  3955. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  3956. },
  3957. args: [],
  3958. source: "isZero\x0a\x09^ self = 0",
  3959. referencedClasses: [],
  3960. messageSends: ["="]
  3961. }),
  3962. $globals.Number);
  3963. $core.addMethod(
  3964. $core.method({
  3965. selector: "ln",
  3966. protocol: 'mathematical functions',
  3967. fn: function (){
  3968. var self=this;
  3969. return $core.withContext(function($ctx1) {
  3970. return Math.log(self);;
  3971. return self;
  3972. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  3973. },
  3974. args: [],
  3975. source: "ln\x0a\x09<return Math.log(self);>",
  3976. referencedClasses: [],
  3977. messageSends: []
  3978. }),
  3979. $globals.Number);
  3980. $core.addMethod(
  3981. $core.method({
  3982. selector: "log",
  3983. protocol: 'mathematical functions',
  3984. fn: function (){
  3985. var self=this;
  3986. return $core.withContext(function($ctx1) {
  3987. return Math.log(self) / Math.LN10;;
  3988. return self;
  3989. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  3990. },
  3991. args: [],
  3992. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  3993. referencedClasses: [],
  3994. messageSends: []
  3995. }),
  3996. $globals.Number);
  3997. $core.addMethod(
  3998. $core.method({
  3999. selector: "log:",
  4000. protocol: 'mathematical functions',
  4001. fn: function (aNumber){
  4002. var self=this;
  4003. return $core.withContext(function($ctx1) {
  4004. return Math.log(self) / Math.log(aNumber);;
  4005. return self;
  4006. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4007. },
  4008. args: ["aNumber"],
  4009. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  4010. referencedClasses: [],
  4011. messageSends: []
  4012. }),
  4013. $globals.Number);
  4014. $core.addMethod(
  4015. $core.method({
  4016. selector: "max:",
  4017. protocol: 'arithmetic',
  4018. fn: function (aNumber){
  4019. var self=this;
  4020. return $core.withContext(function($ctx1) {
  4021. return Math.max(self, aNumber);;
  4022. return self;
  4023. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4024. },
  4025. args: ["aNumber"],
  4026. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  4027. referencedClasses: [],
  4028. messageSends: []
  4029. }),
  4030. $globals.Number);
  4031. $core.addMethod(
  4032. $core.method({
  4033. selector: "min:",
  4034. protocol: 'arithmetic',
  4035. fn: function (aNumber){
  4036. var self=this;
  4037. return $core.withContext(function($ctx1) {
  4038. return Math.min(self, aNumber);;
  4039. return self;
  4040. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4041. },
  4042. args: ["aNumber"],
  4043. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  4044. referencedClasses: [],
  4045. messageSends: []
  4046. }),
  4047. $globals.Number);
  4048. $core.addMethod(
  4049. $core.method({
  4050. selector: "negated",
  4051. protocol: 'arithmetic',
  4052. fn: function (){
  4053. var self=this;
  4054. return $core.withContext(function($ctx1) {
  4055. var $1;
  4056. $1=(0).__minus(self);
  4057. return $1;
  4058. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4059. },
  4060. args: [],
  4061. source: "negated\x0a\x09^ 0 - self",
  4062. referencedClasses: [],
  4063. messageSends: ["-"]
  4064. }),
  4065. $globals.Number);
  4066. $core.addMethod(
  4067. $core.method({
  4068. selector: "negative",
  4069. protocol: 'testing',
  4070. fn: function (){
  4071. var self=this;
  4072. return $core.withContext(function($ctx1) {
  4073. var $1;
  4074. $1=self.__lt((0));
  4075. return $1;
  4076. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4077. },
  4078. args: [],
  4079. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4080. referencedClasses: [],
  4081. messageSends: ["<"]
  4082. }),
  4083. $globals.Number);
  4084. $core.addMethod(
  4085. $core.method({
  4086. selector: "odd",
  4087. protocol: 'testing',
  4088. fn: function (){
  4089. var self=this;
  4090. return $core.withContext(function($ctx1) {
  4091. var $1;
  4092. $1=$recv(self._even())._not();
  4093. return $1;
  4094. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4095. },
  4096. args: [],
  4097. source: "odd\x0a\x09^ self even not",
  4098. referencedClasses: [],
  4099. messageSends: ["not", "even"]
  4100. }),
  4101. $globals.Number);
  4102. $core.addMethod(
  4103. $core.method({
  4104. selector: "positive",
  4105. protocol: 'testing',
  4106. fn: function (){
  4107. var self=this;
  4108. return $core.withContext(function($ctx1) {
  4109. var $1;
  4110. $1=self.__gt_eq((0));
  4111. return $1;
  4112. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4113. },
  4114. args: [],
  4115. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4116. referencedClasses: [],
  4117. messageSends: [">="]
  4118. }),
  4119. $globals.Number);
  4120. $core.addMethod(
  4121. $core.method({
  4122. selector: "printOn:",
  4123. protocol: 'printing',
  4124. fn: function (aStream){
  4125. var self=this;
  4126. return $core.withContext(function($ctx1) {
  4127. $recv(aStream)._nextPutAll_(self._asString());
  4128. return self;
  4129. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4130. },
  4131. args: ["aStream"],
  4132. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4133. referencedClasses: [],
  4134. messageSends: ["nextPutAll:", "asString"]
  4135. }),
  4136. $globals.Number);
  4137. $core.addMethod(
  4138. $core.method({
  4139. selector: "printShowingDecimalPlaces:",
  4140. protocol: 'printing',
  4141. fn: function (placesDesired){
  4142. var self=this;
  4143. return $core.withContext(function($ctx1) {
  4144. return self.toFixed(placesDesired);
  4145. return self;
  4146. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4147. },
  4148. args: ["placesDesired"],
  4149. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4150. referencedClasses: [],
  4151. messageSends: []
  4152. }),
  4153. $globals.Number);
  4154. $core.addMethod(
  4155. $core.method({
  4156. selector: "raisedTo:",
  4157. protocol: 'mathematical functions',
  4158. fn: function (exponent){
  4159. var self=this;
  4160. return $core.withContext(function($ctx1) {
  4161. return Math.pow(self, exponent);;
  4162. return self;
  4163. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4164. },
  4165. args: ["exponent"],
  4166. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4167. referencedClasses: [],
  4168. messageSends: []
  4169. }),
  4170. $globals.Number);
  4171. $core.addMethod(
  4172. $core.method({
  4173. selector: "rounded",
  4174. protocol: 'converting',
  4175. fn: function (){
  4176. var self=this;
  4177. return $core.withContext(function($ctx1) {
  4178. return Math.round(self);;
  4179. return self;
  4180. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4181. },
  4182. args: [],
  4183. source: "rounded\x0a\x09<return Math.round(self);>",
  4184. referencedClasses: [],
  4185. messageSends: []
  4186. }),
  4187. $globals.Number);
  4188. $core.addMethod(
  4189. $core.method({
  4190. selector: "sign",
  4191. protocol: 'mathematical functions',
  4192. fn: function (){
  4193. var self=this;
  4194. return $core.withContext(function($ctx1) {
  4195. var $1,$2;
  4196. $1=self._isZero();
  4197. if($core.assert($1)){
  4198. return (0);
  4199. };
  4200. $2=self._positive();
  4201. if($core.assert($2)){
  4202. return (1);
  4203. } else {
  4204. return (-1);
  4205. };
  4206. return self;
  4207. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4208. },
  4209. args: [],
  4210. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4211. referencedClasses: [],
  4212. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4213. }),
  4214. $globals.Number);
  4215. $core.addMethod(
  4216. $core.method({
  4217. selector: "sin",
  4218. protocol: 'mathematical functions',
  4219. fn: function (){
  4220. var self=this;
  4221. return $core.withContext(function($ctx1) {
  4222. return Math.sin(self);;
  4223. return self;
  4224. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4225. },
  4226. args: [],
  4227. source: "sin\x0a\x09<return Math.sin(self);>",
  4228. referencedClasses: [],
  4229. messageSends: []
  4230. }),
  4231. $globals.Number);
  4232. $core.addMethod(
  4233. $core.method({
  4234. selector: "sqrt",
  4235. protocol: 'mathematical functions',
  4236. fn: function (){
  4237. var self=this;
  4238. return $core.withContext(function($ctx1) {
  4239. return Math.sqrt(self);
  4240. return self;
  4241. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4242. },
  4243. args: [],
  4244. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4245. referencedClasses: [],
  4246. messageSends: []
  4247. }),
  4248. $globals.Number);
  4249. $core.addMethod(
  4250. $core.method({
  4251. selector: "squared",
  4252. protocol: 'mathematical functions',
  4253. fn: function (){
  4254. var self=this;
  4255. return $core.withContext(function($ctx1) {
  4256. var $1;
  4257. $1=self.__star(self);
  4258. return $1;
  4259. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4260. },
  4261. args: [],
  4262. source: "squared\x0a\x09^ self * self",
  4263. referencedClasses: [],
  4264. messageSends: ["*"]
  4265. }),
  4266. $globals.Number);
  4267. $core.addMethod(
  4268. $core.method({
  4269. selector: "tan",
  4270. protocol: 'mathematical functions',
  4271. fn: function (){
  4272. var self=this;
  4273. return $core.withContext(function($ctx1) {
  4274. return Math.tan(self);;
  4275. return self;
  4276. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4277. },
  4278. args: [],
  4279. source: "tan\x0a\x09<return Math.tan(self);>",
  4280. referencedClasses: [],
  4281. messageSends: []
  4282. }),
  4283. $globals.Number);
  4284. $core.addMethod(
  4285. $core.method({
  4286. selector: "timesRepeat:",
  4287. protocol: 'enumerating',
  4288. fn: function (aBlock){
  4289. var self=this;
  4290. var count;
  4291. return $core.withContext(function($ctx1) {
  4292. count=(1);
  4293. $recv((function(){
  4294. return $core.withContext(function($ctx2) {
  4295. return $recv(count).__gt(self);
  4296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4297. }))._whileFalse_((function(){
  4298. return $core.withContext(function($ctx2) {
  4299. $recv(aBlock)._value();
  4300. count=$recv(count).__plus((1));
  4301. return count;
  4302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4303. }));
  4304. return self;
  4305. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  4306. },
  4307. args: ["aBlock"],
  4308. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4309. referencedClasses: [],
  4310. messageSends: ["whileFalse:", ">", "value", "+"]
  4311. }),
  4312. $globals.Number);
  4313. $core.addMethod(
  4314. $core.method({
  4315. selector: "to:",
  4316. protocol: 'converting',
  4317. fn: function (aNumber){
  4318. var self=this;
  4319. var array,first,last,count;
  4320. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4321. return $core.withContext(function($ctx1) {
  4322. var $1;
  4323. first=self._truncated();
  4324. $ctx1.sendIdx["truncated"]=1;
  4325. last=$recv($recv(aNumber)._truncated()).__plus((1));
  4326. $ctx1.sendIdx["+"]=1;
  4327. count=(1);
  4328. array=$recv($Array())._new();
  4329. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  4330. return $core.withContext(function($ctx2) {
  4331. $recv(array)._at_put_(count,first);
  4332. count=$recv(count).__plus((1));
  4333. $ctx2.sendIdx["+"]=2;
  4334. count;
  4335. first=$recv(first).__plus((1));
  4336. return first;
  4337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4338. }));
  4339. $1=array;
  4340. return $1;
  4341. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  4342. },
  4343. args: ["aNumber"],
  4344. 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",
  4345. referencedClasses: ["Array"],
  4346. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  4347. }),
  4348. $globals.Number);
  4349. $core.addMethod(
  4350. $core.method({
  4351. selector: "to:by:",
  4352. protocol: 'converting',
  4353. fn: function (stop,step){
  4354. var self=this;
  4355. var array,value,pos;
  4356. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4357. return $core.withContext(function($ctx1) {
  4358. var $1,$2,$3;
  4359. value=self;
  4360. array=$recv($Array())._new();
  4361. pos=(1);
  4362. $1=$recv(step).__eq((0));
  4363. if($core.assert($1)){
  4364. self._error_("step must be non-zero");
  4365. };
  4366. $2=$recv(step).__lt((0));
  4367. if($core.assert($2)){
  4368. $recv((function(){
  4369. return $core.withContext(function($ctx2) {
  4370. return $recv(value).__gt_eq(stop);
  4371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4372. }))._whileTrue_((function(){
  4373. return $core.withContext(function($ctx2) {
  4374. $recv(array)._at_put_(pos,value);
  4375. $ctx2.sendIdx["at:put:"]=1;
  4376. pos=$recv(pos).__plus((1));
  4377. $ctx2.sendIdx["+"]=1;
  4378. pos;
  4379. value=$recv(value).__plus(step);
  4380. $ctx2.sendIdx["+"]=2;
  4381. return value;
  4382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4383. }));
  4384. $ctx1.sendIdx["whileTrue:"]=1;
  4385. } else {
  4386. $recv((function(){
  4387. return $core.withContext(function($ctx2) {
  4388. return $recv(value).__lt_eq(stop);
  4389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4390. }))._whileTrue_((function(){
  4391. return $core.withContext(function($ctx2) {
  4392. $recv(array)._at_put_(pos,value);
  4393. pos=$recv(pos).__plus((1));
  4394. $ctx2.sendIdx["+"]=3;
  4395. pos;
  4396. value=$recv(value).__plus(step);
  4397. return value;
  4398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4399. }));
  4400. };
  4401. $3=array;
  4402. return $3;
  4403. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  4404. },
  4405. args: ["stop", "step"],
  4406. 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",
  4407. referencedClasses: ["Array"],
  4408. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  4409. }),
  4410. $globals.Number);
  4411. $core.addMethod(
  4412. $core.method({
  4413. selector: "to:by:do:",
  4414. protocol: 'enumerating',
  4415. fn: function (stop,step,aBlock){
  4416. var self=this;
  4417. var value;
  4418. return $core.withContext(function($ctx1) {
  4419. var $1,$2;
  4420. value=self;
  4421. $1=$recv(step).__eq((0));
  4422. if($core.assert($1)){
  4423. self._error_("step must be non-zero");
  4424. };
  4425. $2=$recv(step).__lt((0));
  4426. if($core.assert($2)){
  4427. $recv((function(){
  4428. return $core.withContext(function($ctx2) {
  4429. return $recv(value).__gt_eq(stop);
  4430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4431. }))._whileTrue_((function(){
  4432. return $core.withContext(function($ctx2) {
  4433. $recv(aBlock)._value_(value);
  4434. $ctx2.sendIdx["value:"]=1;
  4435. value=$recv(value).__plus(step);
  4436. $ctx2.sendIdx["+"]=1;
  4437. return value;
  4438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4439. }));
  4440. $ctx1.sendIdx["whileTrue:"]=1;
  4441. } else {
  4442. $recv((function(){
  4443. return $core.withContext(function($ctx2) {
  4444. return $recv(value).__lt_eq(stop);
  4445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4446. }))._whileTrue_((function(){
  4447. return $core.withContext(function($ctx2) {
  4448. $recv(aBlock)._value_(value);
  4449. value=$recv(value).__plus(step);
  4450. return value;
  4451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4452. }));
  4453. };
  4454. return self;
  4455. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  4456. },
  4457. args: ["stop", "step", "aBlock"],
  4458. 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 ]]",
  4459. referencedClasses: [],
  4460. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  4461. }),
  4462. $globals.Number);
  4463. $core.addMethod(
  4464. $core.method({
  4465. selector: "to:do:",
  4466. protocol: 'enumerating',
  4467. fn: function (stop,aBlock){
  4468. var self=this;
  4469. var nextValue;
  4470. return $core.withContext(function($ctx1) {
  4471. nextValue=self;
  4472. $recv((function(){
  4473. return $core.withContext(function($ctx2) {
  4474. return $recv(nextValue).__lt_eq(stop);
  4475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4476. }))._whileTrue_((function(){
  4477. return $core.withContext(function($ctx2) {
  4478. $recv(aBlock)._value_(nextValue);
  4479. nextValue=$recv(nextValue).__plus((1));
  4480. return nextValue;
  4481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4482. }));
  4483. return self;
  4484. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  4485. },
  4486. args: ["stop", "aBlock"],
  4487. 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 ]",
  4488. referencedClasses: [],
  4489. messageSends: ["whileTrue:", "<=", "value:", "+"]
  4490. }),
  4491. $globals.Number);
  4492. $core.addMethod(
  4493. $core.method({
  4494. selector: "truncated",
  4495. protocol: 'converting',
  4496. fn: function (){
  4497. var self=this;
  4498. return $core.withContext(function($ctx1) {
  4499. if(self >= 0) {
  4500. return Math.floor(self);
  4501. } else {
  4502. return Math.floor(self * (-1)) * (-1);
  4503. };
  4504. ;
  4505. return self;
  4506. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  4507. },
  4508. args: [],
  4509. 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>",
  4510. referencedClasses: [],
  4511. messageSends: []
  4512. }),
  4513. $globals.Number);
  4514. $core.addMethod(
  4515. $core.method({
  4516. selector: "|",
  4517. protocol: 'converting',
  4518. fn: function (aNumber){
  4519. var self=this;
  4520. return $core.withContext(function($ctx1) {
  4521. return self | aNumber;
  4522. return self;
  4523. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  4524. },
  4525. args: ["aNumber"],
  4526. source: "| aNumber\x0a\x09<return self | aNumber>",
  4527. referencedClasses: [],
  4528. messageSends: []
  4529. }),
  4530. $globals.Number);
  4531. $core.addMethod(
  4532. $core.method({
  4533. selector: "classTag",
  4534. protocol: 'accessing',
  4535. fn: function (){
  4536. var self=this;
  4537. return "magnitude";
  4538. },
  4539. args: [],
  4540. 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'",
  4541. referencedClasses: [],
  4542. messageSends: []
  4543. }),
  4544. $globals.Number.klass);
  4545. $core.addMethod(
  4546. $core.method({
  4547. selector: "e",
  4548. protocol: 'instance creation',
  4549. fn: function (){
  4550. var self=this;
  4551. return $core.withContext(function($ctx1) {
  4552. return Math.E;;
  4553. return self;
  4554. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  4555. },
  4556. args: [],
  4557. source: "e\x0a\x09<return Math.E;>",
  4558. referencedClasses: [],
  4559. messageSends: []
  4560. }),
  4561. $globals.Number.klass);
  4562. $core.addMethod(
  4563. $core.method({
  4564. selector: "pi",
  4565. protocol: 'instance creation',
  4566. fn: function (){
  4567. var self=this;
  4568. return $core.withContext(function($ctx1) {
  4569. return Math.PI;
  4570. return self;
  4571. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  4572. },
  4573. args: [],
  4574. source: "pi\x0a\x09<return Math.PI>",
  4575. referencedClasses: [],
  4576. messageSends: []
  4577. }),
  4578. $globals.Number.klass);
  4579. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  4580. $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";
  4581. $core.addMethod(
  4582. $core.method({
  4583. selector: "*",
  4584. protocol: 'arithmetic',
  4585. fn: function (aPoint){
  4586. var self=this;
  4587. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4588. return $core.withContext(function($ctx1) {
  4589. var $3,$5,$4,$2,$7,$6,$1;
  4590. $3=self._x();
  4591. $ctx1.sendIdx["x"]=1;
  4592. $5=$recv(aPoint)._asPoint();
  4593. $ctx1.sendIdx["asPoint"]=1;
  4594. $4=$recv($5)._x();
  4595. $2=$recv($3).__star($4);
  4596. $ctx1.sendIdx["*"]=1;
  4597. $7=self._y();
  4598. $ctx1.sendIdx["y"]=1;
  4599. $6=$recv($7).__star($recv($recv(aPoint)._asPoint())._y());
  4600. $1=$recv($Point())._x_y_($2,$6);
  4601. return $1;
  4602. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  4603. },
  4604. args: ["aPoint"],
  4605. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4606. referencedClasses: ["Point"],
  4607. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  4608. }),
  4609. $globals.Point);
  4610. $core.addMethod(
  4611. $core.method({
  4612. selector: "+",
  4613. protocol: 'arithmetic',
  4614. fn: function (aPoint){
  4615. var self=this;
  4616. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4617. return $core.withContext(function($ctx1) {
  4618. var $3,$5,$4,$2,$7,$6,$1;
  4619. $3=self._x();
  4620. $ctx1.sendIdx["x"]=1;
  4621. $5=$recv(aPoint)._asPoint();
  4622. $ctx1.sendIdx["asPoint"]=1;
  4623. $4=$recv($5)._x();
  4624. $2=$recv($3).__plus($4);
  4625. $ctx1.sendIdx["+"]=1;
  4626. $7=self._y();
  4627. $ctx1.sendIdx["y"]=1;
  4628. $6=$recv($7).__plus($recv($recv(aPoint)._asPoint())._y());
  4629. $1=$recv($Point())._x_y_($2,$6);
  4630. return $1;
  4631. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  4632. },
  4633. args: ["aPoint"],
  4634. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4635. referencedClasses: ["Point"],
  4636. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  4637. }),
  4638. $globals.Point);
  4639. $core.addMethod(
  4640. $core.method({
  4641. selector: "-",
  4642. protocol: 'arithmetic',
  4643. fn: function (aPoint){
  4644. var self=this;
  4645. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4646. return $core.withContext(function($ctx1) {
  4647. var $3,$5,$4,$2,$7,$6,$1;
  4648. $3=self._x();
  4649. $ctx1.sendIdx["x"]=1;
  4650. $5=$recv(aPoint)._asPoint();
  4651. $ctx1.sendIdx["asPoint"]=1;
  4652. $4=$recv($5)._x();
  4653. $2=$recv($3).__minus($4);
  4654. $ctx1.sendIdx["-"]=1;
  4655. $7=self._y();
  4656. $ctx1.sendIdx["y"]=1;
  4657. $6=$recv($7).__minus($recv($recv(aPoint)._asPoint())._y());
  4658. $1=$recv($Point())._x_y_($2,$6);
  4659. return $1;
  4660. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  4661. },
  4662. args: ["aPoint"],
  4663. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4664. referencedClasses: ["Point"],
  4665. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  4666. }),
  4667. $globals.Point);
  4668. $core.addMethod(
  4669. $core.method({
  4670. selector: "/",
  4671. protocol: 'arithmetic',
  4672. fn: function (aPoint){
  4673. var self=this;
  4674. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4675. return $core.withContext(function($ctx1) {
  4676. var $3,$5,$4,$2,$7,$6,$1;
  4677. $3=self._x();
  4678. $ctx1.sendIdx["x"]=1;
  4679. $5=$recv(aPoint)._asPoint();
  4680. $ctx1.sendIdx["asPoint"]=1;
  4681. $4=$recv($5)._x();
  4682. $2=$recv($3).__slash($4);
  4683. $ctx1.sendIdx["/"]=1;
  4684. $7=self._y();
  4685. $ctx1.sendIdx["y"]=1;
  4686. $6=$recv($7).__slash($recv($recv(aPoint)._asPoint())._y());
  4687. $1=$recv($Point())._x_y_($2,$6);
  4688. return $1;
  4689. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  4690. },
  4691. args: ["aPoint"],
  4692. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4693. referencedClasses: ["Point"],
  4694. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  4695. }),
  4696. $globals.Point);
  4697. $core.addMethod(
  4698. $core.method({
  4699. selector: "<",
  4700. protocol: 'comparing',
  4701. fn: function (aPoint){
  4702. var self=this;
  4703. return $core.withContext(function($ctx1) {
  4704. var $3,$2,$4,$1;
  4705. $3=self._x();
  4706. $ctx1.sendIdx["x"]=1;
  4707. $2=$recv($3).__lt($recv(aPoint)._x());
  4708. $ctx1.sendIdx["<"]=1;
  4709. $1=$recv($2)._and_((function(){
  4710. return $core.withContext(function($ctx2) {
  4711. $4=self._y();
  4712. $ctx2.sendIdx["y"]=1;
  4713. return $recv($4).__lt($recv(aPoint)._y());
  4714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4715. }));
  4716. return $1;
  4717. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  4718. },
  4719. args: ["aPoint"],
  4720. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  4721. referencedClasses: [],
  4722. messageSends: ["and:", "<", "x", "y"]
  4723. }),
  4724. $globals.Point);
  4725. $core.addMethod(
  4726. $core.method({
  4727. selector: "<=",
  4728. protocol: 'comparing',
  4729. fn: function (aPoint){
  4730. var self=this;
  4731. return $core.withContext(function($ctx1) {
  4732. var $3,$2,$4,$1;
  4733. $3=self._x();
  4734. $ctx1.sendIdx["x"]=1;
  4735. $2=$recv($3).__lt_eq($recv(aPoint)._x());
  4736. $ctx1.sendIdx["<="]=1;
  4737. $1=$recv($2)._and_((function(){
  4738. return $core.withContext(function($ctx2) {
  4739. $4=self._y();
  4740. $ctx2.sendIdx["y"]=1;
  4741. return $recv($4).__lt_eq($recv(aPoint)._y());
  4742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4743. }));
  4744. return $1;
  4745. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  4746. },
  4747. args: ["aPoint"],
  4748. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  4749. referencedClasses: [],
  4750. messageSends: ["and:", "<=", "x", "y"]
  4751. }),
  4752. $globals.Point);
  4753. $core.addMethod(
  4754. $core.method({
  4755. selector: "=",
  4756. protocol: 'comparing',
  4757. fn: function (aPoint){
  4758. var self=this;
  4759. return $core.withContext(function($ctx1) {
  4760. var $3,$2,$5,$4,$7,$6,$1;
  4761. $3=$recv(aPoint)._class();
  4762. $ctx1.sendIdx["class"]=1;
  4763. $2=$recv($3).__eq(self._class());
  4764. $ctx1.sendIdx["="]=1;
  4765. $1=$recv($2)._and_((function(){
  4766. return $core.withContext(function($ctx2) {
  4767. $5=$recv(aPoint)._x();
  4768. $ctx2.sendIdx["x"]=1;
  4769. $4=$recv($5).__eq(self._x());
  4770. $ctx2.sendIdx["="]=2;
  4771. $7=$recv(aPoint)._y();
  4772. $ctx2.sendIdx["y"]=1;
  4773. $6=$recv($7).__eq(self._y());
  4774. return $recv($4).__and($6);
  4775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4776. }));
  4777. return $1;
  4778. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  4779. },
  4780. args: ["aPoint"],
  4781. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  4782. referencedClasses: [],
  4783. messageSends: ["and:", "=", "class", "&", "x", "y"]
  4784. }),
  4785. $globals.Point);
  4786. $core.addMethod(
  4787. $core.method({
  4788. selector: ">",
  4789. protocol: 'comparing',
  4790. fn: function (aPoint){
  4791. var self=this;
  4792. return $core.withContext(function($ctx1) {
  4793. var $3,$2,$4,$1;
  4794. $3=self._x();
  4795. $ctx1.sendIdx["x"]=1;
  4796. $2=$recv($3).__gt($recv(aPoint)._x());
  4797. $ctx1.sendIdx[">"]=1;
  4798. $1=$recv($2)._and_((function(){
  4799. return $core.withContext(function($ctx2) {
  4800. $4=self._y();
  4801. $ctx2.sendIdx["y"]=1;
  4802. return $recv($4).__gt($recv(aPoint)._y());
  4803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4804. }));
  4805. return $1;
  4806. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  4807. },
  4808. args: ["aPoint"],
  4809. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  4810. referencedClasses: [],
  4811. messageSends: ["and:", ">", "x", "y"]
  4812. }),
  4813. $globals.Point);
  4814. $core.addMethod(
  4815. $core.method({
  4816. selector: ">=",
  4817. protocol: 'comparing',
  4818. fn: function (aPoint){
  4819. var self=this;
  4820. return $core.withContext(function($ctx1) {
  4821. var $3,$2,$4,$1;
  4822. $3=self._x();
  4823. $ctx1.sendIdx["x"]=1;
  4824. $2=$recv($3).__gt_eq($recv(aPoint)._x());
  4825. $ctx1.sendIdx[">="]=1;
  4826. $1=$recv($2)._and_((function(){
  4827. return $core.withContext(function($ctx2) {
  4828. $4=self._y();
  4829. $ctx2.sendIdx["y"]=1;
  4830. return $recv($4).__gt_eq($recv(aPoint)._y());
  4831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4832. }));
  4833. return $1;
  4834. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  4835. },
  4836. args: ["aPoint"],
  4837. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  4838. referencedClasses: [],
  4839. messageSends: ["and:", ">=", "x", "y"]
  4840. }),
  4841. $globals.Point);
  4842. $core.addMethod(
  4843. $core.method({
  4844. selector: "asPoint",
  4845. protocol: 'converting',
  4846. fn: function (){
  4847. var self=this;
  4848. return self;
  4849. },
  4850. args: [],
  4851. source: "asPoint\x0a\x09^ self",
  4852. referencedClasses: [],
  4853. messageSends: []
  4854. }),
  4855. $globals.Point);
  4856. $core.addMethod(
  4857. $core.method({
  4858. selector: "dist:",
  4859. protocol: 'transforming',
  4860. fn: function (aPoint){
  4861. var self=this;
  4862. var dx,dy;
  4863. return $core.withContext(function($ctx1) {
  4864. var $3,$2,$1;
  4865. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  4866. $ctx1.sendIdx["-"]=1;
  4867. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  4868. $3=$recv(dx).__star(dx);
  4869. $ctx1.sendIdx["*"]=1;
  4870. $2=$recv($3).__plus($recv(dy).__star(dy));
  4871. $1=$recv($2)._sqrt();
  4872. return $1;
  4873. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  4874. },
  4875. args: ["aPoint"],
  4876. 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",
  4877. referencedClasses: [],
  4878. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  4879. }),
  4880. $globals.Point);
  4881. $core.addMethod(
  4882. $core.method({
  4883. selector: "printOn:",
  4884. protocol: 'printing',
  4885. fn: function (aStream){
  4886. var self=this;
  4887. return $core.withContext(function($ctx1) {
  4888. var $1;
  4889. $recv(self["@x"])._printOn_(aStream);
  4890. $ctx1.sendIdx["printOn:"]=1;
  4891. $recv(aStream)._nextPutAll_("@");
  4892. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  4893. return $core.withContext(function($ctx2) {
  4894. return $recv(self["@y"])._negative();
  4895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4896. }));
  4897. if($core.assert($1)){
  4898. $recv(aStream)._space();
  4899. };
  4900. $recv(self["@y"])._printOn_(aStream);
  4901. return self;
  4902. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  4903. },
  4904. args: ["aStream"],
  4905. 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",
  4906. referencedClasses: [],
  4907. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  4908. }),
  4909. $globals.Point);
  4910. $core.addMethod(
  4911. $core.method({
  4912. selector: "translateBy:",
  4913. protocol: 'transforming',
  4914. fn: function (delta){
  4915. var self=this;
  4916. return $core.withContext(function($ctx1) {
  4917. var $2,$1;
  4918. $2=$recv($recv(delta)._x()).__plus(self["@x"]);
  4919. $ctx1.sendIdx["+"]=1;
  4920. $1=$recv($2).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  4921. return $1;
  4922. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  4923. },
  4924. args: ["delta"],
  4925. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  4926. referencedClasses: [],
  4927. messageSends: ["@", "+", "x", "y"]
  4928. }),
  4929. $globals.Point);
  4930. $core.addMethod(
  4931. $core.method({
  4932. selector: "x",
  4933. protocol: 'accessing',
  4934. fn: function (){
  4935. var self=this;
  4936. var $1;
  4937. $1=self["@x"];
  4938. return $1;
  4939. },
  4940. args: [],
  4941. source: "x\x0a\x09^ x",
  4942. referencedClasses: [],
  4943. messageSends: []
  4944. }),
  4945. $globals.Point);
  4946. $core.addMethod(
  4947. $core.method({
  4948. selector: "x:",
  4949. protocol: 'accessing',
  4950. fn: function (aNumber){
  4951. var self=this;
  4952. self["@x"]=aNumber;
  4953. return self;
  4954. },
  4955. args: ["aNumber"],
  4956. source: "x: aNumber\x0a\x09x := aNumber",
  4957. referencedClasses: [],
  4958. messageSends: []
  4959. }),
  4960. $globals.Point);
  4961. $core.addMethod(
  4962. $core.method({
  4963. selector: "y",
  4964. protocol: 'accessing',
  4965. fn: function (){
  4966. var self=this;
  4967. var $1;
  4968. $1=self["@y"];
  4969. return $1;
  4970. },
  4971. args: [],
  4972. source: "y\x0a\x09^ y",
  4973. referencedClasses: [],
  4974. messageSends: []
  4975. }),
  4976. $globals.Point);
  4977. $core.addMethod(
  4978. $core.method({
  4979. selector: "y:",
  4980. protocol: 'accessing',
  4981. fn: function (aNumber){
  4982. var self=this;
  4983. self["@y"]=aNumber;
  4984. return self;
  4985. },
  4986. args: ["aNumber"],
  4987. source: "y: aNumber\x0a\x09y := aNumber",
  4988. referencedClasses: [],
  4989. messageSends: []
  4990. }),
  4991. $globals.Point);
  4992. $core.addMethod(
  4993. $core.method({
  4994. selector: "classTag",
  4995. protocol: 'accessing',
  4996. fn: function (){
  4997. var self=this;
  4998. return "magnitude";
  4999. },
  5000. args: [],
  5001. 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'",
  5002. referencedClasses: [],
  5003. messageSends: []
  5004. }),
  5005. $globals.Point.klass);
  5006. $core.addMethod(
  5007. $core.method({
  5008. selector: "x:y:",
  5009. protocol: 'instance creation',
  5010. fn: function (aNumber,anotherNumber){
  5011. var self=this;
  5012. return $core.withContext(function($ctx1) {
  5013. var $2,$3,$1;
  5014. $2=self._new();
  5015. $recv($2)._x_(aNumber);
  5016. $recv($2)._y_(anotherNumber);
  5017. $3=$recv($2)._yourself();
  5018. $1=$3;
  5019. return $1;
  5020. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5021. },
  5022. args: ["aNumber", "anotherNumber"],
  5023. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5024. referencedClasses: [],
  5025. messageSends: ["x:", "new", "y:", "yourself"]
  5026. }),
  5027. $globals.Point.klass);
  5028. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  5029. $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'`.";
  5030. $core.addMethod(
  5031. $core.method({
  5032. selector: "next",
  5033. protocol: 'accessing',
  5034. fn: function (){
  5035. var self=this;
  5036. return $core.withContext(function($ctx1) {
  5037. return Math.random();
  5038. return self;
  5039. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5040. },
  5041. args: [],
  5042. source: "next\x0a\x09<return Math.random()>",
  5043. referencedClasses: [],
  5044. messageSends: []
  5045. }),
  5046. $globals.Random);
  5047. $core.addMethod(
  5048. $core.method({
  5049. selector: "next:",
  5050. protocol: 'accessing',
  5051. fn: function (anInteger){
  5052. var self=this;
  5053. return $core.withContext(function($ctx1) {
  5054. var $1;
  5055. $1=$recv((1)._to_(anInteger))._collect_((function(each){
  5056. return $core.withContext(function($ctx2) {
  5057. return self._next();
  5058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5059. }));
  5060. return $1;
  5061. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5062. },
  5063. args: ["anInteger"],
  5064. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5065. referencedClasses: [],
  5066. messageSends: ["collect:", "to:", "next"]
  5067. }),
  5068. $globals.Random);
  5069. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  5070. $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`.";
  5071. $core.addMethod(
  5072. $core.method({
  5073. selector: "asJSON",
  5074. protocol: 'converting',
  5075. fn: function (){
  5076. var self=this;
  5077. var $1;
  5078. $1=null;
  5079. return $1;
  5080. },
  5081. args: [],
  5082. source: "asJSON\x0a\x09^ null",
  5083. referencedClasses: [],
  5084. messageSends: []
  5085. }),
  5086. $globals.UndefinedObject);
  5087. $core.addMethod(
  5088. $core.method({
  5089. selector: "deepCopy",
  5090. protocol: 'copying',
  5091. fn: function (){
  5092. var self=this;
  5093. return self;
  5094. },
  5095. args: [],
  5096. source: "deepCopy\x0a\x09^ self",
  5097. referencedClasses: [],
  5098. messageSends: []
  5099. }),
  5100. $globals.UndefinedObject);
  5101. $core.addMethod(
  5102. $core.method({
  5103. selector: "ifNil:",
  5104. protocol: 'testing',
  5105. fn: function (aBlock){
  5106. var self=this;
  5107. return $core.withContext(function($ctx1) {
  5108. var $1;
  5109. $1=self._ifNil_ifNotNil_(aBlock,(function(){
  5110. }));
  5111. return $1;
  5112. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5113. },
  5114. args: ["aBlock"],
  5115. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5116. referencedClasses: [],
  5117. messageSends: ["ifNil:ifNotNil:"]
  5118. }),
  5119. $globals.UndefinedObject);
  5120. $core.addMethod(
  5121. $core.method({
  5122. selector: "ifNil:ifNotNil:",
  5123. protocol: 'testing',
  5124. fn: function (aBlock,anotherBlock){
  5125. var self=this;
  5126. return $core.withContext(function($ctx1) {
  5127. var $1;
  5128. $1=$recv(aBlock)._value();
  5129. return $1;
  5130. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5131. },
  5132. args: ["aBlock", "anotherBlock"],
  5133. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5134. referencedClasses: [],
  5135. messageSends: ["value"]
  5136. }),
  5137. $globals.UndefinedObject);
  5138. $core.addMethod(
  5139. $core.method({
  5140. selector: "ifNotNil:",
  5141. protocol: 'testing',
  5142. fn: function (aBlock){
  5143. var self=this;
  5144. return self;
  5145. },
  5146. args: ["aBlock"],
  5147. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5148. referencedClasses: [],
  5149. messageSends: []
  5150. }),
  5151. $globals.UndefinedObject);
  5152. $core.addMethod(
  5153. $core.method({
  5154. selector: "ifNotNil:ifNil:",
  5155. protocol: 'testing',
  5156. fn: function (aBlock,anotherBlock){
  5157. var self=this;
  5158. return $core.withContext(function($ctx1) {
  5159. var $1;
  5160. $1=$recv(anotherBlock)._value();
  5161. return $1;
  5162. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5163. },
  5164. args: ["aBlock", "anotherBlock"],
  5165. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5166. referencedClasses: [],
  5167. messageSends: ["value"]
  5168. }),
  5169. $globals.UndefinedObject);
  5170. $core.addMethod(
  5171. $core.method({
  5172. selector: "isImmutable",
  5173. protocol: 'testing',
  5174. fn: function (){
  5175. var self=this;
  5176. return true;
  5177. },
  5178. args: [],
  5179. source: "isImmutable\x0a\x09^ true",
  5180. referencedClasses: [],
  5181. messageSends: []
  5182. }),
  5183. $globals.UndefinedObject);
  5184. $core.addMethod(
  5185. $core.method({
  5186. selector: "isNil",
  5187. protocol: 'testing',
  5188. fn: function (){
  5189. var self=this;
  5190. return true;
  5191. },
  5192. args: [],
  5193. source: "isNil\x0a\x09^ true",
  5194. referencedClasses: [],
  5195. messageSends: []
  5196. }),
  5197. $globals.UndefinedObject);
  5198. $core.addMethod(
  5199. $core.method({
  5200. selector: "notNil",
  5201. protocol: 'testing',
  5202. fn: function (){
  5203. var self=this;
  5204. return false;
  5205. },
  5206. args: [],
  5207. source: "notNil\x0a\x09^ false",
  5208. referencedClasses: [],
  5209. messageSends: []
  5210. }),
  5211. $globals.UndefinedObject);
  5212. $core.addMethod(
  5213. $core.method({
  5214. selector: "printOn:",
  5215. protocol: 'printing',
  5216. fn: function (aStream){
  5217. var self=this;
  5218. return $core.withContext(function($ctx1) {
  5219. $recv(aStream)._nextPutAll_("nil");
  5220. return self;
  5221. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5222. },
  5223. args: ["aStream"],
  5224. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5225. referencedClasses: [],
  5226. messageSends: ["nextPutAll:"]
  5227. }),
  5228. $globals.UndefinedObject);
  5229. $core.addMethod(
  5230. $core.method({
  5231. selector: "shallowCopy",
  5232. protocol: 'copying',
  5233. fn: function (){
  5234. var self=this;
  5235. return self;
  5236. },
  5237. args: [],
  5238. source: "shallowCopy\x0a\x09^ self",
  5239. referencedClasses: [],
  5240. messageSends: []
  5241. }),
  5242. $globals.UndefinedObject);
  5243. $core.addMethod(
  5244. $core.method({
  5245. selector: "subclass:instanceVariableNames:",
  5246. protocol: 'class creation',
  5247. fn: function (aString,anotherString){
  5248. var self=this;
  5249. return $core.withContext(function($ctx1) {
  5250. var $1;
  5251. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5252. return $1;
  5253. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5254. },
  5255. args: ["aString", "anotherString"],
  5256. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5257. referencedClasses: [],
  5258. messageSends: ["subclass:instanceVariableNames:package:"]
  5259. }),
  5260. $globals.UndefinedObject);
  5261. $core.addMethod(
  5262. $core.method({
  5263. selector: "subclass:instanceVariableNames:category:",
  5264. protocol: 'class creation',
  5265. fn: function (aString,aString2,aString3){
  5266. var self=this;
  5267. return $core.withContext(function($ctx1) {
  5268. var $1;
  5269. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5270. return $1;
  5271. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5272. },
  5273. args: ["aString", "aString2", "aString3"],
  5274. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5275. referencedClasses: [],
  5276. messageSends: ["subclass:instanceVariableNames:package:"]
  5277. }),
  5278. $globals.UndefinedObject);
  5279. $core.addMethod(
  5280. $core.method({
  5281. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5282. protocol: 'class creation',
  5283. fn: function (aString,aString2,classVars,pools,aString3){
  5284. var self=this;
  5285. return $core.withContext(function($ctx1) {
  5286. var $1;
  5287. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5288. return $1;
  5289. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5290. },
  5291. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5292. 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",
  5293. referencedClasses: [],
  5294. messageSends: ["subclass:instanceVariableNames:package:"]
  5295. }),
  5296. $globals.UndefinedObject);
  5297. $core.addMethod(
  5298. $core.method({
  5299. selector: "subclass:instanceVariableNames:package:",
  5300. protocol: 'class creation',
  5301. fn: function (aString,aString2,aString3){
  5302. var self=this;
  5303. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5304. return $core.withContext(function($ctx1) {
  5305. var $1;
  5306. $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5307. return $1;
  5308. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5309. },
  5310. args: ["aString", "aString2", "aString3"],
  5311. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5312. referencedClasses: ["ClassBuilder"],
  5313. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5314. }),
  5315. $globals.UndefinedObject);
  5316. $core.addMethod(
  5317. $core.method({
  5318. selector: "new",
  5319. protocol: 'instance creation',
  5320. fn: function (){
  5321. var self=this;
  5322. return $core.withContext(function($ctx1) {
  5323. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5324. return self;
  5325. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5326. },
  5327. args: [],
  5328. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5329. referencedClasses: [],
  5330. messageSends: ["error:"]
  5331. }),
  5332. $globals.UndefinedObject.klass);
  5333. });
  5334. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  5335. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  5336. $core.addPackage('Kernel-Classes');
  5337. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  5338. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5339. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  5340. $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.";
  5341. $core.addMethod(
  5342. $core.method({
  5343. selector: ">>",
  5344. protocol: 'accessing',
  5345. fn: function (aString){
  5346. var self=this;
  5347. return $core.withContext(function($ctx1) {
  5348. var $1;
  5349. $1=self._methodAt_(aString);
  5350. return $1;
  5351. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  5352. },
  5353. args: ["aString"],
  5354. source: ">> aString\x0a\x09^ self methodAt: aString",
  5355. referencedClasses: [],
  5356. messageSends: ["methodAt:"]
  5357. }),
  5358. $globals.Behavior);
  5359. $core.addMethod(
  5360. $core.method({
  5361. selector: "addCompiledMethod:",
  5362. protocol: 'compiling',
  5363. fn: function (aMethod){
  5364. var self=this;
  5365. var oldMethod,announcement;
  5366. function $MethodAdded(){return $globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  5367. function $MethodModified(){return $globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  5368. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5369. return $core.withContext(function($ctx1) {
  5370. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  5371. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  5372. return nil;
  5373. }));
  5374. $2=self._protocols();
  5375. $3=$recv(aMethod)._protocol();
  5376. $ctx1.sendIdx["protocol"]=1;
  5377. $1=$recv($2)._includes_($3);
  5378. if(!$core.assert($1)){
  5379. $4=self._organization();
  5380. $5=$recv(aMethod)._protocol();
  5381. $ctx1.sendIdx["protocol"]=2;
  5382. $recv($4)._addElement_($5);
  5383. };
  5384. self._basicAddCompiledMethod_(aMethod);
  5385. $6=oldMethod;
  5386. if(($receiver = $6) == null || $receiver.isNil){
  5387. $6;
  5388. } else {
  5389. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  5390. };
  5391. $7=oldMethod;
  5392. if(($receiver = $7) == null || $receiver.isNil){
  5393. $8=$recv($MethodAdded())._new();
  5394. $ctx1.sendIdx["new"]=1;
  5395. $recv($8)._method_(aMethod);
  5396. $ctx1.sendIdx["method:"]=1;
  5397. $9=$recv($8)._yourself();
  5398. $ctx1.sendIdx["yourself"]=1;
  5399. announcement=$9;
  5400. } else {
  5401. $10=$recv($MethodModified())._new();
  5402. $recv($10)._oldMethod_(oldMethod);
  5403. $recv($10)._method_(aMethod);
  5404. $11=$recv($10)._yourself();
  5405. announcement=$11;
  5406. };
  5407. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  5408. return self;
  5409. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  5410. },
  5411. args: ["aMethod"],
  5412. 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",
  5413. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  5414. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  5415. }),
  5416. $globals.Behavior);
  5417. $core.addMethod(
  5418. $core.method({
  5419. selector: "allInstanceVariableNames",
  5420. protocol: 'accessing',
  5421. fn: function (){
  5422. var self=this;
  5423. var result;
  5424. return $core.withContext(function($ctx1) {
  5425. var $1,$2,$receiver;
  5426. result=$recv(self._instanceVariableNames())._copy();
  5427. $1=self._superclass();
  5428. $ctx1.sendIdx["superclass"]=1;
  5429. if(($receiver = $1) == null || $receiver.isNil){
  5430. $1;
  5431. } else {
  5432. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  5433. };
  5434. $2=result;
  5435. return $2;
  5436. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  5437. },
  5438. args: [],
  5439. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5440. referencedClasses: [],
  5441. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  5442. }),
  5443. $globals.Behavior);
  5444. $core.addMethod(
  5445. $core.method({
  5446. selector: "allSelectors",
  5447. protocol: 'accessing',
  5448. fn: function (){
  5449. var self=this;
  5450. return $core.withContext(function($ctx1) {
  5451. var $2,$3,$4,$1;
  5452. $2=self._allSuperclasses();
  5453. $3=self._selectors();
  5454. $ctx1.sendIdx["selectors"]=1;
  5455. $1=$recv($2)._inject_into_($3,(function(acc,each){
  5456. return $core.withContext(function($ctx2) {
  5457. $recv(acc)._addAll_($recv(each)._selectors());
  5458. $4=$recv(acc)._yourself();
  5459. return $4;
  5460. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5461. }));
  5462. return $1;
  5463. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  5464. },
  5465. args: [],
  5466. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5467. referencedClasses: [],
  5468. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  5469. }),
  5470. $globals.Behavior);
  5471. $core.addMethod(
  5472. $core.method({
  5473. selector: "allSubclasses",
  5474. protocol: 'accessing',
  5475. fn: function (){
  5476. var self=this;
  5477. var subclasses,index;
  5478. return $core.withContext(function($ctx1) {
  5479. var $1;
  5480. subclasses=self._subclasses();
  5481. $ctx1.sendIdx["subclasses"]=1;
  5482. index=(1);
  5483. $recv((function(){
  5484. return $core.withContext(function($ctx2) {
  5485. return $recv(index).__gt($recv(subclasses)._size());
  5486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5487. }))._whileFalse_((function(){
  5488. return $core.withContext(function($ctx2) {
  5489. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  5490. index=$recv(index).__plus((1));
  5491. return index;
  5492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5493. }));
  5494. $1=subclasses;
  5495. return $1;
  5496. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},$globals.Behavior)});
  5497. },
  5498. args: [],
  5499. 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",
  5500. referencedClasses: [],
  5501. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"]
  5502. }),
  5503. $globals.Behavior);
  5504. $core.addMethod(
  5505. $core.method({
  5506. selector: "allSubclassesDo:",
  5507. protocol: 'enumerating',
  5508. fn: function (aBlock){
  5509. var self=this;
  5510. return $core.withContext(function($ctx1) {
  5511. $recv(self._allSubclasses())._do_((function(each){
  5512. return $core.withContext(function($ctx2) {
  5513. return $recv(aBlock)._value_(each);
  5514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5515. }));
  5516. return self;
  5517. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  5518. },
  5519. args: ["aBlock"],
  5520. 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 ]",
  5521. referencedClasses: [],
  5522. messageSends: ["do:", "allSubclasses", "value:"]
  5523. }),
  5524. $globals.Behavior);
  5525. $core.addMethod(
  5526. $core.method({
  5527. selector: "allSuperclasses",
  5528. protocol: 'accessing',
  5529. fn: function (){
  5530. var self=this;
  5531. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5532. return $core.withContext(function($ctx1) {
  5533. var $1,$2,$5,$4,$6,$3,$receiver;
  5534. $1=self._superclass();
  5535. $ctx1.sendIdx["superclass"]=1;
  5536. if(($receiver = $1) == null || $receiver.isNil){
  5537. $2=[];
  5538. return $2;
  5539. } else {
  5540. $1;
  5541. };
  5542. $5=self._superclass();
  5543. $ctx1.sendIdx["superclass"]=2;
  5544. $4=$recv($OrderedCollection())._with_($5);
  5545. $recv($4)._addAll_($recv(self._superclass())._allSuperclasses());
  5546. $6=$recv($4)._yourself();
  5547. $3=$6;
  5548. return $3;
  5549. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  5550. },
  5551. args: [],
  5552. 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",
  5553. referencedClasses: ["OrderedCollection"],
  5554. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  5555. }),
  5556. $globals.Behavior);
  5557. $core.addMethod(
  5558. $core.method({
  5559. selector: "basicAddCompiledMethod:",
  5560. protocol: 'private',
  5561. fn: function (aMethod){
  5562. var self=this;
  5563. return $core.withContext(function($ctx1) {
  5564. $core.addMethod(aMethod, self);
  5565. return self;
  5566. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5567. },
  5568. args: ["aMethod"],
  5569. source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>",
  5570. referencedClasses: [],
  5571. messageSends: []
  5572. }),
  5573. $globals.Behavior);
  5574. $core.addMethod(
  5575. $core.method({
  5576. selector: "basicNew",
  5577. protocol: 'instance creation',
  5578. fn: function (){
  5579. var self=this;
  5580. return $core.withContext(function($ctx1) {
  5581. return new self.fn();
  5582. return self;
  5583. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  5584. },
  5585. args: [],
  5586. source: "basicNew\x0a\x09<return new self.fn()>",
  5587. referencedClasses: [],
  5588. messageSends: []
  5589. }),
  5590. $globals.Behavior);
  5591. $core.addMethod(
  5592. $core.method({
  5593. selector: "basicRemoveCompiledMethod:",
  5594. protocol: 'private',
  5595. fn: function (aMethod){
  5596. var self=this;
  5597. return $core.withContext(function($ctx1) {
  5598. $core.removeMethod(aMethod,self);
  5599. return self;
  5600. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5601. },
  5602. args: ["aMethod"],
  5603. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>",
  5604. referencedClasses: [],
  5605. messageSends: []
  5606. }),
  5607. $globals.Behavior);
  5608. $core.addMethod(
  5609. $core.method({
  5610. selector: "canUnderstand:",
  5611. protocol: 'testing',
  5612. fn: function (aSelector){
  5613. var self=this;
  5614. return $core.withContext(function($ctx1) {
  5615. var $3,$2,$1;
  5616. $1=$recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  5617. return $core.withContext(function($ctx2) {
  5618. $3=self._superclass();
  5619. $ctx2.sendIdx["superclass"]=1;
  5620. $2=$recv($3)._notNil();
  5621. return $recv($2)._and_((function(){
  5622. return $core.withContext(function($ctx3) {
  5623. return $recv(self._superclass())._canUnderstand_(aSelector);
  5624. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  5625. }));
  5626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5627. }));
  5628. return $1;
  5629. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  5630. },
  5631. args: ["aSelector"],
  5632. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  5633. referencedClasses: [],
  5634. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  5635. }),
  5636. $globals.Behavior);
  5637. $core.addMethod(
  5638. $core.method({
  5639. selector: "comment",
  5640. protocol: 'accessing',
  5641. fn: function (){
  5642. var self=this;
  5643. return $core.withContext(function($ctx1) {
  5644. var $2,$1,$receiver;
  5645. $2=self._basicAt_("comment");
  5646. if(($receiver = $2) == null || $receiver.isNil){
  5647. $1="";
  5648. } else {
  5649. $1=$2;
  5650. };
  5651. return $1;
  5652. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  5653. },
  5654. args: [],
  5655. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  5656. referencedClasses: [],
  5657. messageSends: ["ifNil:", "basicAt:"]
  5658. }),
  5659. $globals.Behavior);
  5660. $core.addMethod(
  5661. $core.method({
  5662. selector: "comment:",
  5663. protocol: 'accessing',
  5664. fn: function (aString){
  5665. var self=this;
  5666. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5667. function $ClassCommentChanged(){return $globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  5668. return $core.withContext(function($ctx1) {
  5669. var $1,$2;
  5670. self._basicAt_put_("comment",aString);
  5671. $1=$recv($ClassCommentChanged())._new();
  5672. $recv($1)._theClass_(self);
  5673. $2=$recv($1)._yourself();
  5674. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  5675. return self;
  5676. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  5677. },
  5678. args: ["aString"],
  5679. 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)",
  5680. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  5681. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  5682. }),
  5683. $globals.Behavior);
  5684. $core.addMethod(
  5685. $core.method({
  5686. selector: "compile:protocol:",
  5687. protocol: 'compiling',
  5688. fn: function (aString,anotherString){
  5689. var self=this;
  5690. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5691. return $core.withContext(function($ctx1) {
  5692. var $1;
  5693. $1=$recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
  5694. return $1;
  5695. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  5696. },
  5697. args: ["aString", "anotherString"],
  5698. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  5699. referencedClasses: ["Compiler"],
  5700. messageSends: ["install:forClass:protocol:", "new"]
  5701. }),
  5702. $globals.Behavior);
  5703. $core.addMethod(
  5704. $core.method({
  5705. selector: "definition",
  5706. protocol: 'accessing',
  5707. fn: function (){
  5708. var self=this;
  5709. return "";
  5710. },
  5711. args: [],
  5712. source: "definition\x0a\x09^ ''",
  5713. referencedClasses: [],
  5714. messageSends: []
  5715. }),
  5716. $globals.Behavior);
  5717. $core.addMethod(
  5718. $core.method({
  5719. selector: "includesBehavior:",
  5720. protocol: 'testing',
  5721. fn: function (aClass){
  5722. var self=this;
  5723. return $core.withContext(function($ctx1) {
  5724. var $1;
  5725. $1=$recv(self.__eq_eq(aClass))._or_((function(){
  5726. return $core.withContext(function($ctx2) {
  5727. return self._inheritsFrom_(aClass);
  5728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5729. }));
  5730. return $1;
  5731. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  5732. },
  5733. args: ["aClass"],
  5734. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  5735. referencedClasses: [],
  5736. messageSends: ["or:", "==", "inheritsFrom:"]
  5737. }),
  5738. $globals.Behavior);
  5739. $core.addMethod(
  5740. $core.method({
  5741. selector: "includesSelector:",
  5742. protocol: 'testing',
  5743. fn: function (aString){
  5744. var self=this;
  5745. return $core.withContext(function($ctx1) {
  5746. var $1;
  5747. $1=$recv(self._methodDictionary())._includesKey_(aString);
  5748. return $1;
  5749. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  5750. },
  5751. args: ["aString"],
  5752. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  5753. referencedClasses: [],
  5754. messageSends: ["includesKey:", "methodDictionary"]
  5755. }),
  5756. $globals.Behavior);
  5757. $core.addMethod(
  5758. $core.method({
  5759. selector: "inheritsFrom:",
  5760. protocol: 'testing',
  5761. fn: function (aClass){
  5762. var self=this;
  5763. return $core.withContext(function($ctx1) {
  5764. var $1,$4,$3,$2,$receiver;
  5765. $1=self._superclass();
  5766. $ctx1.sendIdx["superclass"]=1;
  5767. if(($receiver = $1) == null || $receiver.isNil){
  5768. return false;
  5769. } else {
  5770. $1;
  5771. };
  5772. $4=self._superclass();
  5773. $ctx1.sendIdx["superclass"]=2;
  5774. $3=$recv(aClass).__eq_eq($4);
  5775. $2=$recv($3)._or_((function(){
  5776. return $core.withContext(function($ctx2) {
  5777. return $recv(self._superclass())._inheritsFrom_(aClass);
  5778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5779. }));
  5780. return $2;
  5781. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  5782. },
  5783. args: ["aClass"],
  5784. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  5785. referencedClasses: [],
  5786. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  5787. }),
  5788. $globals.Behavior);
  5789. $core.addMethod(
  5790. $core.method({
  5791. selector: "instanceVariableNames",
  5792. protocol: 'accessing',
  5793. fn: function (){
  5794. var self=this;
  5795. return $core.withContext(function($ctx1) {
  5796. return self.iVarNames;
  5797. return self;
  5798. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  5799. },
  5800. args: [],
  5801. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5802. referencedClasses: [],
  5803. messageSends: []
  5804. }),
  5805. $globals.Behavior);
  5806. $core.addMethod(
  5807. $core.method({
  5808. selector: "isBehavior",
  5809. protocol: 'testing',
  5810. fn: function (){
  5811. var self=this;
  5812. return true;
  5813. },
  5814. args: [],
  5815. source: "isBehavior\x0a\x09^ true",
  5816. referencedClasses: [],
  5817. messageSends: []
  5818. }),
  5819. $globals.Behavior);
  5820. $core.addMethod(
  5821. $core.method({
  5822. selector: "javascriptConstructor",
  5823. protocol: 'accessing',
  5824. fn: function (){
  5825. var self=this;
  5826. return $core.withContext(function($ctx1) {
  5827. return self.fn;
  5828. return self;
  5829. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  5830. },
  5831. args: [],
  5832. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  5833. referencedClasses: [],
  5834. messageSends: []
  5835. }),
  5836. $globals.Behavior);
  5837. $core.addMethod(
  5838. $core.method({
  5839. selector: "javascriptConstructor:",
  5840. protocol: 'accessing',
  5841. fn: function (aJavaScriptFunction){
  5842. var self=this;
  5843. return $core.withContext(function($ctx1) {
  5844. $core.setClassConstructor(self, aJavaScriptFunction);;
  5845. return self;
  5846. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  5847. },
  5848. args: ["aJavaScriptFunction"],
  5849. 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);>",
  5850. referencedClasses: [],
  5851. messageSends: []
  5852. }),
  5853. $globals.Behavior);
  5854. $core.addMethod(
  5855. $core.method({
  5856. selector: "lookupSelector:",
  5857. protocol: 'accessing',
  5858. fn: function (selector){
  5859. var self=this;
  5860. var lookupClass;
  5861. return $core.withContext(function($ctx1) {
  5862. var $1,$2;
  5863. var $early={};
  5864. try {
  5865. lookupClass=self;
  5866. $recv((function(){
  5867. return $core.withContext(function($ctx2) {
  5868. return $recv(lookupClass).__eq(nil);
  5869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5870. }))._whileFalse_((function(){
  5871. return $core.withContext(function($ctx2) {
  5872. $1=$recv(lookupClass)._includesSelector_(selector);
  5873. if($core.assert($1)){
  5874. $2=$recv(lookupClass)._methodAt_(selector);
  5875. throw $early=[$2];
  5876. };
  5877. lookupClass=$recv(lookupClass)._superclass();
  5878. return lookupClass;
  5879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5880. }));
  5881. return nil;
  5882. }
  5883. catch(e) {if(e===$early)return e[0]; throw e}
  5884. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  5885. },
  5886. args: ["selector"],
  5887. 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",
  5888. referencedClasses: [],
  5889. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  5890. }),
  5891. $globals.Behavior);
  5892. $core.addMethod(
  5893. $core.method({
  5894. selector: "methodAt:",
  5895. protocol: 'accessing',
  5896. fn: function (aString){
  5897. var self=this;
  5898. return $core.withContext(function($ctx1) {
  5899. var $1;
  5900. $1=$recv(self._methodDictionary())._at_(aString);
  5901. return $1;
  5902. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  5903. },
  5904. args: ["aString"],
  5905. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  5906. referencedClasses: [],
  5907. messageSends: ["at:", "methodDictionary"]
  5908. }),
  5909. $globals.Behavior);
  5910. $core.addMethod(
  5911. $core.method({
  5912. selector: "methodDictionary",
  5913. protocol: 'accessing',
  5914. fn: function (){
  5915. var self=this;
  5916. return $core.withContext(function($ctx1) {
  5917. var dict = $globals.HashedCollection._new();
  5918. var methods = self.methods;
  5919. Object.keys(methods).forEach(function(i) {
  5920. if(methods[i].selector) {
  5921. dict._at_put_(methods[i].selector, methods[i]);
  5922. }
  5923. });
  5924. return dict;
  5925. return self;
  5926. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  5927. },
  5928. args: [],
  5929. 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>",
  5930. referencedClasses: [],
  5931. messageSends: []
  5932. }),
  5933. $globals.Behavior);
  5934. $core.addMethod(
  5935. $core.method({
  5936. selector: "methodTemplate",
  5937. protocol: 'accessing',
  5938. fn: function (){
  5939. var self=this;
  5940. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  5941. return $core.withContext(function($ctx1) {
  5942. var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
  5943. $1=$recv($String())._streamContents_((function(stream){
  5944. return $core.withContext(function($ctx2) {
  5945. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  5946. $ctx2.sendIdx["nextPutAll:"]=1;
  5947. $3=$recv($String())._lf();
  5948. $ctx2.sendIdx["lf"]=1;
  5949. $4=$recv($String())._tab();
  5950. $ctx2.sendIdx["tab"]=1;
  5951. $2=$recv($3).__comma($4);
  5952. $ctx2.sendIdx[","]=1;
  5953. $recv(stream)._nextPutAll_($2);
  5954. $ctx2.sendIdx["nextPutAll:"]=2;
  5955. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  5956. $ctx2.sendIdx["nextPutAll:"]=3;
  5957. $7=$recv($String())._lf();
  5958. $ctx2.sendIdx["lf"]=2;
  5959. $8=$recv($String())._lf();
  5960. $ctx2.sendIdx["lf"]=3;
  5961. $6=$recv($7).__comma($8);
  5962. $ctx2.sendIdx[","]=3;
  5963. $9=$recv($String())._tab();
  5964. $ctx2.sendIdx["tab"]=2;
  5965. $5=$recv($6).__comma($9);
  5966. $ctx2.sendIdx[","]=2;
  5967. $recv(stream)._nextPutAll_($5);
  5968. $ctx2.sendIdx["nextPutAll:"]=4;
  5969. $recv(stream)._nextPutAll_("| temporary variable names |");
  5970. $ctx2.sendIdx["nextPutAll:"]=5;
  5971. $recv(stream)._nextPutAll_($recv($recv($String())._lf()).__comma($recv($String())._tab()));
  5972. $ctx2.sendIdx["nextPutAll:"]=6;
  5973. $10=$recv(stream)._nextPutAll_("statements");
  5974. return $10;
  5975. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5976. }));
  5977. return $1;
  5978. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  5979. },
  5980. args: [],
  5981. 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' ]",
  5982. referencedClasses: ["String"],
  5983. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  5984. }),
  5985. $globals.Behavior);
  5986. $core.addMethod(
  5987. $core.method({
  5988. selector: "methods",
  5989. protocol: 'accessing',
  5990. fn: function (){
  5991. var self=this;
  5992. return $core.withContext(function($ctx1) {
  5993. var $1;
  5994. $1=$recv(self._methodDictionary())._values();
  5995. return $1;
  5996. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  5997. },
  5998. args: [],
  5999. source: "methods\x0a\x09^ self methodDictionary values",
  6000. referencedClasses: [],
  6001. messageSends: ["values", "methodDictionary"]
  6002. }),
  6003. $globals.Behavior);
  6004. $core.addMethod(
  6005. $core.method({
  6006. selector: "methodsInProtocol:",
  6007. protocol: 'accessing',
  6008. fn: function (aString){
  6009. var self=this;
  6010. return $core.withContext(function($ctx1) {
  6011. var $1;
  6012. $1=$recv(self._methods())._select_((function(each){
  6013. return $core.withContext(function($ctx2) {
  6014. return $recv($recv(each)._protocol()).__eq(aString);
  6015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6016. }));
  6017. return $1;
  6018. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  6019. },
  6020. args: ["aString"],
  6021. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  6022. referencedClasses: [],
  6023. messageSends: ["select:", "methods", "=", "protocol"]
  6024. }),
  6025. $globals.Behavior);
  6026. $core.addMethod(
  6027. $core.method({
  6028. selector: "name",
  6029. protocol: 'accessing',
  6030. fn: function (){
  6031. var self=this;
  6032. return $core.withContext(function($ctx1) {
  6033. return self.className || nil;
  6034. return self;
  6035. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  6036. },
  6037. args: [],
  6038. source: "name\x0a\x09<return self.className || nil>",
  6039. referencedClasses: [],
  6040. messageSends: []
  6041. }),
  6042. $globals.Behavior);
  6043. $core.addMethod(
  6044. $core.method({
  6045. selector: "new",
  6046. protocol: 'instance creation',
  6047. fn: function (){
  6048. var self=this;
  6049. return $core.withContext(function($ctx1) {
  6050. var $1;
  6051. $1=$recv(self._basicNew())._initialize();
  6052. return $1;
  6053. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  6054. },
  6055. args: [],
  6056. source: "new\x0a\x09^ self basicNew initialize",
  6057. referencedClasses: [],
  6058. messageSends: ["initialize", "basicNew"]
  6059. }),
  6060. $globals.Behavior);
  6061. $core.addMethod(
  6062. $core.method({
  6063. selector: "organization",
  6064. protocol: 'accessing',
  6065. fn: function (){
  6066. var self=this;
  6067. return $core.withContext(function($ctx1) {
  6068. var $1;
  6069. $1=self._basicAt_("organization");
  6070. return $1;
  6071. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  6072. },
  6073. args: [],
  6074. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6075. referencedClasses: [],
  6076. messageSends: ["basicAt:"]
  6077. }),
  6078. $globals.Behavior);
  6079. $core.addMethod(
  6080. $core.method({
  6081. selector: "ownMethods",
  6082. protocol: 'accessing',
  6083. fn: function (){
  6084. var self=this;
  6085. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  6086. return $core.withContext(function($ctx1) {
  6087. var $2,$1;
  6088. $1=$recv($recv(self._ownProtocols())._inject_into_($recv($OrderedCollection())._new(),(function(acc,each){
  6089. return $core.withContext(function($ctx2) {
  6090. return $recv(acc).__comma(self._methodsInProtocol_(each));
  6091. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6092. })))._sorted_((function(a,b){
  6093. return $core.withContext(function($ctx2) {
  6094. $2=$recv(a)._selector();
  6095. $ctx2.sendIdx["selector"]=1;
  6096. return $recv($2).__lt_eq($recv(b)._selector());
  6097. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  6098. }));
  6099. return $1;
  6100. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  6101. },
  6102. args: [],
  6103. 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 ]",
  6104. referencedClasses: ["OrderedCollection"],
  6105. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  6106. }),
  6107. $globals.Behavior);
  6108. $core.addMethod(
  6109. $core.method({
  6110. selector: "ownProtocols",
  6111. protocol: 'accessing',
  6112. fn: function (){
  6113. var self=this;
  6114. return $core.withContext(function($ctx1) {
  6115. var $1;
  6116. $1=$recv(self._protocols())._reject_((function(each){
  6117. return $core.withContext(function($ctx2) {
  6118. return $recv(each)._match_("^\x5c*");
  6119. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6120. }));
  6121. return $1;
  6122. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  6123. },
  6124. args: [],
  6125. 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*' ]",
  6126. referencedClasses: [],
  6127. messageSends: ["reject:", "protocols", "match:"]
  6128. }),
  6129. $globals.Behavior);
  6130. $core.addMethod(
  6131. $core.method({
  6132. selector: "packageOfProtocol:",
  6133. protocol: 'accessing',
  6134. fn: function (aString){
  6135. var self=this;
  6136. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  6137. return $core.withContext(function($ctx1) {
  6138. var $1,$2,$3;
  6139. $1=$recv(aString)._beginsWith_("*");
  6140. if(!$core.assert($1)){
  6141. $2=self._package();
  6142. return $2;
  6143. };
  6144. $3=$recv($Package())._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  6145. return nil;
  6146. }));
  6147. return $3;
  6148. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  6149. },
  6150. args: ["aString"],
  6151. 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 ]",
  6152. referencedClasses: ["Package"],
  6153. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  6154. }),
  6155. $globals.Behavior);
  6156. $core.addMethod(
  6157. $core.method({
  6158. selector: "protocols",
  6159. protocol: 'accessing',
  6160. fn: function (){
  6161. var self=this;
  6162. return $core.withContext(function($ctx1) {
  6163. var $1;
  6164. $1=$recv($recv(self._organization())._elements())._sorted();
  6165. return $1;
  6166. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6167. },
  6168. args: [],
  6169. source: "protocols\x0a\x09^ self organization elements sorted",
  6170. referencedClasses: [],
  6171. messageSends: ["sorted", "elements", "organization"]
  6172. }),
  6173. $globals.Behavior);
  6174. $core.addMethod(
  6175. $core.method({
  6176. selector: "protocolsDo:",
  6177. protocol: 'enumerating',
  6178. fn: function (aBlock){
  6179. var self=this;
  6180. var methodsByProtocol;
  6181. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  6182. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6183. return $core.withContext(function($ctx1) {
  6184. methodsByProtocol=$recv($HashedCollection())._new();
  6185. $ctx1.sendIdx["new"]=1;
  6186. $recv(self._methodDictionary())._valuesDo_((function(m){
  6187. return $core.withContext(function($ctx2) {
  6188. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6189. return $core.withContext(function($ctx3) {
  6190. return $recv($Array())._new();
  6191. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6192. })))._add_(m);
  6193. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6194. }));
  6195. $recv(self._protocols())._do_((function(protocol){
  6196. return $core.withContext(function($ctx2) {
  6197. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6198. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6199. }));
  6200. return self;
  6201. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6202. },
  6203. args: ["aBlock"],
  6204. 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) ]",
  6205. referencedClasses: ["HashedCollection", "Array"],
  6206. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6207. }),
  6208. $globals.Behavior);
  6209. $core.addMethod(
  6210. $core.method({
  6211. selector: "prototype",
  6212. protocol: 'accessing',
  6213. fn: function (){
  6214. var self=this;
  6215. return $core.withContext(function($ctx1) {
  6216. return self.fn.prototype;
  6217. return self;
  6218. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6219. },
  6220. args: [],
  6221. source: "prototype\x0a\x09<return self.fn.prototype>",
  6222. referencedClasses: [],
  6223. messageSends: []
  6224. }),
  6225. $globals.Behavior);
  6226. $core.addMethod(
  6227. $core.method({
  6228. selector: "recompile",
  6229. protocol: 'compiling',
  6230. fn: function (){
  6231. var self=this;
  6232. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6233. return $core.withContext(function($ctx1) {
  6234. var $1;
  6235. $1=$recv($recv($Compiler())._new())._recompile_(self);
  6236. return $1;
  6237. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6238. },
  6239. args: [],
  6240. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6241. referencedClasses: ["Compiler"],
  6242. messageSends: ["recompile:", "new"]
  6243. }),
  6244. $globals.Behavior);
  6245. $core.addMethod(
  6246. $core.method({
  6247. selector: "removeCompiledMethod:",
  6248. protocol: 'compiling',
  6249. fn: function (aMethod){
  6250. var self=this;
  6251. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6252. function $MethodRemoved(){return $globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  6253. return $core.withContext(function($ctx1) {
  6254. var $1,$2;
  6255. self._basicRemoveCompiledMethod_(aMethod);
  6256. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6257. $1=$recv($MethodRemoved())._new();
  6258. $recv($1)._method_(aMethod);
  6259. $2=$recv($1)._yourself();
  6260. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  6261. return self;
  6262. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6263. },
  6264. args: ["aMethod"],
  6265. 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)",
  6266. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6267. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6268. }),
  6269. $globals.Behavior);
  6270. $core.addMethod(
  6271. $core.method({
  6272. selector: "removeProtocolIfEmpty:",
  6273. protocol: 'accessing',
  6274. fn: function (aString){
  6275. var self=this;
  6276. return $core.withContext(function($ctx1) {
  6277. $recv(self._methods())._detect_ifNone_((function(each){
  6278. return $core.withContext(function($ctx2) {
  6279. return $recv($recv(each)._protocol()).__eq(aString);
  6280. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6281. }),(function(){
  6282. return $core.withContext(function($ctx2) {
  6283. return $recv(self._organization())._removeElement_(aString);
  6284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6285. }));
  6286. return self;
  6287. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6288. },
  6289. args: ["aString"],
  6290. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6291. referencedClasses: [],
  6292. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6293. }),
  6294. $globals.Behavior);
  6295. $core.addMethod(
  6296. $core.method({
  6297. selector: "selectors",
  6298. protocol: 'accessing',
  6299. fn: function (){
  6300. var self=this;
  6301. return $core.withContext(function($ctx1) {
  6302. var $1;
  6303. $1=$recv(self._methodDictionary())._keys();
  6304. return $1;
  6305. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6306. },
  6307. args: [],
  6308. source: "selectors\x0a\x09^ self methodDictionary keys",
  6309. referencedClasses: [],
  6310. messageSends: ["keys", "methodDictionary"]
  6311. }),
  6312. $globals.Behavior);
  6313. $core.addMethod(
  6314. $core.method({
  6315. selector: "subclasses",
  6316. protocol: 'accessing',
  6317. fn: function (){
  6318. var self=this;
  6319. return $core.withContext(function($ctx1) {
  6320. self._subclassResponsibility();
  6321. return self;
  6322. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6323. },
  6324. args: [],
  6325. source: "subclasses\x0a\x09self subclassResponsibility",
  6326. referencedClasses: [],
  6327. messageSends: ["subclassResponsibility"]
  6328. }),
  6329. $globals.Behavior);
  6330. $core.addMethod(
  6331. $core.method({
  6332. selector: "superclass",
  6333. protocol: 'accessing',
  6334. fn: function (){
  6335. var self=this;
  6336. return $core.withContext(function($ctx1) {
  6337. return self.superclass || nil;
  6338. return self;
  6339. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6340. },
  6341. args: [],
  6342. source: "superclass\x0a\x09<return self.superclass || nil>",
  6343. referencedClasses: [],
  6344. messageSends: []
  6345. }),
  6346. $globals.Behavior);
  6347. $core.addMethod(
  6348. $core.method({
  6349. selector: "theMetaClass",
  6350. protocol: 'accessing',
  6351. fn: function (){
  6352. var self=this;
  6353. return $core.withContext(function($ctx1) {
  6354. self._subclassResponsibility();
  6355. return self;
  6356. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  6357. },
  6358. args: [],
  6359. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6360. referencedClasses: [],
  6361. messageSends: ["subclassResponsibility"]
  6362. }),
  6363. $globals.Behavior);
  6364. $core.addMethod(
  6365. $core.method({
  6366. selector: "theNonMetaClass",
  6367. protocol: 'accessing',
  6368. fn: function (){
  6369. var self=this;
  6370. return $core.withContext(function($ctx1) {
  6371. self._subclassResponsibility();
  6372. return self;
  6373. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6374. },
  6375. args: [],
  6376. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6377. referencedClasses: [],
  6378. messageSends: ["subclassResponsibility"]
  6379. }),
  6380. $globals.Behavior);
  6381. $core.addMethod(
  6382. $core.method({
  6383. selector: "withAllSubclasses",
  6384. protocol: 'accessing',
  6385. fn: function (){
  6386. var self=this;
  6387. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6388. return $core.withContext(function($ctx1) {
  6389. var $2,$3,$1;
  6390. $2=$recv($Array())._with_(self);
  6391. $recv($2)._addAll_(self._allSubclasses());
  6392. $3=$recv($2)._yourself();
  6393. $1=$3;
  6394. return $1;
  6395. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  6396. },
  6397. args: [],
  6398. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6399. referencedClasses: ["Array"],
  6400. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  6401. }),
  6402. $globals.Behavior);
  6403. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  6404. $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.";
  6405. $core.addMethod(
  6406. $core.method({
  6407. selector: "asJavascript",
  6408. protocol: 'converting',
  6409. fn: function (){
  6410. var self=this;
  6411. return $core.withContext(function($ctx1) {
  6412. var $1;
  6413. $1="$globals.".__comma(self._name());
  6414. return $1;
  6415. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  6416. },
  6417. args: [],
  6418. source: "asJavascript\x0a\x09^ '$globals.', self name",
  6419. referencedClasses: [],
  6420. messageSends: [",", "name"]
  6421. }),
  6422. $globals.Class);
  6423. $core.addMethod(
  6424. $core.method({
  6425. selector: "browse",
  6426. protocol: 'browsing',
  6427. fn: function (){
  6428. var self=this;
  6429. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  6430. return $core.withContext(function($ctx1) {
  6431. $recv($Finder())._findClass_(self);
  6432. return self;
  6433. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  6434. },
  6435. args: [],
  6436. source: "browse\x0a\x09Finder findClass: self",
  6437. referencedClasses: ["Finder"],
  6438. messageSends: ["findClass:"]
  6439. }),
  6440. $globals.Class);
  6441. $core.addMethod(
  6442. $core.method({
  6443. selector: "category",
  6444. protocol: 'accessing',
  6445. fn: function (){
  6446. var self=this;
  6447. return $core.withContext(function($ctx1) {
  6448. var $2,$1,$receiver;
  6449. $2=self._package();
  6450. $ctx1.sendIdx["package"]=1;
  6451. if(($receiver = $2) == null || $receiver.isNil){
  6452. $1="Unclassified";
  6453. } else {
  6454. $1=$recv(self._package())._name();
  6455. };
  6456. return $1;
  6457. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  6458. },
  6459. args: [],
  6460. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6461. referencedClasses: [],
  6462. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  6463. }),
  6464. $globals.Class);
  6465. $core.addMethod(
  6466. $core.method({
  6467. selector: "classTag",
  6468. protocol: 'accessing',
  6469. fn: function (){
  6470. var self=this;
  6471. return "class";
  6472. },
  6473. args: [],
  6474. 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'",
  6475. referencedClasses: [],
  6476. messageSends: []
  6477. }),
  6478. $globals.Class);
  6479. $core.addMethod(
  6480. $core.method({
  6481. selector: "definition",
  6482. protocol: 'accessing',
  6483. fn: function (){
  6484. var self=this;
  6485. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6486. return $core.withContext(function($ctx1) {
  6487. var $3,$4,$2,$5,$6,$7,$1;
  6488. $1=$recv($String())._streamContents_((function(stream){
  6489. return $core.withContext(function($ctx2) {
  6490. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  6491. $ctx2.sendIdx["nextPutAll:"]=1;
  6492. $recv(stream)._nextPutAll_(" subclass: #");
  6493. $ctx2.sendIdx["nextPutAll:"]=2;
  6494. $recv(stream)._nextPutAll_(self._name());
  6495. $ctx2.sendIdx["nextPutAll:"]=3;
  6496. $3=$recv($String())._lf();
  6497. $ctx2.sendIdx["lf"]=1;
  6498. $4=$recv($String())._tab();
  6499. $ctx2.sendIdx["tab"]=1;
  6500. $2=$recv($3).__comma($4);
  6501. $ctx2.sendIdx[","]=1;
  6502. $recv(stream)._nextPutAll_($2);
  6503. $ctx2.sendIdx["nextPutAll:"]=4;
  6504. $5=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  6505. $ctx2.sendIdx["nextPutAll:"]=5;
  6506. $5;
  6507. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6508. return $core.withContext(function($ctx3) {
  6509. return $recv(stream)._nextPutAll_(each);
  6510. $ctx3.sendIdx["nextPutAll:"]=6;
  6511. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6512. }),(function(){
  6513. return $core.withContext(function($ctx3) {
  6514. return $recv(stream)._nextPutAll_(" ");
  6515. $ctx3.sendIdx["nextPutAll:"]=7;
  6516. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6517. }));
  6518. $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  6519. $ctx2.sendIdx[","]=2;
  6520. $recv(stream)._nextPutAll_($6);
  6521. $ctx2.sendIdx["nextPutAll:"]=8;
  6522. $recv(stream)._nextPutAll_("package: '");
  6523. $ctx2.sendIdx["nextPutAll:"]=9;
  6524. $recv(stream)._nextPutAll_(self._category());
  6525. $ctx2.sendIdx["nextPutAll:"]=10;
  6526. $7=$recv(stream)._nextPutAll_("'");
  6527. return $7;
  6528. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6529. }));
  6530. return $1;
  6531. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  6532. },
  6533. args: [],
  6534. 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: '''' ]",
  6535. referencedClasses: ["String"],
  6536. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  6537. }),
  6538. $globals.Class);
  6539. $core.addMethod(
  6540. $core.method({
  6541. selector: "isClass",
  6542. protocol: 'testing',
  6543. fn: function (){
  6544. var self=this;
  6545. return true;
  6546. },
  6547. args: [],
  6548. source: "isClass\x0a\x09^ true",
  6549. referencedClasses: [],
  6550. messageSends: []
  6551. }),
  6552. $globals.Class);
  6553. $core.addMethod(
  6554. $core.method({
  6555. selector: "package",
  6556. protocol: 'accessing',
  6557. fn: function (){
  6558. var self=this;
  6559. return $core.withContext(function($ctx1) {
  6560. var $1;
  6561. $1=self._basicAt_("pkg");
  6562. return $1;
  6563. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  6564. },
  6565. args: [],
  6566. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6567. referencedClasses: [],
  6568. messageSends: ["basicAt:"]
  6569. }),
  6570. $globals.Class);
  6571. $core.addMethod(
  6572. $core.method({
  6573. selector: "package:",
  6574. protocol: 'accessing',
  6575. fn: function (aPackage){
  6576. var self=this;
  6577. var oldPackage;
  6578. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6579. function $ClassMoved(){return $globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  6580. return $core.withContext(function($ctx1) {
  6581. var $2,$1,$3,$4,$5;
  6582. $2=self._package();
  6583. $ctx1.sendIdx["package"]=1;
  6584. $1=$recv($2).__eq(aPackage);
  6585. if($core.assert($1)){
  6586. return self;
  6587. };
  6588. oldPackage=self._package();
  6589. self._basicAt_put_("pkg",aPackage);
  6590. $3=$recv(oldPackage)._organization();
  6591. $ctx1.sendIdx["organization"]=1;
  6592. $recv($3)._removeElement_(self);
  6593. $recv($recv(aPackage)._organization())._addElement_(self);
  6594. $4=$recv($ClassMoved())._new();
  6595. $recv($4)._theClass_(self);
  6596. $recv($4)._oldPackage_(oldPackage);
  6597. $5=$recv($4)._yourself();
  6598. $recv($recv($SystemAnnouncer())._current())._announce_($5);
  6599. return self;
  6600. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  6601. },
  6602. args: ["aPackage"],
  6603. 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)",
  6604. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  6605. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  6606. }),
  6607. $globals.Class);
  6608. $core.addMethod(
  6609. $core.method({
  6610. selector: "printOn:",
  6611. protocol: 'printing',
  6612. fn: function (aStream){
  6613. var self=this;
  6614. return $core.withContext(function($ctx1) {
  6615. $recv(aStream)._nextPutAll_(self._name());
  6616. return self;
  6617. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  6618. },
  6619. args: ["aStream"],
  6620. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  6621. referencedClasses: [],
  6622. messageSends: ["nextPutAll:", "name"]
  6623. }),
  6624. $globals.Class);
  6625. $core.addMethod(
  6626. $core.method({
  6627. selector: "rename:",
  6628. protocol: 'accessing',
  6629. fn: function (aString){
  6630. var self=this;
  6631. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6632. return $core.withContext(function($ctx1) {
  6633. $recv($recv($ClassBuilder())._new())._renameClass_to_(self,aString);
  6634. return self;
  6635. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  6636. },
  6637. args: ["aString"],
  6638. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  6639. referencedClasses: ["ClassBuilder"],
  6640. messageSends: ["renameClass:to:", "new"]
  6641. }),
  6642. $globals.Class);
  6643. $core.addMethod(
  6644. $core.method({
  6645. selector: "subclass:instanceVariableNames:",
  6646. protocol: 'class creation',
  6647. fn: function (aString,anotherString){
  6648. var self=this;
  6649. return $core.withContext(function($ctx1) {
  6650. var $1;
  6651. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6652. return $1;
  6653. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  6654. },
  6655. args: ["aString", "anotherString"],
  6656. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  6657. referencedClasses: [],
  6658. messageSends: ["subclass:instanceVariableNames:package:"]
  6659. }),
  6660. $globals.Class);
  6661. $core.addMethod(
  6662. $core.method({
  6663. selector: "subclass:instanceVariableNames:category:",
  6664. protocol: 'class creation',
  6665. fn: function (aString,aString2,aString3){
  6666. var self=this;
  6667. return $core.withContext(function($ctx1) {
  6668. var $1;
  6669. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6670. return $1;
  6671. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6672. },
  6673. args: ["aString", "aString2", "aString3"],
  6674. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  6675. referencedClasses: [],
  6676. messageSends: ["subclass:instanceVariableNames:package:"]
  6677. }),
  6678. $globals.Class);
  6679. $core.addMethod(
  6680. $core.method({
  6681. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  6682. protocol: 'class creation',
  6683. fn: function (aString,aString2,classVars,pools,aString3){
  6684. var self=this;
  6685. return $core.withContext(function($ctx1) {
  6686. var $1;
  6687. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6688. return $1;
  6689. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  6690. },
  6691. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  6692. 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",
  6693. referencedClasses: [],
  6694. messageSends: ["subclass:instanceVariableNames:package:"]
  6695. }),
  6696. $globals.Class);
  6697. $core.addMethod(
  6698. $core.method({
  6699. selector: "subclass:instanceVariableNames:package:",
  6700. protocol: 'class creation',
  6701. fn: function (aString,aString2,aString3){
  6702. var self=this;
  6703. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6704. return $core.withContext(function($ctx1) {
  6705. var $1;
  6706. $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  6707. return $1;
  6708. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6709. },
  6710. args: ["aString", "aString2", "aString3"],
  6711. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6712. referencedClasses: ["ClassBuilder"],
  6713. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  6714. }),
  6715. $globals.Class);
  6716. $core.addMethod(
  6717. $core.method({
  6718. selector: "subclasses",
  6719. protocol: 'accessing',
  6720. fn: function (){
  6721. var self=this;
  6722. return $core.withContext(function($ctx1) {
  6723. return self.subclasses._copy();
  6724. return self;
  6725. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  6726. },
  6727. args: [],
  6728. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  6729. referencedClasses: [],
  6730. messageSends: []
  6731. }),
  6732. $globals.Class);
  6733. $core.addMethod(
  6734. $core.method({
  6735. selector: "theMetaClass",
  6736. protocol: 'accessing',
  6737. fn: function (){
  6738. var self=this;
  6739. return $core.withContext(function($ctx1) {
  6740. var $1;
  6741. $1=self._class();
  6742. return $1;
  6743. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  6744. },
  6745. args: [],
  6746. source: "theMetaClass\x0a\x09^ self class",
  6747. referencedClasses: [],
  6748. messageSends: ["class"]
  6749. }),
  6750. $globals.Class);
  6751. $core.addMethod(
  6752. $core.method({
  6753. selector: "theNonMetaClass",
  6754. protocol: 'accessing',
  6755. fn: function (){
  6756. var self=this;
  6757. return self;
  6758. },
  6759. args: [],
  6760. source: "theNonMetaClass\x0a\x09^ self",
  6761. referencedClasses: [],
  6762. messageSends: []
  6763. }),
  6764. $globals.Class);
  6765. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  6766. $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.";
  6767. $core.addMethod(
  6768. $core.method({
  6769. selector: "asJavascript",
  6770. protocol: 'converting',
  6771. fn: function (){
  6772. var self=this;
  6773. return $core.withContext(function($ctx1) {
  6774. var $1;
  6775. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  6776. $ctx1.sendIdx[","]=1;
  6777. return $1;
  6778. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  6779. },
  6780. args: [],
  6781. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  6782. referencedClasses: [],
  6783. messageSends: [",", "name", "instanceClass"]
  6784. }),
  6785. $globals.Metaclass);
  6786. $core.addMethod(
  6787. $core.method({
  6788. selector: "definition",
  6789. protocol: 'accessing',
  6790. fn: function (){
  6791. var self=this;
  6792. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6793. return $core.withContext(function($ctx1) {
  6794. var $2,$1;
  6795. $1=$recv($String())._streamContents_((function(stream){
  6796. return $core.withContext(function($ctx2) {
  6797. $recv(stream)._nextPutAll_(self._asString());
  6798. $ctx2.sendIdx["nextPutAll:"]=1;
  6799. $2=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  6800. $ctx2.sendIdx["nextPutAll:"]=2;
  6801. $2;
  6802. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6803. return $core.withContext(function($ctx3) {
  6804. return $recv(stream)._nextPutAll_(each);
  6805. $ctx3.sendIdx["nextPutAll:"]=3;
  6806. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6807. }),(function(){
  6808. return $core.withContext(function($ctx3) {
  6809. return $recv(stream)._nextPutAll_(" ");
  6810. $ctx3.sendIdx["nextPutAll:"]=4;
  6811. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6812. }));
  6813. return $recv(stream)._nextPutAll_("'");
  6814. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6815. }));
  6816. return $1;
  6817. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  6818. },
  6819. args: [],
  6820. 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: '''' ]",
  6821. referencedClasses: ["String"],
  6822. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  6823. }),
  6824. $globals.Metaclass);
  6825. $core.addMethod(
  6826. $core.method({
  6827. selector: "instanceClass",
  6828. protocol: 'accessing',
  6829. fn: function (){
  6830. var self=this;
  6831. return $core.withContext(function($ctx1) {
  6832. return self.instanceClass;
  6833. return self;
  6834. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  6835. },
  6836. args: [],
  6837. source: "instanceClass\x0a\x09<return self.instanceClass>",
  6838. referencedClasses: [],
  6839. messageSends: []
  6840. }),
  6841. $globals.Metaclass);
  6842. $core.addMethod(
  6843. $core.method({
  6844. selector: "instanceVariableNames:",
  6845. protocol: 'accessing',
  6846. fn: function (aCollection){
  6847. var self=this;
  6848. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6849. return $core.withContext(function($ctx1) {
  6850. $recv($recv($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  6851. return self;
  6852. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  6853. },
  6854. args: ["aCollection"],
  6855. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  6856. referencedClasses: ["ClassBuilder"],
  6857. messageSends: ["class:instanceVariableNames:", "new"]
  6858. }),
  6859. $globals.Metaclass);
  6860. $core.addMethod(
  6861. $core.method({
  6862. selector: "isMetaclass",
  6863. protocol: 'testing',
  6864. fn: function (){
  6865. var self=this;
  6866. return true;
  6867. },
  6868. args: [],
  6869. source: "isMetaclass\x0a\x09^ true",
  6870. referencedClasses: [],
  6871. messageSends: []
  6872. }),
  6873. $globals.Metaclass);
  6874. $core.addMethod(
  6875. $core.method({
  6876. selector: "package",
  6877. protocol: 'accessing',
  6878. fn: function (){
  6879. var self=this;
  6880. return $core.withContext(function($ctx1) {
  6881. var $1;
  6882. $1=$recv(self._instanceClass())._package();
  6883. return $1;
  6884. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  6885. },
  6886. args: [],
  6887. source: "package\x0a\x09^ self instanceClass package",
  6888. referencedClasses: [],
  6889. messageSends: ["package", "instanceClass"]
  6890. }),
  6891. $globals.Metaclass);
  6892. $core.addMethod(
  6893. $core.method({
  6894. selector: "printOn:",
  6895. protocol: 'printing',
  6896. fn: function (aStream){
  6897. var self=this;
  6898. return $core.withContext(function($ctx1) {
  6899. var $1;
  6900. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  6901. $ctx1.sendIdx["nextPutAll:"]=1;
  6902. $1=$recv(aStream)._nextPutAll_(" class");
  6903. return self;
  6904. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  6905. },
  6906. args: ["aStream"],
  6907. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  6908. referencedClasses: [],
  6909. messageSends: ["nextPutAll:", "name", "instanceClass"]
  6910. }),
  6911. $globals.Metaclass);
  6912. $core.addMethod(
  6913. $core.method({
  6914. selector: "subclasses",
  6915. protocol: 'accessing',
  6916. fn: function (){
  6917. var self=this;
  6918. return $core.withContext(function($ctx1) {
  6919. var $1;
  6920. $1=$recv($recv($recv(self._instanceClass())._subclasses())._select_((function(each){
  6921. return $core.withContext(function($ctx2) {
  6922. return $recv($recv(each)._isMetaclass())._not();
  6923. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6924. })))._collect_((function(each){
  6925. return $core.withContext(function($ctx2) {
  6926. return $recv(each)._theMetaClass();
  6927. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  6928. }));
  6929. return $1;
  6930. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  6931. },
  6932. args: [],
  6933. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  6934. referencedClasses: [],
  6935. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"]
  6936. }),
  6937. $globals.Metaclass);
  6938. $core.addMethod(
  6939. $core.method({
  6940. selector: "theMetaClass",
  6941. protocol: 'accessing',
  6942. fn: function (){
  6943. var self=this;
  6944. return self;
  6945. },
  6946. args: [],
  6947. source: "theMetaClass\x0a\x09^ self",
  6948. referencedClasses: [],
  6949. messageSends: []
  6950. }),
  6951. $globals.Metaclass);
  6952. $core.addMethod(
  6953. $core.method({
  6954. selector: "theNonMetaClass",
  6955. protocol: 'accessing',
  6956. fn: function (){
  6957. var self=this;
  6958. return $core.withContext(function($ctx1) {
  6959. var $1;
  6960. $1=self._instanceClass();
  6961. return $1;
  6962. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  6963. },
  6964. args: [],
  6965. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  6966. referencedClasses: [],
  6967. messageSends: ["instanceClass"]
  6968. }),
  6969. $globals.Metaclass);
  6970. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  6971. $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:`.";
  6972. $core.addMethod(
  6973. $core.method({
  6974. selector: "addSubclassOf:named:instanceVariableNames:package:",
  6975. protocol: 'class definition',
  6976. fn: function (aClass,className,aCollection,packageName){
  6977. var self=this;
  6978. var theClass,thePackage;
  6979. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6980. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  6981. return $core.withContext(function($ctx1) {
  6982. var $1,$2,$3,$4,$receiver;
  6983. theClass=$recv($recv($Smalltalk())._globals())._at_(className);
  6984. thePackage=$recv($Package())._named_(packageName);
  6985. $1=theClass;
  6986. if(($receiver = $1) == null || $receiver.isNil){
  6987. $1;
  6988. } else {
  6989. $recv(theClass)._package_(thePackage);
  6990. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  6991. if(!$core.assert($2)){
  6992. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  6993. return $3;
  6994. };
  6995. };
  6996. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  6997. return $4;
  6998. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  6999. },
  7000. args: ["aClass", "className", "aCollection", "packageName"],
  7001. 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",
  7002. referencedClasses: ["Smalltalk", "Package"],
  7003. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  7004. }),
  7005. $globals.ClassBuilder);
  7006. $core.addMethod(
  7007. $core.method({
  7008. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7009. protocol: 'private',
  7010. fn: function (aClass,aString,aCollection,packageName){
  7011. var self=this;
  7012. return $core.withContext(function($ctx1) {
  7013. $core.addClass(aString, aClass, aCollection, packageName);
  7014. return $globals[aString]
  7015. ;
  7016. return self;
  7017. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  7018. },
  7019. args: ["aClass", "aString", "aCollection", "packageName"],
  7020. 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>",
  7021. referencedClasses: [],
  7022. messageSends: []
  7023. }),
  7024. $globals.ClassBuilder);
  7025. $core.addMethod(
  7026. $core.method({
  7027. selector: "basicClass:instanceVariableNames:",
  7028. protocol: 'private',
  7029. fn: function (aClass,aString){
  7030. var self=this;
  7031. return $core.withContext(function($ctx1) {
  7032. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7033. return self;
  7034. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7035. },
  7036. args: ["aClass", "aString"],
  7037. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7038. referencedClasses: [],
  7039. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  7040. }),
  7041. $globals.ClassBuilder);
  7042. $core.addMethod(
  7043. $core.method({
  7044. selector: "basicClass:instanceVariables:",
  7045. protocol: 'private',
  7046. fn: function (aClass,aCollection){
  7047. var self=this;
  7048. return $core.withContext(function($ctx1) {
  7049. var $1;
  7050. $1=$recv(aClass)._isMetaclass();
  7051. if(!$core.assert($1)){
  7052. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  7053. };
  7054. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  7055. return self;
  7056. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  7057. },
  7058. args: ["aClass", "aCollection"],
  7059. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7060. referencedClasses: [],
  7061. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  7062. }),
  7063. $globals.ClassBuilder);
  7064. $core.addMethod(
  7065. $core.method({
  7066. selector: "basicRemoveClass:",
  7067. protocol: 'private',
  7068. fn: function (aClass){
  7069. var self=this;
  7070. return $core.withContext(function($ctx1) {
  7071. $core.removeClass(aClass);
  7072. return self;
  7073. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  7074. },
  7075. args: ["aClass"],
  7076. source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>",
  7077. referencedClasses: [],
  7078. messageSends: []
  7079. }),
  7080. $globals.ClassBuilder);
  7081. $core.addMethod(
  7082. $core.method({
  7083. selector: "basicRenameClass:to:",
  7084. protocol: 'private',
  7085. fn: function (aClass,aString){
  7086. var self=this;
  7087. return $core.withContext(function($ctx1) {
  7088. $globals[aString] = aClass;
  7089. delete $globals[aClass.className];
  7090. aClass.className = aString;
  7091. ;
  7092. return self;
  7093. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7094. },
  7095. args: ["aClass", "aString"],
  7096. 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>",
  7097. referencedClasses: [],
  7098. messageSends: []
  7099. }),
  7100. $globals.ClassBuilder);
  7101. $core.addMethod(
  7102. $core.method({
  7103. selector: "basicSwapClassNames:with:",
  7104. protocol: 'private',
  7105. fn: function (aClass,anotherClass){
  7106. var self=this;
  7107. return $core.withContext(function($ctx1) {
  7108. var tmp = aClass.className;
  7109. aClass.className = anotherClass.className;
  7110. anotherClass.className = tmp;
  7111. ;
  7112. return self;
  7113. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7114. },
  7115. args: ["aClass", "anotherClass"],
  7116. 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>",
  7117. referencedClasses: [],
  7118. messageSends: []
  7119. }),
  7120. $globals.ClassBuilder);
  7121. $core.addMethod(
  7122. $core.method({
  7123. selector: "class:instanceVariableNames:",
  7124. protocol: 'class definition',
  7125. fn: function (aClass,ivarNames){
  7126. var self=this;
  7127. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7128. function $ClassDefinitionChanged(){return $globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  7129. return $core.withContext(function($ctx1) {
  7130. var $1,$2;
  7131. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7132. self._setupClass_(aClass);
  7133. $1=$recv($ClassDefinitionChanged())._new();
  7134. $recv($1)._theClass_(aClass);
  7135. $2=$recv($1)._yourself();
  7136. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7137. return self;
  7138. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  7139. },
  7140. args: ["aClass", "ivarNames"],
  7141. 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)",
  7142. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  7143. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7144. }),
  7145. $globals.ClassBuilder);
  7146. $core.addMethod(
  7147. $core.method({
  7148. selector: "copyClass:named:",
  7149. protocol: 'copying',
  7150. fn: function (aClass,className){
  7151. var self=this;
  7152. var newClass;
  7153. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7154. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7155. return $core.withContext(function($ctx1) {
  7156. var $1,$2,$3;
  7157. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7158. self._copyClass_to_(aClass,newClass);
  7159. $1=$recv($ClassAdded())._new();
  7160. $recv($1)._theClass_(newClass);
  7161. $2=$recv($1)._yourself();
  7162. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7163. $3=newClass;
  7164. return $3;
  7165. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  7166. },
  7167. args: ["aClass", "className"],
  7168. 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",
  7169. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7170. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  7171. }),
  7172. $globals.ClassBuilder);
  7173. $core.addMethod(
  7174. $core.method({
  7175. selector: "copyClass:to:",
  7176. protocol: 'copying',
  7177. fn: function (aClass,anotherClass){
  7178. var self=this;
  7179. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7180. return $core.withContext(function($ctx1) {
  7181. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  7182. $recv(anotherClass)._comment_($recv(aClass)._comment());
  7183. $1=$recv(aClass)._methodDictionary();
  7184. $ctx1.sendIdx["methodDictionary"]=1;
  7185. $recv($1)._valuesDo_((function(each){
  7186. return $core.withContext(function($ctx2) {
  7187. $2=$recv($Compiler())._new();
  7188. $ctx2.sendIdx["new"]=1;
  7189. $3=$recv(each)._source();
  7190. $ctx2.sendIdx["source"]=1;
  7191. $4=$recv(each)._protocol();
  7192. $ctx2.sendIdx["protocol"]=1;
  7193. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7194. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7195. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7196. }));
  7197. $ctx1.sendIdx["valuesDo:"]=1;
  7198. $5=$recv(anotherClass)._class();
  7199. $ctx1.sendIdx["class"]=1;
  7200. $7=$recv(aClass)._class();
  7201. $ctx1.sendIdx["class"]=2;
  7202. $6=$recv($7)._instanceVariableNames();
  7203. self._basicClass_instanceVariables_($5,$6);
  7204. $9=$recv(aClass)._class();
  7205. $ctx1.sendIdx["class"]=3;
  7206. $8=$recv($9)._methodDictionary();
  7207. $recv($8)._valuesDo_((function(each){
  7208. return $core.withContext(function($ctx2) {
  7209. return $recv($recv($Compiler())._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7211. }));
  7212. self._setupClass_(anotherClass);
  7213. return self;
  7214. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7215. },
  7216. args: ["aClass", "anotherClass"],
  7217. 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",
  7218. referencedClasses: ["Compiler"],
  7219. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"]
  7220. }),
  7221. $globals.ClassBuilder);
  7222. $core.addMethod(
  7223. $core.method({
  7224. selector: "installMethod:forClass:protocol:",
  7225. protocol: 'method definition',
  7226. fn: function (aCompiledMethod,aBehavior,aString){
  7227. var self=this;
  7228. return $core.withContext(function($ctx1) {
  7229. $recv(aCompiledMethod)._protocol_(aString);
  7230. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7231. return aCompiledMethod;
  7232. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7233. },
  7234. args: ["aCompiledMethod", "aBehavior", "aString"],
  7235. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7236. referencedClasses: [],
  7237. messageSends: ["protocol:", "addCompiledMethod:"]
  7238. }),
  7239. $globals.ClassBuilder);
  7240. $core.addMethod(
  7241. $core.method({
  7242. selector: "instanceVariableNamesFor:",
  7243. protocol: 'accessing',
  7244. fn: function (aString){
  7245. var self=this;
  7246. return $core.withContext(function($ctx1) {
  7247. var $1;
  7248. $1=$recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7249. return $core.withContext(function($ctx2) {
  7250. return $recv(each)._isEmpty();
  7251. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7252. }));
  7253. return $1;
  7254. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7255. },
  7256. args: ["aString"],
  7257. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7258. referencedClasses: [],
  7259. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7260. }),
  7261. $globals.ClassBuilder);
  7262. $core.addMethod(
  7263. $core.method({
  7264. selector: "migrateClass:superclass:",
  7265. protocol: 'class migration',
  7266. fn: function (aClass,anotherClass){
  7267. var self=this;
  7268. return $core.withContext(function($ctx1) {
  7269. var $2,$1;
  7270. $2=$recv(aClass)._name();
  7271. $ctx1.sendIdx["name"]=1;
  7272. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7273. return $1;
  7274. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7275. },
  7276. args: ["aClass", "anotherClass"],
  7277. 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",
  7278. referencedClasses: [],
  7279. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7280. }),
  7281. $globals.ClassBuilder);
  7282. $core.addMethod(
  7283. $core.method({
  7284. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7285. protocol: 'class migration',
  7286. fn: function (className,aClass,aCollection,packageName){
  7287. var self=this;
  7288. var oldClass,newClass,tmp;
  7289. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7290. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  7291. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7292. function $ClassMigrated(){return $globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  7293. return $core.withContext(function($ctx1) {
  7294. var $1,$2,$3,$4,$5;
  7295. tmp="new*".__comma(className);
  7296. oldClass=$recv($recv($Smalltalk())._globals())._at_(className);
  7297. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7298. self._basicSwapClassNames_with_(oldClass,newClass);
  7299. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7300. $recv((function(){
  7301. return $core.withContext(function($ctx2) {
  7302. return self._copyClass_to_(oldClass,newClass);
  7303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7304. }))._on_do_($Error(),(function(exception){
  7305. return $core.withContext(function($ctx2) {
  7306. self._basicSwapClassNames_with_(oldClass,newClass);
  7307. $1=self._basicRemoveClass_(newClass);
  7308. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7309. $1;
  7310. return $recv(exception)._resignal();
  7311. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7312. }));
  7313. self._rawRenameClass_to_(oldClass,tmp);
  7314. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7315. $2=self._rawRenameClass_to_(newClass,className);
  7316. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7317. return $core.withContext(function($ctx2) {
  7318. return self._migrateClass_superclass_(each,newClass);
  7319. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7320. }));
  7321. self._basicRemoveClass_(oldClass);
  7322. $3=$recv($ClassMigrated())._new();
  7323. $recv($3)._theClass_(newClass);
  7324. $recv($3)._oldClass_(oldClass);
  7325. $4=$recv($3)._yourself();
  7326. $recv($recv($SystemAnnouncer())._current())._announce_($4);
  7327. $5=newClass;
  7328. return $5;
  7329. }, 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)});
  7330. },
  7331. args: ["className", "aClass", "aCollection", "packageName"],
  7332. 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",
  7333. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7334. 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"]
  7335. }),
  7336. $globals.ClassBuilder);
  7337. $core.addMethod(
  7338. $core.method({
  7339. selector: "rawRenameClass:to:",
  7340. protocol: 'private',
  7341. fn: function (aClass,aString){
  7342. var self=this;
  7343. return $core.withContext(function($ctx1) {
  7344. $globals[aString] = aClass;
  7345. ;
  7346. return self;
  7347. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7348. },
  7349. args: ["aClass", "aString"],
  7350. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>",
  7351. referencedClasses: [],
  7352. messageSends: []
  7353. }),
  7354. $globals.ClassBuilder);
  7355. $core.addMethod(
  7356. $core.method({
  7357. selector: "renameClass:to:",
  7358. protocol: 'class migration',
  7359. fn: function (aClass,className){
  7360. var self=this;
  7361. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7362. function $ClassRenamed(){return $globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  7363. return $core.withContext(function($ctx1) {
  7364. var $1,$2;
  7365. self._basicRenameClass_to_(aClass,className);
  7366. $recv(aClass)._recompile();
  7367. $1=$recv($ClassRenamed())._new();
  7368. $recv($1)._theClass_(aClass);
  7369. $2=$recv($1)._yourself();
  7370. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7371. return self;
  7372. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7373. },
  7374. args: ["aClass", "className"],
  7375. 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)",
  7376. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7377. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7378. }),
  7379. $globals.ClassBuilder);
  7380. $core.addMethod(
  7381. $core.method({
  7382. selector: "setupClass:",
  7383. protocol: 'public',
  7384. fn: function (aClass){
  7385. var self=this;
  7386. return $core.withContext(function($ctx1) {
  7387. $core.init(aClass);;
  7388. return self;
  7389. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7390. },
  7391. args: ["aClass"],
  7392. source: "setupClass: aClass\x0a\x09<$core.init(aClass);>",
  7393. referencedClasses: [],
  7394. messageSends: []
  7395. }),
  7396. $globals.ClassBuilder);
  7397. $core.addMethod(
  7398. $core.method({
  7399. selector: "superclass:subclass:",
  7400. protocol: 'class definition',
  7401. fn: function (aClass,className){
  7402. var self=this;
  7403. return $core.withContext(function($ctx1) {
  7404. var $1;
  7405. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7406. return $1;
  7407. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7408. },
  7409. args: ["aClass", "className"],
  7410. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7411. referencedClasses: [],
  7412. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7413. }),
  7414. $globals.ClassBuilder);
  7415. $core.addMethod(
  7416. $core.method({
  7417. selector: "superclass:subclass:instanceVariableNames:package:",
  7418. protocol: 'class definition',
  7419. fn: function (aClass,className,ivarNames,packageName){
  7420. var self=this;
  7421. var newClass;
  7422. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7423. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7424. return $core.withContext(function($ctx1) {
  7425. var $1,$2,$3,$4,$5,$receiver;
  7426. $1=self._instanceVariableNamesFor_(ivarNames);
  7427. if(($receiver = packageName) == null || $receiver.isNil){
  7428. $2="unclassified";
  7429. } else {
  7430. $2=packageName;
  7431. };
  7432. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7433. self._setupClass_(newClass);
  7434. $3=$recv($ClassAdded())._new();
  7435. $recv($3)._theClass_(newClass);
  7436. $4=$recv($3)._yourself();
  7437. $recv($recv($SystemAnnouncer())._current())._announce_($4);
  7438. $5=newClass;
  7439. return $5;
  7440. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7441. },
  7442. args: ["aClass", "className", "ivarNames", "packageName"],
  7443. 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",
  7444. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7445. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7446. }),
  7447. $globals.ClassBuilder);
  7448. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7449. $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.";
  7450. $core.addMethod(
  7451. $core.method({
  7452. selector: "getNodesFrom:",
  7453. protocol: 'accessing',
  7454. fn: function (aCollection){
  7455. var self=this;
  7456. var children,others;
  7457. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  7458. return $core.withContext(function($ctx1) {
  7459. var $1;
  7460. children=[];
  7461. others=[];
  7462. $recv(aCollection)._do_((function(each){
  7463. return $core.withContext(function($ctx2) {
  7464. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  7465. if($core.assert($1)){
  7466. return $recv(children)._add_(each);
  7467. $ctx2.sendIdx["add:"]=1;
  7468. } else {
  7469. return $recv(others)._add_(each);
  7470. };
  7471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7472. }));
  7473. self["@nodes"]=$recv(children)._collect_((function(each){
  7474. return $core.withContext(function($ctx2) {
  7475. return $recv($ClassSorterNode())._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  7476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  7477. }));
  7478. return self;
  7479. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  7480. },
  7481. args: ["aCollection"],
  7482. 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 ]",
  7483. referencedClasses: ["ClassSorterNode"],
  7484. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  7485. }),
  7486. $globals.ClassSorterNode);
  7487. $core.addMethod(
  7488. $core.method({
  7489. selector: "level",
  7490. protocol: 'accessing',
  7491. fn: function (){
  7492. var self=this;
  7493. var $1;
  7494. $1=self["@level"];
  7495. return $1;
  7496. },
  7497. args: [],
  7498. source: "level\x0a\x09^ level",
  7499. referencedClasses: [],
  7500. messageSends: []
  7501. }),
  7502. $globals.ClassSorterNode);
  7503. $core.addMethod(
  7504. $core.method({
  7505. selector: "level:",
  7506. protocol: 'accessing',
  7507. fn: function (anInteger){
  7508. var self=this;
  7509. self["@level"]=anInteger;
  7510. return self;
  7511. },
  7512. args: ["anInteger"],
  7513. source: "level: anInteger\x0a\x09level := anInteger",
  7514. referencedClasses: [],
  7515. messageSends: []
  7516. }),
  7517. $globals.ClassSorterNode);
  7518. $core.addMethod(
  7519. $core.method({
  7520. selector: "nodes",
  7521. protocol: 'accessing',
  7522. fn: function (){
  7523. var self=this;
  7524. var $1;
  7525. $1=self["@nodes"];
  7526. return $1;
  7527. },
  7528. args: [],
  7529. source: "nodes\x0a\x09^ nodes",
  7530. referencedClasses: [],
  7531. messageSends: []
  7532. }),
  7533. $globals.ClassSorterNode);
  7534. $core.addMethod(
  7535. $core.method({
  7536. selector: "theClass",
  7537. protocol: 'accessing',
  7538. fn: function (){
  7539. var self=this;
  7540. var $1;
  7541. $1=self["@theClass"];
  7542. return $1;
  7543. },
  7544. args: [],
  7545. source: "theClass\x0a\x09^ theClass",
  7546. referencedClasses: [],
  7547. messageSends: []
  7548. }),
  7549. $globals.ClassSorterNode);
  7550. $core.addMethod(
  7551. $core.method({
  7552. selector: "theClass:",
  7553. protocol: 'accessing',
  7554. fn: function (aClass){
  7555. var self=this;
  7556. self["@theClass"]=aClass;
  7557. return self;
  7558. },
  7559. args: ["aClass"],
  7560. source: "theClass: aClass\x0a\x09theClass := aClass",
  7561. referencedClasses: [],
  7562. messageSends: []
  7563. }),
  7564. $globals.ClassSorterNode);
  7565. $core.addMethod(
  7566. $core.method({
  7567. selector: "traverseClassesWith:",
  7568. protocol: 'visiting',
  7569. fn: function (aCollection){
  7570. var self=this;
  7571. return $core.withContext(function($ctx1) {
  7572. var $1,$3,$2;
  7573. $1=self._theClass();
  7574. $ctx1.sendIdx["theClass"]=1;
  7575. $recv(aCollection)._add_($1);
  7576. $recv($recv(self._nodes())._sorted_((function(a,b){
  7577. return $core.withContext(function($ctx2) {
  7578. $3=$recv(a)._theClass();
  7579. $ctx2.sendIdx["theClass"]=2;
  7580. $2=$recv($3)._name();
  7581. $ctx2.sendIdx["name"]=1;
  7582. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  7583. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  7584. })))._do_((function(aNode){
  7585. return $core.withContext(function($ctx2) {
  7586. return $recv(aNode)._traverseClassesWith_(aCollection);
  7587. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  7588. }));
  7589. return self;
  7590. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  7591. },
  7592. args: ["aCollection"],
  7593. 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 ].",
  7594. referencedClasses: [],
  7595. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  7596. }),
  7597. $globals.ClassSorterNode);
  7598. $core.addMethod(
  7599. $core.method({
  7600. selector: "on:classes:level:",
  7601. protocol: 'instance creation',
  7602. fn: function (aClass,aCollection,anInteger){
  7603. var self=this;
  7604. return $core.withContext(function($ctx1) {
  7605. var $2,$3,$1;
  7606. $2=self._new();
  7607. $recv($2)._theClass_(aClass);
  7608. $recv($2)._level_(anInteger);
  7609. $recv($2)._getNodesFrom_(aCollection);
  7610. $3=$recv($2)._yourself();
  7611. $1=$3;
  7612. return $1;
  7613. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  7614. },
  7615. args: ["aClass", "aCollection", "anInteger"],
  7616. 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",
  7617. referencedClasses: [],
  7618. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  7619. }),
  7620. $globals.ClassSorterNode.klass);
  7621. });
  7622. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7623. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  7624. $core.addPackage('Kernel-Methods');
  7625. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  7626. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7627. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  7628. $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 | ... ] `";
  7629. $core.addMethod(
  7630. $core.method({
  7631. selector: "applyTo:arguments:",
  7632. protocol: 'evaluating',
  7633. fn: function (anObject,aCollection){
  7634. var self=this;
  7635. return $core.withContext(function($ctx1) {
  7636. return self.apply(anObject, aCollection);
  7637. return self;
  7638. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  7639. },
  7640. args: ["anObject", "aCollection"],
  7641. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7642. referencedClasses: [],
  7643. messageSends: []
  7644. }),
  7645. $globals.BlockClosure);
  7646. $core.addMethod(
  7647. $core.method({
  7648. selector: "asCompiledMethod:",
  7649. protocol: 'converting',
  7650. fn: function (aString){
  7651. var self=this;
  7652. return $core.withContext(function($ctx1) {
  7653. return $core.method({selector:aString, fn:self});;
  7654. return self;
  7655. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  7656. },
  7657. args: ["aString"],
  7658. source: "asCompiledMethod: aString\x0a\x09<return $core.method({selector:aString, fn:self});>",
  7659. referencedClasses: [],
  7660. messageSends: []
  7661. }),
  7662. $globals.BlockClosure);
  7663. $core.addMethod(
  7664. $core.method({
  7665. selector: "compiledSource",
  7666. protocol: 'accessing',
  7667. fn: function (){
  7668. var self=this;
  7669. return $core.withContext(function($ctx1) {
  7670. return self.toString();
  7671. return self;
  7672. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  7673. },
  7674. args: [],
  7675. source: "compiledSource\x0a\x09<return self.toString()>",
  7676. referencedClasses: [],
  7677. messageSends: []
  7678. }),
  7679. $globals.BlockClosure);
  7680. $core.addMethod(
  7681. $core.method({
  7682. selector: "currySelf",
  7683. protocol: 'converting',
  7684. fn: function (){
  7685. var self=this;
  7686. return $core.withContext(function($ctx1) {
  7687. return function () {
  7688. var args = [ this ];
  7689. args.push.apply(args, arguments);
  7690. return self.apply(null, args);
  7691. }
  7692. ;
  7693. return self;
  7694. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  7695. },
  7696. args: [],
  7697. 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>",
  7698. referencedClasses: [],
  7699. messageSends: []
  7700. }),
  7701. $globals.BlockClosure);
  7702. $core.addMethod(
  7703. $core.method({
  7704. selector: "ensure:",
  7705. protocol: 'evaluating',
  7706. fn: function (aBlock){
  7707. var self=this;
  7708. return $core.withContext(function($ctx1) {
  7709. try{return self._value()}finally{aBlock._value()};
  7710. return self;
  7711. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  7712. },
  7713. args: ["aBlock"],
  7714. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  7715. referencedClasses: [],
  7716. messageSends: []
  7717. }),
  7718. $globals.BlockClosure);
  7719. $core.addMethod(
  7720. $core.method({
  7721. selector: "fork",
  7722. protocol: 'timeout/interval',
  7723. fn: function (){
  7724. var self=this;
  7725. function $ForkPool(){return $globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  7726. return $core.withContext(function($ctx1) {
  7727. $recv($recv($ForkPool())._default())._fork_(self);
  7728. return self;
  7729. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  7730. },
  7731. args: [],
  7732. source: "fork\x0a\x09ForkPool default fork: self",
  7733. referencedClasses: ["ForkPool"],
  7734. messageSends: ["fork:", "default"]
  7735. }),
  7736. $globals.BlockClosure);
  7737. $core.addMethod(
  7738. $core.method({
  7739. selector: "new",
  7740. protocol: 'evaluating',
  7741. fn: function (){
  7742. var self=this;
  7743. return $core.withContext(function($ctx1) {
  7744. return new self();
  7745. return self;
  7746. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  7747. },
  7748. args: [],
  7749. 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()>",
  7750. referencedClasses: [],
  7751. messageSends: []
  7752. }),
  7753. $globals.BlockClosure);
  7754. $core.addMethod(
  7755. $core.method({
  7756. selector: "newValue:",
  7757. protocol: 'evaluating',
  7758. fn: function (anObject){
  7759. var self=this;
  7760. return $core.withContext(function($ctx1) {
  7761. var $1;
  7762. $1=self._newWithValues_([anObject]);
  7763. return $1;
  7764. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  7765. },
  7766. args: ["anObject"],
  7767. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  7768. referencedClasses: [],
  7769. messageSends: ["newWithValues:"]
  7770. }),
  7771. $globals.BlockClosure);
  7772. $core.addMethod(
  7773. $core.method({
  7774. selector: "newValue:value:",
  7775. protocol: 'evaluating',
  7776. fn: function (anObject,anObject2){
  7777. var self=this;
  7778. return $core.withContext(function($ctx1) {
  7779. var $1;
  7780. $1=self._newWithValues_([anObject,anObject2]);
  7781. return $1;
  7782. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  7783. },
  7784. args: ["anObject", "anObject2"],
  7785. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  7786. referencedClasses: [],
  7787. messageSends: ["newWithValues:"]
  7788. }),
  7789. $globals.BlockClosure);
  7790. $core.addMethod(
  7791. $core.method({
  7792. selector: "newValue:value:value:",
  7793. protocol: 'evaluating',
  7794. fn: function (anObject,anObject2,anObject3){
  7795. var self=this;
  7796. return $core.withContext(function($ctx1) {
  7797. var $1;
  7798. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  7799. return $1;
  7800. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  7801. },
  7802. args: ["anObject", "anObject2", "anObject3"],
  7803. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  7804. referencedClasses: [],
  7805. messageSends: ["newWithValues:"]
  7806. }),
  7807. $globals.BlockClosure);
  7808. $core.addMethod(
  7809. $core.method({
  7810. selector: "newWithValues:",
  7811. protocol: 'evaluating',
  7812. fn: function (aCollection){
  7813. var self=this;
  7814. return $core.withContext(function($ctx1) {
  7815. var object = Object.create(self.prototype);
  7816. var result = self.apply(object, aCollection);
  7817. return typeof result === "object" ? result : object;
  7818. ;
  7819. return self;
  7820. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  7821. },
  7822. args: ["aCollection"],
  7823. 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>",
  7824. referencedClasses: [],
  7825. messageSends: []
  7826. }),
  7827. $globals.BlockClosure);
  7828. $core.addMethod(
  7829. $core.method({
  7830. selector: "numArgs",
  7831. protocol: 'accessing',
  7832. fn: function (){
  7833. var self=this;
  7834. return $core.withContext(function($ctx1) {
  7835. return self.length;
  7836. return self;
  7837. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  7838. },
  7839. args: [],
  7840. source: "numArgs\x0a\x09<return self.length>",
  7841. referencedClasses: [],
  7842. messageSends: []
  7843. }),
  7844. $globals.BlockClosure);
  7845. $core.addMethod(
  7846. $core.method({
  7847. selector: "on:do:",
  7848. protocol: 'error handling',
  7849. fn: function (anErrorClass,aBlock){
  7850. var self=this;
  7851. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7852. return $core.withContext(function($ctx1) {
  7853. var $2,$1;
  7854. $1=self._tryCatch_((function(error){
  7855. var smalltalkError;
  7856. return $core.withContext(function($ctx2) {
  7857. smalltalkError=$recv($Smalltalk())._asSmalltalkException_(error);
  7858. smalltalkError;
  7859. $2=$recv(smalltalkError)._isKindOf_(anErrorClass);
  7860. if($core.assert($2)){
  7861. return $recv(aBlock)._value_(smalltalkError);
  7862. } else {
  7863. return $recv(smalltalkError)._resignal();
  7864. };
  7865. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  7866. }));
  7867. return $1;
  7868. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  7869. },
  7870. args: ["anErrorClass", "aBlock"],
  7871. 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 ] ]",
  7872. referencedClasses: ["Smalltalk"],
  7873. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  7874. }),
  7875. $globals.BlockClosure);
  7876. $core.addMethod(
  7877. $core.method({
  7878. selector: "receiver",
  7879. protocol: 'accessing',
  7880. fn: function (){
  7881. var self=this;
  7882. return nil;
  7883. },
  7884. args: [],
  7885. source: "receiver\x0a\x09^ nil",
  7886. referencedClasses: [],
  7887. messageSends: []
  7888. }),
  7889. $globals.BlockClosure);
  7890. $core.addMethod(
  7891. $core.method({
  7892. selector: "timeToRun",
  7893. protocol: 'evaluating',
  7894. fn: function (){
  7895. var self=this;
  7896. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  7897. return $core.withContext(function($ctx1) {
  7898. var $1;
  7899. $1=$recv($Date())._millisecondsToRun_(self);
  7900. return $1;
  7901. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  7902. },
  7903. args: [],
  7904. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  7905. referencedClasses: ["Date"],
  7906. messageSends: ["millisecondsToRun:"]
  7907. }),
  7908. $globals.BlockClosure);
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "tryCatch:",
  7912. protocol: 'error handling',
  7913. fn: function (aBlock){
  7914. var self=this;
  7915. return $core.withContext(function($ctx1) {
  7916. try {
  7917. return self._value();
  7918. } catch(error) {
  7919. // pass non-local returns undetected
  7920. if (Array.isArray(error) && error.length === 1) throw error;
  7921. return aBlock._value_(error);
  7922. }
  7923. ;
  7924. return self;
  7925. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  7926. },
  7927. args: ["aBlock"],
  7928. 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>",
  7929. referencedClasses: [],
  7930. messageSends: []
  7931. }),
  7932. $globals.BlockClosure);
  7933. $core.addMethod(
  7934. $core.method({
  7935. selector: "value",
  7936. protocol: 'evaluating',
  7937. fn: function (){
  7938. var self=this;
  7939. return $core.withContext(function($ctx1) {
  7940. return self();;
  7941. return self;
  7942. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  7943. },
  7944. args: [],
  7945. source: "value\x0a\x09<return self();>",
  7946. referencedClasses: [],
  7947. messageSends: []
  7948. }),
  7949. $globals.BlockClosure);
  7950. $core.addMethod(
  7951. $core.method({
  7952. selector: "value:",
  7953. protocol: 'evaluating',
  7954. fn: function (anArg){
  7955. var self=this;
  7956. return $core.withContext(function($ctx1) {
  7957. return self(anArg);;
  7958. return self;
  7959. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  7960. },
  7961. args: ["anArg"],
  7962. source: "value: anArg\x0a\x09<return self(anArg);>",
  7963. referencedClasses: [],
  7964. messageSends: []
  7965. }),
  7966. $globals.BlockClosure);
  7967. $core.addMethod(
  7968. $core.method({
  7969. selector: "value:value:",
  7970. protocol: 'evaluating',
  7971. fn: function (firstArg,secondArg){
  7972. var self=this;
  7973. return $core.withContext(function($ctx1) {
  7974. return self(firstArg, secondArg);;
  7975. return self;
  7976. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  7977. },
  7978. args: ["firstArg", "secondArg"],
  7979. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  7980. referencedClasses: [],
  7981. messageSends: []
  7982. }),
  7983. $globals.BlockClosure);
  7984. $core.addMethod(
  7985. $core.method({
  7986. selector: "value:value:value:",
  7987. protocol: 'evaluating',
  7988. fn: function (firstArg,secondArg,thirdArg){
  7989. var self=this;
  7990. return $core.withContext(function($ctx1) {
  7991. return self(firstArg, secondArg, thirdArg);;
  7992. return self;
  7993. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  7994. },
  7995. args: ["firstArg", "secondArg", "thirdArg"],
  7996. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  7997. referencedClasses: [],
  7998. messageSends: []
  7999. }),
  8000. $globals.BlockClosure);
  8001. $core.addMethod(
  8002. $core.method({
  8003. selector: "valueWithInterval:",
  8004. protocol: 'timeout/interval',
  8005. fn: function (aNumber){
  8006. var self=this;
  8007. return $core.withContext(function($ctx1) {
  8008. var interval = setInterval(self, aNumber);
  8009. return $globals.Timeout._on_(interval);
  8010. ;
  8011. return self;
  8012. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  8013. },
  8014. args: ["aNumber"],
  8015. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>",
  8016. referencedClasses: [],
  8017. messageSends: []
  8018. }),
  8019. $globals.BlockClosure);
  8020. $core.addMethod(
  8021. $core.method({
  8022. selector: "valueWithPossibleArguments:",
  8023. protocol: 'evaluating',
  8024. fn: function (aCollection){
  8025. var self=this;
  8026. return $core.withContext(function($ctx1) {
  8027. return self.apply(null, aCollection);;
  8028. return self;
  8029. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  8030. },
  8031. args: ["aCollection"],
  8032. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  8033. referencedClasses: [],
  8034. messageSends: []
  8035. }),
  8036. $globals.BlockClosure);
  8037. $core.addMethod(
  8038. $core.method({
  8039. selector: "valueWithTimeout:",
  8040. protocol: 'timeout/interval',
  8041. fn: function (aNumber){
  8042. var self=this;
  8043. return $core.withContext(function($ctx1) {
  8044. var timeout = setTimeout(self, aNumber);
  8045. return $globals.Timeout._on_(timeout);
  8046. ;
  8047. return self;
  8048. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  8049. },
  8050. args: ["aNumber"],
  8051. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>",
  8052. referencedClasses: [],
  8053. messageSends: []
  8054. }),
  8055. $globals.BlockClosure);
  8056. $core.addMethod(
  8057. $core.method({
  8058. selector: "whileFalse",
  8059. protocol: 'controlling',
  8060. fn: function (){
  8061. var self=this;
  8062. return $core.withContext(function($ctx1) {
  8063. self._whileFalse_((function(){
  8064. }));
  8065. return self;
  8066. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  8067. },
  8068. args: [],
  8069. source: "whileFalse\x0a\x09self whileFalse: []",
  8070. referencedClasses: [],
  8071. messageSends: ["whileFalse:"]
  8072. }),
  8073. $globals.BlockClosure);
  8074. $core.addMethod(
  8075. $core.method({
  8076. selector: "whileFalse:",
  8077. protocol: 'controlling',
  8078. fn: function (aBlock){
  8079. var self=this;
  8080. return $core.withContext(function($ctx1) {
  8081. while(!$core.assert(self._value())) {aBlock._value()};
  8082. return self;
  8083. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  8084. },
  8085. args: ["aBlock"],
  8086. source: "whileFalse: aBlock\x0a\x09<while(!$core.assert(self._value())) {aBlock._value()}>",
  8087. referencedClasses: [],
  8088. messageSends: []
  8089. }),
  8090. $globals.BlockClosure);
  8091. $core.addMethod(
  8092. $core.method({
  8093. selector: "whileTrue",
  8094. protocol: 'controlling',
  8095. fn: function (){
  8096. var self=this;
  8097. return $core.withContext(function($ctx1) {
  8098. self._whileTrue_((function(){
  8099. }));
  8100. return self;
  8101. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  8102. },
  8103. args: [],
  8104. source: "whileTrue\x0a\x09self whileTrue: []",
  8105. referencedClasses: [],
  8106. messageSends: ["whileTrue:"]
  8107. }),
  8108. $globals.BlockClosure);
  8109. $core.addMethod(
  8110. $core.method({
  8111. selector: "whileTrue:",
  8112. protocol: 'controlling',
  8113. fn: function (aBlock){
  8114. var self=this;
  8115. return $core.withContext(function($ctx1) {
  8116. while($core.assert(self._value())) {aBlock._value()};
  8117. return self;
  8118. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  8119. },
  8120. args: ["aBlock"],
  8121. source: "whileTrue: aBlock\x0a\x09<while($core.assert(self._value())) {aBlock._value()}>",
  8122. referencedClasses: [],
  8123. messageSends: []
  8124. }),
  8125. $globals.BlockClosure);
  8126. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  8127. $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";
  8128. $core.addMethod(
  8129. $core.method({
  8130. selector: "arguments",
  8131. protocol: 'accessing',
  8132. fn: function (){
  8133. var self=this;
  8134. return $core.withContext(function($ctx1) {
  8135. return self.args || [];
  8136. return self;
  8137. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  8138. },
  8139. args: [],
  8140. source: "arguments\x0a\x09<return self.args || []>",
  8141. referencedClasses: [],
  8142. messageSends: []
  8143. }),
  8144. $globals.CompiledMethod);
  8145. $core.addMethod(
  8146. $core.method({
  8147. selector: "browse",
  8148. protocol: 'browsing',
  8149. fn: function (){
  8150. var self=this;
  8151. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  8152. return $core.withContext(function($ctx1) {
  8153. $recv($Finder())._findMethod_(self);
  8154. return self;
  8155. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  8156. },
  8157. args: [],
  8158. source: "browse\x0a\x09Finder findMethod: self",
  8159. referencedClasses: ["Finder"],
  8160. messageSends: ["findMethod:"]
  8161. }),
  8162. $globals.CompiledMethod);
  8163. $core.addMethod(
  8164. $core.method({
  8165. selector: "category",
  8166. protocol: 'accessing',
  8167. fn: function (){
  8168. var self=this;
  8169. return $core.withContext(function($ctx1) {
  8170. var $1;
  8171. $1=self._protocol();
  8172. return $1;
  8173. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  8174. },
  8175. args: [],
  8176. source: "category\x0a\x09^ self protocol",
  8177. referencedClasses: [],
  8178. messageSends: ["protocol"]
  8179. }),
  8180. $globals.CompiledMethod);
  8181. $core.addMethod(
  8182. $core.method({
  8183. selector: "defaultProtocol",
  8184. protocol: 'defaults',
  8185. fn: function (){
  8186. var self=this;
  8187. return "as yet unclassified";
  8188. },
  8189. args: [],
  8190. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  8191. referencedClasses: [],
  8192. messageSends: []
  8193. }),
  8194. $globals.CompiledMethod);
  8195. $core.addMethod(
  8196. $core.method({
  8197. selector: "fn",
  8198. protocol: 'accessing',
  8199. fn: function (){
  8200. var self=this;
  8201. return $core.withContext(function($ctx1) {
  8202. var $1;
  8203. $1=self._basicAt_("fn");
  8204. return $1;
  8205. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  8206. },
  8207. args: [],
  8208. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8209. referencedClasses: [],
  8210. messageSends: ["basicAt:"]
  8211. }),
  8212. $globals.CompiledMethod);
  8213. $core.addMethod(
  8214. $core.method({
  8215. selector: "fn:",
  8216. protocol: 'accessing',
  8217. fn: function (aBlock){
  8218. var self=this;
  8219. return $core.withContext(function($ctx1) {
  8220. self._basicAt_put_("fn",aBlock);
  8221. return self;
  8222. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8223. },
  8224. args: ["aBlock"],
  8225. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8226. referencedClasses: [],
  8227. messageSends: ["basicAt:put:"]
  8228. }),
  8229. $globals.CompiledMethod);
  8230. $core.addMethod(
  8231. $core.method({
  8232. selector: "isCompiledMethod",
  8233. protocol: 'testing',
  8234. fn: function (){
  8235. var self=this;
  8236. return true;
  8237. },
  8238. args: [],
  8239. source: "isCompiledMethod\x0a\x09^ true",
  8240. referencedClasses: [],
  8241. messageSends: []
  8242. }),
  8243. $globals.CompiledMethod);
  8244. $core.addMethod(
  8245. $core.method({
  8246. selector: "isOverridden",
  8247. protocol: 'testing',
  8248. fn: function (){
  8249. var self=this;
  8250. var selector;
  8251. return $core.withContext(function($ctx1) {
  8252. var $1;
  8253. var $early={};
  8254. try {
  8255. selector=self._selector();
  8256. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8257. return $core.withContext(function($ctx2) {
  8258. $1=$recv(each)._includesSelector_(selector);
  8259. if($core.assert($1)){
  8260. throw $early=[true];
  8261. };
  8262. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8263. }));
  8264. return false;
  8265. }
  8266. catch(e) {if(e===$early)return e[0]; throw e}
  8267. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8268. },
  8269. args: [],
  8270. 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",
  8271. referencedClasses: [],
  8272. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8273. }),
  8274. $globals.CompiledMethod);
  8275. $core.addMethod(
  8276. $core.method({
  8277. selector: "isOverride",
  8278. protocol: 'testing',
  8279. fn: function (){
  8280. var self=this;
  8281. var superclass;
  8282. return $core.withContext(function($ctx1) {
  8283. var $1,$2,$3,$receiver;
  8284. $1=self._methodClass();
  8285. $ctx1.sendIdx["methodClass"]=1;
  8286. superclass=$recv($1)._superclass();
  8287. $ctx1.sendIdx["superclass"]=1;
  8288. $2=superclass;
  8289. if(($receiver = $2) == null || $receiver.isNil){
  8290. return false;
  8291. } else {
  8292. $2;
  8293. };
  8294. $3=$recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8295. return $3;
  8296. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8297. },
  8298. args: [],
  8299. 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",
  8300. referencedClasses: [],
  8301. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8302. }),
  8303. $globals.CompiledMethod);
  8304. $core.addMethod(
  8305. $core.method({
  8306. selector: "messageSends",
  8307. protocol: 'accessing',
  8308. fn: function (){
  8309. var self=this;
  8310. return $core.withContext(function($ctx1) {
  8311. var $1;
  8312. $1=self._basicAt_("messageSends");
  8313. return $1;
  8314. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8315. },
  8316. args: [],
  8317. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8318. referencedClasses: [],
  8319. messageSends: ["basicAt:"]
  8320. }),
  8321. $globals.CompiledMethod);
  8322. $core.addMethod(
  8323. $core.method({
  8324. selector: "methodClass",
  8325. protocol: 'accessing',
  8326. fn: function (){
  8327. var self=this;
  8328. return $core.withContext(function($ctx1) {
  8329. var $1;
  8330. $1=self._basicAt_("methodClass");
  8331. return $1;
  8332. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8333. },
  8334. args: [],
  8335. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8336. referencedClasses: [],
  8337. messageSends: ["basicAt:"]
  8338. }),
  8339. $globals.CompiledMethod);
  8340. $core.addMethod(
  8341. $core.method({
  8342. selector: "package",
  8343. protocol: 'accessing',
  8344. fn: function (){
  8345. var self=this;
  8346. return $core.withContext(function($ctx1) {
  8347. var $2,$1,$receiver;
  8348. $2=self._methodClass();
  8349. if(($receiver = $2) == null || $receiver.isNil){
  8350. $1=$2;
  8351. } else {
  8352. var class_;
  8353. class_=$receiver;
  8354. $1=$recv(class_)._packageOfProtocol_(self._protocol());
  8355. };
  8356. return $1;
  8357. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8358. },
  8359. args: [],
  8360. 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 ]",
  8361. referencedClasses: [],
  8362. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8363. }),
  8364. $globals.CompiledMethod);
  8365. $core.addMethod(
  8366. $core.method({
  8367. selector: "protocol",
  8368. protocol: 'accessing',
  8369. fn: function (){
  8370. var self=this;
  8371. return $core.withContext(function($ctx1) {
  8372. var $2,$1,$receiver;
  8373. $2=self._basicAt_("protocol");
  8374. if(($receiver = $2) == null || $receiver.isNil){
  8375. $1=self._defaultProtocol();
  8376. } else {
  8377. $1=$2;
  8378. };
  8379. return $1;
  8380. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8381. },
  8382. args: [],
  8383. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8384. referencedClasses: [],
  8385. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8386. }),
  8387. $globals.CompiledMethod);
  8388. $core.addMethod(
  8389. $core.method({
  8390. selector: "protocol:",
  8391. protocol: 'accessing',
  8392. fn: function (aString){
  8393. var self=this;
  8394. var oldProtocol;
  8395. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8396. function $MethodMoved(){return $globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  8397. return $core.withContext(function($ctx1) {
  8398. var $1,$2,$3,$receiver;
  8399. oldProtocol=self._protocol();
  8400. self._basicAt_put_("protocol",aString);
  8401. $1=$recv($MethodMoved())._new();
  8402. $recv($1)._method_(self);
  8403. $recv($1)._oldProtocol_(oldProtocol);
  8404. $2=$recv($1)._yourself();
  8405. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  8406. $3=self._methodClass();
  8407. if(($receiver = $3) == null || $receiver.isNil){
  8408. $3;
  8409. } else {
  8410. var methodClass;
  8411. methodClass=$receiver;
  8412. $recv($recv(methodClass)._organization())._addElement_(aString);
  8413. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8414. };
  8415. return self;
  8416. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8417. },
  8418. args: ["aString"],
  8419. 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 ]",
  8420. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8421. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8422. }),
  8423. $globals.CompiledMethod);
  8424. $core.addMethod(
  8425. $core.method({
  8426. selector: "referencedClasses",
  8427. protocol: 'accessing',
  8428. fn: function (){
  8429. var self=this;
  8430. return $core.withContext(function($ctx1) {
  8431. var $1;
  8432. $1=self._basicAt_("referencedClasses");
  8433. return $1;
  8434. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8435. },
  8436. args: [],
  8437. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8438. referencedClasses: [],
  8439. messageSends: ["basicAt:"]
  8440. }),
  8441. $globals.CompiledMethod);
  8442. $core.addMethod(
  8443. $core.method({
  8444. selector: "selector",
  8445. protocol: 'accessing',
  8446. fn: function (){
  8447. var self=this;
  8448. return $core.withContext(function($ctx1) {
  8449. var $1;
  8450. $1=self._basicAt_("selector");
  8451. return $1;
  8452. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8453. },
  8454. args: [],
  8455. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8456. referencedClasses: [],
  8457. messageSends: ["basicAt:"]
  8458. }),
  8459. $globals.CompiledMethod);
  8460. $core.addMethod(
  8461. $core.method({
  8462. selector: "selector:",
  8463. protocol: 'accessing',
  8464. fn: function (aString){
  8465. var self=this;
  8466. return $core.withContext(function($ctx1) {
  8467. self._basicAt_put_("selector",aString);
  8468. return self;
  8469. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8470. },
  8471. args: ["aString"],
  8472. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8473. referencedClasses: [],
  8474. messageSends: ["basicAt:put:"]
  8475. }),
  8476. $globals.CompiledMethod);
  8477. $core.addMethod(
  8478. $core.method({
  8479. selector: "sendTo:arguments:",
  8480. protocol: 'evaluating',
  8481. fn: function (anObject,aCollection){
  8482. var self=this;
  8483. return $core.withContext(function($ctx1) {
  8484. var $1;
  8485. $1=$recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  8486. return $1;
  8487. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  8488. },
  8489. args: ["anObject", "aCollection"],
  8490. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8491. referencedClasses: [],
  8492. messageSends: ["applyTo:arguments:", "fn"]
  8493. }),
  8494. $globals.CompiledMethod);
  8495. $core.addMethod(
  8496. $core.method({
  8497. selector: "source",
  8498. protocol: 'accessing',
  8499. fn: function (){
  8500. var self=this;
  8501. return $core.withContext(function($ctx1) {
  8502. var $2,$1,$receiver;
  8503. $2=self._basicAt_("source");
  8504. if(($receiver = $2) == null || $receiver.isNil){
  8505. $1="";
  8506. } else {
  8507. $1=$2;
  8508. };
  8509. return $1;
  8510. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  8511. },
  8512. args: [],
  8513. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8514. referencedClasses: [],
  8515. messageSends: ["ifNil:", "basicAt:"]
  8516. }),
  8517. $globals.CompiledMethod);
  8518. $core.addMethod(
  8519. $core.method({
  8520. selector: "source:",
  8521. protocol: 'accessing',
  8522. fn: function (aString){
  8523. var self=this;
  8524. return $core.withContext(function($ctx1) {
  8525. self._basicAt_put_("source",aString);
  8526. return self;
  8527. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  8528. },
  8529. args: ["aString"],
  8530. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8531. referencedClasses: [],
  8532. messageSends: ["basicAt:put:"]
  8533. }),
  8534. $globals.CompiledMethod);
  8535. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8536. $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`";
  8537. $core.addMethod(
  8538. $core.method({
  8539. selector: "addWorker",
  8540. protocol: 'private',
  8541. fn: function (){
  8542. var self=this;
  8543. return $core.withContext(function($ctx1) {
  8544. $recv(self["@worker"])._valueWithTimeout_((0));
  8545. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  8546. return self;
  8547. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  8548. },
  8549. args: [],
  8550. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8551. referencedClasses: [],
  8552. messageSends: ["valueWithTimeout:", "+"]
  8553. }),
  8554. $globals.ForkPool);
  8555. $core.addMethod(
  8556. $core.method({
  8557. selector: "defaultMaxPoolSize",
  8558. protocol: 'defaults',
  8559. fn: function (){
  8560. var self=this;
  8561. return $core.withContext(function($ctx1) {
  8562. var $1;
  8563. $1=$recv(self._class())._defaultMaxPoolSize();
  8564. return $1;
  8565. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  8566. },
  8567. args: [],
  8568. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8569. referencedClasses: [],
  8570. messageSends: ["defaultMaxPoolSize", "class"]
  8571. }),
  8572. $globals.ForkPool);
  8573. $core.addMethod(
  8574. $core.method({
  8575. selector: "fork:",
  8576. protocol: 'actions',
  8577. fn: function (aBlock){
  8578. var self=this;
  8579. return $core.withContext(function($ctx1) {
  8580. var $1;
  8581. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  8582. if($core.assert($1)){
  8583. self._addWorker();
  8584. };
  8585. $recv(self["@queue"])._nextPut_(aBlock);
  8586. return self;
  8587. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  8588. },
  8589. args: ["aBlock"],
  8590. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8591. referencedClasses: [],
  8592. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  8593. }),
  8594. $globals.ForkPool);
  8595. $core.addMethod(
  8596. $core.method({
  8597. selector: "initialize",
  8598. protocol: 'initialization',
  8599. fn: function (){
  8600. var self=this;
  8601. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8602. return $core.withContext(function($ctx1) {
  8603. (
  8604. $ctx1.supercall = true,
  8605. $globals.ForkPool.superclass.fn.prototype._initialize.apply($recv(self), []));
  8606. $ctx1.supercall = false;
  8607. self["@poolSize"]=(0);
  8608. self["@queue"]=$recv($Queue())._new();
  8609. self["@worker"]=self._makeWorker();
  8610. return self;
  8611. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  8612. },
  8613. args: [],
  8614. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8615. referencedClasses: ["Queue"],
  8616. messageSends: ["initialize", "new", "makeWorker"]
  8617. }),
  8618. $globals.ForkPool);
  8619. $core.addMethod(
  8620. $core.method({
  8621. selector: "makeWorker",
  8622. protocol: 'initialization',
  8623. fn: function (){
  8624. var self=this;
  8625. var sentinel;
  8626. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  8627. return $core.withContext(function($ctx1) {
  8628. var $2,$1;
  8629. sentinel=$recv($Object())._new();
  8630. $1=(function(){
  8631. var block;
  8632. return $core.withContext(function($ctx2) {
  8633. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  8634. self["@poolSize"];
  8635. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  8636. return sentinel;
  8637. }));
  8638. block;
  8639. $2=$recv(block).__eq_eq(sentinel);
  8640. if(!$core.assert($2)){
  8641. return $recv((function(){
  8642. return $core.withContext(function($ctx3) {
  8643. return $recv(block)._value();
  8644. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  8645. }))._ensure_((function(){
  8646. return $core.withContext(function($ctx3) {
  8647. return self._addWorker();
  8648. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  8649. }));
  8650. };
  8651. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  8652. });
  8653. return $1;
  8654. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  8655. },
  8656. args: [],
  8657. 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 ] ]]",
  8658. referencedClasses: ["Object"],
  8659. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  8660. }),
  8661. $globals.ForkPool);
  8662. $core.addMethod(
  8663. $core.method({
  8664. selector: "maxPoolSize",
  8665. protocol: 'accessing',
  8666. fn: function (){
  8667. var self=this;
  8668. return $core.withContext(function($ctx1) {
  8669. var $2,$1,$receiver;
  8670. $2=self["@maxPoolSize"];
  8671. if(($receiver = $2) == null || $receiver.isNil){
  8672. $1=self._defaultMaxPoolSize();
  8673. } else {
  8674. $1=$2;
  8675. };
  8676. return $1;
  8677. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  8678. },
  8679. args: [],
  8680. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8681. referencedClasses: [],
  8682. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  8683. }),
  8684. $globals.ForkPool);
  8685. $core.addMethod(
  8686. $core.method({
  8687. selector: "maxPoolSize:",
  8688. protocol: 'accessing',
  8689. fn: function (anInteger){
  8690. var self=this;
  8691. self["@maxPoolSize"]=anInteger;
  8692. return self;
  8693. },
  8694. args: ["anInteger"],
  8695. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8696. referencedClasses: [],
  8697. messageSends: []
  8698. }),
  8699. $globals.ForkPool);
  8700. $globals.ForkPool.klass.iVarNames = ['default'];
  8701. $core.addMethod(
  8702. $core.method({
  8703. selector: "default",
  8704. protocol: 'accessing',
  8705. fn: function (){
  8706. var self=this;
  8707. return $core.withContext(function($ctx1) {
  8708. var $2,$1,$receiver;
  8709. $2=self["@default"];
  8710. if(($receiver = $2) == null || $receiver.isNil){
  8711. self["@default"]=self._new();
  8712. $1=self["@default"];
  8713. } else {
  8714. $1=$2;
  8715. };
  8716. return $1;
  8717. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  8718. },
  8719. args: [],
  8720. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  8721. referencedClasses: [],
  8722. messageSends: ["ifNil:", "new"]
  8723. }),
  8724. $globals.ForkPool.klass);
  8725. $core.addMethod(
  8726. $core.method({
  8727. selector: "defaultMaxPoolSize",
  8728. protocol: 'accessing',
  8729. fn: function (){
  8730. var self=this;
  8731. return (100);
  8732. },
  8733. args: [],
  8734. source: "defaultMaxPoolSize\x0a\x09^ 100",
  8735. referencedClasses: [],
  8736. messageSends: []
  8737. }),
  8738. $globals.ForkPool.klass);
  8739. $core.addMethod(
  8740. $core.method({
  8741. selector: "resetDefault",
  8742. protocol: 'accessing',
  8743. fn: function (){
  8744. var self=this;
  8745. self["@default"]=nil;
  8746. return self;
  8747. },
  8748. args: [],
  8749. source: "resetDefault\x0a\x09default := nil",
  8750. referencedClasses: [],
  8751. messageSends: []
  8752. }),
  8753. $globals.ForkPool.klass);
  8754. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  8755. $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.";
  8756. $core.addMethod(
  8757. $core.method({
  8758. selector: "arguments",
  8759. protocol: 'accessing',
  8760. fn: function (){
  8761. var self=this;
  8762. var $1;
  8763. $1=self["@arguments"];
  8764. return $1;
  8765. },
  8766. args: [],
  8767. source: "arguments\x0a\x09^ arguments",
  8768. referencedClasses: [],
  8769. messageSends: []
  8770. }),
  8771. $globals.Message);
  8772. $core.addMethod(
  8773. $core.method({
  8774. selector: "arguments:",
  8775. protocol: 'accessing',
  8776. fn: function (anArray){
  8777. var self=this;
  8778. self["@arguments"]=anArray;
  8779. return self;
  8780. },
  8781. args: ["anArray"],
  8782. source: "arguments: anArray\x0a\x09arguments := anArray",
  8783. referencedClasses: [],
  8784. messageSends: []
  8785. }),
  8786. $globals.Message);
  8787. $core.addMethod(
  8788. $core.method({
  8789. selector: "printOn:",
  8790. protocol: 'printing',
  8791. fn: function (aStream){
  8792. var self=this;
  8793. return $core.withContext(function($ctx1) {
  8794. var $1;
  8795. (
  8796. $ctx1.supercall = true,
  8797. $globals.Message.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  8798. $ctx1.supercall = false;
  8799. $recv(aStream)._nextPutAll_("(");
  8800. $ctx1.sendIdx["nextPutAll:"]=1;
  8801. $recv(aStream)._nextPutAll_(self._selector());
  8802. $ctx1.sendIdx["nextPutAll:"]=2;
  8803. $1=$recv(aStream)._nextPutAll_(")");
  8804. return self;
  8805. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  8806. },
  8807. args: ["aStream"],
  8808. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8809. referencedClasses: [],
  8810. messageSends: ["printOn:", "nextPutAll:", "selector"]
  8811. }),
  8812. $globals.Message);
  8813. $core.addMethod(
  8814. $core.method({
  8815. selector: "selector",
  8816. protocol: 'accessing',
  8817. fn: function (){
  8818. var self=this;
  8819. var $1;
  8820. $1=self["@selector"];
  8821. return $1;
  8822. },
  8823. args: [],
  8824. source: "selector\x0a\x09^ selector",
  8825. referencedClasses: [],
  8826. messageSends: []
  8827. }),
  8828. $globals.Message);
  8829. $core.addMethod(
  8830. $core.method({
  8831. selector: "selector:",
  8832. protocol: 'accessing',
  8833. fn: function (aString){
  8834. var self=this;
  8835. self["@selector"]=aString;
  8836. return self;
  8837. },
  8838. args: ["aString"],
  8839. source: "selector: aString\x0a\x09selector := aString",
  8840. referencedClasses: [],
  8841. messageSends: []
  8842. }),
  8843. $globals.Message);
  8844. $core.addMethod(
  8845. $core.method({
  8846. selector: "sendTo:",
  8847. protocol: 'actions',
  8848. fn: function (anObject){
  8849. var self=this;
  8850. return $core.withContext(function($ctx1) {
  8851. var $1;
  8852. $1=$recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  8853. return $1;
  8854. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  8855. },
  8856. args: ["anObject"],
  8857. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  8858. referencedClasses: [],
  8859. messageSends: ["perform:withArguments:", "selector", "arguments"]
  8860. }),
  8861. $globals.Message);
  8862. $core.addMethod(
  8863. $core.method({
  8864. selector: "selector:arguments:",
  8865. protocol: 'instance creation',
  8866. fn: function (aString,anArray){
  8867. var self=this;
  8868. return $core.withContext(function($ctx1) {
  8869. var $2,$3,$1;
  8870. $2=self._new();
  8871. $recv($2)._selector_(aString);
  8872. $recv($2)._arguments_(anArray);
  8873. $3=$recv($2)._yourself();
  8874. $1=$3;
  8875. return $1;
  8876. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  8877. },
  8878. args: ["aString", "anArray"],
  8879. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  8880. referencedClasses: [],
  8881. messageSends: ["selector:", "new", "arguments:", "yourself"]
  8882. }),
  8883. $globals.Message.klass);
  8884. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  8885. $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.";
  8886. $core.addMethod(
  8887. $core.method({
  8888. selector: "arguments",
  8889. protocol: 'accessing',
  8890. fn: function (){
  8891. var self=this;
  8892. return $core.withContext(function($ctx1) {
  8893. var $1;
  8894. $1=$recv(self["@message"])._arguments();
  8895. return $1;
  8896. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  8897. },
  8898. args: [],
  8899. source: "arguments\x0a\x09^ message arguments",
  8900. referencedClasses: [],
  8901. messageSends: ["arguments"]
  8902. }),
  8903. $globals.MessageSend);
  8904. $core.addMethod(
  8905. $core.method({
  8906. selector: "arguments:",
  8907. protocol: 'accessing',
  8908. fn: function (aCollection){
  8909. var self=this;
  8910. return $core.withContext(function($ctx1) {
  8911. $recv(self["@message"])._arguments_(aCollection);
  8912. return self;
  8913. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  8914. },
  8915. args: ["aCollection"],
  8916. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  8917. referencedClasses: [],
  8918. messageSends: ["arguments:"]
  8919. }),
  8920. $globals.MessageSend);
  8921. $core.addMethod(
  8922. $core.method({
  8923. selector: "initialize",
  8924. protocol: 'initialization',
  8925. fn: function (){
  8926. var self=this;
  8927. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  8928. return $core.withContext(function($ctx1) {
  8929. (
  8930. $ctx1.supercall = true,
  8931. $globals.MessageSend.superclass.fn.prototype._initialize.apply($recv(self), []));
  8932. $ctx1.supercall = false;
  8933. self["@message"]=$recv($Message())._new();
  8934. return self;
  8935. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  8936. },
  8937. args: [],
  8938. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  8939. referencedClasses: ["Message"],
  8940. messageSends: ["initialize", "new"]
  8941. }),
  8942. $globals.MessageSend);
  8943. $core.addMethod(
  8944. $core.method({
  8945. selector: "printOn:",
  8946. protocol: 'printing',
  8947. fn: function (aStream){
  8948. var self=this;
  8949. return $core.withContext(function($ctx1) {
  8950. var $1;
  8951. (
  8952. $ctx1.supercall = true,
  8953. $globals.MessageSend.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  8954. $ctx1.supercall = false;
  8955. $recv(aStream)._nextPutAll_("(");
  8956. $ctx1.sendIdx["nextPutAll:"]=1;
  8957. $recv(aStream)._nextPutAll_(self._receiver());
  8958. $ctx1.sendIdx["nextPutAll:"]=2;
  8959. $recv(aStream)._nextPutAll_(" >> ");
  8960. $ctx1.sendIdx["nextPutAll:"]=3;
  8961. $recv(aStream)._nextPutAll_(self._selector());
  8962. $ctx1.sendIdx["nextPutAll:"]=4;
  8963. $1=$recv(aStream)._nextPutAll_(")");
  8964. return self;
  8965. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  8966. },
  8967. args: ["aStream"],
  8968. 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: ')'",
  8969. referencedClasses: [],
  8970. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  8971. }),
  8972. $globals.MessageSend);
  8973. $core.addMethod(
  8974. $core.method({
  8975. selector: "receiver",
  8976. protocol: 'accessing',
  8977. fn: function (){
  8978. var self=this;
  8979. var $1;
  8980. $1=self["@receiver"];
  8981. return $1;
  8982. },
  8983. args: [],
  8984. source: "receiver\x0a\x09^ receiver",
  8985. referencedClasses: [],
  8986. messageSends: []
  8987. }),
  8988. $globals.MessageSend);
  8989. $core.addMethod(
  8990. $core.method({
  8991. selector: "receiver:",
  8992. protocol: 'accessing',
  8993. fn: function (anObject){
  8994. var self=this;
  8995. self["@receiver"]=anObject;
  8996. return self;
  8997. },
  8998. args: ["anObject"],
  8999. source: "receiver: anObject\x0a\x09receiver := anObject",
  9000. referencedClasses: [],
  9001. messageSends: []
  9002. }),
  9003. $globals.MessageSend);
  9004. $core.addMethod(
  9005. $core.method({
  9006. selector: "selector",
  9007. protocol: 'accessing',
  9008. fn: function (){
  9009. var self=this;
  9010. return $core.withContext(function($ctx1) {
  9011. var $1;
  9012. $1=$recv(self["@message"])._selector();
  9013. return $1;
  9014. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  9015. },
  9016. args: [],
  9017. source: "selector\x0a\x09^ message selector",
  9018. referencedClasses: [],
  9019. messageSends: ["selector"]
  9020. }),
  9021. $globals.MessageSend);
  9022. $core.addMethod(
  9023. $core.method({
  9024. selector: "selector:",
  9025. protocol: 'accessing',
  9026. fn: function (aString){
  9027. var self=this;
  9028. return $core.withContext(function($ctx1) {
  9029. $recv(self["@message"])._selector_(aString);
  9030. return self;
  9031. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  9032. },
  9033. args: ["aString"],
  9034. source: "selector: aString\x0a\x09message selector: aString",
  9035. referencedClasses: [],
  9036. messageSends: ["selector:"]
  9037. }),
  9038. $globals.MessageSend);
  9039. $core.addMethod(
  9040. $core.method({
  9041. selector: "value",
  9042. protocol: 'evaluating',
  9043. fn: function (){
  9044. var self=this;
  9045. return $core.withContext(function($ctx1) {
  9046. var $1;
  9047. $1=$recv(self["@message"])._sendTo_(self._receiver());
  9048. return $1;
  9049. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  9050. },
  9051. args: [],
  9052. source: "value\x0a\x09^ message sendTo: self receiver",
  9053. referencedClasses: [],
  9054. messageSends: ["sendTo:", "receiver"]
  9055. }),
  9056. $globals.MessageSend);
  9057. $core.addMethod(
  9058. $core.method({
  9059. selector: "value:",
  9060. protocol: 'evaluating',
  9061. fn: function (anObject){
  9062. var self=this;
  9063. return $core.withContext(function($ctx1) {
  9064. var $2,$3,$1;
  9065. $2=self["@message"];
  9066. $recv($2)._arguments_([anObject]);
  9067. $3=$recv($2)._sendTo_(self._receiver());
  9068. $1=$3;
  9069. return $1;
  9070. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  9071. },
  9072. args: ["anObject"],
  9073. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9074. referencedClasses: [],
  9075. messageSends: ["arguments:", "sendTo:", "receiver"]
  9076. }),
  9077. $globals.MessageSend);
  9078. $core.addMethod(
  9079. $core.method({
  9080. selector: "value:value:",
  9081. protocol: 'evaluating',
  9082. fn: function (firstArgument,secondArgument){
  9083. var self=this;
  9084. return $core.withContext(function($ctx1) {
  9085. var $2,$3,$1;
  9086. $2=self["@message"];
  9087. $recv($2)._arguments_([firstArgument,secondArgument]);
  9088. $3=$recv($2)._sendTo_(self._receiver());
  9089. $1=$3;
  9090. return $1;
  9091. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  9092. },
  9093. args: ["firstArgument", "secondArgument"],
  9094. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9095. referencedClasses: [],
  9096. messageSends: ["arguments:", "sendTo:", "receiver"]
  9097. }),
  9098. $globals.MessageSend);
  9099. $core.addMethod(
  9100. $core.method({
  9101. selector: "value:value:value:",
  9102. protocol: 'evaluating',
  9103. fn: function (firstArgument,secondArgument,thirdArgument){
  9104. var self=this;
  9105. return $core.withContext(function($ctx1) {
  9106. var $2,$3,$1;
  9107. $2=self["@message"];
  9108. $recv($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9109. $3=$recv($2)._sendTo_(self._receiver());
  9110. $1=$3;
  9111. return $1;
  9112. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  9113. },
  9114. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9115. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9116. referencedClasses: [],
  9117. messageSends: ["arguments:", "sendTo:", "receiver"]
  9118. }),
  9119. $globals.MessageSend);
  9120. $core.addMethod(
  9121. $core.method({
  9122. selector: "valueWithPossibleArguments:",
  9123. protocol: 'evaluating',
  9124. fn: function (aCollection){
  9125. var self=this;
  9126. return $core.withContext(function($ctx1) {
  9127. var $1;
  9128. self._arguments_(aCollection);
  9129. $1=self._value();
  9130. return $1;
  9131. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  9132. },
  9133. args: ["aCollection"],
  9134. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9135. referencedClasses: [],
  9136. messageSends: ["arguments:", "value"]
  9137. }),
  9138. $globals.MessageSend);
  9139. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  9140. $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`.";
  9141. $core.addMethod(
  9142. $core.method({
  9143. selector: "asString",
  9144. protocol: 'converting',
  9145. fn: function (){
  9146. var self=this;
  9147. return $core.withContext(function($ctx1) {
  9148. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  9149. $2=self._isBlockContext();
  9150. if($core.assert($2)){
  9151. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  9152. $ctx1.sendIdx[","]=2;
  9153. $1=$recv($3).__comma(")");
  9154. $ctx1.sendIdx[","]=1;
  9155. } else {
  9156. var methodClass;
  9157. methodClass=$recv(self._method())._methodClass();
  9158. methodClass;
  9159. $5=methodClass;
  9160. $7=self._receiver();
  9161. $ctx1.sendIdx["receiver"]=1;
  9162. $6=$recv($7)._class();
  9163. $ctx1.sendIdx["class"]=1;
  9164. $4=$recv($5).__eq($6);
  9165. if($core.assert($4)){
  9166. $11=self._receiver();
  9167. $ctx1.sendIdx["receiver"]=2;
  9168. $10=$recv($11)._class();
  9169. $ctx1.sendIdx["class"]=2;
  9170. $9=$recv($10)._name();
  9171. $ctx1.sendIdx["name"]=1;
  9172. $8=$recv($9).__comma(" >> ");
  9173. $ctx1.sendIdx[","]=4;
  9174. $12=self._selector();
  9175. $ctx1.sendIdx["selector"]=1;
  9176. $1=$recv($8).__comma($12);
  9177. $ctx1.sendIdx[","]=3;
  9178. } else {
  9179. $16=$recv($recv(self._receiver())._class())._name();
  9180. $ctx1.sendIdx["name"]=2;
  9181. $15=$recv($16).__comma("(");
  9182. $14=$recv($15).__comma($recv(methodClass)._name());
  9183. $ctx1.sendIdx[","]=7;
  9184. $13=$recv($14).__comma(") >> ");
  9185. $ctx1.sendIdx[","]=6;
  9186. $1=$recv($13).__comma(self._selector());
  9187. $ctx1.sendIdx[","]=5;
  9188. };
  9189. };
  9190. return $1;
  9191. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  9192. },
  9193. args: [],
  9194. 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 ] ]",
  9195. referencedClasses: [],
  9196. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  9197. }),
  9198. $globals.MethodContext);
  9199. $core.addMethod(
  9200. $core.method({
  9201. selector: "basicReceiver",
  9202. protocol: 'accessing',
  9203. fn: function (){
  9204. var self=this;
  9205. return $core.withContext(function($ctx1) {
  9206. return self.receiver;
  9207. return self;
  9208. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  9209. },
  9210. args: [],
  9211. source: "basicReceiver\x0a\x09<return self.receiver>",
  9212. referencedClasses: [],
  9213. messageSends: []
  9214. }),
  9215. $globals.MethodContext);
  9216. $core.addMethod(
  9217. $core.method({
  9218. selector: "evaluatedSelector",
  9219. protocol: 'accessing',
  9220. fn: function (){
  9221. var self=this;
  9222. return $core.withContext(function($ctx1) {
  9223. return self.evaluatedSelector;
  9224. return self;
  9225. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  9226. },
  9227. args: [],
  9228. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  9229. referencedClasses: [],
  9230. messageSends: []
  9231. }),
  9232. $globals.MethodContext);
  9233. $core.addMethod(
  9234. $core.method({
  9235. selector: "findContextSuchThat:",
  9236. protocol: 'accessing',
  9237. fn: function (testBlock){
  9238. var self=this;
  9239. var context;
  9240. return $core.withContext(function($ctx1) {
  9241. var $1,$2;
  9242. var $early={};
  9243. try {
  9244. context=self;
  9245. $recv((function(){
  9246. return $core.withContext(function($ctx2) {
  9247. return $recv(context)._isNil();
  9248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9249. }))._whileFalse_((function(){
  9250. return $core.withContext(function($ctx2) {
  9251. $1=$recv(testBlock)._value_(context);
  9252. if($core.assert($1)){
  9253. $2=context;
  9254. throw $early=[$2];
  9255. };
  9256. context=$recv(context)._outerContext();
  9257. return context;
  9258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9259. }));
  9260. return nil;
  9261. }
  9262. catch(e) {if(e===$early)return e[0]; throw e}
  9263. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9264. },
  9265. args: ["testBlock"],
  9266. 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",
  9267. referencedClasses: [],
  9268. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9269. }),
  9270. $globals.MethodContext);
  9271. $core.addMethod(
  9272. $core.method({
  9273. selector: "home",
  9274. protocol: 'accessing',
  9275. fn: function (){
  9276. var self=this;
  9277. return $core.withContext(function($ctx1) {
  9278. return self.homeContext;
  9279. return self;
  9280. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9281. },
  9282. args: [],
  9283. source: "home\x0a\x09<return self.homeContext>",
  9284. referencedClasses: [],
  9285. messageSends: []
  9286. }),
  9287. $globals.MethodContext);
  9288. $core.addMethod(
  9289. $core.method({
  9290. selector: "index",
  9291. protocol: 'accessing',
  9292. fn: function (){
  9293. var self=this;
  9294. return $core.withContext(function($ctx1) {
  9295. return self.index || 0;
  9296. return self;
  9297. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9298. },
  9299. args: [],
  9300. source: "index\x0a\x09<return self.index || 0>",
  9301. referencedClasses: [],
  9302. messageSends: []
  9303. }),
  9304. $globals.MethodContext);
  9305. $core.addMethod(
  9306. $core.method({
  9307. selector: "isBlockContext",
  9308. protocol: 'testing',
  9309. fn: function (){
  9310. var self=this;
  9311. return $core.withContext(function($ctx1) {
  9312. var $1;
  9313. $1=$recv(self._selector())._isNil();
  9314. return $1;
  9315. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9316. },
  9317. args: [],
  9318. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9319. referencedClasses: [],
  9320. messageSends: ["isNil", "selector"]
  9321. }),
  9322. $globals.MethodContext);
  9323. $core.addMethod(
  9324. $core.method({
  9325. selector: "locals",
  9326. protocol: 'accessing',
  9327. fn: function (){
  9328. var self=this;
  9329. return $core.withContext(function($ctx1) {
  9330. return self.locals || {};
  9331. return self;
  9332. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9333. },
  9334. args: [],
  9335. source: "locals\x0a\x09<return self.locals || {}>",
  9336. referencedClasses: [],
  9337. messageSends: []
  9338. }),
  9339. $globals.MethodContext);
  9340. $core.addMethod(
  9341. $core.method({
  9342. selector: "method",
  9343. protocol: 'accessing',
  9344. fn: function (){
  9345. var self=this;
  9346. var method,lookupClass,receiverClass,supercall;
  9347. return $core.withContext(function($ctx1) {
  9348. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$receiver;
  9349. $1=self._methodContext();
  9350. $ctx1.sendIdx["methodContext"]=1;
  9351. if(($receiver = $1) == null || $receiver.isNil){
  9352. return nil;
  9353. } else {
  9354. $1;
  9355. };
  9356. $3=self._methodContext();
  9357. $ctx1.sendIdx["methodContext"]=2;
  9358. $2=$recv($3)._receiver();
  9359. receiverClass=$recv($2)._class();
  9360. $4=receiverClass;
  9361. $6=self._methodContext();
  9362. $ctx1.sendIdx["methodContext"]=3;
  9363. $5=$recv($6)._selector();
  9364. $ctx1.sendIdx["selector"]=1;
  9365. method=$recv($4)._lookupSelector_($5);
  9366. $ctx1.sendIdx["lookupSelector:"]=1;
  9367. $7=self._outerContext();
  9368. if(($receiver = $7) == null || $receiver.isNil){
  9369. supercall=false;
  9370. } else {
  9371. var outer;
  9372. outer=$receiver;
  9373. supercall=$recv(outer)._supercall();
  9374. };
  9375. $9=supercall;
  9376. if($core.assert($9)){
  9377. $8=$recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9378. } else {
  9379. $8=method;
  9380. };
  9381. return $8;
  9382. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9383. },
  9384. args: [],
  9385. 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 ]",
  9386. referencedClasses: [],
  9387. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9388. }),
  9389. $globals.MethodContext);
  9390. $core.addMethod(
  9391. $core.method({
  9392. selector: "methodContext",
  9393. protocol: 'accessing',
  9394. fn: function (){
  9395. var self=this;
  9396. return $core.withContext(function($ctx1) {
  9397. var $1,$3,$2,$receiver;
  9398. $1=self._isBlockContext();
  9399. if(!$core.assert($1)){
  9400. return self;
  9401. };
  9402. $3=self._outerContext();
  9403. if(($receiver = $3) == null || $receiver.isNil){
  9404. $2=$3;
  9405. } else {
  9406. var outer;
  9407. outer=$receiver;
  9408. $2=$recv(outer)._methodContext();
  9409. };
  9410. return $2;
  9411. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9412. },
  9413. args: [],
  9414. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9415. referencedClasses: [],
  9416. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9417. }),
  9418. $globals.MethodContext);
  9419. $core.addMethod(
  9420. $core.method({
  9421. selector: "outerContext",
  9422. protocol: 'accessing',
  9423. fn: function (){
  9424. var self=this;
  9425. return $core.withContext(function($ctx1) {
  9426. return self.outerContext || self.homeContext;
  9427. return self;
  9428. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9429. },
  9430. args: [],
  9431. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9432. referencedClasses: [],
  9433. messageSends: []
  9434. }),
  9435. $globals.MethodContext);
  9436. $core.addMethod(
  9437. $core.method({
  9438. selector: "printOn:",
  9439. protocol: 'printing',
  9440. fn: function (aStream){
  9441. var self=this;
  9442. return $core.withContext(function($ctx1) {
  9443. var $1;
  9444. (
  9445. $ctx1.supercall = true,
  9446. $globals.MethodContext.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  9447. $ctx1.supercall = false;
  9448. $recv(aStream)._nextPutAll_("(");
  9449. $ctx1.sendIdx["nextPutAll:"]=1;
  9450. $recv(aStream)._nextPutAll_(self._asString());
  9451. $ctx1.sendIdx["nextPutAll:"]=2;
  9452. $1=$recv(aStream)._nextPutAll_(")");
  9453. return self;
  9454. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9455. },
  9456. args: ["aStream"],
  9457. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9458. referencedClasses: [],
  9459. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9460. }),
  9461. $globals.MethodContext);
  9462. $core.addMethod(
  9463. $core.method({
  9464. selector: "receiver",
  9465. protocol: 'accessing',
  9466. fn: function (){
  9467. var self=this;
  9468. return $core.withContext(function($ctx1) {
  9469. var $3,$2,$1;
  9470. $2=$recv(self._isBlockContext())._and_((function(){
  9471. return $core.withContext(function($ctx2) {
  9472. $3=self._outerContext();
  9473. $ctx2.sendIdx["outerContext"]=1;
  9474. return $recv($3)._notNil();
  9475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9476. }));
  9477. if($core.assert($2)){
  9478. $1=$recv(self._outerContext())._receiver();
  9479. } else {
  9480. $1=self._basicReceiver();
  9481. };
  9482. return $1;
  9483. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9484. },
  9485. args: [],
  9486. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9487. referencedClasses: [],
  9488. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9489. }),
  9490. $globals.MethodContext);
  9491. $core.addMethod(
  9492. $core.method({
  9493. selector: "selector",
  9494. protocol: 'accessing',
  9495. fn: function (){
  9496. var self=this;
  9497. return $core.withContext(function($ctx1) {
  9498. if(self.selector) {
  9499. return $core.js2st(self.selector);
  9500. } else {
  9501. return nil;
  9502. }
  9503. ;
  9504. return self;
  9505. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9506. },
  9507. args: [],
  9508. 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>",
  9509. referencedClasses: [],
  9510. messageSends: []
  9511. }),
  9512. $globals.MethodContext);
  9513. $core.addMethod(
  9514. $core.method({
  9515. selector: "sendIndexAt:",
  9516. protocol: 'accessing',
  9517. fn: function (aSelector){
  9518. var self=this;
  9519. return $core.withContext(function($ctx1) {
  9520. return self.sendIdx[aSelector] || 0;
  9521. return self;
  9522. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9523. },
  9524. args: ["aSelector"],
  9525. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  9526. referencedClasses: [],
  9527. messageSends: []
  9528. }),
  9529. $globals.MethodContext);
  9530. $core.addMethod(
  9531. $core.method({
  9532. selector: "sendIndexes",
  9533. protocol: 'accessing',
  9534. fn: function (){
  9535. var self=this;
  9536. return $core.withContext(function($ctx1) {
  9537. return self.sendIdx;
  9538. return self;
  9539. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  9540. },
  9541. args: [],
  9542. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  9543. referencedClasses: [],
  9544. messageSends: []
  9545. }),
  9546. $globals.MethodContext);
  9547. $core.addMethod(
  9548. $core.method({
  9549. selector: "supercall",
  9550. protocol: 'accessing',
  9551. fn: function (){
  9552. var self=this;
  9553. return $core.withContext(function($ctx1) {
  9554. return self.supercall == true;
  9555. return self;
  9556. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  9557. },
  9558. args: [],
  9559. source: "supercall\x0a\x09<return self.supercall == true>",
  9560. referencedClasses: [],
  9561. messageSends: []
  9562. }),
  9563. $globals.MethodContext);
  9564. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  9565. $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' ]";
  9566. $core.addMethod(
  9567. $core.method({
  9568. selector: "constructor:",
  9569. protocol: 'instance creation',
  9570. fn: function (aString){
  9571. var self=this;
  9572. return $core.withContext(function($ctx1) {
  9573. self._deprecatedAPI_("Use constructorNamed:");
  9574. var nativeFunc=eval(aString);
  9575. return new nativeFunc();
  9576. ;
  9577. return self;
  9578. }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},$globals.NativeFunction.klass)});
  9579. },
  9580. args: ["aString"],
  9581. 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>",
  9582. referencedClasses: [],
  9583. messageSends: []
  9584. }),
  9585. $globals.NativeFunction.klass);
  9586. $core.addMethod(
  9587. $core.method({
  9588. selector: "constructor:value:",
  9589. protocol: 'instance creation',
  9590. fn: function (aString,anObject){
  9591. var self=this;
  9592. return $core.withContext(function($ctx1) {
  9593. self._deprecatedAPI_("Use constructorNamed:value:");
  9594. var nativeFunc=eval(aString);
  9595. return new nativeFunc(anObject);
  9596. ;
  9597. return self;
  9598. }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9599. },
  9600. args: ["aString", "anObject"],
  9601. 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>",
  9602. referencedClasses: [],
  9603. messageSends: []
  9604. }),
  9605. $globals.NativeFunction.klass);
  9606. $core.addMethod(
  9607. $core.method({
  9608. selector: "constructor:value:value:",
  9609. protocol: 'instance creation',
  9610. fn: function (aString,anObject,anObject2){
  9611. var self=this;
  9612. return $core.withContext(function($ctx1) {
  9613. self._deprecatedAPI_("Use constructorNamed:value:value:");
  9614. var nativeFunc=eval(aString);
  9615. return new nativeFunc(anObject,anObject2);
  9616. ;
  9617. return self;
  9618. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9619. },
  9620. args: ["aString", "anObject", "anObject2"],
  9621. 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>",
  9622. referencedClasses: [],
  9623. messageSends: []
  9624. }),
  9625. $globals.NativeFunction.klass);
  9626. $core.addMethod(
  9627. $core.method({
  9628. selector: "constructor:value:value:value:",
  9629. protocol: 'instance creation',
  9630. fn: function (aString,anObject,anObject2,anObject3){
  9631. var self=this;
  9632. return $core.withContext(function($ctx1) {
  9633. self._deprecatedAPI_("Use constructorNamed:value:value:value");
  9634. var nativeFunc=eval(aString);
  9635. return new nativeFunc(anObject,anObject2, anObject3);
  9636. ;
  9637. return self;
  9638. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9639. },
  9640. args: ["aString", "anObject", "anObject2", "anObject3"],
  9641. 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>",
  9642. referencedClasses: [],
  9643. messageSends: []
  9644. }),
  9645. $globals.NativeFunction.klass);
  9646. $core.addMethod(
  9647. $core.method({
  9648. selector: "constructorNamed:",
  9649. protocol: 'instance creation',
  9650. fn: function (aString){
  9651. var self=this;
  9652. return $core.withContext(function($ctx1) {
  9653. var nativeFunc=(new Function('return this'))()[aString];
  9654. return new nativeFunc();
  9655. ;
  9656. return self;
  9657. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9658. },
  9659. args: ["aString"],
  9660. source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9661. referencedClasses: [],
  9662. messageSends: []
  9663. }),
  9664. $globals.NativeFunction.klass);
  9665. $core.addMethod(
  9666. $core.method({
  9667. selector: "constructorNamed:value:",
  9668. protocol: 'instance creation',
  9669. fn: function (aString,anObject){
  9670. var self=this;
  9671. return $core.withContext(function($ctx1) {
  9672. var nativeFunc=(new Function('return this'))()[aString];
  9673. return new nativeFunc(anObject);
  9674. ;
  9675. return self;
  9676. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9677. },
  9678. args: ["aString", "anObject"],
  9679. source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9680. referencedClasses: [],
  9681. messageSends: []
  9682. }),
  9683. $globals.NativeFunction.klass);
  9684. $core.addMethod(
  9685. $core.method({
  9686. selector: "constructorNamed:value:value:",
  9687. protocol: 'instance creation',
  9688. fn: function (aString,anObject,anObject2){
  9689. var self=this;
  9690. return $core.withContext(function($ctx1) {
  9691. var nativeFunc=(new Function('return this'))()[aString];
  9692. return new nativeFunc(anObject,anObject2);
  9693. ;
  9694. return self;
  9695. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9696. },
  9697. args: ["aString", "anObject", "anObject2"],
  9698. 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>",
  9699. referencedClasses: [],
  9700. messageSends: []
  9701. }),
  9702. $globals.NativeFunction.klass);
  9703. $core.addMethod(
  9704. $core.method({
  9705. selector: "constructorNamed:value:value:value:",
  9706. protocol: 'instance creation',
  9707. fn: function (aString,anObject,anObject2,anObject3){
  9708. var self=this;
  9709. return $core.withContext(function($ctx1) {
  9710. var nativeFunc=(new Function('return this'))()[aString];
  9711. return new nativeFunc(anObject,anObject2, anObject3);
  9712. ;
  9713. return self;
  9714. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9715. },
  9716. args: ["aString", "anObject", "anObject2", "anObject3"],
  9717. 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>",
  9718. referencedClasses: [],
  9719. messageSends: []
  9720. }),
  9721. $globals.NativeFunction.klass);
  9722. $core.addMethod(
  9723. $core.method({
  9724. selector: "constructorOf:",
  9725. protocol: 'instance creation',
  9726. fn: function (nativeFunc){
  9727. var self=this;
  9728. return $core.withContext(function($ctx1) {
  9729. return new nativeFunc();
  9730. ;
  9731. return self;
  9732. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9733. },
  9734. args: ["nativeFunc"],
  9735. source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9736. referencedClasses: [],
  9737. messageSends: []
  9738. }),
  9739. $globals.NativeFunction.klass);
  9740. $core.addMethod(
  9741. $core.method({
  9742. selector: "constructorOf:value:",
  9743. protocol: 'instance creation',
  9744. fn: function (nativeFunc,anObject){
  9745. var self=this;
  9746. return $core.withContext(function($ctx1) {
  9747. return new nativeFunc(anObject);
  9748. ;
  9749. return self;
  9750. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9751. },
  9752. args: ["nativeFunc", "anObject"],
  9753. source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9754. referencedClasses: [],
  9755. messageSends: []
  9756. }),
  9757. $globals.NativeFunction.klass);
  9758. $core.addMethod(
  9759. $core.method({
  9760. selector: "constructorOf:value:value:",
  9761. protocol: 'instance creation',
  9762. fn: function (nativeFunc,anObject,anObject2){
  9763. var self=this;
  9764. return $core.withContext(function($ctx1) {
  9765. return new nativeFunc(anObject,anObject2);
  9766. ;
  9767. return self;
  9768. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9769. },
  9770. args: ["nativeFunc", "anObject", "anObject2"],
  9771. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9772. referencedClasses: [],
  9773. messageSends: []
  9774. }),
  9775. $globals.NativeFunction.klass);
  9776. $core.addMethod(
  9777. $core.method({
  9778. selector: "constructorOf:value:value:value:",
  9779. protocol: 'instance creation',
  9780. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9781. var self=this;
  9782. return $core.withContext(function($ctx1) {
  9783. return new nativeFunc(anObject,anObject2, anObject3);
  9784. ;
  9785. return self;
  9786. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9787. },
  9788. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9789. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9790. referencedClasses: [],
  9791. messageSends: []
  9792. }),
  9793. $globals.NativeFunction.klass);
  9794. $core.addMethod(
  9795. $core.method({
  9796. selector: "exists:",
  9797. protocol: 'testing',
  9798. fn: function (aString){
  9799. var self=this;
  9800. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  9801. return $core.withContext(function($ctx1) {
  9802. var $1;
  9803. $1=$recv($Smalltalk())._existsJsGlobal_(aString);
  9804. return $1;
  9805. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  9806. },
  9807. args: ["aString"],
  9808. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  9809. referencedClasses: ["Smalltalk"],
  9810. messageSends: ["existsJsGlobal:"]
  9811. }),
  9812. $globals.NativeFunction.klass);
  9813. $core.addMethod(
  9814. $core.method({
  9815. selector: "functionNamed:",
  9816. protocol: 'function calling',
  9817. fn: function (aString){
  9818. var self=this;
  9819. return $core.withContext(function($ctx1) {
  9820. var nativeFunc=(new Function('return this'))()[aString];
  9821. return nativeFunc();
  9822. ;
  9823. return self;
  9824. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9825. },
  9826. args: ["aString"],
  9827. source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9828. referencedClasses: [],
  9829. messageSends: []
  9830. }),
  9831. $globals.NativeFunction.klass);
  9832. $core.addMethod(
  9833. $core.method({
  9834. selector: "functionNamed:value:",
  9835. protocol: 'function calling',
  9836. fn: function (aString,anObject){
  9837. var self=this;
  9838. return $core.withContext(function($ctx1) {
  9839. var nativeFunc=(new Function('return this'))()[aString];
  9840. return nativeFunc(anObject);
  9841. ;
  9842. return self;
  9843. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9844. },
  9845. args: ["aString", "anObject"],
  9846. source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9847. referencedClasses: [],
  9848. messageSends: []
  9849. }),
  9850. $globals.NativeFunction.klass);
  9851. $core.addMethod(
  9852. $core.method({
  9853. selector: "functionNamed:value:value:",
  9854. protocol: 'function calling',
  9855. fn: function (aString,anObject,anObject2){
  9856. var self=this;
  9857. return $core.withContext(function($ctx1) {
  9858. var nativeFunc=(new Function('return this'))()[aString];
  9859. return nativeFunc(anObject,anObject2);
  9860. ;
  9861. return self;
  9862. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9863. },
  9864. args: ["aString", "anObject", "anObject2"],
  9865. 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>",
  9866. referencedClasses: [],
  9867. messageSends: []
  9868. }),
  9869. $globals.NativeFunction.klass);
  9870. $core.addMethod(
  9871. $core.method({
  9872. selector: "functionNamed:value:value:value:",
  9873. protocol: 'function calling',
  9874. fn: function (aString,anObject,anObject2,anObject3){
  9875. var self=this;
  9876. return $core.withContext(function($ctx1) {
  9877. var nativeFunc=(new Function('return this'))()[aString];
  9878. return nativeFunc(anObject,anObject2, anObject3);
  9879. ;
  9880. return self;
  9881. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9882. },
  9883. args: ["aString", "anObject", "anObject2", "anObject3"],
  9884. 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>",
  9885. referencedClasses: [],
  9886. messageSends: []
  9887. }),
  9888. $globals.NativeFunction.klass);
  9889. $core.addMethod(
  9890. $core.method({
  9891. selector: "functionNamed:valueWithArgs:",
  9892. protocol: 'function calling',
  9893. fn: function (aString,args){
  9894. var self=this;
  9895. return $core.withContext(function($ctx1) {
  9896. var nativeFunc=(new Function('return this'))()[aString];
  9897. return Function.prototype.apply.call(nativeFunc, null, args);
  9898. ;
  9899. return self;
  9900. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  9901. },
  9902. args: ["aString", "args"],
  9903. 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>",
  9904. referencedClasses: [],
  9905. messageSends: []
  9906. }),
  9907. $globals.NativeFunction.klass);
  9908. $core.addMethod(
  9909. $core.method({
  9910. selector: "functionOf:",
  9911. protocol: 'function calling',
  9912. fn: function (nativeFunc){
  9913. var self=this;
  9914. return $core.withContext(function($ctx1) {
  9915. return nativeFunc();
  9916. ;
  9917. return self;
  9918. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9919. },
  9920. args: ["nativeFunc"],
  9921. source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9922. referencedClasses: [],
  9923. messageSends: []
  9924. }),
  9925. $globals.NativeFunction.klass);
  9926. $core.addMethod(
  9927. $core.method({
  9928. selector: "functionOf:value:",
  9929. protocol: 'function calling',
  9930. fn: function (nativeFunc,anObject){
  9931. var self=this;
  9932. return $core.withContext(function($ctx1) {
  9933. return nativeFunc(anObject);
  9934. ;
  9935. return self;
  9936. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9937. },
  9938. args: ["nativeFunc", "anObject"],
  9939. source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9940. referencedClasses: [],
  9941. messageSends: []
  9942. }),
  9943. $globals.NativeFunction.klass);
  9944. $core.addMethod(
  9945. $core.method({
  9946. selector: "functionOf:value:value:",
  9947. protocol: 'function calling',
  9948. fn: function (nativeFunc,anObject,anObject2){
  9949. var self=this;
  9950. return $core.withContext(function($ctx1) {
  9951. return nativeFunc(anObject,anObject2);
  9952. ;
  9953. return self;
  9954. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9955. },
  9956. args: ["nativeFunc", "anObject", "anObject2"],
  9957. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  9958. referencedClasses: [],
  9959. messageSends: []
  9960. }),
  9961. $globals.NativeFunction.klass);
  9962. $core.addMethod(
  9963. $core.method({
  9964. selector: "functionOf:value:value:value:",
  9965. protocol: 'function calling',
  9966. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9967. var self=this;
  9968. return $core.withContext(function($ctx1) {
  9969. return nativeFunc(anObject,anObject2, anObject3);
  9970. ;
  9971. return self;
  9972. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9973. },
  9974. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9975. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9976. referencedClasses: [],
  9977. messageSends: []
  9978. }),
  9979. $globals.NativeFunction.klass);
  9980. $core.addMethod(
  9981. $core.method({
  9982. selector: "functionOf:valueWithArgs:",
  9983. protocol: 'function calling',
  9984. fn: function (nativeFunc,args){
  9985. var self=this;
  9986. return $core.withContext(function($ctx1) {
  9987. return Function.prototype.apply.call(nativeFunc, null, args);
  9988. ;
  9989. return self;
  9990. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  9991. },
  9992. args: ["nativeFunc", "args"],
  9993. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  9994. referencedClasses: [],
  9995. messageSends: []
  9996. }),
  9997. $globals.NativeFunction.klass);
  9998. $core.addMethod(
  9999. $core.method({
  10000. selector: "methodOf:this:",
  10001. protocol: 'method calling',
  10002. fn: function (nativeFunc,thisObject){
  10003. var self=this;
  10004. return $core.withContext(function($ctx1) {
  10005. return Function.prototype.call.call(nativeFunc, thisObject);
  10006. ;
  10007. return self;
  10008. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  10009. },
  10010. args: ["nativeFunc", "thisObject"],
  10011. source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>",
  10012. referencedClasses: [],
  10013. messageSends: []
  10014. }),
  10015. $globals.NativeFunction.klass);
  10016. $core.addMethod(
  10017. $core.method({
  10018. selector: "methodOf:this:value:",
  10019. protocol: 'method calling',
  10020. fn: function (nativeFunc,thisObject,anObject){
  10021. var self=this;
  10022. return $core.withContext(function($ctx1) {
  10023. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  10024. ;
  10025. return self;
  10026. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  10027. },
  10028. args: ["nativeFunc", "thisObject", "anObject"],
  10029. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>",
  10030. referencedClasses: [],
  10031. messageSends: []
  10032. }),
  10033. $globals.NativeFunction.klass);
  10034. $core.addMethod(
  10035. $core.method({
  10036. selector: "methodOf:this:value:value:",
  10037. protocol: 'method calling',
  10038. fn: function (nativeFunc,thisObject,anObject,anObject2){
  10039. var self=this;
  10040. return $core.withContext(function($ctx1) {
  10041. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  10042. ;
  10043. return self;
  10044. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10045. },
  10046. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  10047. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>",
  10048. referencedClasses: [],
  10049. messageSends: []
  10050. }),
  10051. $globals.NativeFunction.klass);
  10052. $core.addMethod(
  10053. $core.method({
  10054. selector: "methodOf:this:value:value:value:",
  10055. protocol: 'method calling',
  10056. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  10057. var self=this;
  10058. return $core.withContext(function($ctx1) {
  10059. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  10060. ;
  10061. return self;
  10062. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10063. },
  10064. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  10065. 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>",
  10066. referencedClasses: [],
  10067. messageSends: []
  10068. }),
  10069. $globals.NativeFunction.klass);
  10070. $core.addMethod(
  10071. $core.method({
  10072. selector: "methodOf:this:valueWithArgs:",
  10073. protocol: 'method calling',
  10074. fn: function (nativeFunc,thisObject,args){
  10075. var self=this;
  10076. return $core.withContext(function($ctx1) {
  10077. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  10078. ;
  10079. return self;
  10080. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  10081. },
  10082. args: ["nativeFunc", "thisObject", "args"],
  10083. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>",
  10084. referencedClasses: [],
  10085. messageSends: []
  10086. }),
  10087. $globals.NativeFunction.klass);
  10088. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  10089. $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.";
  10090. $core.addMethod(
  10091. $core.method({
  10092. selector: "clearInterval",
  10093. protocol: 'timeout/interval',
  10094. fn: function (){
  10095. var self=this;
  10096. return $core.withContext(function($ctx1) {
  10097. var interval = self["@rawTimeout"];
  10098. clearInterval(interval);
  10099. ;
  10100. return self;
  10101. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  10102. },
  10103. args: [],
  10104. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  10105. referencedClasses: [],
  10106. messageSends: []
  10107. }),
  10108. $globals.Timeout);
  10109. $core.addMethod(
  10110. $core.method({
  10111. selector: "clearTimeout",
  10112. protocol: 'timeout/interval',
  10113. fn: function (){
  10114. var self=this;
  10115. return $core.withContext(function($ctx1) {
  10116. var timeout = self["@rawTimeout"];
  10117. clearTimeout(timeout);
  10118. ;
  10119. return self;
  10120. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  10121. },
  10122. args: [],
  10123. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  10124. referencedClasses: [],
  10125. messageSends: []
  10126. }),
  10127. $globals.Timeout);
  10128. $core.addMethod(
  10129. $core.method({
  10130. selector: "rawTimeout:",
  10131. protocol: 'accessing',
  10132. fn: function (anObject){
  10133. var self=this;
  10134. self["@rawTimeout"]=anObject;
  10135. return self;
  10136. },
  10137. args: ["anObject"],
  10138. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  10139. referencedClasses: [],
  10140. messageSends: []
  10141. }),
  10142. $globals.Timeout);
  10143. $core.addMethod(
  10144. $core.method({
  10145. selector: "on:",
  10146. protocol: 'instance creation',
  10147. fn: function (anObject){
  10148. var self=this;
  10149. return $core.withContext(function($ctx1) {
  10150. var $2,$3,$1;
  10151. $2=self._new();
  10152. $recv($2)._rawTimeout_(anObject);
  10153. $3=$recv($2)._yourself();
  10154. $1=$3;
  10155. return $1;
  10156. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  10157. },
  10158. args: ["anObject"],
  10159. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  10160. referencedClasses: [],
  10161. messageSends: ["rawTimeout:", "new", "yourself"]
  10162. }),
  10163. $globals.Timeout.klass);
  10164. });
  10165. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  10166. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  10167. $core.addPackage('Kernel-Collections');
  10168. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  10169. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10170. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  10171. $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:`";
  10172. $core.addMethod(
  10173. $core.method({
  10174. selector: "=",
  10175. protocol: 'comparing',
  10176. fn: function (anAssociation){
  10177. var self=this;
  10178. return $core.withContext(function($ctx1) {
  10179. var $3,$2,$5,$4,$6,$1;
  10180. $3=self._class();
  10181. $ctx1.sendIdx["class"]=1;
  10182. $2=$recv($3).__eq($recv(anAssociation)._class());
  10183. $ctx1.sendIdx["="]=1;
  10184. $1=$recv($2)._and_((function(){
  10185. return $core.withContext(function($ctx2) {
  10186. $5=self._key();
  10187. $ctx2.sendIdx["key"]=1;
  10188. $4=$recv($5).__eq($recv(anAssociation)._key());
  10189. $ctx2.sendIdx["="]=2;
  10190. return $recv($4)._and_((function(){
  10191. return $core.withContext(function($ctx3) {
  10192. $6=self._value();
  10193. $ctx3.sendIdx["value"]=1;
  10194. return $recv($6).__eq($recv(anAssociation)._value());
  10195. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10196. }));
  10197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10198. }));
  10199. $ctx1.sendIdx["and:"]=1;
  10200. return $1;
  10201. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  10202. },
  10203. args: ["anAssociation"],
  10204. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  10205. referencedClasses: [],
  10206. messageSends: ["and:", "=", "class", "key", "value"]
  10207. }),
  10208. $globals.Association);
  10209. $core.addMethod(
  10210. $core.method({
  10211. selector: "key",
  10212. protocol: 'accessing',
  10213. fn: function (){
  10214. var self=this;
  10215. var $1;
  10216. $1=self["@key"];
  10217. return $1;
  10218. },
  10219. args: [],
  10220. source: "key\x0a\x09^ key",
  10221. referencedClasses: [],
  10222. messageSends: []
  10223. }),
  10224. $globals.Association);
  10225. $core.addMethod(
  10226. $core.method({
  10227. selector: "key:",
  10228. protocol: 'accessing',
  10229. fn: function (aKey){
  10230. var self=this;
  10231. self["@key"]=aKey;
  10232. return self;
  10233. },
  10234. args: ["aKey"],
  10235. source: "key: aKey\x0a\x09key := aKey",
  10236. referencedClasses: [],
  10237. messageSends: []
  10238. }),
  10239. $globals.Association);
  10240. $core.addMethod(
  10241. $core.method({
  10242. selector: "printOn:",
  10243. protocol: 'printing',
  10244. fn: function (aStream){
  10245. var self=this;
  10246. return $core.withContext(function($ctx1) {
  10247. $recv(self._key())._printOn_(aStream);
  10248. $ctx1.sendIdx["printOn:"]=1;
  10249. $recv(aStream)._nextPutAll_(" -> ");
  10250. $recv(self._value())._printOn_(aStream);
  10251. return self;
  10252. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  10253. },
  10254. args: ["aStream"],
  10255. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10256. referencedClasses: [],
  10257. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  10258. }),
  10259. $globals.Association);
  10260. $core.addMethod(
  10261. $core.method({
  10262. selector: "value",
  10263. protocol: 'accessing',
  10264. fn: function (){
  10265. var self=this;
  10266. var $1;
  10267. $1=self["@value"];
  10268. return $1;
  10269. },
  10270. args: [],
  10271. source: "value\x0a\x09^ value",
  10272. referencedClasses: [],
  10273. messageSends: []
  10274. }),
  10275. $globals.Association);
  10276. $core.addMethod(
  10277. $core.method({
  10278. selector: "value:",
  10279. protocol: 'accessing',
  10280. fn: function (aValue){
  10281. var self=this;
  10282. self["@value"]=aValue;
  10283. return self;
  10284. },
  10285. args: ["aValue"],
  10286. source: "value: aValue\x0a\x09value := aValue",
  10287. referencedClasses: [],
  10288. messageSends: []
  10289. }),
  10290. $globals.Association);
  10291. $core.addMethod(
  10292. $core.method({
  10293. selector: "key:value:",
  10294. protocol: 'instance creation',
  10295. fn: function (aKey,aValue){
  10296. var self=this;
  10297. return $core.withContext(function($ctx1) {
  10298. var $2,$3,$1;
  10299. $2=self._new();
  10300. $recv($2)._key_(aKey);
  10301. $recv($2)._value_(aValue);
  10302. $3=$recv($2)._yourself();
  10303. $1=$3;
  10304. return $1;
  10305. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10306. },
  10307. args: ["aKey", "aValue"],
  10308. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10309. referencedClasses: [],
  10310. messageSends: ["key:", "new", "value:", "yourself"]
  10311. }),
  10312. $globals.Association.klass);
  10313. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10314. $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`.";
  10315. $core.addMethod(
  10316. $core.method({
  10317. selector: "bucketOfElement:",
  10318. protocol: 'accessing',
  10319. fn: function (anObject){
  10320. var self=this;
  10321. return $core.withContext(function($ctx1) {
  10322. var hash = self['@hashBlock'](anObject);
  10323. if (!hash) return null;
  10324. var buckets = self['@buckets'],
  10325. bucket = buckets[hash];
  10326. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10327. return bucket;
  10328. ;
  10329. return self;
  10330. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10331. },
  10332. args: ["anObject"],
  10333. 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>",
  10334. referencedClasses: [],
  10335. messageSends: []
  10336. }),
  10337. $globals.BucketStore);
  10338. $core.addMethod(
  10339. $core.method({
  10340. selector: "do:",
  10341. protocol: 'enumerating',
  10342. fn: function (aBlock){
  10343. var self=this;
  10344. return $core.withContext(function($ctx1) {
  10345. var buckets = self['@buckets'];
  10346. var keys = Object.keys(buckets);
  10347. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10348. ;
  10349. return self;
  10350. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10351. },
  10352. args: ["aBlock"],
  10353. 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>",
  10354. referencedClasses: [],
  10355. messageSends: []
  10356. }),
  10357. $globals.BucketStore);
  10358. $core.addMethod(
  10359. $core.method({
  10360. selector: "hashBlock:",
  10361. protocol: 'accessing',
  10362. fn: function (aBlock){
  10363. var self=this;
  10364. self["@hashBlock"]=aBlock;
  10365. return self;
  10366. },
  10367. args: ["aBlock"],
  10368. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10369. referencedClasses: [],
  10370. messageSends: []
  10371. }),
  10372. $globals.BucketStore);
  10373. $core.addMethod(
  10374. $core.method({
  10375. selector: "initialize",
  10376. protocol: 'initialization',
  10377. fn: function (){
  10378. var self=this;
  10379. return $core.withContext(function($ctx1) {
  10380. (
  10381. $ctx1.supercall = true,
  10382. $globals.BucketStore.superclass.fn.prototype._initialize.apply($recv(self), []));
  10383. $ctx1.supercall = false;
  10384. self._removeAll();
  10385. return self;
  10386. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10387. },
  10388. args: [],
  10389. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10390. referencedClasses: [],
  10391. messageSends: ["initialize", "removeAll"]
  10392. }),
  10393. $globals.BucketStore);
  10394. $core.addMethod(
  10395. $core.method({
  10396. selector: "newBucket",
  10397. protocol: 'private',
  10398. fn: function (){
  10399. var self=this;
  10400. return $core.withContext(function($ctx1) {
  10401. self._subclassResponsibility();
  10402. return self;
  10403. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10404. },
  10405. args: [],
  10406. source: "newBucket\x0a\x09self subclassResponsibility",
  10407. referencedClasses: [],
  10408. messageSends: ["subclassResponsibility"]
  10409. }),
  10410. $globals.BucketStore);
  10411. $core.addMethod(
  10412. $core.method({
  10413. selector: "removeAll",
  10414. protocol: 'adding/removing',
  10415. fn: function (){
  10416. var self=this;
  10417. return $core.withContext(function($ctx1) {
  10418. self['@buckets'] = Object.create(null);;
  10419. return self;
  10420. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10421. },
  10422. args: [],
  10423. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  10424. referencedClasses: [],
  10425. messageSends: []
  10426. }),
  10427. $globals.BucketStore);
  10428. $core.addMethod(
  10429. $core.method({
  10430. selector: "hashBlock:",
  10431. protocol: 'instance creation',
  10432. fn: function (aBlock){
  10433. var self=this;
  10434. return $core.withContext(function($ctx1) {
  10435. var $2,$3,$1;
  10436. $2=self._new();
  10437. $recv($2)._hashBlock_(aBlock);
  10438. $3=$recv($2)._yourself();
  10439. $1=$3;
  10440. return $1;
  10441. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10442. },
  10443. args: ["aBlock"],
  10444. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10445. referencedClasses: [],
  10446. messageSends: ["hashBlock:", "new", "yourself"]
  10447. }),
  10448. $globals.BucketStore.klass);
  10449. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10450. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10451. $core.addMethod(
  10452. $core.method({
  10453. selector: "newBucket",
  10454. protocol: 'private',
  10455. fn: function (){
  10456. var self=this;
  10457. var $1;
  10458. $1=[];
  10459. return $1;
  10460. },
  10461. args: [],
  10462. source: "newBucket\x0a\x09^ #()",
  10463. referencedClasses: [],
  10464. messageSends: []
  10465. }),
  10466. $globals.ArrayBucketStore);
  10467. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10468. $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.";
  10469. $core.addMethod(
  10470. $core.method({
  10471. selector: ",",
  10472. protocol: 'copying',
  10473. fn: function (aCollection){
  10474. var self=this;
  10475. return $core.withContext(function($ctx1) {
  10476. var $2,$3,$1;
  10477. $2=self._copy();
  10478. $recv($2)._addAll_(aCollection);
  10479. $3=$recv($2)._yourself();
  10480. $1=$3;
  10481. return $1;
  10482. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10483. },
  10484. args: ["aCollection"],
  10485. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10486. referencedClasses: [],
  10487. messageSends: ["addAll:", "copy", "yourself"]
  10488. }),
  10489. $globals.Collection);
  10490. $core.addMethod(
  10491. $core.method({
  10492. selector: "add:",
  10493. protocol: 'adding/removing',
  10494. fn: function (anObject){
  10495. var self=this;
  10496. return $core.withContext(function($ctx1) {
  10497. self._subclassResponsibility();
  10498. return self;
  10499. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10500. },
  10501. args: ["anObject"],
  10502. source: "add: anObject\x0a\x09self subclassResponsibility",
  10503. referencedClasses: [],
  10504. messageSends: ["subclassResponsibility"]
  10505. }),
  10506. $globals.Collection);
  10507. $core.addMethod(
  10508. $core.method({
  10509. selector: "addAll:",
  10510. protocol: 'adding/removing',
  10511. fn: function (aCollection){
  10512. var self=this;
  10513. return $core.withContext(function($ctx1) {
  10514. $recv(aCollection)._do_((function(each){
  10515. return $core.withContext(function($ctx2) {
  10516. return self._add_(each);
  10517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10518. }));
  10519. return aCollection;
  10520. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10521. },
  10522. args: ["aCollection"],
  10523. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10524. referencedClasses: [],
  10525. messageSends: ["do:", "add:"]
  10526. }),
  10527. $globals.Collection);
  10528. $core.addMethod(
  10529. $core.method({
  10530. selector: "allSatisfy:",
  10531. protocol: 'enumerating',
  10532. fn: function (aBlock){
  10533. var self=this;
  10534. return $core.withContext(function($ctx1) {
  10535. var $1;
  10536. var $early={};
  10537. try {
  10538. self._do_((function(each){
  10539. return $core.withContext(function($ctx2) {
  10540. $1=$recv(aBlock)._value_(each);
  10541. if(!$core.assert($1)){
  10542. throw $early=[false];
  10543. };
  10544. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10545. }));
  10546. return true;
  10547. }
  10548. catch(e) {if(e===$early)return e[0]; throw e}
  10549. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10550. },
  10551. args: ["aBlock"],
  10552. 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",
  10553. referencedClasses: [],
  10554. messageSends: ["do:", "ifFalse:", "value:"]
  10555. }),
  10556. $globals.Collection);
  10557. $core.addMethod(
  10558. $core.method({
  10559. selector: "anyOne",
  10560. protocol: 'adding/removing',
  10561. fn: function (){
  10562. var self=this;
  10563. return $core.withContext(function($ctx1) {
  10564. var $early={};
  10565. try {
  10566. self._ifEmpty_((function(){
  10567. return $core.withContext(function($ctx2) {
  10568. return self._error_("Collection is empty");
  10569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10570. }));
  10571. self._do_((function(each){
  10572. throw $early=[each];
  10573. }));
  10574. return self;
  10575. }
  10576. catch(e) {if(e===$early)return e[0]; throw e}
  10577. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  10578. },
  10579. args: [],
  10580. 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 ]",
  10581. referencedClasses: [],
  10582. messageSends: ["ifEmpty:", "error:", "do:"]
  10583. }),
  10584. $globals.Collection);
  10585. $core.addMethod(
  10586. $core.method({
  10587. selector: "anySatisfy:",
  10588. protocol: 'enumerating',
  10589. fn: function (aBlock){
  10590. var self=this;
  10591. return $core.withContext(function($ctx1) {
  10592. var $1;
  10593. var $early={};
  10594. try {
  10595. self._do_((function(each){
  10596. return $core.withContext(function($ctx2) {
  10597. $1=$recv(aBlock)._value_(each);
  10598. if($core.assert($1)){
  10599. throw $early=[true];
  10600. };
  10601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10602. }));
  10603. return false;
  10604. }
  10605. catch(e) {if(e===$early)return e[0]; throw e}
  10606. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  10607. },
  10608. args: ["aBlock"],
  10609. 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",
  10610. referencedClasses: [],
  10611. messageSends: ["do:", "ifTrue:", "value:"]
  10612. }),
  10613. $globals.Collection);
  10614. $core.addMethod(
  10615. $core.method({
  10616. selector: "asArray",
  10617. protocol: 'converting',
  10618. fn: function (){
  10619. var self=this;
  10620. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  10621. return $core.withContext(function($ctx1) {
  10622. var $1;
  10623. $1=$recv($Array())._withAll_(self);
  10624. return $1;
  10625. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  10626. },
  10627. args: [],
  10628. source: "asArray\x0a\x09^ Array withAll: self",
  10629. referencedClasses: ["Array"],
  10630. messageSends: ["withAll:"]
  10631. }),
  10632. $globals.Collection);
  10633. $core.addMethod(
  10634. $core.method({
  10635. selector: "asJSON",
  10636. protocol: 'converting',
  10637. fn: function (){
  10638. var self=this;
  10639. return $core.withContext(function($ctx1) {
  10640. var $1;
  10641. $1=$recv(self._asArray())._collect_((function(each){
  10642. return $core.withContext(function($ctx2) {
  10643. return $recv(each)._asJSON();
  10644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10645. }));
  10646. return $1;
  10647. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  10648. },
  10649. args: [],
  10650. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  10651. referencedClasses: [],
  10652. messageSends: ["collect:", "asArray", "asJSON"]
  10653. }),
  10654. $globals.Collection);
  10655. $core.addMethod(
  10656. $core.method({
  10657. selector: "asOrderedCollection",
  10658. protocol: 'converting',
  10659. fn: function (){
  10660. var self=this;
  10661. return $core.withContext(function($ctx1) {
  10662. var $1;
  10663. $1=self._asArray();
  10664. return $1;
  10665. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  10666. },
  10667. args: [],
  10668. source: "asOrderedCollection\x0a\x09^ self asArray",
  10669. referencedClasses: [],
  10670. messageSends: ["asArray"]
  10671. }),
  10672. $globals.Collection);
  10673. $core.addMethod(
  10674. $core.method({
  10675. selector: "asSet",
  10676. protocol: 'converting',
  10677. fn: function (){
  10678. var self=this;
  10679. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  10680. return $core.withContext(function($ctx1) {
  10681. var $1;
  10682. $1=$recv($Set())._withAll_(self);
  10683. return $1;
  10684. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  10685. },
  10686. args: [],
  10687. source: "asSet\x0a\x09^ Set withAll: self",
  10688. referencedClasses: ["Set"],
  10689. messageSends: ["withAll:"]
  10690. }),
  10691. $globals.Collection);
  10692. $core.addMethod(
  10693. $core.method({
  10694. selector: "collect:",
  10695. protocol: 'enumerating',
  10696. fn: function (aBlock){
  10697. var self=this;
  10698. var stream;
  10699. return $core.withContext(function($ctx1) {
  10700. var $1;
  10701. stream=$recv($recv(self._class())._new())._writeStream();
  10702. self._do_((function(each){
  10703. return $core.withContext(function($ctx2) {
  10704. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  10705. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10706. }));
  10707. $1=$recv(stream)._contents();
  10708. return $1;
  10709. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10710. },
  10711. args: ["aBlock"],
  10712. 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",
  10713. referencedClasses: [],
  10714. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  10715. }),
  10716. $globals.Collection);
  10717. $core.addMethod(
  10718. $core.method({
  10719. selector: "copyWith:",
  10720. protocol: 'copying',
  10721. fn: function (anObject){
  10722. var self=this;
  10723. return $core.withContext(function($ctx1) {
  10724. var $2,$3,$1;
  10725. $2=self._copy();
  10726. $recv($2)._add_(anObject);
  10727. $3=$recv($2)._yourself();
  10728. $1=$3;
  10729. return $1;
  10730. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  10731. },
  10732. args: ["anObject"],
  10733. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10734. referencedClasses: [],
  10735. messageSends: ["add:", "copy", "yourself"]
  10736. }),
  10737. $globals.Collection);
  10738. $core.addMethod(
  10739. $core.method({
  10740. selector: "copyWithAll:",
  10741. protocol: 'copying',
  10742. fn: function (aCollection){
  10743. var self=this;
  10744. return $core.withContext(function($ctx1) {
  10745. var $2,$3,$1;
  10746. $2=self._copy();
  10747. $recv($2)._addAll_(aCollection);
  10748. $3=$recv($2)._yourself();
  10749. $1=$3;
  10750. return $1;
  10751. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  10752. },
  10753. args: ["aCollection"],
  10754. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10755. referencedClasses: [],
  10756. messageSends: ["addAll:", "copy", "yourself"]
  10757. }),
  10758. $globals.Collection);
  10759. $core.addMethod(
  10760. $core.method({
  10761. selector: "copyWithoutAll:",
  10762. protocol: 'copying',
  10763. fn: function (aCollection){
  10764. var self=this;
  10765. return $core.withContext(function($ctx1) {
  10766. var $1;
  10767. $1=self._reject_((function(each){
  10768. return $core.withContext(function($ctx2) {
  10769. return $recv(aCollection)._includes_(each);
  10770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10771. }));
  10772. return $1;
  10773. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  10774. },
  10775. args: ["aCollection"],
  10776. 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 ]",
  10777. referencedClasses: [],
  10778. messageSends: ["reject:", "includes:"]
  10779. }),
  10780. $globals.Collection);
  10781. $core.addMethod(
  10782. $core.method({
  10783. selector: "detect:",
  10784. protocol: 'enumerating',
  10785. fn: function (aBlock){
  10786. var self=this;
  10787. return $core.withContext(function($ctx1) {
  10788. var $1;
  10789. $1=self._detect_ifNone_(aBlock,(function(){
  10790. return $core.withContext(function($ctx2) {
  10791. return self._errorNotFound();
  10792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10793. }));
  10794. return $1;
  10795. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  10796. },
  10797. args: ["aBlock"],
  10798. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  10799. referencedClasses: [],
  10800. messageSends: ["detect:ifNone:", "errorNotFound"]
  10801. }),
  10802. $globals.Collection);
  10803. $core.addMethod(
  10804. $core.method({
  10805. selector: "detect:ifNone:",
  10806. protocol: 'enumerating',
  10807. fn: function (aBlock,anotherBlock){
  10808. var self=this;
  10809. return $core.withContext(function($ctx1) {
  10810. self._subclassResponsibility();
  10811. return self;
  10812. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10813. },
  10814. args: ["aBlock", "anotherBlock"],
  10815. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10816. referencedClasses: [],
  10817. messageSends: ["subclassResponsibility"]
  10818. }),
  10819. $globals.Collection);
  10820. $core.addMethod(
  10821. $core.method({
  10822. selector: "do:",
  10823. protocol: 'enumerating',
  10824. fn: function (aBlock){
  10825. var self=this;
  10826. return $core.withContext(function($ctx1) {
  10827. self._subclassResponsibility();
  10828. return self;
  10829. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  10830. },
  10831. args: ["aBlock"],
  10832. source: "do: aBlock\x0a\x09self subclassResponsibility",
  10833. referencedClasses: [],
  10834. messageSends: ["subclassResponsibility"]
  10835. }),
  10836. $globals.Collection);
  10837. $core.addMethod(
  10838. $core.method({
  10839. selector: "do:separatedBy:",
  10840. protocol: 'enumerating',
  10841. fn: function (aBlock,anotherBlock){
  10842. var self=this;
  10843. var actionBeforeElement;
  10844. return $core.withContext(function($ctx1) {
  10845. actionBeforeElement=(function(){
  10846. actionBeforeElement=anotherBlock;
  10847. return actionBeforeElement;
  10848. });
  10849. self._do_((function(each){
  10850. return $core.withContext(function($ctx2) {
  10851. $recv(actionBeforeElement)._value();
  10852. return $recv(aBlock)._value_(each);
  10853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  10854. }));
  10855. return self;
  10856. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  10857. },
  10858. args: ["aBlock", "anotherBlock"],
  10859. 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 ]",
  10860. referencedClasses: [],
  10861. messageSends: ["do:", "value", "value:"]
  10862. }),
  10863. $globals.Collection);
  10864. $core.addMethod(
  10865. $core.method({
  10866. selector: "errorNotFound",
  10867. protocol: 'error handling',
  10868. fn: function (){
  10869. var self=this;
  10870. return $core.withContext(function($ctx1) {
  10871. self._error_("Object is not in the collection");
  10872. return self;
  10873. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  10874. },
  10875. args: [],
  10876. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  10877. referencedClasses: [],
  10878. messageSends: ["error:"]
  10879. }),
  10880. $globals.Collection);
  10881. $core.addMethod(
  10882. $core.method({
  10883. selector: "ifEmpty:",
  10884. protocol: 'testing',
  10885. fn: function (aBlock){
  10886. var self=this;
  10887. return $core.withContext(function($ctx1) {
  10888. var $2,$1;
  10889. $2=self._isEmpty();
  10890. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  10891. return self;
  10892. }));
  10893. return $1;
  10894. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  10895. },
  10896. args: ["aBlock"],
  10897. 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 ]",
  10898. referencedClasses: [],
  10899. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  10900. }),
  10901. $globals.Collection);
  10902. $core.addMethod(
  10903. $core.method({
  10904. selector: "ifEmpty:ifNotEmpty:",
  10905. protocol: 'testing',
  10906. fn: function (aBlock,anotherBlock){
  10907. var self=this;
  10908. return $core.withContext(function($ctx1) {
  10909. var $2,$1;
  10910. $2=self._isEmpty();
  10911. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  10912. return $core.withContext(function($ctx2) {
  10913. return $recv(anotherBlock)._value_(self);
  10914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10915. }));
  10916. return $1;
  10917. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10918. },
  10919. args: ["aBlock", "anotherBlock"],
  10920. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  10921. referencedClasses: [],
  10922. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  10923. }),
  10924. $globals.Collection);
  10925. $core.addMethod(
  10926. $core.method({
  10927. selector: "ifNotEmpty:",
  10928. protocol: 'testing',
  10929. fn: function (aBlock){
  10930. var self=this;
  10931. return $core.withContext(function($ctx1) {
  10932. var $2,$1;
  10933. $2=self._notEmpty();
  10934. if($core.assert($2)){
  10935. $1=$recv(aBlock)._value_(self);
  10936. } else {
  10937. $1=self;
  10938. };
  10939. return $1;
  10940. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  10941. },
  10942. args: ["aBlock"],
  10943. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  10944. referencedClasses: [],
  10945. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10946. }),
  10947. $globals.Collection);
  10948. $core.addMethod(
  10949. $core.method({
  10950. selector: "ifNotEmpty:ifEmpty:",
  10951. protocol: 'testing',
  10952. fn: function (aBlock,anotherBlock){
  10953. var self=this;
  10954. return $core.withContext(function($ctx1) {
  10955. var $2,$1;
  10956. $2=self._notEmpty();
  10957. $1=$recv($2)._ifTrue_ifFalse_((function(){
  10958. return $core.withContext(function($ctx2) {
  10959. return $recv(aBlock)._value_(self);
  10960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10961. }),anotherBlock);
  10962. return $1;
  10963. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10964. },
  10965. args: ["aBlock", "anotherBlock"],
  10966. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  10967. referencedClasses: [],
  10968. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10969. }),
  10970. $globals.Collection);
  10971. $core.addMethod(
  10972. $core.method({
  10973. selector: "includes:",
  10974. protocol: 'testing',
  10975. fn: function (anObject){
  10976. var self=this;
  10977. return $core.withContext(function($ctx1) {
  10978. var $1;
  10979. $1=self._anySatisfy_((function(each){
  10980. return $core.withContext(function($ctx2) {
  10981. return $recv(each).__eq(anObject);
  10982. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10983. }));
  10984. return $1;
  10985. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  10986. },
  10987. args: ["anObject"],
  10988. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  10989. referencedClasses: [],
  10990. messageSends: ["anySatisfy:", "="]
  10991. }),
  10992. $globals.Collection);
  10993. $core.addMethod(
  10994. $core.method({
  10995. selector: "inject:into:",
  10996. protocol: 'enumerating',
  10997. fn: function (anObject,aBlock){
  10998. var self=this;
  10999. var result;
  11000. return $core.withContext(function($ctx1) {
  11001. var $1;
  11002. result=anObject;
  11003. self._do_((function(each){
  11004. return $core.withContext(function($ctx2) {
  11005. result=$recv(aBlock)._value_value_(result,each);
  11006. return result;
  11007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11008. }));
  11009. $1=result;
  11010. return $1;
  11011. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  11012. },
  11013. args: ["anObject", "aBlock"],
  11014. 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",
  11015. referencedClasses: [],
  11016. messageSends: ["do:", "value:value:"]
  11017. }),
  11018. $globals.Collection);
  11019. $core.addMethod(
  11020. $core.method({
  11021. selector: "intersection:",
  11022. protocol: 'enumerating',
  11023. fn: function (aCollection){
  11024. var self=this;
  11025. var set,outputSet;
  11026. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  11027. return $core.withContext(function($ctx1) {
  11028. var $2,$1,$3;
  11029. set=self._asSet();
  11030. outputSet=$recv($Set())._new();
  11031. $recv(aCollection)._do_((function(each){
  11032. return $core.withContext(function($ctx2) {
  11033. $2=$recv(set)._includes_(each);
  11034. $ctx2.sendIdx["includes:"]=1;
  11035. $1=$recv($2)._and_((function(){
  11036. return $core.withContext(function($ctx3) {
  11037. return $recv($recv(outputSet)._includes_(each))._not();
  11038. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  11039. }));
  11040. if($core.assert($1)){
  11041. return $recv(outputSet)._add_(each);
  11042. };
  11043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11044. }));
  11045. $3=$recv(self._class())._withAll_($recv(outputSet)._asArray());
  11046. return $3;
  11047. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  11048. },
  11049. args: ["aCollection"],
  11050. 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",
  11051. referencedClasses: ["Set"],
  11052. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  11053. }),
  11054. $globals.Collection);
  11055. $core.addMethod(
  11056. $core.method({
  11057. selector: "isEmpty",
  11058. protocol: 'testing',
  11059. fn: function (){
  11060. var self=this;
  11061. return $core.withContext(function($ctx1) {
  11062. var $1;
  11063. $1=$recv(self._size()).__eq((0));
  11064. return $1;
  11065. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  11066. },
  11067. args: [],
  11068. source: "isEmpty\x0a\x09^ self size = 0",
  11069. referencedClasses: [],
  11070. messageSends: ["=", "size"]
  11071. }),
  11072. $globals.Collection);
  11073. $core.addMethod(
  11074. $core.method({
  11075. selector: "noneSatisfy:",
  11076. protocol: 'enumerating',
  11077. fn: function (aBlock){
  11078. var self=this;
  11079. return $core.withContext(function($ctx1) {
  11080. var $1;
  11081. var $early={};
  11082. try {
  11083. self._do_((function(item){
  11084. return $core.withContext(function($ctx2) {
  11085. $1=$recv(aBlock)._value_(item);
  11086. if($core.assert($1)){
  11087. throw $early=[false];
  11088. };
  11089. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  11090. }));
  11091. return true;
  11092. }
  11093. catch(e) {if(e===$early)return e[0]; throw e}
  11094. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11095. },
  11096. args: ["aBlock"],
  11097. 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",
  11098. referencedClasses: [],
  11099. messageSends: ["do:", "ifTrue:", "value:"]
  11100. }),
  11101. $globals.Collection);
  11102. $core.addMethod(
  11103. $core.method({
  11104. selector: "notEmpty",
  11105. protocol: 'testing',
  11106. fn: function (){
  11107. var self=this;
  11108. return $core.withContext(function($ctx1) {
  11109. var $1;
  11110. $1=$recv(self._isEmpty())._not();
  11111. return $1;
  11112. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  11113. },
  11114. args: [],
  11115. source: "notEmpty\x0a\x09^ self isEmpty not",
  11116. referencedClasses: [],
  11117. messageSends: ["not", "isEmpty"]
  11118. }),
  11119. $globals.Collection);
  11120. $core.addMethod(
  11121. $core.method({
  11122. selector: "occurrencesOf:",
  11123. protocol: 'accessing',
  11124. fn: function (anObject){
  11125. var self=this;
  11126. var tally;
  11127. return $core.withContext(function($ctx1) {
  11128. var $1,$2;
  11129. tally=(0);
  11130. self._do_((function(each){
  11131. return $core.withContext(function($ctx2) {
  11132. $1=$recv(anObject).__eq(each);
  11133. if($core.assert($1)){
  11134. tally=$recv(tally).__plus((1));
  11135. return tally;
  11136. };
  11137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11138. }));
  11139. $2=tally;
  11140. return $2;
  11141. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  11142. },
  11143. args: ["anObject"],
  11144. 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",
  11145. referencedClasses: [],
  11146. messageSends: ["do:", "ifTrue:", "=", "+"]
  11147. }),
  11148. $globals.Collection);
  11149. $core.addMethod(
  11150. $core.method({
  11151. selector: "putOn:",
  11152. protocol: 'streaming',
  11153. fn: function (aStream){
  11154. var self=this;
  11155. return $core.withContext(function($ctx1) {
  11156. self._do_((function(each){
  11157. return $core.withContext(function($ctx2) {
  11158. return $recv(each)._putOn_(aStream);
  11159. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11160. }));
  11161. return self;
  11162. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  11163. },
  11164. args: ["aStream"],
  11165. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  11166. referencedClasses: [],
  11167. messageSends: ["do:", "putOn:"]
  11168. }),
  11169. $globals.Collection);
  11170. $core.addMethod(
  11171. $core.method({
  11172. selector: "reject:",
  11173. protocol: 'enumerating',
  11174. fn: function (aBlock){
  11175. var self=this;
  11176. return $core.withContext(function($ctx1) {
  11177. var $1;
  11178. $1=self._select_((function(each){
  11179. return $core.withContext(function($ctx2) {
  11180. return $recv($recv(aBlock)._value_(each)).__eq(false);
  11181. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11182. }));
  11183. return $1;
  11184. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  11185. },
  11186. args: ["aBlock"],
  11187. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  11188. referencedClasses: [],
  11189. messageSends: ["select:", "=", "value:"]
  11190. }),
  11191. $globals.Collection);
  11192. $core.addMethod(
  11193. $core.method({
  11194. selector: "remove:",
  11195. protocol: 'adding/removing',
  11196. fn: function (anObject){
  11197. var self=this;
  11198. return $core.withContext(function($ctx1) {
  11199. var $1;
  11200. $1=self._remove_ifAbsent_(anObject,(function(){
  11201. return $core.withContext(function($ctx2) {
  11202. return self._errorNotFound();
  11203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11204. }));
  11205. return $1;
  11206. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  11207. },
  11208. args: ["anObject"],
  11209. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  11210. referencedClasses: [],
  11211. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  11212. }),
  11213. $globals.Collection);
  11214. $core.addMethod(
  11215. $core.method({
  11216. selector: "remove:ifAbsent:",
  11217. protocol: 'adding/removing',
  11218. fn: function (anObject,aBlock){
  11219. var self=this;
  11220. return $core.withContext(function($ctx1) {
  11221. self._subclassResponsibility();
  11222. return self;
  11223. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  11224. },
  11225. args: ["anObject", "aBlock"],
  11226. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11227. referencedClasses: [],
  11228. messageSends: ["subclassResponsibility"]
  11229. }),
  11230. $globals.Collection);
  11231. $core.addMethod(
  11232. $core.method({
  11233. selector: "removeAll",
  11234. protocol: 'adding/removing',
  11235. fn: function (){
  11236. var self=this;
  11237. return $core.withContext(function($ctx1) {
  11238. self._subclassResponsibility();
  11239. return self;
  11240. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  11241. },
  11242. args: [],
  11243. source: "removeAll\x0a\x09self subclassResponsibility",
  11244. referencedClasses: [],
  11245. messageSends: ["subclassResponsibility"]
  11246. }),
  11247. $globals.Collection);
  11248. $core.addMethod(
  11249. $core.method({
  11250. selector: "select:",
  11251. protocol: 'enumerating',
  11252. fn: function (aBlock){
  11253. var self=this;
  11254. var stream;
  11255. return $core.withContext(function($ctx1) {
  11256. var $1,$2;
  11257. stream=$recv($recv(self._class())._new())._writeStream();
  11258. self._do_((function(each){
  11259. return $core.withContext(function($ctx2) {
  11260. $1=$recv(aBlock)._value_(each);
  11261. if($core.assert($1)){
  11262. return $recv(stream)._nextPut_(each);
  11263. };
  11264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11265. }));
  11266. $2=$recv(stream)._contents();
  11267. return $2;
  11268. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11269. },
  11270. args: ["aBlock"],
  11271. 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",
  11272. referencedClasses: [],
  11273. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11274. }),
  11275. $globals.Collection);
  11276. $core.addMethod(
  11277. $core.method({
  11278. selector: "select:thenCollect:",
  11279. protocol: 'enumerating',
  11280. fn: function (selectBlock,collectBlock){
  11281. var self=this;
  11282. var stream;
  11283. return $core.withContext(function($ctx1) {
  11284. var $1,$2;
  11285. stream=$recv($recv(self._class())._new())._writeStream();
  11286. self._do_((function(each){
  11287. return $core.withContext(function($ctx2) {
  11288. $1=$recv(selectBlock)._value_(each);
  11289. $ctx2.sendIdx["value:"]=1;
  11290. if($core.assert($1)){
  11291. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  11292. };
  11293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11294. }));
  11295. $2=$recv(stream)._contents();
  11296. return $2;
  11297. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  11298. },
  11299. args: ["selectBlock", "collectBlock"],
  11300. 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",
  11301. referencedClasses: [],
  11302. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11303. }),
  11304. $globals.Collection);
  11305. $core.addMethod(
  11306. $core.method({
  11307. selector: "size",
  11308. protocol: 'accessing',
  11309. fn: function (){
  11310. var self=this;
  11311. return $core.withContext(function($ctx1) {
  11312. self._subclassResponsibility();
  11313. return self;
  11314. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11315. },
  11316. args: [],
  11317. source: "size\x0a\x09self subclassResponsibility",
  11318. referencedClasses: [],
  11319. messageSends: ["subclassResponsibility"]
  11320. }),
  11321. $globals.Collection);
  11322. $core.addMethod(
  11323. $core.method({
  11324. selector: "classTag",
  11325. protocol: 'accessing',
  11326. fn: function (){
  11327. var self=this;
  11328. return "collection";
  11329. },
  11330. args: [],
  11331. 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'",
  11332. referencedClasses: [],
  11333. messageSends: []
  11334. }),
  11335. $globals.Collection.klass);
  11336. $core.addMethod(
  11337. $core.method({
  11338. selector: "new:",
  11339. protocol: 'instance creation',
  11340. fn: function (anInteger){
  11341. var self=this;
  11342. return $core.withContext(function($ctx1) {
  11343. var $1;
  11344. $1=self._new();
  11345. return $1;
  11346. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11347. },
  11348. args: ["anInteger"],
  11349. source: "new: anInteger\x0a\x09^ self new",
  11350. referencedClasses: [],
  11351. messageSends: ["new"]
  11352. }),
  11353. $globals.Collection.klass);
  11354. $core.addMethod(
  11355. $core.method({
  11356. selector: "with:",
  11357. protocol: 'instance creation',
  11358. fn: function (anObject){
  11359. var self=this;
  11360. return $core.withContext(function($ctx1) {
  11361. var $2,$3,$1;
  11362. $2=self._new();
  11363. $recv($2)._add_(anObject);
  11364. $3=$recv($2)._yourself();
  11365. $1=$3;
  11366. return $1;
  11367. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11368. },
  11369. args: ["anObject"],
  11370. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11371. referencedClasses: [],
  11372. messageSends: ["add:", "new", "yourself"]
  11373. }),
  11374. $globals.Collection.klass);
  11375. $core.addMethod(
  11376. $core.method({
  11377. selector: "with:with:",
  11378. protocol: 'instance creation',
  11379. fn: function (anObject,anotherObject){
  11380. var self=this;
  11381. return $core.withContext(function($ctx1) {
  11382. var $2,$3,$1;
  11383. $2=self._new();
  11384. $recv($2)._add_(anObject);
  11385. $ctx1.sendIdx["add:"]=1;
  11386. $recv($2)._add_(anotherObject);
  11387. $3=$recv($2)._yourself();
  11388. $1=$3;
  11389. return $1;
  11390. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11391. },
  11392. args: ["anObject", "anotherObject"],
  11393. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11394. referencedClasses: [],
  11395. messageSends: ["add:", "new", "yourself"]
  11396. }),
  11397. $globals.Collection.klass);
  11398. $core.addMethod(
  11399. $core.method({
  11400. selector: "with:with:with:",
  11401. protocol: 'instance creation',
  11402. fn: function (firstObject,secondObject,thirdObject){
  11403. var self=this;
  11404. return $core.withContext(function($ctx1) {
  11405. var $2,$3,$1;
  11406. $2=self._new();
  11407. $recv($2)._add_(firstObject);
  11408. $ctx1.sendIdx["add:"]=1;
  11409. $recv($2)._add_(secondObject);
  11410. $ctx1.sendIdx["add:"]=2;
  11411. $recv($2)._add_(thirdObject);
  11412. $3=$recv($2)._yourself();
  11413. $1=$3;
  11414. return $1;
  11415. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11416. },
  11417. args: ["firstObject", "secondObject", "thirdObject"],
  11418. 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",
  11419. referencedClasses: [],
  11420. messageSends: ["add:", "new", "yourself"]
  11421. }),
  11422. $globals.Collection.klass);
  11423. $core.addMethod(
  11424. $core.method({
  11425. selector: "withAll:",
  11426. protocol: 'instance creation',
  11427. fn: function (aCollection){
  11428. var self=this;
  11429. return $core.withContext(function($ctx1) {
  11430. var $2,$3,$1;
  11431. $2=self._new();
  11432. $recv($2)._addAll_(aCollection);
  11433. $3=$recv($2)._yourself();
  11434. $1=$3;
  11435. return $1;
  11436. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11437. },
  11438. args: ["aCollection"],
  11439. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11440. referencedClasses: [],
  11441. messageSends: ["addAll:", "new", "yourself"]
  11442. }),
  11443. $globals.Collection.klass);
  11444. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11445. $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.";
  11446. $core.addMethod(
  11447. $core.method({
  11448. selector: "at:",
  11449. protocol: 'accessing',
  11450. fn: function (anIndex){
  11451. var self=this;
  11452. return $core.withContext(function($ctx1) {
  11453. var $1;
  11454. $1=self._at_ifAbsent_(anIndex,(function(){
  11455. return $core.withContext(function($ctx2) {
  11456. return self._errorNotFound();
  11457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11458. }));
  11459. return $1;
  11460. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11461. },
  11462. args: ["anIndex"],
  11463. 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 ]",
  11464. referencedClasses: [],
  11465. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11466. }),
  11467. $globals.IndexableCollection);
  11468. $core.addMethod(
  11469. $core.method({
  11470. selector: "at:ifAbsent:",
  11471. protocol: 'accessing',
  11472. fn: function (anIndex,aBlock){
  11473. var self=this;
  11474. return $core.withContext(function($ctx1) {
  11475. self._subclassResponsibility();
  11476. return self;
  11477. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11478. },
  11479. args: ["anIndex", "aBlock"],
  11480. 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",
  11481. referencedClasses: [],
  11482. messageSends: ["subclassResponsibility"]
  11483. }),
  11484. $globals.IndexableCollection);
  11485. $core.addMethod(
  11486. $core.method({
  11487. selector: "at:ifAbsentPut:",
  11488. protocol: 'accessing',
  11489. fn: function (aKey,aBlock){
  11490. var self=this;
  11491. return $core.withContext(function($ctx1) {
  11492. var $1;
  11493. $1=self._at_ifAbsent_(aKey,(function(){
  11494. return $core.withContext(function($ctx2) {
  11495. return self._at_put_(aKey,$recv(aBlock)._value());
  11496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11497. }));
  11498. return $1;
  11499. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11500. },
  11501. args: ["aKey", "aBlock"],
  11502. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11503. referencedClasses: [],
  11504. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11505. }),
  11506. $globals.IndexableCollection);
  11507. $core.addMethod(
  11508. $core.method({
  11509. selector: "at:ifPresent:",
  11510. protocol: 'accessing',
  11511. fn: function (anIndex,aBlock){
  11512. var self=this;
  11513. return $core.withContext(function($ctx1) {
  11514. var $1;
  11515. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11516. return nil;
  11517. }));
  11518. return $1;
  11519. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11520. },
  11521. args: ["anIndex", "aBlock"],
  11522. 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 ]",
  11523. referencedClasses: [],
  11524. messageSends: ["at:ifPresent:ifAbsent:"]
  11525. }),
  11526. $globals.IndexableCollection);
  11527. $core.addMethod(
  11528. $core.method({
  11529. selector: "at:ifPresent:ifAbsent:",
  11530. protocol: 'accessing',
  11531. fn: function (anIndex,aBlock,anotherBlock){
  11532. var self=this;
  11533. return $core.withContext(function($ctx1) {
  11534. self._subclassResponsibility();
  11535. return self;
  11536. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11537. },
  11538. args: ["anIndex", "aBlock", "anotherBlock"],
  11539. 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",
  11540. referencedClasses: [],
  11541. messageSends: ["subclassResponsibility"]
  11542. }),
  11543. $globals.IndexableCollection);
  11544. $core.addMethod(
  11545. $core.method({
  11546. selector: "at:put:",
  11547. protocol: 'accessing',
  11548. fn: function (anIndex,anObject){
  11549. var self=this;
  11550. return $core.withContext(function($ctx1) {
  11551. self._subclassResponsibility();
  11552. return self;
  11553. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11554. },
  11555. args: ["anIndex", "anObject"],
  11556. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11557. referencedClasses: [],
  11558. messageSends: ["subclassResponsibility"]
  11559. }),
  11560. $globals.IndexableCollection);
  11561. $core.addMethod(
  11562. $core.method({
  11563. selector: "indexOf:",
  11564. protocol: 'accessing',
  11565. fn: function (anObject){
  11566. var self=this;
  11567. return $core.withContext(function($ctx1) {
  11568. var $1;
  11569. $1=self._indexOf_ifAbsent_(anObject,(function(){
  11570. return $core.withContext(function($ctx2) {
  11571. return self._errorNotFound();
  11572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11573. }));
  11574. return $1;
  11575. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  11576. },
  11577. args: ["anObject"],
  11578. 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 ]",
  11579. referencedClasses: [],
  11580. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  11581. }),
  11582. $globals.IndexableCollection);
  11583. $core.addMethod(
  11584. $core.method({
  11585. selector: "indexOf:ifAbsent:",
  11586. protocol: 'accessing',
  11587. fn: function (anObject,aBlock){
  11588. var self=this;
  11589. return $core.withContext(function($ctx1) {
  11590. self._subclassResponsibility();
  11591. return self;
  11592. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  11593. },
  11594. args: ["anObject", "aBlock"],
  11595. 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",
  11596. referencedClasses: [],
  11597. messageSends: ["subclassResponsibility"]
  11598. }),
  11599. $globals.IndexableCollection);
  11600. $core.addMethod(
  11601. $core.method({
  11602. selector: "with:do:",
  11603. protocol: 'enumerating',
  11604. fn: function (anotherCollection,aBlock){
  11605. var self=this;
  11606. return $core.withContext(function($ctx1) {
  11607. self._withIndexDo_((function(each,index){
  11608. return $core.withContext(function($ctx2) {
  11609. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  11610. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  11611. }));
  11612. return self;
  11613. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  11614. },
  11615. args: ["anotherCollection", "aBlock"],
  11616. 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) ]",
  11617. referencedClasses: [],
  11618. messageSends: ["withIndexDo:", "value:value:", "at:"]
  11619. }),
  11620. $globals.IndexableCollection);
  11621. $core.addMethod(
  11622. $core.method({
  11623. selector: "withIndexDo:",
  11624. protocol: 'enumerating',
  11625. fn: function (aBlock){
  11626. var self=this;
  11627. return $core.withContext(function($ctx1) {
  11628. self._subclassResponsibility();
  11629. return self;
  11630. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  11631. },
  11632. args: ["aBlock"],
  11633. 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",
  11634. referencedClasses: [],
  11635. messageSends: ["subclassResponsibility"]
  11636. }),
  11637. $globals.IndexableCollection);
  11638. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  11639. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  11640. $core.addMethod(
  11641. $core.method({
  11642. selector: "=",
  11643. protocol: 'comparing',
  11644. fn: function (anAssocitativeCollection){
  11645. var self=this;
  11646. return $core.withContext(function($ctx1) {
  11647. var $2,$1,$4,$3,$6,$5;
  11648. $2=self._class();
  11649. $ctx1.sendIdx["class"]=1;
  11650. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  11651. $ctx1.sendIdx["="]=1;
  11652. if(!$core.assert($1)){
  11653. return false;
  11654. };
  11655. $4=self._size();
  11656. $ctx1.sendIdx["size"]=1;
  11657. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  11658. $ctx1.sendIdx["="]=2;
  11659. if(!$core.assert($3)){
  11660. return false;
  11661. };
  11662. $6=self._associations();
  11663. $ctx1.sendIdx["associations"]=1;
  11664. $5=$recv($6).__eq($recv(anAssocitativeCollection)._associations());
  11665. return $5;
  11666. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  11667. },
  11668. args: ["anAssocitativeCollection"],
  11669. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  11670. referencedClasses: [],
  11671. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  11672. }),
  11673. $globals.AssociativeCollection);
  11674. $core.addMethod(
  11675. $core.method({
  11676. selector: "add:",
  11677. protocol: 'adding/removing',
  11678. fn: function (anAssociation){
  11679. var self=this;
  11680. return $core.withContext(function($ctx1) {
  11681. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  11682. return self;
  11683. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  11684. },
  11685. args: ["anAssociation"],
  11686. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11687. referencedClasses: [],
  11688. messageSends: ["at:put:", "key", "value"]
  11689. }),
  11690. $globals.AssociativeCollection);
  11691. $core.addMethod(
  11692. $core.method({
  11693. selector: "addAll:",
  11694. protocol: 'adding/removing',
  11695. fn: function (anAssociativeCollection){
  11696. var self=this;
  11697. return $core.withContext(function($ctx1) {
  11698. (
  11699. $ctx1.supercall = true,
  11700. $globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  11701. $ctx1.supercall = false;
  11702. return anAssociativeCollection;
  11703. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  11704. },
  11705. args: ["anAssociativeCollection"],
  11706. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  11707. referencedClasses: [],
  11708. messageSends: ["addAll:", "associations"]
  11709. }),
  11710. $globals.AssociativeCollection);
  11711. $core.addMethod(
  11712. $core.method({
  11713. selector: "asDictionary",
  11714. protocol: 'converting',
  11715. fn: function (){
  11716. var self=this;
  11717. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  11718. return $core.withContext(function($ctx1) {
  11719. var $1;
  11720. $1=$recv($Dictionary())._from_(self._associations());
  11721. return $1;
  11722. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  11723. },
  11724. args: [],
  11725. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  11726. referencedClasses: ["Dictionary"],
  11727. messageSends: ["from:", "associations"]
  11728. }),
  11729. $globals.AssociativeCollection);
  11730. $core.addMethod(
  11731. $core.method({
  11732. selector: "asHashedCollection",
  11733. protocol: 'converting',
  11734. fn: function (){
  11735. var self=this;
  11736. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11737. return $core.withContext(function($ctx1) {
  11738. var $1;
  11739. $1=$recv($HashedCollection())._from_(self._associations());
  11740. return $1;
  11741. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  11742. },
  11743. args: [],
  11744. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  11745. referencedClasses: ["HashedCollection"],
  11746. messageSends: ["from:", "associations"]
  11747. }),
  11748. $globals.AssociativeCollection);
  11749. $core.addMethod(
  11750. $core.method({
  11751. selector: "asJSON",
  11752. protocol: 'converting',
  11753. fn: function (){
  11754. var self=this;
  11755. var hash;
  11756. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11757. return $core.withContext(function($ctx1) {
  11758. var $1;
  11759. hash=$recv($HashedCollection())._new();
  11760. self._keysAndValuesDo_((function(key,value){
  11761. return $core.withContext(function($ctx2) {
  11762. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  11763. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11764. }));
  11765. $1=hash;
  11766. return $1;
  11767. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  11768. },
  11769. args: [],
  11770. 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",
  11771. referencedClasses: ["HashedCollection"],
  11772. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  11773. }),
  11774. $globals.AssociativeCollection);
  11775. $core.addMethod(
  11776. $core.method({
  11777. selector: "associations",
  11778. protocol: 'accessing',
  11779. fn: function (){
  11780. var self=this;
  11781. var associations;
  11782. return $core.withContext(function($ctx1) {
  11783. var $1;
  11784. associations=[];
  11785. self._associationsDo_((function(each){
  11786. return $core.withContext(function($ctx2) {
  11787. return $recv(associations)._add_(each);
  11788. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11789. }));
  11790. $1=associations;
  11791. return $1;
  11792. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  11793. },
  11794. args: [],
  11795. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  11796. referencedClasses: [],
  11797. messageSends: ["associationsDo:", "add:"]
  11798. }),
  11799. $globals.AssociativeCollection);
  11800. $core.addMethod(
  11801. $core.method({
  11802. selector: "associationsDo:",
  11803. protocol: 'enumerating',
  11804. fn: function (aBlock){
  11805. var self=this;
  11806. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  11807. return $core.withContext(function($ctx1) {
  11808. self._keysAndValuesDo_((function(key,value){
  11809. return $core.withContext(function($ctx2) {
  11810. return $recv(aBlock)._value_($recv($Association())._key_value_(key,value));
  11811. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11812. }));
  11813. return self;
  11814. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11815. },
  11816. args: ["aBlock"],
  11817. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  11818. referencedClasses: ["Association"],
  11819. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  11820. }),
  11821. $globals.AssociativeCollection);
  11822. $core.addMethod(
  11823. $core.method({
  11824. selector: "at:ifPresent:ifAbsent:",
  11825. protocol: 'accessing',
  11826. fn: function (aKey,aBlock,anotherBlock){
  11827. var self=this;
  11828. return $core.withContext(function($ctx1) {
  11829. var $2,$1;
  11830. $2=self._includesKey_(aKey);
  11831. if($core.assert($2)){
  11832. $1=$recv(aBlock)._value_(self._at_(aKey));
  11833. } else {
  11834. $1=$recv(anotherBlock)._value();
  11835. };
  11836. return $1;
  11837. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11838. },
  11839. args: ["aKey", "aBlock", "anotherBlock"],
  11840. 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 ]",
  11841. referencedClasses: [],
  11842. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  11843. }),
  11844. $globals.AssociativeCollection);
  11845. $core.addMethod(
  11846. $core.method({
  11847. selector: "collect:",
  11848. protocol: 'enumerating',
  11849. fn: function (aBlock){
  11850. var self=this;
  11851. var newDict;
  11852. return $core.withContext(function($ctx1) {
  11853. var $1;
  11854. newDict=$recv(self._class())._new();
  11855. self._keysAndValuesDo_((function(key,value){
  11856. return $core.withContext(function($ctx2) {
  11857. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  11858. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11859. }));
  11860. $1=newDict;
  11861. return $1;
  11862. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  11863. },
  11864. args: ["aBlock"],
  11865. 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",
  11866. referencedClasses: [],
  11867. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  11868. }),
  11869. $globals.AssociativeCollection);
  11870. $core.addMethod(
  11871. $core.method({
  11872. selector: "deepCopy",
  11873. protocol: 'copying',
  11874. fn: function (){
  11875. var self=this;
  11876. var copy;
  11877. return $core.withContext(function($ctx1) {
  11878. var $1;
  11879. copy=$recv(self._class())._new();
  11880. self._keysAndValuesDo_((function(key,value){
  11881. return $core.withContext(function($ctx2) {
  11882. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  11883. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11884. }));
  11885. $1=copy;
  11886. return $1;
  11887. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  11888. },
  11889. args: [],
  11890. 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",
  11891. referencedClasses: [],
  11892. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  11893. }),
  11894. $globals.AssociativeCollection);
  11895. $core.addMethod(
  11896. $core.method({
  11897. selector: "detect:ifNone:",
  11898. protocol: 'enumerating',
  11899. fn: function (aBlock,anotherBlock){
  11900. var self=this;
  11901. return $core.withContext(function($ctx1) {
  11902. var $1;
  11903. $1=$recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  11904. return $1;
  11905. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11906. },
  11907. args: ["aBlock", "anotherBlock"],
  11908. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  11909. referencedClasses: [],
  11910. messageSends: ["detect:ifNone:", "values"]
  11911. }),
  11912. $globals.AssociativeCollection);
  11913. $core.addMethod(
  11914. $core.method({
  11915. selector: "do:",
  11916. protocol: 'enumerating',
  11917. fn: function (aBlock){
  11918. var self=this;
  11919. return $core.withContext(function($ctx1) {
  11920. self._valuesDo_(aBlock);
  11921. return self;
  11922. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11923. },
  11924. args: ["aBlock"],
  11925. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  11926. referencedClasses: [],
  11927. messageSends: ["valuesDo:"]
  11928. }),
  11929. $globals.AssociativeCollection);
  11930. $core.addMethod(
  11931. $core.method({
  11932. selector: "includes:",
  11933. protocol: 'enumerating',
  11934. fn: function (anObject){
  11935. var self=this;
  11936. return $core.withContext(function($ctx1) {
  11937. var $1;
  11938. $1=$recv(self._values())._includes_(anObject);
  11939. return $1;
  11940. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  11941. },
  11942. args: ["anObject"],
  11943. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  11944. referencedClasses: [],
  11945. messageSends: ["includes:", "values"]
  11946. }),
  11947. $globals.AssociativeCollection);
  11948. $core.addMethod(
  11949. $core.method({
  11950. selector: "includesKey:",
  11951. protocol: 'testing',
  11952. fn: function (aKey){
  11953. var self=this;
  11954. return $core.withContext(function($ctx1) {
  11955. self._subclassResponsibility();
  11956. return self;
  11957. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  11958. },
  11959. args: ["aKey"],
  11960. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  11961. referencedClasses: [],
  11962. messageSends: ["subclassResponsibility"]
  11963. }),
  11964. $globals.AssociativeCollection);
  11965. $core.addMethod(
  11966. $core.method({
  11967. selector: "indexOf:ifAbsent:",
  11968. protocol: 'accessing',
  11969. fn: function (anObject,aBlock){
  11970. var self=this;
  11971. return $core.withContext(function($ctx1) {
  11972. var $1;
  11973. $1=$recv(self._keys())._detect_ifNone_((function(each){
  11974. return $core.withContext(function($ctx2) {
  11975. return $recv(self._at_(each)).__eq(anObject);
  11976. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11977. }),aBlock);
  11978. return $1;
  11979. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  11980. },
  11981. args: ["anObject", "aBlock"],
  11982. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  11983. referencedClasses: [],
  11984. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  11985. }),
  11986. $globals.AssociativeCollection);
  11987. $core.addMethod(
  11988. $core.method({
  11989. selector: "keyAtValue:",
  11990. protocol: 'accessing',
  11991. fn: function (anObject){
  11992. var self=this;
  11993. return $core.withContext(function($ctx1) {
  11994. var $1;
  11995. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  11996. return $core.withContext(function($ctx2) {
  11997. return self._errorNotFound();
  11998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11999. }));
  12000. return $1;
  12001. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  12002. },
  12003. args: ["anObject"],
  12004. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  12005. referencedClasses: [],
  12006. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  12007. }),
  12008. $globals.AssociativeCollection);
  12009. $core.addMethod(
  12010. $core.method({
  12011. selector: "keyAtValue:ifAbsent:",
  12012. protocol: 'accessing',
  12013. fn: function (anObject,aBlock){
  12014. var self=this;
  12015. return $core.withContext(function($ctx1) {
  12016. var $1;
  12017. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  12018. return $1;
  12019. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12020. },
  12021. args: ["anObject", "aBlock"],
  12022. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  12023. referencedClasses: [],
  12024. messageSends: ["indexOf:ifAbsent:"]
  12025. }),
  12026. $globals.AssociativeCollection);
  12027. $core.addMethod(
  12028. $core.method({
  12029. selector: "keys",
  12030. protocol: 'accessing',
  12031. fn: function (){
  12032. var self=this;
  12033. return $core.withContext(function($ctx1) {
  12034. self._subclassResponsibility();
  12035. return self;
  12036. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  12037. },
  12038. args: [],
  12039. source: "keys\x0a\x09self subclassResponsibility",
  12040. referencedClasses: [],
  12041. messageSends: ["subclassResponsibility"]
  12042. }),
  12043. $globals.AssociativeCollection);
  12044. $core.addMethod(
  12045. $core.method({
  12046. selector: "keysAndValuesDo:",
  12047. protocol: 'enumerating',
  12048. fn: function (aBlock){
  12049. var self=this;
  12050. return $core.withContext(function($ctx1) {
  12051. self._keysDo_((function(each){
  12052. return $core.withContext(function($ctx2) {
  12053. return $recv(aBlock)._value_value_(each,self._at_(each));
  12054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12055. }));
  12056. return self;
  12057. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12058. },
  12059. args: ["aBlock"],
  12060. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  12061. referencedClasses: [],
  12062. messageSends: ["keysDo:", "value:value:", "at:"]
  12063. }),
  12064. $globals.AssociativeCollection);
  12065. $core.addMethod(
  12066. $core.method({
  12067. selector: "keysDo:",
  12068. protocol: 'enumerating',
  12069. fn: function (aBlock){
  12070. var self=this;
  12071. return $core.withContext(function($ctx1) {
  12072. self._subclassResponsibility();
  12073. return self;
  12074. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12075. },
  12076. args: ["aBlock"],
  12077. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  12078. referencedClasses: [],
  12079. messageSends: ["subclassResponsibility"]
  12080. }),
  12081. $globals.AssociativeCollection);
  12082. $core.addMethod(
  12083. $core.method({
  12084. selector: "printOn:",
  12085. protocol: 'printing',
  12086. fn: function (aStream){
  12087. var self=this;
  12088. return $core.withContext(function($ctx1) {
  12089. (
  12090. $ctx1.supercall = true,
  12091. $globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  12092. $ctx1.supercall = false;
  12093. $ctx1.sendIdx["printOn:"]=1;
  12094. $recv(aStream)._nextPutAll_(" (");
  12095. $ctx1.sendIdx["nextPutAll:"]=1;
  12096. $recv(self._associations())._do_separatedBy_((function(each){
  12097. return $core.withContext(function($ctx2) {
  12098. return $recv(each)._printOn_(aStream);
  12099. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12100. }),(function(){
  12101. return $core.withContext(function($ctx2) {
  12102. return $recv(aStream)._nextPutAll_(" , ");
  12103. $ctx2.sendIdx["nextPutAll:"]=2;
  12104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12105. }));
  12106. $recv(aStream)._nextPutAll_(")");
  12107. return self;
  12108. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  12109. },
  12110. args: ["aStream"],
  12111. 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: ')'",
  12112. referencedClasses: [],
  12113. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  12114. }),
  12115. $globals.AssociativeCollection);
  12116. $core.addMethod(
  12117. $core.method({
  12118. selector: "remove:ifAbsent:",
  12119. protocol: 'adding/removing',
  12120. fn: function (aKey,aBlock){
  12121. var self=this;
  12122. return $core.withContext(function($ctx1) {
  12123. var $1;
  12124. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  12125. return $1;
  12126. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12127. },
  12128. args: ["aKey", "aBlock"],
  12129. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  12130. referencedClasses: [],
  12131. messageSends: ["removeKey:ifAbsent:"]
  12132. }),
  12133. $globals.AssociativeCollection);
  12134. $core.addMethod(
  12135. $core.method({
  12136. selector: "removeAll",
  12137. protocol: 'adding/removing',
  12138. fn: function (){
  12139. var self=this;
  12140. return $core.withContext(function($ctx1) {
  12141. var $1;
  12142. $1=$recv(self._keys())._do_((function(each){
  12143. return $core.withContext(function($ctx2) {
  12144. return self._removeKey_(each);
  12145. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12146. }));
  12147. return $1;
  12148. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  12149. },
  12150. args: [],
  12151. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  12152. referencedClasses: [],
  12153. messageSends: ["do:", "keys", "removeKey:"]
  12154. }),
  12155. $globals.AssociativeCollection);
  12156. $core.addMethod(
  12157. $core.method({
  12158. selector: "removeKey:",
  12159. protocol: 'adding/removing',
  12160. fn: function (aKey){
  12161. var self=this;
  12162. return $core.withContext(function($ctx1) {
  12163. var $1;
  12164. $1=self._remove_(aKey);
  12165. return $1;
  12166. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12167. },
  12168. args: ["aKey"],
  12169. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  12170. referencedClasses: [],
  12171. messageSends: ["remove:"]
  12172. }),
  12173. $globals.AssociativeCollection);
  12174. $core.addMethod(
  12175. $core.method({
  12176. selector: "removeKey:ifAbsent:",
  12177. protocol: 'adding/removing',
  12178. fn: function (aKey,aBlock){
  12179. var self=this;
  12180. return $core.withContext(function($ctx1) {
  12181. self._subclassResponsibility();
  12182. return self;
  12183. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12184. },
  12185. args: ["aKey", "aBlock"],
  12186. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  12187. referencedClasses: [],
  12188. messageSends: ["subclassResponsibility"]
  12189. }),
  12190. $globals.AssociativeCollection);
  12191. $core.addMethod(
  12192. $core.method({
  12193. selector: "select:",
  12194. protocol: 'enumerating',
  12195. fn: function (aBlock){
  12196. var self=this;
  12197. var newDict;
  12198. return $core.withContext(function($ctx1) {
  12199. var $1,$2;
  12200. newDict=$recv(self._class())._new();
  12201. self._keysAndValuesDo_((function(key,value){
  12202. return $core.withContext(function($ctx2) {
  12203. $1=$recv(aBlock)._value_(value);
  12204. if($core.assert($1)){
  12205. return $recv(newDict)._at_put_(key,value);
  12206. };
  12207. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12208. }));
  12209. $2=newDict;
  12210. return $2;
  12211. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12212. },
  12213. args: ["aBlock"],
  12214. 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",
  12215. referencedClasses: [],
  12216. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  12217. }),
  12218. $globals.AssociativeCollection);
  12219. $core.addMethod(
  12220. $core.method({
  12221. selector: "shallowCopy",
  12222. protocol: 'copying',
  12223. fn: function (){
  12224. var self=this;
  12225. var copy;
  12226. return $core.withContext(function($ctx1) {
  12227. var $1;
  12228. copy=$recv(self._class())._new();
  12229. self._keysAndValuesDo_((function(key,value){
  12230. return $core.withContext(function($ctx2) {
  12231. return $recv(copy)._at_put_(key,value);
  12232. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12233. }));
  12234. $1=copy;
  12235. return $1;
  12236. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  12237. },
  12238. args: [],
  12239. 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",
  12240. referencedClasses: [],
  12241. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  12242. }),
  12243. $globals.AssociativeCollection);
  12244. $core.addMethod(
  12245. $core.method({
  12246. selector: "size",
  12247. protocol: 'accessing',
  12248. fn: function (){
  12249. var self=this;
  12250. return $core.withContext(function($ctx1) {
  12251. var $1;
  12252. $1=$recv(self._keys())._size();
  12253. return $1;
  12254. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  12255. },
  12256. args: [],
  12257. source: "size\x0a\x09^ self keys size",
  12258. referencedClasses: [],
  12259. messageSends: ["size", "keys"]
  12260. }),
  12261. $globals.AssociativeCollection);
  12262. $core.addMethod(
  12263. $core.method({
  12264. selector: "values",
  12265. protocol: 'accessing',
  12266. fn: function (){
  12267. var self=this;
  12268. return $core.withContext(function($ctx1) {
  12269. self._subclassResponsibility();
  12270. return self;
  12271. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  12272. },
  12273. args: [],
  12274. source: "values\x0a\x09self subclassResponsibility",
  12275. referencedClasses: [],
  12276. messageSends: ["subclassResponsibility"]
  12277. }),
  12278. $globals.AssociativeCollection);
  12279. $core.addMethod(
  12280. $core.method({
  12281. selector: "valuesDo:",
  12282. protocol: 'enumerating',
  12283. fn: function (aBlock){
  12284. var self=this;
  12285. return $core.withContext(function($ctx1) {
  12286. self._subclassResponsibility();
  12287. return self;
  12288. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12289. },
  12290. args: ["aBlock"],
  12291. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  12292. referencedClasses: [],
  12293. messageSends: ["subclassResponsibility"]
  12294. }),
  12295. $globals.AssociativeCollection);
  12296. $core.addMethod(
  12297. $core.method({
  12298. selector: "withIndexDo:",
  12299. protocol: 'enumerating',
  12300. fn: function (aBlock){
  12301. var self=this;
  12302. return $core.withContext(function($ctx1) {
  12303. self._keysAndValuesDo_((function(key,value){
  12304. return $core.withContext(function($ctx2) {
  12305. return $recv(aBlock)._value_value_(value,key);
  12306. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12307. }));
  12308. return self;
  12309. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12310. },
  12311. args: ["aBlock"],
  12312. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  12313. referencedClasses: [],
  12314. messageSends: ["keysAndValuesDo:", "value:value:"]
  12315. }),
  12316. $globals.AssociativeCollection);
  12317. $core.addMethod(
  12318. $core.method({
  12319. selector: "from:",
  12320. protocol: 'instance creation',
  12321. fn: function (aCollection){
  12322. var self=this;
  12323. var newCollection;
  12324. return $core.withContext(function($ctx1) {
  12325. var $1;
  12326. newCollection=self._new();
  12327. $recv(aCollection)._do_((function(each){
  12328. return $core.withContext(function($ctx2) {
  12329. return $recv(newCollection)._add_(each);
  12330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12331. }));
  12332. $1=newCollection;
  12333. return $1;
  12334. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12335. },
  12336. args: ["aCollection"],
  12337. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  12338. referencedClasses: [],
  12339. messageSends: ["new", "do:", "add:"]
  12340. }),
  12341. $globals.AssociativeCollection.klass);
  12342. $core.addMethod(
  12343. $core.method({
  12344. selector: "fromPairs:",
  12345. protocol: 'instance creation',
  12346. fn: function (aCollection){
  12347. var self=this;
  12348. return $core.withContext(function($ctx1) {
  12349. var $1;
  12350. $1=self._from_(aCollection);
  12351. return $1;
  12352. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12353. },
  12354. args: ["aCollection"],
  12355. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12356. referencedClasses: [],
  12357. messageSends: ["from:"]
  12358. }),
  12359. $globals.AssociativeCollection.klass);
  12360. $core.addMethod(
  12361. $core.method({
  12362. selector: "newFromPairs:",
  12363. protocol: 'instance creation',
  12364. fn: function (aCollection){
  12365. var self=this;
  12366. var newCollection;
  12367. return $core.withContext(function($ctx1) {
  12368. var $2,$1,$3,$4,$5;
  12369. $2=$recv(aCollection)._size();
  12370. $ctx1.sendIdx["size"]=1;
  12371. $1=$recv($2)._even();
  12372. if(!$core.assert($1)){
  12373. self._error_("#newFromPairs only accepts arrays of an even length");
  12374. };
  12375. newCollection=self._new();
  12376. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12377. return $core.withContext(function($ctx2) {
  12378. $3=newCollection;
  12379. $4=$recv(aCollection)._at_(each);
  12380. $ctx2.sendIdx["at:"]=1;
  12381. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12383. }));
  12384. $5=newCollection;
  12385. return $5;
  12386. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12387. },
  12388. args: ["aCollection"],
  12389. 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",
  12390. referencedClasses: [],
  12391. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12392. }),
  12393. $globals.AssociativeCollection.klass);
  12394. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12395. $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.";
  12396. $core.addMethod(
  12397. $core.method({
  12398. selector: "at:ifAbsent:",
  12399. protocol: 'accessing',
  12400. fn: function (aKey,aBlock){
  12401. var self=this;
  12402. return $core.withContext(function($ctx1) {
  12403. var index = self._positionOfKey_(aKey);
  12404. return index >=0 ? self['@values'][index] : aBlock._value();
  12405. ;
  12406. return self;
  12407. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12408. },
  12409. args: ["aKey", "aBlock"],
  12410. 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>",
  12411. referencedClasses: [],
  12412. messageSends: []
  12413. }),
  12414. $globals.Dictionary);
  12415. $core.addMethod(
  12416. $core.method({
  12417. selector: "at:put:",
  12418. protocol: 'accessing',
  12419. fn: function (aKey,aValue){
  12420. var self=this;
  12421. return $core.withContext(function($ctx1) {
  12422. var index = self._positionOfKey_(aKey);
  12423. if(index === -1) {
  12424. var keys = self['@keys'];
  12425. index = keys.length;
  12426. keys.push(aKey);
  12427. }
  12428. return self['@values'][index] = aValue;
  12429. ;
  12430. return self;
  12431. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12432. },
  12433. args: ["aKey", "aValue"],
  12434. 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>",
  12435. referencedClasses: [],
  12436. messageSends: []
  12437. }),
  12438. $globals.Dictionary);
  12439. $core.addMethod(
  12440. $core.method({
  12441. selector: "includesKey:",
  12442. protocol: 'testing',
  12443. fn: function (aKey){
  12444. var self=this;
  12445. return $core.withContext(function($ctx1) {
  12446. return self._positionOfKey_(aKey) >= 0; ;
  12447. return self;
  12448. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12449. },
  12450. args: ["aKey"],
  12451. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  12452. referencedClasses: [],
  12453. messageSends: []
  12454. }),
  12455. $globals.Dictionary);
  12456. $core.addMethod(
  12457. $core.method({
  12458. selector: "indexOf:ifAbsent:",
  12459. protocol: 'accessing',
  12460. fn: function (anObject,aBlock){
  12461. var self=this;
  12462. var index;
  12463. return $core.withContext(function($ctx1) {
  12464. var $2,$1;
  12465. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12466. return (0);
  12467. }));
  12468. $2=$recv(index).__eq((0));
  12469. if($core.assert($2)){
  12470. $1=$recv(aBlock)._value();
  12471. } else {
  12472. $1=$recv(self["@keys"])._at_(index);
  12473. };
  12474. return $1;
  12475. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12476. },
  12477. args: ["anObject", "aBlock"],
  12478. 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 ]",
  12479. referencedClasses: [],
  12480. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12481. }),
  12482. $globals.Dictionary);
  12483. $core.addMethod(
  12484. $core.method({
  12485. selector: "initialize",
  12486. protocol: 'initialization',
  12487. fn: function (){
  12488. var self=this;
  12489. return $core.withContext(function($ctx1) {
  12490. (
  12491. $ctx1.supercall = true,
  12492. $globals.Dictionary.superclass.fn.prototype._initialize.apply($recv(self), []));
  12493. $ctx1.supercall = false;
  12494. self["@keys"]=[];
  12495. self["@values"]=[];
  12496. return self;
  12497. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12498. },
  12499. args: [],
  12500. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12501. referencedClasses: [],
  12502. messageSends: ["initialize"]
  12503. }),
  12504. $globals.Dictionary);
  12505. $core.addMethod(
  12506. $core.method({
  12507. selector: "keys",
  12508. protocol: 'accessing',
  12509. fn: function (){
  12510. var self=this;
  12511. return $core.withContext(function($ctx1) {
  12512. var $1;
  12513. $1=$recv(self["@keys"])._copy();
  12514. return $1;
  12515. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12516. },
  12517. args: [],
  12518. source: "keys\x0a\x09^ keys copy",
  12519. referencedClasses: [],
  12520. messageSends: ["copy"]
  12521. }),
  12522. $globals.Dictionary);
  12523. $core.addMethod(
  12524. $core.method({
  12525. selector: "keysAndValuesDo:",
  12526. protocol: 'enumerating',
  12527. fn: function (aBlock){
  12528. var self=this;
  12529. return $core.withContext(function($ctx1) {
  12530. var $1;
  12531. $1=$recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12532. return $1;
  12533. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12534. },
  12535. args: ["aBlock"],
  12536. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12537. referencedClasses: [],
  12538. messageSends: ["with:do:"]
  12539. }),
  12540. $globals.Dictionary);
  12541. $core.addMethod(
  12542. $core.method({
  12543. selector: "keysDo:",
  12544. protocol: 'enumerating',
  12545. fn: function (aBlock){
  12546. var self=this;
  12547. return $core.withContext(function($ctx1) {
  12548. var $1;
  12549. $1=$recv(self["@keys"])._do_(aBlock);
  12550. return $1;
  12551. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12552. },
  12553. args: ["aBlock"],
  12554. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12555. referencedClasses: [],
  12556. messageSends: ["do:"]
  12557. }),
  12558. $globals.Dictionary);
  12559. $core.addMethod(
  12560. $core.method({
  12561. selector: "positionOfKey:",
  12562. protocol: 'private',
  12563. fn: function (anObject){
  12564. var self=this;
  12565. return $core.withContext(function($ctx1) {
  12566. var keys = self['@keys'];
  12567. for(var i=0;i<keys.length;i++){
  12568. if(keys[i].__eq(anObject)) { return i;}
  12569. }
  12570. return -1;
  12571. ;
  12572. return self;
  12573. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12574. },
  12575. args: ["anObject"],
  12576. 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>",
  12577. referencedClasses: [],
  12578. messageSends: []
  12579. }),
  12580. $globals.Dictionary);
  12581. $core.addMethod(
  12582. $core.method({
  12583. selector: "removeAll",
  12584. protocol: 'adding/removing',
  12585. fn: function (){
  12586. var self=this;
  12587. return $core.withContext(function($ctx1) {
  12588. $recv(self["@keys"])._removeAll();
  12589. $ctx1.sendIdx["removeAll"]=1;
  12590. $recv(self["@values"])._removeAll();
  12591. return self;
  12592. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12593. },
  12594. args: [],
  12595. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12596. referencedClasses: [],
  12597. messageSends: ["removeAll"]
  12598. }),
  12599. $globals.Dictionary);
  12600. $core.addMethod(
  12601. $core.method({
  12602. selector: "removeKey:ifAbsent:",
  12603. protocol: 'adding/removing',
  12604. fn: function (aKey,aBlock){
  12605. var self=this;
  12606. return $core.withContext(function($ctx1) {
  12607. var index = self._positionOfKey_(aKey);
  12608. if(index === -1) {
  12609. return aBlock._value()
  12610. } else {
  12611. var keys = self['@keys'], values = self['@values'];
  12612. var value = values[index], l = keys.length;
  12613. keys[index] = keys[l-1];
  12614. keys.pop();
  12615. values[index] = values[l-1];
  12616. values.pop();
  12617. return value;
  12618. }
  12619. ;
  12620. return self;
  12621. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12622. },
  12623. args: ["aKey", "aBlock"],
  12624. 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>",
  12625. referencedClasses: [],
  12626. messageSends: []
  12627. }),
  12628. $globals.Dictionary);
  12629. $core.addMethod(
  12630. $core.method({
  12631. selector: "values",
  12632. protocol: 'accessing',
  12633. fn: function (){
  12634. var self=this;
  12635. var $1;
  12636. $1=self["@values"];
  12637. return $1;
  12638. },
  12639. args: [],
  12640. source: "values\x0a\x09^ values",
  12641. referencedClasses: [],
  12642. messageSends: []
  12643. }),
  12644. $globals.Dictionary);
  12645. $core.addMethod(
  12646. $core.method({
  12647. selector: "valuesDo:",
  12648. protocol: 'enumerating',
  12649. fn: function (aBlock){
  12650. var self=this;
  12651. return $core.withContext(function($ctx1) {
  12652. var $1;
  12653. $1=$recv(self["@values"])._do_(aBlock);
  12654. return $1;
  12655. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12656. },
  12657. args: ["aBlock"],
  12658. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  12659. referencedClasses: [],
  12660. messageSends: ["do:"]
  12661. }),
  12662. $globals.Dictionary);
  12663. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  12664. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  12665. $core.addMethod(
  12666. $core.method({
  12667. selector: "at:ifAbsent:",
  12668. protocol: 'accessing',
  12669. fn: function (aKey,aBlock){
  12670. var self=this;
  12671. return $core.withContext(function($ctx1) {
  12672. var $2,$1;
  12673. $2=self._includesKey_(aKey);
  12674. if($core.assert($2)){
  12675. $1=self._basicAt_(aKey);
  12676. } else {
  12677. $1=$recv(aBlock)._value();
  12678. };
  12679. return $1;
  12680. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12681. },
  12682. args: ["aKey", "aBlock"],
  12683. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  12684. referencedClasses: [],
  12685. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  12686. }),
  12687. $globals.HashedCollection);
  12688. $core.addMethod(
  12689. $core.method({
  12690. selector: "at:put:",
  12691. protocol: 'accessing',
  12692. fn: function (aKey,aValue){
  12693. var self=this;
  12694. return $core.withContext(function($ctx1) {
  12695. var $1;
  12696. $1=self._basicAt_put_(aKey,aValue);
  12697. return $1;
  12698. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  12699. },
  12700. args: ["aKey", "aValue"],
  12701. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  12702. referencedClasses: [],
  12703. messageSends: ["basicAt:put:"]
  12704. }),
  12705. $globals.HashedCollection);
  12706. $core.addMethod(
  12707. $core.method({
  12708. selector: "includesKey:",
  12709. protocol: 'testing',
  12710. fn: function (aKey){
  12711. var self=this;
  12712. return $core.withContext(function($ctx1) {
  12713. return self.hasOwnProperty(aKey);
  12714. return self;
  12715. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  12716. },
  12717. args: ["aKey"],
  12718. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  12719. referencedClasses: [],
  12720. messageSends: []
  12721. }),
  12722. $globals.HashedCollection);
  12723. $core.addMethod(
  12724. $core.method({
  12725. selector: "keys",
  12726. protocol: 'accessing',
  12727. fn: function (){
  12728. var self=this;
  12729. return $core.withContext(function($ctx1) {
  12730. return Object.keys(self);
  12731. return self;
  12732. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  12733. },
  12734. args: [],
  12735. source: "keys\x0a\x09<return Object.keys(self)>",
  12736. referencedClasses: [],
  12737. messageSends: []
  12738. }),
  12739. $globals.HashedCollection);
  12740. $core.addMethod(
  12741. $core.method({
  12742. selector: "keysDo:",
  12743. protocol: 'enumerating',
  12744. fn: function (aBlock){
  12745. var self=this;
  12746. return $core.withContext(function($ctx1) {
  12747. $recv(self._keys())._do_(aBlock);
  12748. return self;
  12749. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12750. },
  12751. args: ["aBlock"],
  12752. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  12753. referencedClasses: [],
  12754. messageSends: ["do:", "keys"]
  12755. }),
  12756. $globals.HashedCollection);
  12757. $core.addMethod(
  12758. $core.method({
  12759. selector: "removeKey:ifAbsent:",
  12760. protocol: 'adding/removing',
  12761. fn: function (aKey,aBlock){
  12762. var self=this;
  12763. return $core.withContext(function($ctx1) {
  12764. var $1;
  12765. $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  12766. return $core.withContext(function($ctx2) {
  12767. self._basicDelete_(aKey);
  12768. return removed;
  12769. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  12770. }),(function(){
  12771. return $core.withContext(function($ctx2) {
  12772. return $recv(aBlock)._value();
  12773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12774. }));
  12775. return $1;
  12776. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12777. },
  12778. args: ["aKey", "aBlock"],
  12779. 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 ]",
  12780. referencedClasses: [],
  12781. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  12782. }),
  12783. $globals.HashedCollection);
  12784. $core.addMethod(
  12785. $core.method({
  12786. selector: "values",
  12787. protocol: 'accessing',
  12788. fn: function (){
  12789. var self=this;
  12790. return $core.withContext(function($ctx1) {
  12791. return self._keys().map(function(key){
  12792. return self._at_(key);
  12793. });
  12794. ;
  12795. return self;
  12796. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  12797. },
  12798. args: [],
  12799. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  12800. referencedClasses: [],
  12801. messageSends: []
  12802. }),
  12803. $globals.HashedCollection);
  12804. $core.addMethod(
  12805. $core.method({
  12806. selector: "valuesDo:",
  12807. protocol: 'enumerating',
  12808. fn: function (aBlock){
  12809. var self=this;
  12810. return $core.withContext(function($ctx1) {
  12811. $recv(self._values())._do_(aBlock);
  12812. return self;
  12813. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12814. },
  12815. args: ["aBlock"],
  12816. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  12817. referencedClasses: [],
  12818. messageSends: ["do:", "values"]
  12819. }),
  12820. $globals.HashedCollection);
  12821. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12822. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  12823. $core.addMethod(
  12824. $core.method({
  12825. selector: "=",
  12826. protocol: 'comparing',
  12827. fn: function (aCollection){
  12828. var self=this;
  12829. return $core.withContext(function($ctx1) {
  12830. var $3,$2,$4,$1,$5;
  12831. var $early={};
  12832. try {
  12833. $3=self._class();
  12834. $ctx1.sendIdx["class"]=1;
  12835. $2=$recv($3).__eq($recv(aCollection)._class());
  12836. $ctx1.sendIdx["="]=1;
  12837. $1=$recv($2)._and_((function(){
  12838. return $core.withContext(function($ctx2) {
  12839. $4=self._size();
  12840. $ctx2.sendIdx["size"]=1;
  12841. return $recv($4).__eq($recv(aCollection)._size());
  12842. $ctx2.sendIdx["="]=2;
  12843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12844. }));
  12845. if(!$core.assert($1)){
  12846. return false;
  12847. };
  12848. self._withIndexDo_((function(each,i){
  12849. return $core.withContext(function($ctx2) {
  12850. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  12851. if(!$core.assert($5)){
  12852. throw $early=[false];
  12853. };
  12854. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  12855. }));
  12856. return true;
  12857. }
  12858. catch(e) {if(e===$early)return e[0]; throw e}
  12859. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  12860. },
  12861. args: ["aCollection"],
  12862. 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",
  12863. referencedClasses: [],
  12864. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  12865. }),
  12866. $globals.SequenceableCollection);
  12867. $core.addMethod(
  12868. $core.method({
  12869. selector: "addLast:",
  12870. protocol: 'adding/removing',
  12871. fn: function (anObject){
  12872. var self=this;
  12873. return $core.withContext(function($ctx1) {
  12874. self._add_(anObject);
  12875. return self;
  12876. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  12877. },
  12878. args: ["anObject"],
  12879. source: "addLast: anObject\x0a\x09self add: anObject",
  12880. referencedClasses: [],
  12881. messageSends: ["add:"]
  12882. }),
  12883. $globals.SequenceableCollection);
  12884. $core.addMethod(
  12885. $core.method({
  12886. selector: "allButFirst",
  12887. protocol: 'accessing',
  12888. fn: function (){
  12889. var self=this;
  12890. return $core.withContext(function($ctx1) {
  12891. var $1;
  12892. $1=self._copyFrom_to_((2),self._size());
  12893. return $1;
  12894. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  12895. },
  12896. args: [],
  12897. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  12898. referencedClasses: [],
  12899. messageSends: ["copyFrom:to:", "size"]
  12900. }),
  12901. $globals.SequenceableCollection);
  12902. $core.addMethod(
  12903. $core.method({
  12904. selector: "allButLast",
  12905. protocol: 'accessing',
  12906. fn: function (){
  12907. var self=this;
  12908. return $core.withContext(function($ctx1) {
  12909. var $1;
  12910. $1=self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  12911. return $1;
  12912. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  12913. },
  12914. args: [],
  12915. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  12916. referencedClasses: [],
  12917. messageSends: ["copyFrom:to:", "-", "size"]
  12918. }),
  12919. $globals.SequenceableCollection);
  12920. $core.addMethod(
  12921. $core.method({
  12922. selector: "atRandom",
  12923. protocol: 'accessing',
  12924. fn: function (){
  12925. var self=this;
  12926. return $core.withContext(function($ctx1) {
  12927. var $1;
  12928. $1=self._at_($recv(self._size())._atRandom());
  12929. return $1;
  12930. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  12931. },
  12932. args: [],
  12933. source: "atRandom\x0a\x09^ self at: self size atRandom",
  12934. referencedClasses: [],
  12935. messageSends: ["at:", "atRandom", "size"]
  12936. }),
  12937. $globals.SequenceableCollection);
  12938. $core.addMethod(
  12939. $core.method({
  12940. selector: "beginsWith:",
  12941. protocol: 'testing',
  12942. fn: function (prefix){
  12943. var self=this;
  12944. return $core.withContext(function($ctx1) {
  12945. var $2,$3,$1,$4;
  12946. $2=self._size();
  12947. $ctx1.sendIdx["size"]=1;
  12948. $3=$recv(prefix)._size();
  12949. $ctx1.sendIdx["size"]=2;
  12950. $1=$recv($2).__lt($3);
  12951. if($core.assert($1)){
  12952. return false;
  12953. };
  12954. $4=$recv(self._first_($recv(prefix)._size())).__eq(prefix);
  12955. return $4;
  12956. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  12957. },
  12958. args: ["prefix"],
  12959. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  12960. referencedClasses: [],
  12961. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  12962. }),
  12963. $globals.SequenceableCollection);
  12964. $core.addMethod(
  12965. $core.method({
  12966. selector: "copyFrom:to:",
  12967. protocol: 'copying',
  12968. fn: function (anIndex,anotherIndex){
  12969. var self=this;
  12970. var range,newCollection;
  12971. return $core.withContext(function($ctx1) {
  12972. var $1;
  12973. range=$recv(anIndex)._to_(anotherIndex);
  12974. newCollection=$recv(self._class())._new_($recv(range)._size());
  12975. $recv(range)._withIndexDo_((function(each,i){
  12976. return $core.withContext(function($ctx2) {
  12977. return $recv(newCollection)._at_put_(i,self._at_(each));
  12978. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  12979. }));
  12980. $1=newCollection;
  12981. return $1;
  12982. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},$globals.SequenceableCollection)});
  12983. },
  12984. args: ["anIndex", "anotherIndex"],
  12985. 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",
  12986. referencedClasses: [],
  12987. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"]
  12988. }),
  12989. $globals.SequenceableCollection);
  12990. $core.addMethod(
  12991. $core.method({
  12992. selector: "deepCopy",
  12993. protocol: 'copying',
  12994. fn: function (){
  12995. var self=this;
  12996. var newCollection;
  12997. return $core.withContext(function($ctx1) {
  12998. var $1;
  12999. newCollection=$recv(self._class())._new_(self._size());
  13000. self._withIndexDo_((function(each,index){
  13001. return $core.withContext(function($ctx2) {
  13002. return $recv(newCollection)._at_put_(index,$recv(each)._deepCopy());
  13003. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  13004. }));
  13005. $1=newCollection;
  13006. return $1;
  13007. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},$globals.SequenceableCollection)});
  13008. },
  13009. args: [],
  13010. 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",
  13011. referencedClasses: [],
  13012. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"]
  13013. }),
  13014. $globals.SequenceableCollection);
  13015. $core.addMethod(
  13016. $core.method({
  13017. selector: "detect:ifNone:",
  13018. protocol: 'enumerating',
  13019. fn: function (aBlock,anotherBlock){
  13020. var self=this;
  13021. return $core.withContext(function($ctx1) {
  13022. self = self._numericallyIndexable();
  13023. for(var i = 0; i < self.length; i++)
  13024. if(aBlock._value_(self[i]))
  13025. return self[i];
  13026. return anotherBlock._value();
  13027. ;
  13028. return self;
  13029. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  13030. },
  13031. args: ["aBlock", "anotherBlock"],
  13032. 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>",
  13033. referencedClasses: [],
  13034. messageSends: []
  13035. }),
  13036. $globals.SequenceableCollection);
  13037. $core.addMethod(
  13038. $core.method({
  13039. selector: "do:",
  13040. protocol: 'enumerating',
  13041. fn: function (aBlock){
  13042. var self=this;
  13043. return $core.withContext(function($ctx1) {
  13044. self = self._numericallyIndexable();
  13045. for(var i=0; i < self.length; i++) {
  13046. aBlock._value_(self[i]);
  13047. }
  13048. ;
  13049. return self;
  13050. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13051. },
  13052. args: ["aBlock"],
  13053. 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>",
  13054. referencedClasses: [],
  13055. messageSends: []
  13056. }),
  13057. $globals.SequenceableCollection);
  13058. $core.addMethod(
  13059. $core.method({
  13060. selector: "endsWith:",
  13061. protocol: 'testing',
  13062. fn: function (suffix){
  13063. var self=this;
  13064. return $core.withContext(function($ctx1) {
  13065. var $2,$3,$1,$4;
  13066. $2=self._size();
  13067. $ctx1.sendIdx["size"]=1;
  13068. $3=$recv(suffix)._size();
  13069. $ctx1.sendIdx["size"]=2;
  13070. $1=$recv($2).__lt($3);
  13071. if($core.assert($1)){
  13072. return false;
  13073. };
  13074. $4=$recv(self._last_($recv(suffix)._size())).__eq(suffix);
  13075. return $4;
  13076. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  13077. },
  13078. args: ["suffix"],
  13079. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  13080. referencedClasses: [],
  13081. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  13082. }),
  13083. $globals.SequenceableCollection);
  13084. $core.addMethod(
  13085. $core.method({
  13086. selector: "first",
  13087. protocol: 'accessing',
  13088. fn: function (){
  13089. var self=this;
  13090. return $core.withContext(function($ctx1) {
  13091. var $1;
  13092. $1=self._at_((1));
  13093. return $1;
  13094. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  13095. },
  13096. args: [],
  13097. source: "first\x0a\x09^ self at: 1",
  13098. referencedClasses: [],
  13099. messageSends: ["at:"]
  13100. }),
  13101. $globals.SequenceableCollection);
  13102. $core.addMethod(
  13103. $core.method({
  13104. selector: "first:",
  13105. protocol: 'accessing',
  13106. fn: function (aNumber){
  13107. var self=this;
  13108. return $core.withContext(function($ctx1) {
  13109. var $1,$2;
  13110. $1=$recv(self._size()).__lt(aNumber);
  13111. if($core.assert($1)){
  13112. self._error_("Invalid number of elements");
  13113. };
  13114. $2=self._copyFrom_to_((1),aNumber);
  13115. return $2;
  13116. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13117. },
  13118. args: ["aNumber"],
  13119. 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",
  13120. referencedClasses: [],
  13121. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  13122. }),
  13123. $globals.SequenceableCollection);
  13124. $core.addMethod(
  13125. $core.method({
  13126. selector: "fourth",
  13127. protocol: 'accessing',
  13128. fn: function (){
  13129. var self=this;
  13130. return $core.withContext(function($ctx1) {
  13131. var $1;
  13132. $1=self._at_((4));
  13133. return $1;
  13134. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  13135. },
  13136. args: [],
  13137. source: "fourth\x0a\x09^ self at: 4",
  13138. referencedClasses: [],
  13139. messageSends: ["at:"]
  13140. }),
  13141. $globals.SequenceableCollection);
  13142. $core.addMethod(
  13143. $core.method({
  13144. selector: "includes:",
  13145. protocol: 'testing',
  13146. fn: function (anObject){
  13147. var self=this;
  13148. return $core.withContext(function($ctx1) {
  13149. var $1;
  13150. $1=$recv(self._indexOf_ifAbsent_(anObject,(function(){
  13151. return nil;
  13152. })))._notNil();
  13153. return $1;
  13154. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  13155. },
  13156. args: ["anObject"],
  13157. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  13158. referencedClasses: [],
  13159. messageSends: ["notNil", "indexOf:ifAbsent:"]
  13160. }),
  13161. $globals.SequenceableCollection);
  13162. $core.addMethod(
  13163. $core.method({
  13164. selector: "indexOf:ifAbsent:",
  13165. protocol: 'accessing',
  13166. fn: function (anObject,aBlock){
  13167. var self=this;
  13168. return $core.withContext(function($ctx1) {
  13169. self = self._numericallyIndexable();
  13170. for(var i=0; i < self.length; i++) {
  13171. if($recv(self[i]).__eq(anObject)) {return i+1}
  13172. };
  13173. return aBlock._value();
  13174. ;
  13175. return self;
  13176. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  13177. },
  13178. args: ["anObject", "aBlock"],
  13179. 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>",
  13180. referencedClasses: [],
  13181. messageSends: []
  13182. }),
  13183. $globals.SequenceableCollection);
  13184. $core.addMethod(
  13185. $core.method({
  13186. selector: "indexOf:startingAt:",
  13187. protocol: 'accessing',
  13188. fn: function (anObject,start){
  13189. var self=this;
  13190. return $core.withContext(function($ctx1) {
  13191. var $1;
  13192. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  13193. return (0);
  13194. }));
  13195. return $1;
  13196. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  13197. },
  13198. args: ["anObject", "start"],
  13199. 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 ]",
  13200. referencedClasses: [],
  13201. messageSends: ["indexOf:startingAt:ifAbsent:"]
  13202. }),
  13203. $globals.SequenceableCollection);
  13204. $core.addMethod(
  13205. $core.method({
  13206. selector: "indexOf:startingAt:ifAbsent:",
  13207. protocol: 'accessing',
  13208. fn: function (anObject,start,aBlock){
  13209. var self=this;
  13210. return $core.withContext(function($ctx1) {
  13211. self = self._numericallyIndexable();
  13212. for(var i=start - 1; i < self.length; i++){
  13213. if($recv(self[i]).__eq(anObject)) {return i+1}
  13214. }
  13215. return aBlock._value();
  13216. ;
  13217. return self;
  13218. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  13219. },
  13220. args: ["anObject", "start", "aBlock"],
  13221. 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>",
  13222. referencedClasses: [],
  13223. messageSends: []
  13224. }),
  13225. $globals.SequenceableCollection);
  13226. $core.addMethod(
  13227. $core.method({
  13228. selector: "last",
  13229. protocol: 'accessing',
  13230. fn: function (){
  13231. var self=this;
  13232. return $core.withContext(function($ctx1) {
  13233. var $1;
  13234. $1=self._at_(self._size());
  13235. return $1;
  13236. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  13237. },
  13238. args: [],
  13239. source: "last\x0a\x09^ self at: self size",
  13240. referencedClasses: [],
  13241. messageSends: ["at:", "size"]
  13242. }),
  13243. $globals.SequenceableCollection);
  13244. $core.addMethod(
  13245. $core.method({
  13246. selector: "last:",
  13247. protocol: 'accessing',
  13248. fn: function (aNumber){
  13249. var self=this;
  13250. return $core.withContext(function($ctx1) {
  13251. var $2,$1,$6,$5,$4,$3;
  13252. $2=self._size();
  13253. $ctx1.sendIdx["size"]=1;
  13254. $1=$recv($2).__lt(aNumber);
  13255. if($core.assert($1)){
  13256. self._error_("Invalid number of elements");
  13257. };
  13258. $6=self._size();
  13259. $ctx1.sendIdx["size"]=2;
  13260. $5=$recv($6).__minus(aNumber);
  13261. $4=$recv($5).__plus((1));
  13262. $3=self._copyFrom_to_($4,self._size());
  13263. return $3;
  13264. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13265. },
  13266. args: ["aNumber"],
  13267. 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",
  13268. referencedClasses: [],
  13269. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  13270. }),
  13271. $globals.SequenceableCollection);
  13272. $core.addMethod(
  13273. $core.method({
  13274. selector: "newStream",
  13275. protocol: 'streaming',
  13276. fn: function (){
  13277. var self=this;
  13278. return $core.withContext(function($ctx1) {
  13279. var $1;
  13280. $1=$recv(self._streamClass())._on_(self);
  13281. return $1;
  13282. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  13283. },
  13284. args: [],
  13285. source: "newStream\x0a\x09^ self streamClass on: self",
  13286. referencedClasses: [],
  13287. messageSends: ["on:", "streamClass"]
  13288. }),
  13289. $globals.SequenceableCollection);
  13290. $core.addMethod(
  13291. $core.method({
  13292. selector: "numericallyIndexable",
  13293. protocol: 'private',
  13294. fn: function (){
  13295. var self=this;
  13296. return $core.withContext(function($ctx1) {
  13297. self._subclassResponsibility();
  13298. return self;
  13299. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  13300. },
  13301. args: [],
  13302. 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",
  13303. referencedClasses: [],
  13304. messageSends: ["subclassResponsibility"]
  13305. }),
  13306. $globals.SequenceableCollection);
  13307. $core.addMethod(
  13308. $core.method({
  13309. selector: "readStream",
  13310. protocol: 'streaming',
  13311. fn: function (){
  13312. var self=this;
  13313. return $core.withContext(function($ctx1) {
  13314. var $1;
  13315. $1=self._stream();
  13316. return $1;
  13317. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  13318. },
  13319. args: [],
  13320. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13321. referencedClasses: [],
  13322. messageSends: ["stream"]
  13323. }),
  13324. $globals.SequenceableCollection);
  13325. $core.addMethod(
  13326. $core.method({
  13327. selector: "removeLast",
  13328. protocol: 'adding/removing',
  13329. fn: function (){
  13330. var self=this;
  13331. return $core.withContext(function($ctx1) {
  13332. var $1;
  13333. $1=self._remove_(self._last());
  13334. return $1;
  13335. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  13336. },
  13337. args: [],
  13338. source: "removeLast\x0a\x09^ self remove: self last",
  13339. referencedClasses: [],
  13340. messageSends: ["remove:", "last"]
  13341. }),
  13342. $globals.SequenceableCollection);
  13343. $core.addMethod(
  13344. $core.method({
  13345. selector: "reversed",
  13346. protocol: 'converting',
  13347. fn: function (){
  13348. var self=this;
  13349. return $core.withContext(function($ctx1) {
  13350. self._subclassResponsibility();
  13351. return self;
  13352. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  13353. },
  13354. args: [],
  13355. source: "reversed\x0a\x09self subclassResponsibility",
  13356. referencedClasses: [],
  13357. messageSends: ["subclassResponsibility"]
  13358. }),
  13359. $globals.SequenceableCollection);
  13360. $core.addMethod(
  13361. $core.method({
  13362. selector: "second",
  13363. protocol: 'accessing',
  13364. fn: function (){
  13365. var self=this;
  13366. return $core.withContext(function($ctx1) {
  13367. var $1;
  13368. $1=self._at_((2));
  13369. return $1;
  13370. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  13371. },
  13372. args: [],
  13373. source: "second\x0a\x09^ self at: 2",
  13374. referencedClasses: [],
  13375. messageSends: ["at:"]
  13376. }),
  13377. $globals.SequenceableCollection);
  13378. $core.addMethod(
  13379. $core.method({
  13380. selector: "shallowCopy",
  13381. protocol: 'copying',
  13382. fn: function (){
  13383. var self=this;
  13384. var newCollection;
  13385. return $core.withContext(function($ctx1) {
  13386. var $1;
  13387. newCollection=$recv(self._class())._new_(self._size());
  13388. self._withIndexDo_((function(each,index){
  13389. return $core.withContext(function($ctx2) {
  13390. return $recv(newCollection)._at_put_(index,each);
  13391. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  13392. }));
  13393. $1=newCollection;
  13394. return $1;
  13395. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},$globals.SequenceableCollection)});
  13396. },
  13397. args: [],
  13398. 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",
  13399. referencedClasses: [],
  13400. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"]
  13401. }),
  13402. $globals.SequenceableCollection);
  13403. $core.addMethod(
  13404. $core.method({
  13405. selector: "stream",
  13406. protocol: 'streaming',
  13407. fn: function (){
  13408. var self=this;
  13409. return $core.withContext(function($ctx1) {
  13410. var $1;
  13411. $1=self._newStream();
  13412. return $1;
  13413. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  13414. },
  13415. args: [],
  13416. source: "stream\x0a\x09^ self newStream",
  13417. referencedClasses: [],
  13418. messageSends: ["newStream"]
  13419. }),
  13420. $globals.SequenceableCollection);
  13421. $core.addMethod(
  13422. $core.method({
  13423. selector: "streamClass",
  13424. protocol: 'streaming',
  13425. fn: function (){
  13426. var self=this;
  13427. return $core.withContext(function($ctx1) {
  13428. var $1;
  13429. $1=$recv(self._class())._streamClass();
  13430. return $1;
  13431. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  13432. },
  13433. args: [],
  13434. source: "streamClass\x0a\x09^ self class streamClass",
  13435. referencedClasses: [],
  13436. messageSends: ["streamClass", "class"]
  13437. }),
  13438. $globals.SequenceableCollection);
  13439. $core.addMethod(
  13440. $core.method({
  13441. selector: "third",
  13442. protocol: 'accessing',
  13443. fn: function (){
  13444. var self=this;
  13445. return $core.withContext(function($ctx1) {
  13446. var $1;
  13447. $1=self._at_((3));
  13448. return $1;
  13449. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  13450. },
  13451. args: [],
  13452. source: "third\x0a\x09^ self at: 3",
  13453. referencedClasses: [],
  13454. messageSends: ["at:"]
  13455. }),
  13456. $globals.SequenceableCollection);
  13457. $core.addMethod(
  13458. $core.method({
  13459. selector: "with:do:",
  13460. protocol: 'enumerating',
  13461. fn: function (anotherCollection,aBlock){
  13462. var self=this;
  13463. return $core.withContext(function($ctx1) {
  13464. self = self._numericallyIndexable();
  13465. anotherCollection = anotherCollection._numericallyIndexable();
  13466. for(var i=0; i<self.length; i++) {
  13467. aBlock._value_value_(self[i], anotherCollection[i]);
  13468. }
  13469. ;
  13470. return self;
  13471. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13472. },
  13473. args: ["anotherCollection", "aBlock"],
  13474. 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>",
  13475. referencedClasses: [],
  13476. messageSends: []
  13477. }),
  13478. $globals.SequenceableCollection);
  13479. $core.addMethod(
  13480. $core.method({
  13481. selector: "withIndexDo:",
  13482. protocol: 'enumerating',
  13483. fn: function (aBlock){
  13484. var self=this;
  13485. return $core.withContext(function($ctx1) {
  13486. self = self._numericallyIndexable();
  13487. for(var i=0; i < self.length; i++) {
  13488. aBlock._value_value_(self[i], i+1);
  13489. }
  13490. ;
  13491. return self;
  13492. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13493. },
  13494. args: ["aBlock"],
  13495. 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>",
  13496. referencedClasses: [],
  13497. messageSends: []
  13498. }),
  13499. $globals.SequenceableCollection);
  13500. $core.addMethod(
  13501. $core.method({
  13502. selector: "writeStream",
  13503. protocol: 'streaming',
  13504. fn: function (){
  13505. var self=this;
  13506. return $core.withContext(function($ctx1) {
  13507. var $1;
  13508. $1=self._stream();
  13509. return $1;
  13510. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13511. },
  13512. args: [],
  13513. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13514. referencedClasses: [],
  13515. messageSends: ["stream"]
  13516. }),
  13517. $globals.SequenceableCollection);
  13518. $core.addMethod(
  13519. $core.method({
  13520. selector: "streamClass",
  13521. protocol: 'accessing',
  13522. fn: function (){
  13523. var self=this;
  13524. function $Stream(){return $globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  13525. return $Stream();
  13526. },
  13527. args: [],
  13528. source: "streamClass\x0a\x09\x09^ Stream",
  13529. referencedClasses: ["Stream"],
  13530. messageSends: []
  13531. }),
  13532. $globals.SequenceableCollection.klass);
  13533. $core.addMethod(
  13534. $core.method({
  13535. selector: "streamContents:",
  13536. protocol: 'streaming',
  13537. fn: function (aBlock){
  13538. var self=this;
  13539. var stream;
  13540. return $core.withContext(function($ctx1) {
  13541. var $1;
  13542. stream=$recv(self._streamClass())._on_(self._new());
  13543. $recv(aBlock)._value_(stream);
  13544. $1=$recv(stream)._contents();
  13545. return $1;
  13546. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13547. },
  13548. args: ["aBlock"],
  13549. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13550. referencedClasses: [],
  13551. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13552. }),
  13553. $globals.SequenceableCollection.klass);
  13554. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13555. $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`.";
  13556. $core.addMethod(
  13557. $core.method({
  13558. selector: "add:",
  13559. protocol: 'adding/removing',
  13560. fn: function (anObject){
  13561. var self=this;
  13562. return $core.withContext(function($ctx1) {
  13563. self.push(anObject); return anObject;;
  13564. return self;
  13565. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13566. },
  13567. args: ["anObject"],
  13568. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  13569. referencedClasses: [],
  13570. messageSends: []
  13571. }),
  13572. $globals.Array);
  13573. $core.addMethod(
  13574. $core.method({
  13575. selector: "addFirst:",
  13576. protocol: 'adding/removing',
  13577. fn: function (anObject){
  13578. var self=this;
  13579. return $core.withContext(function($ctx1) {
  13580. self.unshift(anObject); return anObject;;
  13581. return self;
  13582. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13583. },
  13584. args: ["anObject"],
  13585. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  13586. referencedClasses: [],
  13587. messageSends: []
  13588. }),
  13589. $globals.Array);
  13590. $core.addMethod(
  13591. $core.method({
  13592. selector: "asJavascript",
  13593. protocol: 'converting',
  13594. fn: function (){
  13595. var self=this;
  13596. return $core.withContext(function($ctx1) {
  13597. var $1;
  13598. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13599. return $core.withContext(function($ctx2) {
  13600. return $recv(each)._asJavascript();
  13601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13602. })))._join_(", "))).__comma("]");
  13603. $ctx1.sendIdx[","]=1;
  13604. return $1;
  13605. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13606. },
  13607. args: [],
  13608. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13609. referencedClasses: [],
  13610. messageSends: [",", "join:", "collect:", "asJavascript"]
  13611. }),
  13612. $globals.Array);
  13613. $core.addMethod(
  13614. $core.method({
  13615. selector: "at:ifAbsent:",
  13616. protocol: 'accessing',
  13617. fn: function (anIndex,aBlock){
  13618. var self=this;
  13619. return $core.withContext(function($ctx1) {
  13620. return anIndex >= 1 && anIndex <= self.length
  13621. ? self[anIndex - 1]
  13622. : aBlock._value()
  13623. ;
  13624. return self;
  13625. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13626. },
  13627. args: ["anIndex", "aBlock"],
  13628. 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>",
  13629. referencedClasses: [],
  13630. messageSends: []
  13631. }),
  13632. $globals.Array);
  13633. $core.addMethod(
  13634. $core.method({
  13635. selector: "at:ifPresent:ifAbsent:",
  13636. protocol: 'accessing',
  13637. fn: function (anIndex,aBlock,anotherBlock){
  13638. var self=this;
  13639. return $core.withContext(function($ctx1) {
  13640. return anIndex >= 1 && anIndex <= self.length
  13641. ? aBlock._value_(self[anIndex - 1])
  13642. : anotherBlock._value()
  13643. ;
  13644. return self;
  13645. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13646. },
  13647. args: ["anIndex", "aBlock", "anotherBlock"],
  13648. 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>",
  13649. referencedClasses: [],
  13650. messageSends: []
  13651. }),
  13652. $globals.Array);
  13653. $core.addMethod(
  13654. $core.method({
  13655. selector: "at:put:",
  13656. protocol: 'accessing',
  13657. fn: function (anIndex,anObject){
  13658. var self=this;
  13659. return $core.withContext(function($ctx1) {
  13660. return self[anIndex - 1] = anObject;
  13661. return self;
  13662. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13663. },
  13664. args: ["anIndex", "anObject"],
  13665. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  13666. referencedClasses: [],
  13667. messageSends: []
  13668. }),
  13669. $globals.Array);
  13670. $core.addMethod(
  13671. $core.method({
  13672. selector: "collect:",
  13673. protocol: 'enumerating',
  13674. fn: function (aBlock){
  13675. var self=this;
  13676. return $core.withContext(function($ctx1) {
  13677. return self.map(function(each) {return aBlock._value_(each)});
  13678. return self;
  13679. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13680. },
  13681. args: ["aBlock"],
  13682. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  13683. referencedClasses: [],
  13684. messageSends: []
  13685. }),
  13686. $globals.Array);
  13687. $core.addMethod(
  13688. $core.method({
  13689. selector: "join:",
  13690. protocol: 'enumerating',
  13691. fn: function (aString){
  13692. var self=this;
  13693. return $core.withContext(function($ctx1) {
  13694. return self.join(aString);
  13695. return self;
  13696. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  13697. },
  13698. args: ["aString"],
  13699. source: "join: aString\x0a\x09<return self.join(aString)>",
  13700. referencedClasses: [],
  13701. messageSends: []
  13702. }),
  13703. $globals.Array);
  13704. $core.addMethod(
  13705. $core.method({
  13706. selector: "numericallyIndexable",
  13707. protocol: 'private',
  13708. fn: function (){
  13709. var self=this;
  13710. return self;
  13711. },
  13712. args: [],
  13713. source: "numericallyIndexable\x0a\x09^ self",
  13714. referencedClasses: [],
  13715. messageSends: []
  13716. }),
  13717. $globals.Array);
  13718. $core.addMethod(
  13719. $core.method({
  13720. selector: "printOn:",
  13721. protocol: 'printing',
  13722. fn: function (aStream){
  13723. var self=this;
  13724. return $core.withContext(function($ctx1) {
  13725. (
  13726. $ctx1.supercall = true,
  13727. $globals.Array.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  13728. $ctx1.supercall = false;
  13729. $ctx1.sendIdx["printOn:"]=1;
  13730. $recv(aStream)._nextPutAll_(" (");
  13731. $ctx1.sendIdx["nextPutAll:"]=1;
  13732. self._do_separatedBy_((function(each){
  13733. return $core.withContext(function($ctx2) {
  13734. return $recv(each)._printOn_(aStream);
  13735. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13736. }),(function(){
  13737. return $core.withContext(function($ctx2) {
  13738. return $recv(aStream)._nextPutAll_(" ");
  13739. $ctx2.sendIdx["nextPutAll:"]=2;
  13740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13741. }));
  13742. $recv(aStream)._nextPutAll_(")");
  13743. return self;
  13744. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  13745. },
  13746. args: ["aStream"],
  13747. 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: ')'",
  13748. referencedClasses: [],
  13749. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13750. }),
  13751. $globals.Array);
  13752. $core.addMethod(
  13753. $core.method({
  13754. selector: "remove:ifAbsent:",
  13755. protocol: 'adding/removing',
  13756. fn: function (anObject,aBlock){
  13757. var self=this;
  13758. var index;
  13759. return $core.withContext(function($ctx1) {
  13760. var $2,$1;
  13761. index=self._indexOf_ifAbsent_(anObject,(function(){
  13762. return (0);
  13763. }));
  13764. $2=$recv(index).__eq((0));
  13765. if($core.assert($2)){
  13766. $1=$recv(aBlock)._value();
  13767. } else {
  13768. self._removeIndex_(index);
  13769. $1=anObject;
  13770. };
  13771. return $1;
  13772. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  13773. },
  13774. args: ["anObject", "aBlock"],
  13775. 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 ]",
  13776. referencedClasses: [],
  13777. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  13778. }),
  13779. $globals.Array);
  13780. $core.addMethod(
  13781. $core.method({
  13782. selector: "removeAll",
  13783. protocol: 'adding/removing',
  13784. fn: function (){
  13785. var self=this;
  13786. return $core.withContext(function($ctx1) {
  13787. self.length = 0;
  13788. return self;
  13789. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  13790. },
  13791. args: [],
  13792. source: "removeAll\x0a\x09<self.length = 0>",
  13793. referencedClasses: [],
  13794. messageSends: []
  13795. }),
  13796. $globals.Array);
  13797. $core.addMethod(
  13798. $core.method({
  13799. selector: "removeFrom:to:",
  13800. protocol: 'adding/removing',
  13801. fn: function (aNumber,anotherNumber){
  13802. var self=this;
  13803. return $core.withContext(function($ctx1) {
  13804. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  13805. return self;
  13806. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  13807. },
  13808. args: ["aNumber", "anotherNumber"],
  13809. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  13810. referencedClasses: [],
  13811. messageSends: []
  13812. }),
  13813. $globals.Array);
  13814. $core.addMethod(
  13815. $core.method({
  13816. selector: "removeIndex:",
  13817. protocol: 'adding/removing',
  13818. fn: function (anInteger){
  13819. var self=this;
  13820. return $core.withContext(function($ctx1) {
  13821. self.splice(anInteger - 1, 1);
  13822. return self;
  13823. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  13824. },
  13825. args: ["anInteger"],
  13826. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  13827. referencedClasses: [],
  13828. messageSends: []
  13829. }),
  13830. $globals.Array);
  13831. $core.addMethod(
  13832. $core.method({
  13833. selector: "removeLast",
  13834. protocol: 'adding/removing',
  13835. fn: function (){
  13836. var self=this;
  13837. return $core.withContext(function($ctx1) {
  13838. return self.pop();;
  13839. return self;
  13840. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  13841. },
  13842. args: [],
  13843. source: "removeLast\x0a\x09<return self.pop();>",
  13844. referencedClasses: [],
  13845. messageSends: []
  13846. }),
  13847. $globals.Array);
  13848. $core.addMethod(
  13849. $core.method({
  13850. selector: "reversed",
  13851. protocol: 'converting',
  13852. fn: function (){
  13853. var self=this;
  13854. return $core.withContext(function($ctx1) {
  13855. return self._copy().reverse();
  13856. return self;
  13857. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  13858. },
  13859. args: [],
  13860. source: "reversed\x0a\x09<return self._copy().reverse()>",
  13861. referencedClasses: [],
  13862. messageSends: []
  13863. }),
  13864. $globals.Array);
  13865. $core.addMethod(
  13866. $core.method({
  13867. selector: "select:",
  13868. protocol: 'enumerating',
  13869. fn: function (aBlock){
  13870. var self=this;
  13871. return $core.withContext(function($ctx1) {
  13872. var result = self.klass._new();
  13873. for(var i=0; i<self.length; i++) {
  13874. if(aBlock._value_(self[i])) {
  13875. result.push(self[i]);
  13876. }
  13877. }
  13878. return result;
  13879. ;
  13880. return self;
  13881. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  13882. },
  13883. args: ["aBlock"],
  13884. 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>",
  13885. referencedClasses: [],
  13886. messageSends: []
  13887. }),
  13888. $globals.Array);
  13889. $core.addMethod(
  13890. $core.method({
  13891. selector: "size",
  13892. protocol: 'accessing',
  13893. fn: function (){
  13894. var self=this;
  13895. return $core.withContext(function($ctx1) {
  13896. return self.length;
  13897. return self;
  13898. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  13899. },
  13900. args: [],
  13901. source: "size\x0a\x09<return self.length>",
  13902. referencedClasses: [],
  13903. messageSends: []
  13904. }),
  13905. $globals.Array);
  13906. $core.addMethod(
  13907. $core.method({
  13908. selector: "sort",
  13909. protocol: 'enumerating',
  13910. fn: function (){
  13911. var self=this;
  13912. return $core.withContext(function($ctx1) {
  13913. var $1;
  13914. $1=self._sort_((function(a,b){
  13915. return $core.withContext(function($ctx2) {
  13916. return $recv(a).__lt(b);
  13917. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  13918. }));
  13919. return $1;
  13920. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  13921. },
  13922. args: [],
  13923. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  13924. referencedClasses: [],
  13925. messageSends: ["sort:", "<"]
  13926. }),
  13927. $globals.Array);
  13928. $core.addMethod(
  13929. $core.method({
  13930. selector: "sort:",
  13931. protocol: 'enumerating',
  13932. fn: function (aBlock){
  13933. var self=this;
  13934. return $core.withContext(function($ctx1) {
  13935. return self.sort(function(a, b) {
  13936. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  13937. })
  13938. ;
  13939. return self;
  13940. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  13941. },
  13942. args: ["aBlock"],
  13943. 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>",
  13944. referencedClasses: [],
  13945. messageSends: []
  13946. }),
  13947. $globals.Array);
  13948. $core.addMethod(
  13949. $core.method({
  13950. selector: "sorted",
  13951. protocol: 'enumerating',
  13952. fn: function (){
  13953. var self=this;
  13954. return $core.withContext(function($ctx1) {
  13955. var $1;
  13956. $1=$recv(self._copy())._sort();
  13957. return $1;
  13958. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  13959. },
  13960. args: [],
  13961. source: "sorted\x0a\x09^ self copy sort",
  13962. referencedClasses: [],
  13963. messageSends: ["sort", "copy"]
  13964. }),
  13965. $globals.Array);
  13966. $core.addMethod(
  13967. $core.method({
  13968. selector: "sorted:",
  13969. protocol: 'enumerating',
  13970. fn: function (aBlock){
  13971. var self=this;
  13972. return $core.withContext(function($ctx1) {
  13973. var $1;
  13974. $1=$recv(self._copy())._sort_(aBlock);
  13975. return $1;
  13976. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  13977. },
  13978. args: ["aBlock"],
  13979. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  13980. referencedClasses: [],
  13981. messageSends: ["sort:", "copy"]
  13982. }),
  13983. $globals.Array);
  13984. $core.addMethod(
  13985. $core.method({
  13986. selector: "new:",
  13987. protocol: 'instance creation',
  13988. fn: function (anInteger){
  13989. var self=this;
  13990. return $core.withContext(function($ctx1) {
  13991. return new Array(anInteger);
  13992. return self;
  13993. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  13994. },
  13995. args: ["anInteger"],
  13996. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  13997. referencedClasses: [],
  13998. messageSends: []
  13999. }),
  14000. $globals.Array.klass);
  14001. $core.addMethod(
  14002. $core.method({
  14003. selector: "with:",
  14004. protocol: 'instance creation',
  14005. fn: function (anObject){
  14006. var self=this;
  14007. return $core.withContext(function($ctx1) {
  14008. var $2,$3,$1;
  14009. $2=self._new_((1));
  14010. $recv($2)._at_put_((1),anObject);
  14011. $3=$recv($2)._yourself();
  14012. $1=$3;
  14013. return $1;
  14014. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  14015. },
  14016. args: ["anObject"],
  14017. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  14018. referencedClasses: [],
  14019. messageSends: ["at:put:", "new:", "yourself"]
  14020. }),
  14021. $globals.Array.klass);
  14022. $core.addMethod(
  14023. $core.method({
  14024. selector: "with:with:",
  14025. protocol: 'instance creation',
  14026. fn: function (anObject,anObject2){
  14027. var self=this;
  14028. return $core.withContext(function($ctx1) {
  14029. var $2,$3,$1;
  14030. $2=self._new_((2));
  14031. $recv($2)._at_put_((1),anObject);
  14032. $ctx1.sendIdx["at:put:"]=1;
  14033. $recv($2)._at_put_((2),anObject2);
  14034. $3=$recv($2)._yourself();
  14035. $1=$3;
  14036. return $1;
  14037. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  14038. },
  14039. args: ["anObject", "anObject2"],
  14040. 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",
  14041. referencedClasses: [],
  14042. messageSends: ["at:put:", "new:", "yourself"]
  14043. }),
  14044. $globals.Array.klass);
  14045. $core.addMethod(
  14046. $core.method({
  14047. selector: "with:with:with:",
  14048. protocol: 'instance creation',
  14049. fn: function (anObject,anObject2,anObject3){
  14050. var self=this;
  14051. return $core.withContext(function($ctx1) {
  14052. var $2,$3,$1;
  14053. $2=self._new_((3));
  14054. $recv($2)._at_put_((1),anObject);
  14055. $ctx1.sendIdx["at:put:"]=1;
  14056. $recv($2)._at_put_((2),anObject2);
  14057. $ctx1.sendIdx["at:put:"]=2;
  14058. $recv($2)._at_put_((3),anObject3);
  14059. $3=$recv($2)._yourself();
  14060. $1=$3;
  14061. return $1;
  14062. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  14063. },
  14064. args: ["anObject", "anObject2", "anObject3"],
  14065. 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",
  14066. referencedClasses: [],
  14067. messageSends: ["at:put:", "new:", "yourself"]
  14068. }),
  14069. $globals.Array.klass);
  14070. $core.addMethod(
  14071. $core.method({
  14072. selector: "withAll:",
  14073. protocol: 'instance creation',
  14074. fn: function (aCollection){
  14075. var self=this;
  14076. var instance,index;
  14077. return $core.withContext(function($ctx1) {
  14078. var $1;
  14079. index=(1);
  14080. instance=self._new_($recv(aCollection)._size());
  14081. $recv(aCollection)._do_((function(each){
  14082. return $core.withContext(function($ctx2) {
  14083. $recv(instance)._at_put_(index,each);
  14084. index=$recv(index).__plus((1));
  14085. return index;
  14086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14087. }));
  14088. $1=instance;
  14089. return $1;
  14090. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  14091. },
  14092. args: ["aCollection"],
  14093. 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",
  14094. referencedClasses: [],
  14095. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  14096. }),
  14097. $globals.Array.klass);
  14098. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  14099. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  14100. $core.addMethod(
  14101. $core.method({
  14102. selector: ",",
  14103. protocol: 'copying',
  14104. fn: function (aString){
  14105. var self=this;
  14106. return $core.withContext(function($ctx1) {
  14107. var $2,$1;
  14108. $2=self._asString();
  14109. $ctx1.sendIdx["asString"]=1;
  14110. $1=$recv($2).__comma($recv(aString)._asString());
  14111. return $1;
  14112. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  14113. },
  14114. args: ["aString"],
  14115. source: ", aString\x0a\x09^ self asString, aString asString",
  14116. referencedClasses: [],
  14117. messageSends: [",", "asString"]
  14118. }),
  14119. $globals.CharacterArray);
  14120. $core.addMethod(
  14121. $core.method({
  14122. selector: "add:",
  14123. protocol: 'adding/removing',
  14124. fn: function (anObject){
  14125. var self=this;
  14126. return $core.withContext(function($ctx1) {
  14127. self._errorReadOnly();
  14128. return self;
  14129. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  14130. },
  14131. args: ["anObject"],
  14132. source: "add: anObject\x0a\x09self errorReadOnly",
  14133. referencedClasses: [],
  14134. messageSends: ["errorReadOnly"]
  14135. }),
  14136. $globals.CharacterArray);
  14137. $core.addMethod(
  14138. $core.method({
  14139. selector: "asLowercase",
  14140. protocol: 'converting',
  14141. fn: function (){
  14142. var self=this;
  14143. return $core.withContext(function($ctx1) {
  14144. var $1;
  14145. $1=$recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  14146. return $1;
  14147. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  14148. },
  14149. args: [],
  14150. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  14151. referencedClasses: [],
  14152. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  14153. }),
  14154. $globals.CharacterArray);
  14155. $core.addMethod(
  14156. $core.method({
  14157. selector: "asNumber",
  14158. protocol: 'converting',
  14159. fn: function (){
  14160. var self=this;
  14161. return $core.withContext(function($ctx1) {
  14162. var $1;
  14163. $1=$recv(self._asString())._asNumber();
  14164. return $1;
  14165. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  14166. },
  14167. args: [],
  14168. source: "asNumber\x0a\x09^ self asString asNumber",
  14169. referencedClasses: [],
  14170. messageSends: ["asNumber", "asString"]
  14171. }),
  14172. $globals.CharacterArray);
  14173. $core.addMethod(
  14174. $core.method({
  14175. selector: "asString",
  14176. protocol: 'converting',
  14177. fn: function (){
  14178. var self=this;
  14179. return $core.withContext(function($ctx1) {
  14180. var $1;
  14181. $1=self._subclassResponsibility();
  14182. return $1;
  14183. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  14184. },
  14185. args: [],
  14186. source: "asString\x0a\x09^ self subclassResponsibility",
  14187. referencedClasses: [],
  14188. messageSends: ["subclassResponsibility"]
  14189. }),
  14190. $globals.CharacterArray);
  14191. $core.addMethod(
  14192. $core.method({
  14193. selector: "asSymbol",
  14194. protocol: 'converting',
  14195. fn: function (){
  14196. var self=this;
  14197. return $core.withContext(function($ctx1) {
  14198. var $1;
  14199. $1=self._asString();
  14200. return $1;
  14201. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  14202. },
  14203. args: [],
  14204. source: "asSymbol\x0a\x09^ self asString",
  14205. referencedClasses: [],
  14206. messageSends: ["asString"]
  14207. }),
  14208. $globals.CharacterArray);
  14209. $core.addMethod(
  14210. $core.method({
  14211. selector: "asUppercase",
  14212. protocol: 'converting',
  14213. fn: function (){
  14214. var self=this;
  14215. return $core.withContext(function($ctx1) {
  14216. var $1;
  14217. $1=$recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  14218. return $1;
  14219. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  14220. },
  14221. args: [],
  14222. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  14223. referencedClasses: [],
  14224. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  14225. }),
  14226. $globals.CharacterArray);
  14227. $core.addMethod(
  14228. $core.method({
  14229. selector: "at:put:",
  14230. protocol: 'accessing',
  14231. fn: function (anIndex,anObject){
  14232. var self=this;
  14233. return $core.withContext(function($ctx1) {
  14234. self._errorReadOnly();
  14235. return self;
  14236. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  14237. },
  14238. args: ["anIndex", "anObject"],
  14239. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  14240. referencedClasses: [],
  14241. messageSends: ["errorReadOnly"]
  14242. }),
  14243. $globals.CharacterArray);
  14244. $core.addMethod(
  14245. $core.method({
  14246. selector: "errorReadOnly",
  14247. protocol: 'error handling',
  14248. fn: function (){
  14249. var self=this;
  14250. return $core.withContext(function($ctx1) {
  14251. self._error_("Object is read-only");
  14252. return self;
  14253. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  14254. },
  14255. args: [],
  14256. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  14257. referencedClasses: [],
  14258. messageSends: ["error:"]
  14259. }),
  14260. $globals.CharacterArray);
  14261. $core.addMethod(
  14262. $core.method({
  14263. selector: "printOn:",
  14264. protocol: 'printing',
  14265. fn: function (aStream){
  14266. var self=this;
  14267. return $core.withContext(function($ctx1) {
  14268. $recv(self._asString())._printOn_(aStream);
  14269. return self;
  14270. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  14271. },
  14272. args: ["aStream"],
  14273. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  14274. referencedClasses: [],
  14275. messageSends: ["printOn:", "asString"]
  14276. }),
  14277. $globals.CharacterArray);
  14278. $core.addMethod(
  14279. $core.method({
  14280. selector: "putOn:",
  14281. protocol: 'streaming',
  14282. fn: function (aStream){
  14283. var self=this;
  14284. return $core.withContext(function($ctx1) {
  14285. $recv(aStream)._nextPutString_(self);
  14286. return self;
  14287. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  14288. },
  14289. args: ["aStream"],
  14290. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  14291. referencedClasses: [],
  14292. messageSends: ["nextPutString:"]
  14293. }),
  14294. $globals.CharacterArray);
  14295. $core.addMethod(
  14296. $core.method({
  14297. selector: "remove:",
  14298. protocol: 'adding/removing',
  14299. fn: function (anObject){
  14300. var self=this;
  14301. return $core.withContext(function($ctx1) {
  14302. self._errorReadOnly();
  14303. return self;
  14304. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  14305. },
  14306. args: ["anObject"],
  14307. source: "remove: anObject\x0a\x09self errorReadOnly",
  14308. referencedClasses: [],
  14309. messageSends: ["errorReadOnly"]
  14310. }),
  14311. $globals.CharacterArray);
  14312. $core.addMethod(
  14313. $core.method({
  14314. selector: "fromString:",
  14315. protocol: 'instance creation',
  14316. fn: function (aString){
  14317. var self=this;
  14318. return $core.withContext(function($ctx1) {
  14319. self._subclassResponsibility();
  14320. return self;
  14321. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  14322. },
  14323. args: ["aString"],
  14324. source: "fromString: aString\x0a\x09self subclassResponsibility",
  14325. referencedClasses: [],
  14326. messageSends: ["subclassResponsibility"]
  14327. }),
  14328. $globals.CharacterArray.klass);
  14329. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  14330. $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 >> #,`";
  14331. $core.addMethod(
  14332. $core.method({
  14333. selector: ",",
  14334. protocol: 'copying',
  14335. fn: function (aString){
  14336. var self=this;
  14337. return $core.withContext(function($ctx1) {
  14338. return String(self) + aString;
  14339. return self;
  14340. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  14341. },
  14342. args: ["aString"],
  14343. source: ", aString\x0a\x09<return String(self) + aString>",
  14344. referencedClasses: [],
  14345. messageSends: []
  14346. }),
  14347. $globals.String);
  14348. $core.addMethod(
  14349. $core.method({
  14350. selector: "<",
  14351. protocol: 'comparing',
  14352. fn: function (aString){
  14353. var self=this;
  14354. return $core.withContext(function($ctx1) {
  14355. return String(self) < aString._asString();
  14356. return self;
  14357. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  14358. },
  14359. args: ["aString"],
  14360. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  14361. referencedClasses: [],
  14362. messageSends: []
  14363. }),
  14364. $globals.String);
  14365. $core.addMethod(
  14366. $core.method({
  14367. selector: "<=",
  14368. protocol: 'comparing',
  14369. fn: function (aString){
  14370. var self=this;
  14371. return $core.withContext(function($ctx1) {
  14372. return String(self) <= aString._asString();
  14373. return self;
  14374. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  14375. },
  14376. args: ["aString"],
  14377. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  14378. referencedClasses: [],
  14379. messageSends: []
  14380. }),
  14381. $globals.String);
  14382. $core.addMethod(
  14383. $core.method({
  14384. selector: "=",
  14385. protocol: 'comparing',
  14386. fn: function (aString){
  14387. var self=this;
  14388. return $core.withContext(function($ctx1) {
  14389. var $1;
  14390. $1=self.__eq_eq(aString);
  14391. return $1;
  14392. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  14393. },
  14394. args: ["aString"],
  14395. source: "= aString\x0a\x09^ self == aString",
  14396. referencedClasses: [],
  14397. messageSends: ["=="]
  14398. }),
  14399. $globals.String);
  14400. $core.addMethod(
  14401. $core.method({
  14402. selector: "==",
  14403. protocol: 'comparing',
  14404. fn: function (aString){
  14405. var self=this;
  14406. return $core.withContext(function($ctx1) {
  14407. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14408. return self;
  14409. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  14410. },
  14411. args: ["aString"],
  14412. source: "== aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  14413. referencedClasses: [],
  14414. messageSends: []
  14415. }),
  14416. $globals.String);
  14417. $core.addMethod(
  14418. $core.method({
  14419. selector: ">",
  14420. protocol: 'comparing',
  14421. fn: function (aString){
  14422. var self=this;
  14423. return $core.withContext(function($ctx1) {
  14424. return String(self) > aString._asString();
  14425. return self;
  14426. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  14427. },
  14428. args: ["aString"],
  14429. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  14430. referencedClasses: [],
  14431. messageSends: []
  14432. }),
  14433. $globals.String);
  14434. $core.addMethod(
  14435. $core.method({
  14436. selector: ">=",
  14437. protocol: 'comparing',
  14438. fn: function (aString){
  14439. var self=this;
  14440. return $core.withContext(function($ctx1) {
  14441. return String(self) >= aString._asString();
  14442. return self;
  14443. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14444. },
  14445. args: ["aString"],
  14446. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  14447. referencedClasses: [],
  14448. messageSends: []
  14449. }),
  14450. $globals.String);
  14451. $core.addMethod(
  14452. $core.method({
  14453. selector: "asJSON",
  14454. protocol: 'converting',
  14455. fn: function (){
  14456. var self=this;
  14457. return self;
  14458. },
  14459. args: [],
  14460. source: "asJSON\x0a\x09^ self",
  14461. referencedClasses: [],
  14462. messageSends: []
  14463. }),
  14464. $globals.String);
  14465. $core.addMethod(
  14466. $core.method({
  14467. selector: "asJavaScriptMethodName",
  14468. protocol: 'converting',
  14469. fn: function (){
  14470. var self=this;
  14471. return $core.withContext(function($ctx1) {
  14472. return $core.st2js(self);
  14473. return self;
  14474. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14475. },
  14476. args: [],
  14477. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  14478. referencedClasses: [],
  14479. messageSends: []
  14480. }),
  14481. $globals.String);
  14482. $core.addMethod(
  14483. $core.method({
  14484. selector: "asJavascript",
  14485. protocol: 'converting',
  14486. fn: function (){
  14487. var self=this;
  14488. return $core.withContext(function($ctx1) {
  14489. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14490. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14491. else
  14492. return "\"" + self + "\"";
  14493. ;
  14494. return self;
  14495. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14496. },
  14497. args: [],
  14498. 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>",
  14499. referencedClasses: [],
  14500. messageSends: []
  14501. }),
  14502. $globals.String);
  14503. $core.addMethod(
  14504. $core.method({
  14505. selector: "asLowercase",
  14506. protocol: 'converting',
  14507. fn: function (){
  14508. var self=this;
  14509. return $core.withContext(function($ctx1) {
  14510. return self.toLowerCase();
  14511. return self;
  14512. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14513. },
  14514. args: [],
  14515. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  14516. referencedClasses: [],
  14517. messageSends: []
  14518. }),
  14519. $globals.String);
  14520. $core.addMethod(
  14521. $core.method({
  14522. selector: "asMutator",
  14523. protocol: 'converting',
  14524. fn: function (){
  14525. var self=this;
  14526. return $core.withContext(function($ctx1) {
  14527. var $1,$2;
  14528. $1=$recv(self._last()).__eq(":");
  14529. if(!$core.assert($1)){
  14530. $2=self.__comma(":");
  14531. return $2;
  14532. };
  14533. return self;
  14534. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14535. },
  14536. args: [],
  14537. 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",
  14538. referencedClasses: [],
  14539. messageSends: ["ifFalse:", "=", "last", ","]
  14540. }),
  14541. $globals.String);
  14542. $core.addMethod(
  14543. $core.method({
  14544. selector: "asNumber",
  14545. protocol: 'converting',
  14546. fn: function (){
  14547. var self=this;
  14548. return $core.withContext(function($ctx1) {
  14549. return Number(self);
  14550. return self;
  14551. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14552. },
  14553. args: [],
  14554. source: "asNumber\x0a\x09<return Number(self)>",
  14555. referencedClasses: [],
  14556. messageSends: []
  14557. }),
  14558. $globals.String);
  14559. $core.addMethod(
  14560. $core.method({
  14561. selector: "asRegexp",
  14562. protocol: 'converting',
  14563. fn: function (){
  14564. var self=this;
  14565. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14566. return $core.withContext(function($ctx1) {
  14567. var $1;
  14568. $1=$recv($RegularExpression())._fromString_(self);
  14569. return $1;
  14570. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14571. },
  14572. args: [],
  14573. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14574. referencedClasses: ["RegularExpression"],
  14575. messageSends: ["fromString:"]
  14576. }),
  14577. $globals.String);
  14578. $core.addMethod(
  14579. $core.method({
  14580. selector: "asString",
  14581. protocol: 'converting',
  14582. fn: function (){
  14583. var self=this;
  14584. return self;
  14585. },
  14586. args: [],
  14587. source: "asString\x0a\x09^ self",
  14588. referencedClasses: [],
  14589. messageSends: []
  14590. }),
  14591. $globals.String);
  14592. $core.addMethod(
  14593. $core.method({
  14594. selector: "asSymbol",
  14595. protocol: 'converting',
  14596. fn: function (){
  14597. var self=this;
  14598. return self;
  14599. },
  14600. args: [],
  14601. source: "asSymbol\x0a\x09^ self",
  14602. referencedClasses: [],
  14603. messageSends: []
  14604. }),
  14605. $globals.String);
  14606. $core.addMethod(
  14607. $core.method({
  14608. selector: "asUppercase",
  14609. protocol: 'converting',
  14610. fn: function (){
  14611. var self=this;
  14612. return $core.withContext(function($ctx1) {
  14613. return self.toUpperCase();
  14614. return self;
  14615. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14616. },
  14617. args: [],
  14618. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  14619. referencedClasses: [],
  14620. messageSends: []
  14621. }),
  14622. $globals.String);
  14623. $core.addMethod(
  14624. $core.method({
  14625. selector: "asciiValue",
  14626. protocol: 'accessing',
  14627. fn: function (){
  14628. var self=this;
  14629. return $core.withContext(function($ctx1) {
  14630. return self.charCodeAt(0);;
  14631. return self;
  14632. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14633. },
  14634. args: [],
  14635. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  14636. referencedClasses: [],
  14637. messageSends: []
  14638. }),
  14639. $globals.String);
  14640. $core.addMethod(
  14641. $core.method({
  14642. selector: "at:ifAbsent:",
  14643. protocol: 'accessing',
  14644. fn: function (anIndex,aBlock){
  14645. var self=this;
  14646. return $core.withContext(function($ctx1) {
  14647. return String(self)[anIndex - 1] || aBlock._value();
  14648. return self;
  14649. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14650. },
  14651. args: ["anIndex", "aBlock"],
  14652. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  14653. referencedClasses: [],
  14654. messageSends: []
  14655. }),
  14656. $globals.String);
  14657. $core.addMethod(
  14658. $core.method({
  14659. selector: "at:ifPresent:ifAbsent:",
  14660. protocol: 'accessing',
  14661. fn: function (anIndex,aBlock,anotherBlock){
  14662. var self=this;
  14663. return $core.withContext(function($ctx1) {
  14664. var result = String(self)[anIndex - 1];
  14665. return result ? aBlock._value_(result) : anotherBlock._value();
  14666. ;
  14667. return self;
  14668. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14669. },
  14670. args: ["anIndex", "aBlock", "anotherBlock"],
  14671. 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>",
  14672. referencedClasses: [],
  14673. messageSends: []
  14674. }),
  14675. $globals.String);
  14676. $core.addMethod(
  14677. $core.method({
  14678. selector: "capitalized",
  14679. protocol: 'converting',
  14680. fn: function (){
  14681. var self=this;
  14682. return $core.withContext(function($ctx1) {
  14683. var $2,$1;
  14684. $2=self._isEmpty();
  14685. if($core.assert($2)){
  14686. $1=self;
  14687. } else {
  14688. $1=$recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14689. };
  14690. return $1;
  14691. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14692. },
  14693. args: [],
  14694. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  14695. referencedClasses: [],
  14696. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  14697. }),
  14698. $globals.String);
  14699. $core.addMethod(
  14700. $core.method({
  14701. selector: "charCodeAt:",
  14702. protocol: 'accessing',
  14703. fn: function (anInteger){
  14704. var self=this;
  14705. return $core.withContext(function($ctx1) {
  14706. return self.charCodeAt(anInteger - 1);
  14707. return self;
  14708. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  14709. },
  14710. args: ["anInteger"],
  14711. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  14712. referencedClasses: [],
  14713. messageSends: []
  14714. }),
  14715. $globals.String);
  14716. $core.addMethod(
  14717. $core.method({
  14718. selector: "copyFrom:to:",
  14719. protocol: 'copying',
  14720. fn: function (anIndex,anotherIndex){
  14721. var self=this;
  14722. return $core.withContext(function($ctx1) {
  14723. return self.substring(anIndex - 1, anotherIndex);
  14724. return self;
  14725. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  14726. },
  14727. args: ["anIndex", "anotherIndex"],
  14728. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  14729. referencedClasses: [],
  14730. messageSends: []
  14731. }),
  14732. $globals.String);
  14733. $core.addMethod(
  14734. $core.method({
  14735. selector: "crlfSanitized",
  14736. protocol: 'converting',
  14737. fn: function (){
  14738. var self=this;
  14739. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14740. return $core.withContext(function($ctx1) {
  14741. var $1;
  14742. $1=$recv(self._lines())._join_($recv($String())._lf());
  14743. return $1;
  14744. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  14745. },
  14746. args: [],
  14747. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  14748. referencedClasses: ["String"],
  14749. messageSends: ["join:", "lines", "lf"]
  14750. }),
  14751. $globals.String);
  14752. $core.addMethod(
  14753. $core.method({
  14754. selector: "deepCopy",
  14755. protocol: 'copying',
  14756. fn: function (){
  14757. var self=this;
  14758. return $core.withContext(function($ctx1) {
  14759. var $1;
  14760. $1=self._shallowCopy();
  14761. return $1;
  14762. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  14763. },
  14764. args: [],
  14765. source: "deepCopy\x0a\x09^ self shallowCopy",
  14766. referencedClasses: [],
  14767. messageSends: ["shallowCopy"]
  14768. }),
  14769. $globals.String);
  14770. $core.addMethod(
  14771. $core.method({
  14772. selector: "escaped",
  14773. protocol: 'converting',
  14774. fn: function (){
  14775. var self=this;
  14776. return $core.withContext(function($ctx1) {
  14777. return escape(self);
  14778. return self;
  14779. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  14780. },
  14781. args: [],
  14782. source: "escaped\x0a\x09<return escape(self)>",
  14783. referencedClasses: [],
  14784. messageSends: []
  14785. }),
  14786. $globals.String);
  14787. $core.addMethod(
  14788. $core.method({
  14789. selector: "includesSubString:",
  14790. protocol: 'testing',
  14791. fn: function (subString){
  14792. var self=this;
  14793. return $core.withContext(function($ctx1) {
  14794. return self.indexOf(subString) != -1;
  14795. return self;
  14796. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  14797. },
  14798. args: ["subString"],
  14799. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  14800. referencedClasses: [],
  14801. messageSends: []
  14802. }),
  14803. $globals.String);
  14804. $core.addMethod(
  14805. $core.method({
  14806. selector: "isCapitalized",
  14807. protocol: 'testing',
  14808. fn: function (){
  14809. var self=this;
  14810. return $core.withContext(function($ctx1) {
  14811. var $3,$2,$1;
  14812. $3=self._first();
  14813. $ctx1.sendIdx["first"]=1;
  14814. $2=$recv($3)._asUppercase();
  14815. $1=$recv($2).__eq_eq(self._first());
  14816. return $1;
  14817. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  14818. },
  14819. args: [],
  14820. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  14821. referencedClasses: [],
  14822. messageSends: ["==", "asUppercase", "first"]
  14823. }),
  14824. $globals.String);
  14825. $core.addMethod(
  14826. $core.method({
  14827. selector: "isImmutable",
  14828. protocol: 'testing',
  14829. fn: function (){
  14830. var self=this;
  14831. return true;
  14832. },
  14833. args: [],
  14834. source: "isImmutable\x0a\x09^ true",
  14835. referencedClasses: [],
  14836. messageSends: []
  14837. }),
  14838. $globals.String);
  14839. $core.addMethod(
  14840. $core.method({
  14841. selector: "isString",
  14842. protocol: 'testing',
  14843. fn: function (){
  14844. var self=this;
  14845. return true;
  14846. },
  14847. args: [],
  14848. source: "isString\x0a\x09^ true",
  14849. referencedClasses: [],
  14850. messageSends: []
  14851. }),
  14852. $globals.String);
  14853. $core.addMethod(
  14854. $core.method({
  14855. selector: "isVowel",
  14856. protocol: 'testing',
  14857. fn: function (){
  14858. var self=this;
  14859. return $core.withContext(function($ctx1) {
  14860. var $1;
  14861. $1=$recv($recv(self._size()).__eq((1)))._and_((function(){
  14862. return $core.withContext(function($ctx2) {
  14863. return "aeiou"._includes_(self._asLowercase());
  14864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14865. }));
  14866. return $1;
  14867. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  14868. },
  14869. args: [],
  14870. 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 ]",
  14871. referencedClasses: [],
  14872. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  14873. }),
  14874. $globals.String);
  14875. $core.addMethod(
  14876. $core.method({
  14877. selector: "join:",
  14878. protocol: 'split join',
  14879. fn: function (aCollection){
  14880. var self=this;
  14881. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14882. return $core.withContext(function($ctx1) {
  14883. var $1;
  14884. $1=$recv($String())._streamContents_((function(stream){
  14885. return $core.withContext(function($ctx2) {
  14886. return $recv(aCollection)._do_separatedBy_((function(each){
  14887. return $core.withContext(function($ctx3) {
  14888. return $recv(stream)._nextPutAll_($recv(each)._asString());
  14889. $ctx3.sendIdx["nextPutAll:"]=1;
  14890. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14891. }),(function(){
  14892. return $core.withContext(function($ctx3) {
  14893. return $recv(stream)._nextPutAll_(self);
  14894. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14895. }));
  14896. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14897. }));
  14898. return $1;
  14899. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  14900. },
  14901. args: ["aCollection"],
  14902. 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 ]]",
  14903. referencedClasses: ["String"],
  14904. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  14905. }),
  14906. $globals.String);
  14907. $core.addMethod(
  14908. $core.method({
  14909. selector: "lineIndicesDo:",
  14910. protocol: 'split join',
  14911. fn: function (aBlock){
  14912. var self=this;
  14913. var cr,lf,start,sz,nextLF,nextCR;
  14914. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14915. return $core.withContext(function($ctx1) {
  14916. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  14917. var $early={};
  14918. try {
  14919. start=(1);
  14920. sz=self._size();
  14921. cr=$recv($String())._cr();
  14922. nextCR=self._indexOf_startingAt_(cr,(1));
  14923. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  14924. lf=$recv($String())._lf();
  14925. nextLF=self._indexOf_startingAt_(lf,(1));
  14926. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  14927. $recv((function(){
  14928. return $core.withContext(function($ctx2) {
  14929. return $recv(start).__lt_eq(sz);
  14930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14931. }))._whileTrue_((function(){
  14932. return $core.withContext(function($ctx2) {
  14933. $2=$recv(nextLF).__eq((0));
  14934. $ctx2.sendIdx["="]=1;
  14935. $1=$recv($2)._and_((function(){
  14936. return $core.withContext(function($ctx3) {
  14937. return $recv(nextCR).__eq((0));
  14938. $ctx3.sendIdx["="]=2;
  14939. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14940. }));
  14941. $ctx2.sendIdx["and:"]=1;
  14942. if($core.assert($1)){
  14943. $recv(aBlock)._value_value_value_(start,sz,sz);
  14944. $ctx2.sendIdx["value:value:value:"]=1;
  14945. throw $early=[self];
  14946. };
  14947. $4=$recv(nextCR).__eq((0));
  14948. $ctx2.sendIdx["="]=3;
  14949. $3=$recv($4)._or_((function(){
  14950. return $core.withContext(function($ctx3) {
  14951. $5=(0).__lt(nextLF);
  14952. $ctx3.sendIdx["<"]=1;
  14953. return $recv($5)._and_((function(){
  14954. return $core.withContext(function($ctx4) {
  14955. return $recv(nextLF).__lt(nextCR);
  14956. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  14957. }));
  14958. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  14959. }));
  14960. if($core.assert($3)){
  14961. $6=start;
  14962. $7=$recv(nextLF).__minus((1));
  14963. $ctx2.sendIdx["-"]=1;
  14964. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  14965. $ctx2.sendIdx["value:value:value:"]=2;
  14966. start=(1).__plus(nextLF);
  14967. $ctx2.sendIdx["+"]=1;
  14968. start;
  14969. nextLF=self._indexOf_startingAt_(lf,start);
  14970. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  14971. return nextLF;
  14972. } else {
  14973. $9=(1).__plus(nextCR);
  14974. $ctx2.sendIdx["+"]=2;
  14975. $8=$recv($9).__eq(nextLF);
  14976. if($core.assert($8)){
  14977. $10=start;
  14978. $11=$recv(nextCR).__minus((1));
  14979. $ctx2.sendIdx["-"]=2;
  14980. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  14981. $ctx2.sendIdx["value:value:value:"]=3;
  14982. start=(1).__plus(nextLF);
  14983. $ctx2.sendIdx["+"]=3;
  14984. start;
  14985. nextCR=self._indexOf_startingAt_(cr,start);
  14986. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  14987. nextCR;
  14988. nextLF=self._indexOf_startingAt_(lf,start);
  14989. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  14990. return nextLF;
  14991. } else {
  14992. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  14993. start=(1).__plus(nextCR);
  14994. start;
  14995. nextCR=self._indexOf_startingAt_(cr,start);
  14996. return nextCR;
  14997. };
  14998. };
  14999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15000. }));
  15001. return self;
  15002. }
  15003. catch(e) {if(e===$early)return e[0]; throw e}
  15004. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  15005. },
  15006. args: ["aBlock"],
  15007. 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 ] ]]",
  15008. referencedClasses: ["String"],
  15009. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  15010. }),
  15011. $globals.String);
  15012. $core.addMethod(
  15013. $core.method({
  15014. selector: "lineNumber:",
  15015. protocol: 'split join',
  15016. fn: function (anIndex){
  15017. var self=this;
  15018. var lineCount;
  15019. return $core.withContext(function($ctx1) {
  15020. var $2,$1,$3;
  15021. var $early={};
  15022. try {
  15023. lineCount=(0);
  15024. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15025. return $core.withContext(function($ctx2) {
  15026. lineCount=$recv(lineCount).__plus((1));
  15027. $2=lineCount;
  15028. $1=$recv($2).__eq(anIndex);
  15029. if($core.assert($1)){
  15030. $3=self._copyFrom_to_(start,endWithoutDelimiters);
  15031. throw $early=[$3];
  15032. };
  15033. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15034. }));
  15035. return nil;
  15036. }
  15037. catch(e) {if(e===$early)return e[0]; throw e}
  15038. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  15039. },
  15040. args: ["anIndex"],
  15041. 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",
  15042. referencedClasses: [],
  15043. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  15044. }),
  15045. $globals.String);
  15046. $core.addMethod(
  15047. $core.method({
  15048. selector: "lines",
  15049. protocol: 'split join',
  15050. fn: function (){
  15051. var self=this;
  15052. var lines;
  15053. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  15054. return $core.withContext(function($ctx1) {
  15055. var $1;
  15056. lines=$recv($Array())._new();
  15057. self._linesDo_((function(aLine){
  15058. return $core.withContext(function($ctx2) {
  15059. return $recv(lines)._add_(aLine);
  15060. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)});
  15061. }));
  15062. $1=lines;
  15063. return $1;
  15064. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},$globals.String)});
  15065. },
  15066. args: [],
  15067. 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",
  15068. referencedClasses: ["Array"],
  15069. messageSends: ["new", "linesDo:", "add:"]
  15070. }),
  15071. $globals.String);
  15072. $core.addMethod(
  15073. $core.method({
  15074. selector: "linesDo:",
  15075. protocol: 'split join',
  15076. fn: function (aBlock){
  15077. var self=this;
  15078. return $core.withContext(function($ctx1) {
  15079. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15080. return $core.withContext(function($ctx2) {
  15081. return $recv(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  15082. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15083. }));
  15084. return self;
  15085. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  15086. },
  15087. args: ["aBlock"],
  15088. 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) ]",
  15089. referencedClasses: [],
  15090. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"]
  15091. }),
  15092. $globals.String);
  15093. $core.addMethod(
  15094. $core.method({
  15095. selector: "match:",
  15096. protocol: 'regular expressions',
  15097. fn: function (aRegexp){
  15098. var self=this;
  15099. return $core.withContext(function($ctx1) {
  15100. return self.search(aRegexp) != -1;
  15101. return self;
  15102. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  15103. },
  15104. args: ["aRegexp"],
  15105. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  15106. referencedClasses: [],
  15107. messageSends: []
  15108. }),
  15109. $globals.String);
  15110. $core.addMethod(
  15111. $core.method({
  15112. selector: "matchesOf:",
  15113. protocol: 'regular expressions',
  15114. fn: function (aRegularExpression){
  15115. var self=this;
  15116. return $core.withContext(function($ctx1) {
  15117. return self.match(aRegularExpression);
  15118. return self;
  15119. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  15120. },
  15121. args: ["aRegularExpression"],
  15122. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  15123. referencedClasses: [],
  15124. messageSends: []
  15125. }),
  15126. $globals.String);
  15127. $core.addMethod(
  15128. $core.method({
  15129. selector: "numericallyIndexable",
  15130. protocol: 'private',
  15131. fn: function (){
  15132. var self=this;
  15133. return $core.withContext(function($ctx1) {
  15134. return String(self);
  15135. return self;
  15136. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  15137. },
  15138. args: [],
  15139. source: "numericallyIndexable\x0a\x09<return String(self)>",
  15140. referencedClasses: [],
  15141. messageSends: []
  15142. }),
  15143. $globals.String);
  15144. $core.addMethod(
  15145. $core.method({
  15146. selector: "printNl",
  15147. protocol: 'printing',
  15148. fn: function (){
  15149. var self=this;
  15150. return $core.withContext(function($ctx1) {
  15151. console.log(self);
  15152. return self;
  15153. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  15154. },
  15155. args: [],
  15156. source: "printNl\x0a\x09<console.log(self)>",
  15157. referencedClasses: [],
  15158. messageSends: []
  15159. }),
  15160. $globals.String);
  15161. $core.addMethod(
  15162. $core.method({
  15163. selector: "printOn:",
  15164. protocol: 'printing',
  15165. fn: function (aStream){
  15166. var self=this;
  15167. return $core.withContext(function($ctx1) {
  15168. var $1;
  15169. $recv(aStream)._nextPutAll_("'");
  15170. $ctx1.sendIdx["nextPutAll:"]=1;
  15171. $recv(aStream)._nextPutAll_(self);
  15172. $ctx1.sendIdx["nextPutAll:"]=2;
  15173. $1=$recv(aStream)._nextPutAll_("'");
  15174. return self;
  15175. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  15176. },
  15177. args: ["aStream"],
  15178. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  15179. referencedClasses: [],
  15180. messageSends: ["nextPutAll:"]
  15181. }),
  15182. $globals.String);
  15183. $core.addMethod(
  15184. $core.method({
  15185. selector: "replace:with:",
  15186. protocol: 'regular expressions',
  15187. fn: function (aString,anotherString){
  15188. var self=this;
  15189. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15190. return $core.withContext(function($ctx1) {
  15191. var $1;
  15192. $1=self._replaceRegexp_with_($recv($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  15193. return $1;
  15194. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  15195. },
  15196. args: ["aString", "anotherString"],
  15197. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  15198. referencedClasses: ["RegularExpression"],
  15199. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  15200. }),
  15201. $globals.String);
  15202. $core.addMethod(
  15203. $core.method({
  15204. selector: "replaceRegexp:with:",
  15205. protocol: 'regular expressions',
  15206. fn: function (aRegexp,aString){
  15207. var self=this;
  15208. return $core.withContext(function($ctx1) {
  15209. return self.replace(aRegexp, aString);
  15210. return self;
  15211. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  15212. },
  15213. args: ["aRegexp", "aString"],
  15214. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  15215. referencedClasses: [],
  15216. messageSends: []
  15217. }),
  15218. $globals.String);
  15219. $core.addMethod(
  15220. $core.method({
  15221. selector: "reversed",
  15222. protocol: 'converting',
  15223. fn: function (){
  15224. var self=this;
  15225. return $core.withContext(function($ctx1) {
  15226. return self.split("").reverse().join("");
  15227. return self;
  15228. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  15229. },
  15230. args: [],
  15231. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  15232. referencedClasses: [],
  15233. messageSends: []
  15234. }),
  15235. $globals.String);
  15236. $core.addMethod(
  15237. $core.method({
  15238. selector: "shallowCopy",
  15239. protocol: 'copying',
  15240. fn: function (){
  15241. var self=this;
  15242. return $core.withContext(function($ctx1) {
  15243. var $1;
  15244. $1=$recv(self._class())._fromString_(self);
  15245. return $1;
  15246. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.String)});
  15247. },
  15248. args: [],
  15249. source: "shallowCopy\x0a\x09^ self class fromString: self",
  15250. referencedClasses: [],
  15251. messageSends: ["fromString:", "class"]
  15252. }),
  15253. $globals.String);
  15254. $core.addMethod(
  15255. $core.method({
  15256. selector: "size",
  15257. protocol: 'accessing',
  15258. fn: function (){
  15259. var self=this;
  15260. return $core.withContext(function($ctx1) {
  15261. return self.length;
  15262. return self;
  15263. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  15264. },
  15265. args: [],
  15266. source: "size\x0a\x09<return self.length>",
  15267. referencedClasses: [],
  15268. messageSends: []
  15269. }),
  15270. $globals.String);
  15271. $core.addMethod(
  15272. $core.method({
  15273. selector: "subStrings:",
  15274. protocol: 'split join',
  15275. fn: function (aString){
  15276. var self=this;
  15277. return $core.withContext(function($ctx1) {
  15278. var $1;
  15279. $1=self._tokenize_(aString);
  15280. return $1;
  15281. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  15282. },
  15283. args: ["aString"],
  15284. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  15285. referencedClasses: [],
  15286. messageSends: ["tokenize:"]
  15287. }),
  15288. $globals.String);
  15289. $core.addMethod(
  15290. $core.method({
  15291. selector: "tokenize:",
  15292. protocol: 'split join',
  15293. fn: function (aString){
  15294. var self=this;
  15295. return $core.withContext(function($ctx1) {
  15296. return self.split(aString);
  15297. return self;
  15298. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  15299. },
  15300. args: ["aString"],
  15301. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  15302. referencedClasses: [],
  15303. messageSends: []
  15304. }),
  15305. $globals.String);
  15306. $core.addMethod(
  15307. $core.method({
  15308. selector: "trimBoth",
  15309. protocol: 'regular expressions',
  15310. fn: function (){
  15311. var self=this;
  15312. return $core.withContext(function($ctx1) {
  15313. var $1;
  15314. $1=self._trimBoth_("\x5cs");
  15315. return $1;
  15316. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  15317. },
  15318. args: [],
  15319. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  15320. referencedClasses: [],
  15321. messageSends: ["trimBoth:"]
  15322. }),
  15323. $globals.String);
  15324. $core.addMethod(
  15325. $core.method({
  15326. selector: "trimBoth:",
  15327. protocol: 'regular expressions',
  15328. fn: function (separators){
  15329. var self=this;
  15330. return $core.withContext(function($ctx1) {
  15331. var $1;
  15332. $1=$recv(self._trimLeft_(separators))._trimRight_(separators);
  15333. return $1;
  15334. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  15335. },
  15336. args: ["separators"],
  15337. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  15338. referencedClasses: [],
  15339. messageSends: ["trimRight:", "trimLeft:"]
  15340. }),
  15341. $globals.String);
  15342. $core.addMethod(
  15343. $core.method({
  15344. selector: "trimLeft",
  15345. protocol: 'regular expressions',
  15346. fn: function (){
  15347. var self=this;
  15348. return $core.withContext(function($ctx1) {
  15349. var $1;
  15350. $1=self._trimLeft_("\x5cs");
  15351. return $1;
  15352. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  15353. },
  15354. args: [],
  15355. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  15356. referencedClasses: [],
  15357. messageSends: ["trimLeft:"]
  15358. }),
  15359. $globals.String);
  15360. $core.addMethod(
  15361. $core.method({
  15362. selector: "trimLeft:",
  15363. protocol: 'regular expressions',
  15364. fn: function (separators){
  15365. var self=this;
  15366. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15367. return $core.withContext(function($ctx1) {
  15368. var $3,$2,$1;
  15369. $3=$recv("^[".__comma(separators)).__comma("]+");
  15370. $ctx1.sendIdx[","]=1;
  15371. $2=$recv($RegularExpression())._fromString_flag_($3,"g");
  15372. $1=self._replaceRegexp_with_($2,"");
  15373. return $1;
  15374. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  15375. },
  15376. args: ["separators"],
  15377. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  15378. referencedClasses: ["RegularExpression"],
  15379. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15380. }),
  15381. $globals.String);
  15382. $core.addMethod(
  15383. $core.method({
  15384. selector: "trimRight",
  15385. protocol: 'regular expressions',
  15386. fn: function (){
  15387. var self=this;
  15388. return $core.withContext(function($ctx1) {
  15389. var $1;
  15390. $1=self._trimRight_("\x5cs");
  15391. return $1;
  15392. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  15393. },
  15394. args: [],
  15395. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  15396. referencedClasses: [],
  15397. messageSends: ["trimRight:"]
  15398. }),
  15399. $globals.String);
  15400. $core.addMethod(
  15401. $core.method({
  15402. selector: "trimRight:",
  15403. protocol: 'regular expressions',
  15404. fn: function (separators){
  15405. var self=this;
  15406. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15407. return $core.withContext(function($ctx1) {
  15408. var $3,$2,$1;
  15409. $3=$recv("[".__comma(separators)).__comma("]+$");
  15410. $ctx1.sendIdx[","]=1;
  15411. $2=$recv($RegularExpression())._fromString_flag_($3,"g");
  15412. $1=self._replaceRegexp_with_($2,"");
  15413. return $1;
  15414. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  15415. },
  15416. args: ["separators"],
  15417. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  15418. referencedClasses: ["RegularExpression"],
  15419. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15420. }),
  15421. $globals.String);
  15422. $core.addMethod(
  15423. $core.method({
  15424. selector: "unescaped",
  15425. protocol: 'converting',
  15426. fn: function (){
  15427. var self=this;
  15428. return $core.withContext(function($ctx1) {
  15429. return unescape(self);
  15430. return self;
  15431. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  15432. },
  15433. args: [],
  15434. source: "unescaped\x0a\x09<return unescape(self)>",
  15435. referencedClasses: [],
  15436. messageSends: []
  15437. }),
  15438. $globals.String);
  15439. $core.addMethod(
  15440. $core.method({
  15441. selector: "uriComponentDecoded",
  15442. protocol: 'converting',
  15443. fn: function (){
  15444. var self=this;
  15445. return $core.withContext(function($ctx1) {
  15446. return decodeURIComponent(self);
  15447. return self;
  15448. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  15449. },
  15450. args: [],
  15451. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  15452. referencedClasses: [],
  15453. messageSends: []
  15454. }),
  15455. $globals.String);
  15456. $core.addMethod(
  15457. $core.method({
  15458. selector: "uriComponentEncoded",
  15459. protocol: 'converting',
  15460. fn: function (){
  15461. var self=this;
  15462. return $core.withContext(function($ctx1) {
  15463. return encodeURIComponent(self);
  15464. return self;
  15465. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  15466. },
  15467. args: [],
  15468. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  15469. referencedClasses: [],
  15470. messageSends: []
  15471. }),
  15472. $globals.String);
  15473. $core.addMethod(
  15474. $core.method({
  15475. selector: "uriDecoded",
  15476. protocol: 'converting',
  15477. fn: function (){
  15478. var self=this;
  15479. return $core.withContext(function($ctx1) {
  15480. return decodeURI(self);
  15481. return self;
  15482. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15483. },
  15484. args: [],
  15485. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  15486. referencedClasses: [],
  15487. messageSends: []
  15488. }),
  15489. $globals.String);
  15490. $core.addMethod(
  15491. $core.method({
  15492. selector: "uriEncoded",
  15493. protocol: 'converting',
  15494. fn: function (){
  15495. var self=this;
  15496. return $core.withContext(function($ctx1) {
  15497. return encodeURI(self);
  15498. return self;
  15499. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15500. },
  15501. args: [],
  15502. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  15503. referencedClasses: [],
  15504. messageSends: []
  15505. }),
  15506. $globals.String);
  15507. $core.addMethod(
  15508. $core.method({
  15509. selector: "value:",
  15510. protocol: 'evaluating',
  15511. fn: function (anObject){
  15512. var self=this;
  15513. return $core.withContext(function($ctx1) {
  15514. var $1;
  15515. $1=$recv(anObject)._perform_(self);
  15516. return $1;
  15517. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15518. },
  15519. args: ["anObject"],
  15520. source: "value: anObject \x0a\x09^ anObject perform: self",
  15521. referencedClasses: [],
  15522. messageSends: ["perform:"]
  15523. }),
  15524. $globals.String);
  15525. $core.addMethod(
  15526. $core.method({
  15527. selector: "cr",
  15528. protocol: 'accessing',
  15529. fn: function (){
  15530. var self=this;
  15531. return $core.withContext(function($ctx1) {
  15532. return '\r';
  15533. return self;
  15534. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15535. },
  15536. args: [],
  15537. source: "cr\x0a\x09<return '\x5cr'>",
  15538. referencedClasses: [],
  15539. messageSends: []
  15540. }),
  15541. $globals.String.klass);
  15542. $core.addMethod(
  15543. $core.method({
  15544. selector: "crlf",
  15545. protocol: 'accessing',
  15546. fn: function (){
  15547. var self=this;
  15548. return $core.withContext(function($ctx1) {
  15549. return '\r\n';
  15550. return self;
  15551. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15552. },
  15553. args: [],
  15554. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  15555. referencedClasses: [],
  15556. messageSends: []
  15557. }),
  15558. $globals.String.klass);
  15559. $core.addMethod(
  15560. $core.method({
  15561. selector: "esc",
  15562. protocol: 'accessing',
  15563. fn: function (){
  15564. var self=this;
  15565. return $core.withContext(function($ctx1) {
  15566. var $1;
  15567. $1=self._fromCharCode_((27));
  15568. return $1;
  15569. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15570. },
  15571. args: [],
  15572. source: "esc\x0a\x09^ self fromCharCode: 27",
  15573. referencedClasses: [],
  15574. messageSends: ["fromCharCode:"]
  15575. }),
  15576. $globals.String.klass);
  15577. $core.addMethod(
  15578. $core.method({
  15579. selector: "fromCharCode:",
  15580. protocol: 'instance creation',
  15581. fn: function (anInteger){
  15582. var self=this;
  15583. return $core.withContext(function($ctx1) {
  15584. return String.fromCharCode(anInteger);
  15585. return self;
  15586. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15587. },
  15588. args: ["anInteger"],
  15589. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  15590. referencedClasses: [],
  15591. messageSends: []
  15592. }),
  15593. $globals.String.klass);
  15594. $core.addMethod(
  15595. $core.method({
  15596. selector: "fromString:",
  15597. protocol: 'instance creation',
  15598. fn: function (aString){
  15599. var self=this;
  15600. return $core.withContext(function($ctx1) {
  15601. return String(aString);
  15602. return self;
  15603. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15604. },
  15605. args: ["aString"],
  15606. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  15607. referencedClasses: [],
  15608. messageSends: []
  15609. }),
  15610. $globals.String.klass);
  15611. $core.addMethod(
  15612. $core.method({
  15613. selector: "lf",
  15614. protocol: 'accessing',
  15615. fn: function (){
  15616. var self=this;
  15617. return $core.withContext(function($ctx1) {
  15618. return '\n';
  15619. return self;
  15620. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15621. },
  15622. args: [],
  15623. source: "lf\x0a\x09<return '\x5cn'>",
  15624. referencedClasses: [],
  15625. messageSends: []
  15626. }),
  15627. $globals.String.klass);
  15628. $core.addMethod(
  15629. $core.method({
  15630. selector: "random",
  15631. protocol: 'random',
  15632. fn: function (){
  15633. var self=this;
  15634. return $core.withContext(function($ctx1) {
  15635. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15636. return self;
  15637. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15638. },
  15639. args: [],
  15640. 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);>",
  15641. referencedClasses: [],
  15642. messageSends: []
  15643. }),
  15644. $globals.String.klass);
  15645. $core.addMethod(
  15646. $core.method({
  15647. selector: "randomNotIn:",
  15648. protocol: 'random',
  15649. fn: function (aString){
  15650. var self=this;
  15651. var result;
  15652. return $core.withContext(function($ctx1) {
  15653. var $1;
  15654. $recv((function(){
  15655. return $core.withContext(function($ctx2) {
  15656. result=self._random();
  15657. result;
  15658. return $recv(aString)._includesSubString_(result);
  15659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15660. }))._whileTrue();
  15661. $1=result;
  15662. return $1;
  15663. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15664. },
  15665. args: ["aString"],
  15666. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15667. referencedClasses: [],
  15668. messageSends: ["whileTrue", "random", "includesSubString:"]
  15669. }),
  15670. $globals.String.klass);
  15671. $core.addMethod(
  15672. $core.method({
  15673. selector: "space",
  15674. protocol: 'accessing',
  15675. fn: function (){
  15676. var self=this;
  15677. return $core.withContext(function($ctx1) {
  15678. return ' ';
  15679. return self;
  15680. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15681. },
  15682. args: [],
  15683. source: "space\x0a\x09<return ' '>",
  15684. referencedClasses: [],
  15685. messageSends: []
  15686. }),
  15687. $globals.String.klass);
  15688. $core.addMethod(
  15689. $core.method({
  15690. selector: "streamClass",
  15691. protocol: 'accessing',
  15692. fn: function (){
  15693. var self=this;
  15694. function $StringStream(){return $globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  15695. return $StringStream();
  15696. },
  15697. args: [],
  15698. source: "streamClass\x0a\x09\x09^ StringStream",
  15699. referencedClasses: ["StringStream"],
  15700. messageSends: []
  15701. }),
  15702. $globals.String.klass);
  15703. $core.addMethod(
  15704. $core.method({
  15705. selector: "tab",
  15706. protocol: 'accessing',
  15707. fn: function (){
  15708. var self=this;
  15709. return $core.withContext(function($ctx1) {
  15710. return '\t';
  15711. return self;
  15712. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15713. },
  15714. args: [],
  15715. source: "tab\x0a\x09<return '\x5ct'>",
  15716. referencedClasses: [],
  15717. messageSends: []
  15718. }),
  15719. $globals.String.klass);
  15720. $core.addMethod(
  15721. $core.method({
  15722. selector: "value:",
  15723. protocol: 'instance creation',
  15724. fn: function (aUTFCharCode){
  15725. var self=this;
  15726. return $core.withContext(function($ctx1) {
  15727. return String.fromCharCode(aUTFCharCode);;
  15728. return self;
  15729. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15730. },
  15731. args: ["aUTFCharCode"],
  15732. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  15733. referencedClasses: [],
  15734. messageSends: []
  15735. }),
  15736. $globals.String.klass);
  15737. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15738. $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`.";
  15739. $core.addMethod(
  15740. $core.method({
  15741. selector: "=",
  15742. protocol: 'comparing',
  15743. fn: function (aCollection){
  15744. var self=this;
  15745. return $core.withContext(function($ctx1) {
  15746. var $2,$1,$4,$3,$5;
  15747. var $early={};
  15748. try {
  15749. $2=self._class();
  15750. $ctx1.sendIdx["class"]=1;
  15751. $1=$recv($2).__eq($recv(aCollection)._class());
  15752. $ctx1.sendIdx["="]=1;
  15753. if(!$core.assert($1)){
  15754. return false;
  15755. };
  15756. $4=self._size();
  15757. $ctx1.sendIdx["size"]=1;
  15758. $3=$recv($4).__eq($recv(aCollection)._size());
  15759. if(!$core.assert($3)){
  15760. return false;
  15761. };
  15762. self._do_((function(each){
  15763. return $core.withContext(function($ctx2) {
  15764. $5=$recv(aCollection)._includes_(each);
  15765. if(!$core.assert($5)){
  15766. throw $early=[false];
  15767. };
  15768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15769. }));
  15770. return true;
  15771. }
  15772. catch(e) {if(e===$early)return e[0]; throw e}
  15773. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  15774. },
  15775. args: ["aCollection"],
  15776. 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",
  15777. referencedClasses: [],
  15778. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  15779. }),
  15780. $globals.Set);
  15781. $core.addMethod(
  15782. $core.method({
  15783. selector: "add:",
  15784. protocol: 'adding/removing',
  15785. fn: function (anObject){
  15786. var self=this;
  15787. var bucket;
  15788. return $core.withContext(function($ctx1) {
  15789. var $2,$1,$receiver;
  15790. bucket=self._bucketsOfElement_(anObject);
  15791. $2=$recv(bucket)._second();
  15792. if(($receiver = $2) == null || $receiver.isNil){
  15793. var object,slowBucket;
  15794. object=$recv(bucket)._first();
  15795. $ctx1.sendIdx["first"]=1;
  15796. object;
  15797. slowBucket=$recv(bucket)._third();
  15798. slowBucket;
  15799. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  15800. return $core.withContext(function($ctx2) {
  15801. $recv(slowBucket)._add_(object);
  15802. self["@size"]=$recv(self["@size"]).__plus((1));
  15803. return self["@size"];
  15804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15805. }));
  15806. $1=object;
  15807. } else {
  15808. var primitiveBucket;
  15809. primitiveBucket=$receiver;
  15810. $1=self._add_in_($recv(bucket)._first(),primitiveBucket);
  15811. };
  15812. return $1;
  15813. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15814. },
  15815. args: ["anObject"],
  15816. 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 ]",
  15817. referencedClasses: [],
  15818. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  15819. }),
  15820. $globals.Set);
  15821. $core.addMethod(
  15822. $core.method({
  15823. selector: "add:in:",
  15824. protocol: 'private',
  15825. fn: function (anObject,anotherObject){
  15826. var self=this;
  15827. return $core.withContext(function($ctx1) {
  15828. if (anObject in anotherObject.store) { return false; }
  15829. self['@size']++;
  15830. anotherObject.store[anObject] = true;
  15831. return anObject;
  15832. ;
  15833. return self;
  15834. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15835. },
  15836. args: ["anObject", "anotherObject"],
  15837. 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>",
  15838. referencedClasses: [],
  15839. messageSends: []
  15840. }),
  15841. $globals.Set);
  15842. $core.addMethod(
  15843. $core.method({
  15844. selector: "bucketsOfElement:",
  15845. protocol: 'private',
  15846. fn: function (anObject){
  15847. var self=this;
  15848. return $core.withContext(function($ctx1) {
  15849. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  15850. if ((type = typeof prim) === "object") {
  15851. if (anObject !== nil) {
  15852. bucket = null;
  15853. self['@slowBucketStores'].some(function (store) {
  15854. return bucket = store._bucketOfElement_(anObject);
  15855. });
  15856. return [ anObject, null, bucket || self['@defaultBucket'] ];
  15857. }
  15858. // include nil to well-known objects under 'boolean' fastBucket
  15859. prim = null;
  15860. type = 'boolean';
  15861. }
  15862. return [ prim, self['@fastBuckets'][type] ];
  15863. ;
  15864. return self;
  15865. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  15866. },
  15867. args: ["anObject"],
  15868. 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>",
  15869. referencedClasses: [],
  15870. messageSends: []
  15871. }),
  15872. $globals.Set);
  15873. $core.addMethod(
  15874. $core.method({
  15875. selector: "classNameOf:",
  15876. protocol: 'private',
  15877. fn: function (anObject){
  15878. var self=this;
  15879. return $core.withContext(function($ctx1) {
  15880. return anObject.klass != null && anObject.klass.className;
  15881. return self;
  15882. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  15883. },
  15884. args: ["anObject"],
  15885. 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>",
  15886. referencedClasses: [],
  15887. messageSends: []
  15888. }),
  15889. $globals.Set);
  15890. $core.addMethod(
  15891. $core.method({
  15892. selector: "collect:",
  15893. protocol: 'enumerating',
  15894. fn: function (aBlock){
  15895. var self=this;
  15896. var collection;
  15897. return $core.withContext(function($ctx1) {
  15898. var $1;
  15899. collection=$recv(self._class())._new();
  15900. self._do_((function(each){
  15901. return $core.withContext(function($ctx2) {
  15902. return $recv(collection)._add_($recv(aBlock)._value_(each));
  15903. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15904. }));
  15905. $1=collection;
  15906. return $1;
  15907. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15908. },
  15909. args: ["aBlock"],
  15910. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  15911. referencedClasses: [],
  15912. messageSends: ["new", "class", "do:", "add:", "value:"]
  15913. }),
  15914. $globals.Set);
  15915. $core.addMethod(
  15916. $core.method({
  15917. selector: "detect:ifNone:",
  15918. protocol: 'enumerating',
  15919. fn: function (aBlock,anotherBlock){
  15920. var self=this;
  15921. return $core.withContext(function($ctx1) {
  15922. var $1,$2;
  15923. var $early={};
  15924. try {
  15925. self._do_((function(each){
  15926. return $core.withContext(function($ctx2) {
  15927. $1=$recv(aBlock)._value_(each);
  15928. if($core.assert($1)){
  15929. throw $early=[each];
  15930. };
  15931. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15932. }));
  15933. $2=$recv(anotherBlock)._value();
  15934. return $2;
  15935. }
  15936. catch(e) {if(e===$early)return e[0]; throw e}
  15937. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  15938. },
  15939. args: ["aBlock", "anotherBlock"],
  15940. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  15941. referencedClasses: [],
  15942. messageSends: ["do:", "ifTrue:", "value:", "value"]
  15943. }),
  15944. $globals.Set);
  15945. $core.addMethod(
  15946. $core.method({
  15947. selector: "do:",
  15948. protocol: 'enumerating',
  15949. fn: function (aBlock){
  15950. var self=this;
  15951. return $core.withContext(function($ctx1) {
  15952. var el, keys, i;
  15953. el = self['@fastBuckets'];
  15954. keys = Object.keys(el);
  15955. for (i = 0; i < keys.length; ++i) {
  15956. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  15957. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  15958. else { store._do_(aBlock); }
  15959. }
  15960. el = self['@slowBucketStores'];
  15961. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  15962. self['@defaultBucket']._do_(aBlock);
  15963. ;
  15964. return self;
  15965. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  15966. },
  15967. args: ["aBlock"],
  15968. 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>",
  15969. referencedClasses: [],
  15970. messageSends: []
  15971. }),
  15972. $globals.Set);
  15973. $core.addMethod(
  15974. $core.method({
  15975. selector: "includes:",
  15976. protocol: 'testing',
  15977. fn: function (anObject){
  15978. var self=this;
  15979. var bucket;
  15980. return $core.withContext(function($ctx1) {
  15981. var $2,$3,$4,$1,$receiver;
  15982. bucket=self._bucketsOfElement_(anObject);
  15983. $2=$recv(bucket)._second();
  15984. if(($receiver = $2) == null || $receiver.isNil){
  15985. $3=$recv(bucket)._third();
  15986. $4=$recv(bucket)._first();
  15987. $ctx1.sendIdx["first"]=1;
  15988. $1=$recv($3)._includes_($4);
  15989. } else {
  15990. var primitiveBucket;
  15991. primitiveBucket=$receiver;
  15992. $1=self._includes_in_($recv(bucket)._first(),primitiveBucket);
  15993. };
  15994. return $1;
  15995. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15996. },
  15997. args: ["anObject"],
  15998. 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 ]",
  15999. referencedClasses: [],
  16000. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  16001. }),
  16002. $globals.Set);
  16003. $core.addMethod(
  16004. $core.method({
  16005. selector: "includes:in:",
  16006. protocol: 'private',
  16007. fn: function (anObject,anotherObject){
  16008. var self=this;
  16009. return $core.withContext(function($ctx1) {
  16010. return anObject in anotherObject.store;
  16011. return self;
  16012. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16013. },
  16014. args: ["anObject", "anotherObject"],
  16015. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  16016. referencedClasses: [],
  16017. messageSends: []
  16018. }),
  16019. $globals.Set);
  16020. $core.addMethod(
  16021. $core.method({
  16022. selector: "initialize",
  16023. protocol: 'initialization',
  16024. fn: function (){
  16025. var self=this;
  16026. return $core.withContext(function($ctx1) {
  16027. var $1;
  16028. (
  16029. $ctx1.supercall = true,
  16030. $globals.Set.superclass.fn.prototype._initialize.apply($recv(self), []));
  16031. $ctx1.supercall = false;
  16032. self["@defaultBucket"]=[];
  16033. self._initializeSlowBucketStores();
  16034. $1=self._removeAll();
  16035. return self;
  16036. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  16037. },
  16038. args: [],
  16039. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  16040. referencedClasses: [],
  16041. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  16042. }),
  16043. $globals.Set);
  16044. $core.addMethod(
  16045. $core.method({
  16046. selector: "initializeSlowBucketStores",
  16047. protocol: 'initialization',
  16048. fn: function (){
  16049. var self=this;
  16050. function $ArrayBucketStore(){return $globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  16051. return $core.withContext(function($ctx1) {
  16052. var $1;
  16053. $1=$recv($ArrayBucketStore())._hashBlock_((function(x){
  16054. return $core.withContext(function($ctx2) {
  16055. return self._classNameOf_(x);
  16056. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  16057. }));
  16058. $ctx1.sendIdx["hashBlock:"]=1;
  16059. self["@slowBucketStores"]=[$1,$recv($ArrayBucketStore())._hashBlock_((function(x){
  16060. return $core.withContext(function($ctx2) {
  16061. return self._jsConstructorNameOf_(x);
  16062. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  16063. }))];
  16064. return self;
  16065. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  16066. },
  16067. args: [],
  16068. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  16069. referencedClasses: ["ArrayBucketStore"],
  16070. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  16071. }),
  16072. $globals.Set);
  16073. $core.addMethod(
  16074. $core.method({
  16075. selector: "jsConstructorNameOf:",
  16076. protocol: 'private',
  16077. fn: function (anObject){
  16078. var self=this;
  16079. return $core.withContext(function($ctx1) {
  16080. return anObject.constructor && anObject.constructor.name;
  16081. return self;
  16082. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  16083. },
  16084. args: ["anObject"],
  16085. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  16086. referencedClasses: [],
  16087. messageSends: []
  16088. }),
  16089. $globals.Set);
  16090. $core.addMethod(
  16091. $core.method({
  16092. selector: "printOn:",
  16093. protocol: 'printing',
  16094. fn: function (aStream){
  16095. var self=this;
  16096. return $core.withContext(function($ctx1) {
  16097. (
  16098. $ctx1.supercall = true,
  16099. $globals.Set.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  16100. $ctx1.supercall = false;
  16101. $ctx1.sendIdx["printOn:"]=1;
  16102. $recv(aStream)._nextPutAll_(" (");
  16103. $ctx1.sendIdx["nextPutAll:"]=1;
  16104. self._do_separatedBy_((function(each){
  16105. return $core.withContext(function($ctx2) {
  16106. return $recv(each)._printOn_(aStream);
  16107. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16108. }),(function(){
  16109. return $core.withContext(function($ctx2) {
  16110. return $recv(aStream)._nextPutAll_(" ");
  16111. $ctx2.sendIdx["nextPutAll:"]=2;
  16112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16113. }));
  16114. $recv(aStream)._nextPutAll_(")");
  16115. return self;
  16116. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  16117. },
  16118. args: ["aStream"],
  16119. 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: ')'",
  16120. referencedClasses: [],
  16121. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  16122. }),
  16123. $globals.Set);
  16124. $core.addMethod(
  16125. $core.method({
  16126. selector: "remove:ifAbsent:",
  16127. protocol: 'adding/removing',
  16128. fn: function (anObject,aBlock){
  16129. var self=this;
  16130. var bucket;
  16131. return $core.withContext(function($ctx1) {
  16132. var $2,$3,$4,$5,$1,$receiver;
  16133. var $early={};
  16134. try {
  16135. bucket=self._bucketsOfElement_(anObject);
  16136. $2=$recv(bucket)._second();
  16137. if(($receiver = $2) == null || $receiver.isNil){
  16138. $3=$recv(bucket)._third();
  16139. $4=$recv(bucket)._first();
  16140. $ctx1.sendIdx["first"]=1;
  16141. $recv($3)._remove_ifAbsent_($4,(function(){
  16142. return $core.withContext(function($ctx2) {
  16143. $5=$recv(aBlock)._value();
  16144. throw $early=[$5];
  16145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16146. }));
  16147. self["@size"]=$recv(self["@size"]).__minus((1));
  16148. $1=self["@size"];
  16149. } else {
  16150. var primitiveBucket;
  16151. primitiveBucket=$receiver;
  16152. $1=self._remove_in_($recv(bucket)._first(),primitiveBucket);
  16153. };
  16154. return $1;
  16155. }
  16156. catch(e) {if(e===$early)return e[0]; throw e}
  16157. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  16158. },
  16159. args: ["anObject", "aBlock"],
  16160. 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 ]",
  16161. referencedClasses: [],
  16162. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  16163. }),
  16164. $globals.Set);
  16165. $core.addMethod(
  16166. $core.method({
  16167. selector: "remove:in:",
  16168. protocol: 'private',
  16169. fn: function (anObject,anotherObject){
  16170. var self=this;
  16171. return $core.withContext(function($ctx1) {
  16172. if (delete anotherObject.store[anObject]) self['@size']--;
  16173. return self;
  16174. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16175. },
  16176. args: ["anObject", "anotherObject"],
  16177. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  16178. referencedClasses: [],
  16179. messageSends: []
  16180. }),
  16181. $globals.Set);
  16182. $core.addMethod(
  16183. $core.method({
  16184. selector: "removeAll",
  16185. protocol: 'adding/removing',
  16186. fn: function (){
  16187. var self=this;
  16188. return $core.withContext(function($ctx1) {
  16189. self['@fastBuckets'] = {
  16190. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  16191. 'number': { store: Object.create(null), fn: Number },
  16192. 'string': { store: Object.create(null) }
  16193. };
  16194. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  16195. self['@defaultBucket']._removeAll();
  16196. self['@size'] = 0;
  16197. ;
  16198. return self;
  16199. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  16200. },
  16201. args: [],
  16202. 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>",
  16203. referencedClasses: [],
  16204. messageSends: []
  16205. }),
  16206. $globals.Set);
  16207. $core.addMethod(
  16208. $core.method({
  16209. selector: "select:",
  16210. protocol: 'enumerating',
  16211. fn: function (aBlock){
  16212. var self=this;
  16213. var collection;
  16214. return $core.withContext(function($ctx1) {
  16215. var $1,$2;
  16216. collection=$recv(self._class())._new();
  16217. self._do_((function(each){
  16218. return $core.withContext(function($ctx2) {
  16219. $1=$recv(aBlock)._value_(each);
  16220. if($core.assert($1)){
  16221. return $recv(collection)._add_(each);
  16222. };
  16223. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16224. }));
  16225. $2=collection;
  16226. return $2;
  16227. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16228. },
  16229. args: ["aBlock"],
  16230. 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",
  16231. referencedClasses: [],
  16232. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  16233. }),
  16234. $globals.Set);
  16235. $core.addMethod(
  16236. $core.method({
  16237. selector: "size",
  16238. protocol: 'accessing',
  16239. fn: function (){
  16240. var self=this;
  16241. var $1;
  16242. $1=self["@size"];
  16243. return $1;
  16244. },
  16245. args: [],
  16246. source: "size\x0a\x09^ size",
  16247. referencedClasses: [],
  16248. messageSends: []
  16249. }),
  16250. $globals.Set);
  16251. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  16252. $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.";
  16253. $core.addMethod(
  16254. $core.method({
  16255. selector: "<<",
  16256. protocol: 'writing',
  16257. fn: function (anObject){
  16258. var self=this;
  16259. return $core.withContext(function($ctx1) {
  16260. self._write_(anObject);
  16261. return self;
  16262. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  16263. },
  16264. args: ["anObject"],
  16265. source: "<< anObject\x0a\x09self write: anObject",
  16266. referencedClasses: [],
  16267. messageSends: ["write:"]
  16268. }),
  16269. $globals.ProtoStream);
  16270. $core.addMethod(
  16271. $core.method({
  16272. selector: "atEnd",
  16273. protocol: 'testing',
  16274. fn: function (){
  16275. var self=this;
  16276. return $core.withContext(function($ctx1) {
  16277. self._subclassResponsibility();
  16278. return self;
  16279. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  16280. },
  16281. args: [],
  16282. source: "atEnd\x0a\x09self subclassResponsibility",
  16283. referencedClasses: [],
  16284. messageSends: ["subclassResponsibility"]
  16285. }),
  16286. $globals.ProtoStream);
  16287. $core.addMethod(
  16288. $core.method({
  16289. selector: "atStart",
  16290. protocol: 'testing',
  16291. fn: function (){
  16292. var self=this;
  16293. return $core.withContext(function($ctx1) {
  16294. self._subclassResponsibility();
  16295. return self;
  16296. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  16297. },
  16298. args: [],
  16299. source: "atStart\x0a\x09self subclassResponsibility",
  16300. referencedClasses: [],
  16301. messageSends: ["subclassResponsibility"]
  16302. }),
  16303. $globals.ProtoStream);
  16304. $core.addMethod(
  16305. $core.method({
  16306. selector: "contents",
  16307. protocol: 'accessing',
  16308. fn: function (){
  16309. var self=this;
  16310. return $core.withContext(function($ctx1) {
  16311. self._subclassResponsibility();
  16312. return self;
  16313. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  16314. },
  16315. args: [],
  16316. source: "contents\x0a\x09self subclassResponsibility",
  16317. referencedClasses: [],
  16318. messageSends: ["subclassResponsibility"]
  16319. }),
  16320. $globals.ProtoStream);
  16321. $core.addMethod(
  16322. $core.method({
  16323. selector: "do:",
  16324. protocol: 'enumerating',
  16325. fn: function (aBlock){
  16326. var self=this;
  16327. return $core.withContext(function($ctx1) {
  16328. $recv((function(){
  16329. return $core.withContext(function($ctx2) {
  16330. return self._atEnd();
  16331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16332. }))._whileFalse_((function(){
  16333. return $core.withContext(function($ctx2) {
  16334. return $recv(aBlock)._value_(self._next());
  16335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16336. }));
  16337. return self;
  16338. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  16339. },
  16340. args: ["aBlock"],
  16341. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  16342. referencedClasses: [],
  16343. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  16344. }),
  16345. $globals.ProtoStream);
  16346. $core.addMethod(
  16347. $core.method({
  16348. selector: "isEmpty",
  16349. protocol: 'testing',
  16350. fn: function (){
  16351. var self=this;
  16352. return $core.withContext(function($ctx1) {
  16353. var $1;
  16354. $1=$recv(self._atStart())._and_((function(){
  16355. return $core.withContext(function($ctx2) {
  16356. return self._atEnd();
  16357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16358. }));
  16359. return $1;
  16360. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  16361. },
  16362. args: [],
  16363. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  16364. referencedClasses: [],
  16365. messageSends: ["and:", "atStart", "atEnd"]
  16366. }),
  16367. $globals.ProtoStream);
  16368. $core.addMethod(
  16369. $core.method({
  16370. selector: "next",
  16371. protocol: 'reading',
  16372. fn: function (){
  16373. var self=this;
  16374. return $core.withContext(function($ctx1) {
  16375. var $2,$1;
  16376. $2=self._atEnd();
  16377. if($core.assert($2)){
  16378. $1=nil;
  16379. } else {
  16380. $1=self._subclassResponsibility();
  16381. };
  16382. return $1;
  16383. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  16384. },
  16385. args: [],
  16386. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16387. referencedClasses: [],
  16388. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16389. }),
  16390. $globals.ProtoStream);
  16391. $core.addMethod(
  16392. $core.method({
  16393. selector: "nextPut:",
  16394. protocol: 'writing',
  16395. fn: function (anObject){
  16396. var self=this;
  16397. return $core.withContext(function($ctx1) {
  16398. self._subclassResponsibility();
  16399. return self;
  16400. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  16401. },
  16402. args: ["anObject"],
  16403. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  16404. referencedClasses: [],
  16405. messageSends: ["subclassResponsibility"]
  16406. }),
  16407. $globals.ProtoStream);
  16408. $core.addMethod(
  16409. $core.method({
  16410. selector: "nextPutAll:",
  16411. protocol: 'writing',
  16412. fn: function (aCollection){
  16413. var self=this;
  16414. return $core.withContext(function($ctx1) {
  16415. $recv(aCollection)._do_((function(each){
  16416. return $core.withContext(function($ctx2) {
  16417. return self._nextPut_(each);
  16418. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16419. }));
  16420. return self;
  16421. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  16422. },
  16423. args: ["aCollection"],
  16424. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  16425. referencedClasses: [],
  16426. messageSends: ["do:", "nextPut:"]
  16427. }),
  16428. $globals.ProtoStream);
  16429. $core.addMethod(
  16430. $core.method({
  16431. selector: "nextPutJSObject:",
  16432. protocol: 'writing',
  16433. fn: function (aJSObject){
  16434. var self=this;
  16435. return $core.withContext(function($ctx1) {
  16436. self._nextPut_(aJSObject);
  16437. return self;
  16438. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  16439. },
  16440. args: ["aJSObject"],
  16441. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  16442. referencedClasses: [],
  16443. messageSends: ["nextPut:"]
  16444. }),
  16445. $globals.ProtoStream);
  16446. $core.addMethod(
  16447. $core.method({
  16448. selector: "nextPutString:",
  16449. protocol: 'writing',
  16450. fn: function (aString){
  16451. var self=this;
  16452. return $core.withContext(function($ctx1) {
  16453. self._nextPut_(aString);
  16454. return self;
  16455. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  16456. },
  16457. args: ["aString"],
  16458. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  16459. referencedClasses: [],
  16460. messageSends: ["nextPut:"]
  16461. }),
  16462. $globals.ProtoStream);
  16463. $core.addMethod(
  16464. $core.method({
  16465. selector: "peek",
  16466. protocol: 'reading',
  16467. fn: function (){
  16468. var self=this;
  16469. return $core.withContext(function($ctx1) {
  16470. var $2,$1;
  16471. $2=self._atEnd();
  16472. if($core.assert($2)){
  16473. $1=nil;
  16474. } else {
  16475. $1=self._subclassResponsibility();
  16476. };
  16477. return $1;
  16478. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  16479. },
  16480. args: [],
  16481. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16482. referencedClasses: [],
  16483. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16484. }),
  16485. $globals.ProtoStream);
  16486. $core.addMethod(
  16487. $core.method({
  16488. selector: "reset",
  16489. protocol: 'actions',
  16490. fn: function (){
  16491. var self=this;
  16492. return $core.withContext(function($ctx1) {
  16493. self._subclassResponsibility();
  16494. return self;
  16495. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  16496. },
  16497. args: [],
  16498. source: "reset\x0a\x09self subclassResponsibility",
  16499. referencedClasses: [],
  16500. messageSends: ["subclassResponsibility"]
  16501. }),
  16502. $globals.ProtoStream);
  16503. $core.addMethod(
  16504. $core.method({
  16505. selector: "resetContents",
  16506. protocol: 'actions',
  16507. fn: function (){
  16508. var self=this;
  16509. return $core.withContext(function($ctx1) {
  16510. self._subclassResponsibility();
  16511. return self;
  16512. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16513. },
  16514. args: [],
  16515. source: "resetContents\x0a\x09self subclassResponsibility",
  16516. referencedClasses: [],
  16517. messageSends: ["subclassResponsibility"]
  16518. }),
  16519. $globals.ProtoStream);
  16520. $core.addMethod(
  16521. $core.method({
  16522. selector: "setToEnd",
  16523. protocol: 'positioning',
  16524. fn: function (){
  16525. var self=this;
  16526. return $core.withContext(function($ctx1) {
  16527. self._subclassResponsibility();
  16528. return self;
  16529. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16530. },
  16531. args: [],
  16532. source: "setToEnd\x0a\x09self subclassResponsibility",
  16533. referencedClasses: [],
  16534. messageSends: ["subclassResponsibility"]
  16535. }),
  16536. $globals.ProtoStream);
  16537. $core.addMethod(
  16538. $core.method({
  16539. selector: "setToStart",
  16540. protocol: 'positioning',
  16541. fn: function (){
  16542. var self=this;
  16543. return $core.withContext(function($ctx1) {
  16544. self._reset();
  16545. return self;
  16546. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16547. },
  16548. args: [],
  16549. source: "setToStart\x0a\x09self reset",
  16550. referencedClasses: [],
  16551. messageSends: ["reset"]
  16552. }),
  16553. $globals.ProtoStream);
  16554. $core.addMethod(
  16555. $core.method({
  16556. selector: "write:",
  16557. protocol: 'writing',
  16558. fn: function (anObject){
  16559. var self=this;
  16560. return $core.withContext(function($ctx1) {
  16561. $recv(anObject)._putOn_(self);
  16562. return self;
  16563. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16564. },
  16565. args: ["anObject"],
  16566. source: "write: anObject\x0a\x09anObject putOn: self",
  16567. referencedClasses: [],
  16568. messageSends: ["putOn:"]
  16569. }),
  16570. $globals.ProtoStream);
  16571. $core.addMethod(
  16572. $core.method({
  16573. selector: "on:",
  16574. protocol: 'instance creation',
  16575. fn: function (aCollection){
  16576. var self=this;
  16577. return $core.withContext(function($ctx1) {
  16578. var $2,$3,$1;
  16579. $2=self._new();
  16580. $recv($2)._setCollection_(aCollection);
  16581. $recv($2)._setStreamSize_($recv(aCollection)._size());
  16582. $3=$recv($2)._yourself();
  16583. $1=$3;
  16584. return $1;
  16585. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16586. },
  16587. args: ["aCollection"],
  16588. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16589. referencedClasses: [],
  16590. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16591. }),
  16592. $globals.ProtoStream.klass);
  16593. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16594. $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.";
  16595. $core.addMethod(
  16596. $core.method({
  16597. selector: "atEnd",
  16598. protocol: 'testing',
  16599. fn: function (){
  16600. var self=this;
  16601. return $core.withContext(function($ctx1) {
  16602. var $1;
  16603. $1=$recv(self._position()).__eq(self._size());
  16604. return $1;
  16605. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16606. },
  16607. args: [],
  16608. source: "atEnd\x0a\x09^ self position = self size",
  16609. referencedClasses: [],
  16610. messageSends: ["=", "position", "size"]
  16611. }),
  16612. $globals.Stream);
  16613. $core.addMethod(
  16614. $core.method({
  16615. selector: "atStart",
  16616. protocol: 'testing',
  16617. fn: function (){
  16618. var self=this;
  16619. return $core.withContext(function($ctx1) {
  16620. var $1;
  16621. $1=$recv(self._position()).__eq((0));
  16622. return $1;
  16623. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16624. },
  16625. args: [],
  16626. source: "atStart\x0a\x09^ self position = 0",
  16627. referencedClasses: [],
  16628. messageSends: ["=", "position"]
  16629. }),
  16630. $globals.Stream);
  16631. $core.addMethod(
  16632. $core.method({
  16633. selector: "close",
  16634. protocol: 'actions',
  16635. fn: function (){
  16636. var self=this;
  16637. return self;
  16638. },
  16639. args: [],
  16640. source: "close",
  16641. referencedClasses: [],
  16642. messageSends: []
  16643. }),
  16644. $globals.Stream);
  16645. $core.addMethod(
  16646. $core.method({
  16647. selector: "collection",
  16648. protocol: 'accessing',
  16649. fn: function (){
  16650. var self=this;
  16651. var $1;
  16652. $1=self["@collection"];
  16653. return $1;
  16654. },
  16655. args: [],
  16656. source: "collection\x0a\x09^ collection",
  16657. referencedClasses: [],
  16658. messageSends: []
  16659. }),
  16660. $globals.Stream);
  16661. $core.addMethod(
  16662. $core.method({
  16663. selector: "contents",
  16664. protocol: 'accessing',
  16665. fn: function (){
  16666. var self=this;
  16667. return $core.withContext(function($ctx1) {
  16668. var $1;
  16669. $1=$recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16670. return $1;
  16671. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16672. },
  16673. args: [],
  16674. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16675. referencedClasses: [],
  16676. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16677. }),
  16678. $globals.Stream);
  16679. $core.addMethod(
  16680. $core.method({
  16681. selector: "flush",
  16682. protocol: 'actions',
  16683. fn: function (){
  16684. var self=this;
  16685. return self;
  16686. },
  16687. args: [],
  16688. source: "flush",
  16689. referencedClasses: [],
  16690. messageSends: []
  16691. }),
  16692. $globals.Stream);
  16693. $core.addMethod(
  16694. $core.method({
  16695. selector: "isEmpty",
  16696. protocol: 'testing',
  16697. fn: function (){
  16698. var self=this;
  16699. return $core.withContext(function($ctx1) {
  16700. var $1;
  16701. $1=$recv(self._size()).__eq((0));
  16702. return $1;
  16703. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16704. },
  16705. args: [],
  16706. source: "isEmpty\x0a\x09^ self size = 0",
  16707. referencedClasses: [],
  16708. messageSends: ["=", "size"]
  16709. }),
  16710. $globals.Stream);
  16711. $core.addMethod(
  16712. $core.method({
  16713. selector: "next",
  16714. protocol: 'reading',
  16715. fn: function (){
  16716. var self=this;
  16717. return $core.withContext(function($ctx1) {
  16718. var $2,$4,$3,$1;
  16719. $2=self._atEnd();
  16720. if($core.assert($2)){
  16721. $1=nil;
  16722. } else {
  16723. $4=self._position();
  16724. $ctx1.sendIdx["position"]=1;
  16725. $3=$recv($4).__plus((1));
  16726. self._position_($3);
  16727. $1=$recv(self["@collection"])._at_(self._position());
  16728. };
  16729. return $1;
  16730. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16731. },
  16732. args: [],
  16733. 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 ]",
  16734. referencedClasses: [],
  16735. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16736. }),
  16737. $globals.Stream);
  16738. $core.addMethod(
  16739. $core.method({
  16740. selector: "next:",
  16741. protocol: 'reading',
  16742. fn: function (anInteger){
  16743. var self=this;
  16744. var tempCollection;
  16745. return $core.withContext(function($ctx1) {
  16746. var $1,$2;
  16747. tempCollection=$recv($recv(self._collection())._class())._new();
  16748. $recv(anInteger)._timesRepeat_((function(){
  16749. return $core.withContext(function($ctx2) {
  16750. $1=self._atEnd();
  16751. if(!$core.assert($1)){
  16752. return $recv(tempCollection)._add_(self._next());
  16753. };
  16754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16755. }));
  16756. $2=tempCollection;
  16757. return $2;
  16758. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16759. },
  16760. args: ["anInteger"],
  16761. 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",
  16762. referencedClasses: [],
  16763. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16764. }),
  16765. $globals.Stream);
  16766. $core.addMethod(
  16767. $core.method({
  16768. selector: "nextPut:",
  16769. protocol: 'writing',
  16770. fn: function (anObject){
  16771. var self=this;
  16772. return $core.withContext(function($ctx1) {
  16773. var $2,$1,$3,$4;
  16774. $2=self._position();
  16775. $ctx1.sendIdx["position"]=1;
  16776. $1=$recv($2).__plus((1));
  16777. self._position_($1);
  16778. $3=self._collection();
  16779. $4=self._position();
  16780. $ctx1.sendIdx["position"]=2;
  16781. $recv($3)._at_put_($4,anObject);
  16782. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16783. return self;
  16784. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16785. },
  16786. args: ["anObject"],
  16787. 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)",
  16788. referencedClasses: [],
  16789. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  16790. }),
  16791. $globals.Stream);
  16792. $core.addMethod(
  16793. $core.method({
  16794. selector: "peek",
  16795. protocol: 'reading',
  16796. fn: function (){
  16797. var self=this;
  16798. return $core.withContext(function($ctx1) {
  16799. var $2,$1;
  16800. $2=self._atEnd();
  16801. if(!$core.assert($2)){
  16802. $1=$recv(self._collection())._at_($recv(self._position()).__plus((1)));
  16803. };
  16804. return $1;
  16805. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  16806. },
  16807. args: [],
  16808. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  16809. referencedClasses: [],
  16810. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  16811. }),
  16812. $globals.Stream);
  16813. $core.addMethod(
  16814. $core.method({
  16815. selector: "position",
  16816. protocol: 'accessing',
  16817. fn: function (){
  16818. var self=this;
  16819. return $core.withContext(function($ctx1) {
  16820. var $2,$1,$receiver;
  16821. $2=self["@position"];
  16822. if(($receiver = $2) == null || $receiver.isNil){
  16823. self["@position"]=(0);
  16824. $1=self["@position"];
  16825. } else {
  16826. $1=$2;
  16827. };
  16828. return $1;
  16829. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  16830. },
  16831. args: [],
  16832. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  16833. referencedClasses: [],
  16834. messageSends: ["ifNil:"]
  16835. }),
  16836. $globals.Stream);
  16837. $core.addMethod(
  16838. $core.method({
  16839. selector: "position:",
  16840. protocol: 'accessing',
  16841. fn: function (anInteger){
  16842. var self=this;
  16843. self["@position"]=anInteger;
  16844. return self;
  16845. },
  16846. args: ["anInteger"],
  16847. source: "position: anInteger\x0a\x09position := anInteger",
  16848. referencedClasses: [],
  16849. messageSends: []
  16850. }),
  16851. $globals.Stream);
  16852. $core.addMethod(
  16853. $core.method({
  16854. selector: "reset",
  16855. protocol: 'actions',
  16856. fn: function (){
  16857. var self=this;
  16858. return $core.withContext(function($ctx1) {
  16859. self._position_((0));
  16860. return self;
  16861. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  16862. },
  16863. args: [],
  16864. source: "reset\x0a\x09self position: 0",
  16865. referencedClasses: [],
  16866. messageSends: ["position:"]
  16867. }),
  16868. $globals.Stream);
  16869. $core.addMethod(
  16870. $core.method({
  16871. selector: "resetContents",
  16872. protocol: 'actions',
  16873. fn: function (){
  16874. var self=this;
  16875. return $core.withContext(function($ctx1) {
  16876. self._reset();
  16877. self._setStreamSize_((0));
  16878. return self;
  16879. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  16880. },
  16881. args: [],
  16882. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  16883. referencedClasses: [],
  16884. messageSends: ["reset", "setStreamSize:"]
  16885. }),
  16886. $globals.Stream);
  16887. $core.addMethod(
  16888. $core.method({
  16889. selector: "setCollection:",
  16890. protocol: 'accessing',
  16891. fn: function (aCollection){
  16892. var self=this;
  16893. self["@collection"]=aCollection;
  16894. return self;
  16895. },
  16896. args: ["aCollection"],
  16897. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  16898. referencedClasses: [],
  16899. messageSends: []
  16900. }),
  16901. $globals.Stream);
  16902. $core.addMethod(
  16903. $core.method({
  16904. selector: "setStreamSize:",
  16905. protocol: 'accessing',
  16906. fn: function (anInteger){
  16907. var self=this;
  16908. self["@streamSize"]=anInteger;
  16909. return self;
  16910. },
  16911. args: ["anInteger"],
  16912. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  16913. referencedClasses: [],
  16914. messageSends: []
  16915. }),
  16916. $globals.Stream);
  16917. $core.addMethod(
  16918. $core.method({
  16919. selector: "setToEnd",
  16920. protocol: 'positioning',
  16921. fn: function (){
  16922. var self=this;
  16923. return $core.withContext(function($ctx1) {
  16924. self._position_(self._size());
  16925. return self;
  16926. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  16927. },
  16928. args: [],
  16929. source: "setToEnd\x0a\x09self position: self size",
  16930. referencedClasses: [],
  16931. messageSends: ["position:", "size"]
  16932. }),
  16933. $globals.Stream);
  16934. $core.addMethod(
  16935. $core.method({
  16936. selector: "size",
  16937. protocol: 'accessing',
  16938. fn: function (){
  16939. var self=this;
  16940. return $core.withContext(function($ctx1) {
  16941. var $1;
  16942. $1=self._streamSize();
  16943. return $1;
  16944. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  16945. },
  16946. args: [],
  16947. source: "size\x0a\x09^ self streamSize",
  16948. referencedClasses: [],
  16949. messageSends: ["streamSize"]
  16950. }),
  16951. $globals.Stream);
  16952. $core.addMethod(
  16953. $core.method({
  16954. selector: "skip:",
  16955. protocol: 'positioning',
  16956. fn: function (anInteger){
  16957. var self=this;
  16958. return $core.withContext(function($ctx1) {
  16959. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  16960. return self;
  16961. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  16962. },
  16963. args: ["anInteger"],
  16964. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  16965. referencedClasses: [],
  16966. messageSends: ["position:", "min:max:", "+", "position", "size"]
  16967. }),
  16968. $globals.Stream);
  16969. $core.addMethod(
  16970. $core.method({
  16971. selector: "streamSize",
  16972. protocol: 'accessing',
  16973. fn: function (){
  16974. var self=this;
  16975. var $1;
  16976. $1=self["@streamSize"];
  16977. return $1;
  16978. },
  16979. args: [],
  16980. source: "streamSize\x0a\x09^ streamSize",
  16981. referencedClasses: [],
  16982. messageSends: []
  16983. }),
  16984. $globals.Stream);
  16985. $core.addMethod(
  16986. $core.method({
  16987. selector: "on:",
  16988. protocol: 'instance creation',
  16989. fn: function (aCollection){
  16990. var self=this;
  16991. return $core.withContext(function($ctx1) {
  16992. var $2,$3,$1;
  16993. $2=self._new();
  16994. $recv($2)._setCollection_(aCollection);
  16995. $recv($2)._setStreamSize_($recv(aCollection)._size());
  16996. $3=$recv($2)._yourself();
  16997. $1=$3;
  16998. return $1;
  16999. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  17000. },
  17001. args: ["aCollection"],
  17002. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  17003. referencedClasses: [],
  17004. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  17005. }),
  17006. $globals.Stream.klass);
  17007. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  17008. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  17009. $core.addMethod(
  17010. $core.method({
  17011. selector: "cr",
  17012. protocol: 'writing',
  17013. fn: function (){
  17014. var self=this;
  17015. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17016. return $core.withContext(function($ctx1) {
  17017. var $1;
  17018. $1=self._nextPutAll_($recv($String())._cr());
  17019. return $1;
  17020. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  17021. },
  17022. args: [],
  17023. source: "cr\x0a\x09^ self nextPutAll: String cr",
  17024. referencedClasses: ["String"],
  17025. messageSends: ["nextPutAll:", "cr"]
  17026. }),
  17027. $globals.StringStream);
  17028. $core.addMethod(
  17029. $core.method({
  17030. selector: "crlf",
  17031. protocol: 'writing',
  17032. fn: function (){
  17033. var self=this;
  17034. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17035. return $core.withContext(function($ctx1) {
  17036. var $1;
  17037. $1=self._nextPutAll_($recv($String())._crlf());
  17038. return $1;
  17039. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  17040. },
  17041. args: [],
  17042. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  17043. referencedClasses: ["String"],
  17044. messageSends: ["nextPutAll:", "crlf"]
  17045. }),
  17046. $globals.StringStream);
  17047. $core.addMethod(
  17048. $core.method({
  17049. selector: "lf",
  17050. protocol: 'writing',
  17051. fn: function (){
  17052. var self=this;
  17053. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17054. return $core.withContext(function($ctx1) {
  17055. var $1;
  17056. $1=self._nextPutAll_($recv($String())._lf());
  17057. return $1;
  17058. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  17059. },
  17060. args: [],
  17061. source: "lf\x0a\x09^ self nextPutAll: String lf",
  17062. referencedClasses: ["String"],
  17063. messageSends: ["nextPutAll:", "lf"]
  17064. }),
  17065. $globals.StringStream);
  17066. $core.addMethod(
  17067. $core.method({
  17068. selector: "next:",
  17069. protocol: 'reading',
  17070. fn: function (anInteger){
  17071. var self=this;
  17072. var tempCollection;
  17073. return $core.withContext(function($ctx1) {
  17074. var $1,$2;
  17075. tempCollection=$recv($recv(self._collection())._class())._new();
  17076. $recv(anInteger)._timesRepeat_((function(){
  17077. return $core.withContext(function($ctx2) {
  17078. $1=self._atEnd();
  17079. if(!$core.assert($1)){
  17080. tempCollection=$recv(tempCollection).__comma(self._next());
  17081. return tempCollection;
  17082. };
  17083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17084. }));
  17085. $2=tempCollection;
  17086. return $2;
  17087. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  17088. },
  17089. args: ["anInteger"],
  17090. 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",
  17091. referencedClasses: [],
  17092. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  17093. }),
  17094. $globals.StringStream);
  17095. $core.addMethod(
  17096. $core.method({
  17097. selector: "nextPut:",
  17098. protocol: 'writing',
  17099. fn: function (aString){
  17100. var self=this;
  17101. return $core.withContext(function($ctx1) {
  17102. self._nextPutAll_(aString);
  17103. return self;
  17104. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  17105. },
  17106. args: ["aString"],
  17107. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  17108. referencedClasses: [],
  17109. messageSends: ["nextPutAll:"]
  17110. }),
  17111. $globals.StringStream);
  17112. $core.addMethod(
  17113. $core.method({
  17114. selector: "nextPutAll:",
  17115. protocol: 'writing',
  17116. fn: function (aString){
  17117. var self=this;
  17118. var pre,post;
  17119. return $core.withContext(function($ctx1) {
  17120. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  17121. $1=self._atEnd();
  17122. if($core.assert($1)){
  17123. $3=self._collection();
  17124. $ctx1.sendIdx["collection"]=1;
  17125. $2=$recv($3).__comma(aString);
  17126. $ctx1.sendIdx[","]=1;
  17127. self._setCollection_($2);
  17128. $ctx1.sendIdx["setCollection:"]=1;
  17129. } else {
  17130. $4=self._collection();
  17131. $ctx1.sendIdx["collection"]=2;
  17132. $5=self._position();
  17133. $ctx1.sendIdx["position"]=1;
  17134. pre=$recv($4)._copyFrom_to_((1),$5);
  17135. $ctx1.sendIdx["copyFrom:to:"]=1;
  17136. pre;
  17137. $6=self._collection();
  17138. $ctx1.sendIdx["collection"]=3;
  17139. $9=self._position();
  17140. $ctx1.sendIdx["position"]=2;
  17141. $8=$recv($9).__plus((1));
  17142. $ctx1.sendIdx["+"]=2;
  17143. $10=$recv(aString)._size();
  17144. $ctx1.sendIdx["size"]=1;
  17145. $7=$recv($8).__plus($10);
  17146. $ctx1.sendIdx["+"]=1;
  17147. $11=$recv(self._collection())._size();
  17148. $ctx1.sendIdx["size"]=2;
  17149. post=$recv($6)._copyFrom_to_($7,$11);
  17150. post;
  17151. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  17152. $ctx1.sendIdx[","]=2;
  17153. self._setCollection_($12);
  17154. };
  17155. $14=self._position();
  17156. $ctx1.sendIdx["position"]=3;
  17157. $13=$recv($14).__plus($recv(aString)._size());
  17158. self._position_($13);
  17159. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  17160. return self;
  17161. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  17162. },
  17163. args: ["aString"],
  17164. 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)",
  17165. referencedClasses: [],
  17166. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  17167. }),
  17168. $globals.StringStream);
  17169. $core.addMethod(
  17170. $core.method({
  17171. selector: "nextPutString:",
  17172. protocol: 'writing',
  17173. fn: function (aString){
  17174. var self=this;
  17175. return $core.withContext(function($ctx1) {
  17176. self._nextPutAll_(aString);
  17177. return self;
  17178. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  17179. },
  17180. args: ["aString"],
  17181. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  17182. referencedClasses: [],
  17183. messageSends: ["nextPutAll:"]
  17184. }),
  17185. $globals.StringStream);
  17186. $core.addMethod(
  17187. $core.method({
  17188. selector: "space",
  17189. protocol: 'writing',
  17190. fn: function (){
  17191. var self=this;
  17192. return $core.withContext(function($ctx1) {
  17193. self._nextPut_(" ");
  17194. return self;
  17195. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  17196. },
  17197. args: [],
  17198. source: "space\x0a\x09self nextPut: ' '",
  17199. referencedClasses: [],
  17200. messageSends: ["nextPut:"]
  17201. }),
  17202. $globals.StringStream);
  17203. $core.addMethod(
  17204. $core.method({
  17205. selector: "tab",
  17206. protocol: 'writing',
  17207. fn: function (){
  17208. var self=this;
  17209. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17210. return $core.withContext(function($ctx1) {
  17211. var $1;
  17212. $1=self._nextPutAll_($recv($String())._tab());
  17213. return $1;
  17214. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  17215. },
  17216. args: [],
  17217. source: "tab\x0a\x09^ self nextPutAll: String tab",
  17218. referencedClasses: ["String"],
  17219. messageSends: ["nextPutAll:", "tab"]
  17220. }),
  17221. $globals.StringStream);
  17222. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  17223. $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.";
  17224. $core.addMethod(
  17225. $core.method({
  17226. selector: "initialize",
  17227. protocol: 'initialization',
  17228. fn: function (){
  17229. var self=this;
  17230. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  17231. return $core.withContext(function($ctx1) {
  17232. (
  17233. $ctx1.supercall = true,
  17234. $globals.Queue.superclass.fn.prototype._initialize.apply($recv(self), []));
  17235. $ctx1.supercall = false;
  17236. self["@read"]=$recv($OrderedCollection())._new();
  17237. $ctx1.sendIdx["new"]=1;
  17238. self["@write"]=$recv($OrderedCollection())._new();
  17239. self["@readIndex"]=(1);
  17240. return self;
  17241. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  17242. },
  17243. args: [],
  17244. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  17245. referencedClasses: ["OrderedCollection"],
  17246. messageSends: ["initialize", "new"]
  17247. }),
  17248. $globals.Queue);
  17249. $core.addMethod(
  17250. $core.method({
  17251. selector: "next",
  17252. protocol: 'accessing',
  17253. fn: function (){
  17254. var self=this;
  17255. return $core.withContext(function($ctx1) {
  17256. var $1;
  17257. $1=self._nextIfAbsent_((function(){
  17258. return $core.withContext(function($ctx2) {
  17259. return self._error_("Cannot read from empty Queue.");
  17260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17261. }));
  17262. return $1;
  17263. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  17264. },
  17265. args: [],
  17266. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  17267. referencedClasses: [],
  17268. messageSends: ["nextIfAbsent:", "error:"]
  17269. }),
  17270. $globals.Queue);
  17271. $core.addMethod(
  17272. $core.method({
  17273. selector: "nextIfAbsent:",
  17274. protocol: 'accessing',
  17275. fn: function (aBlock){
  17276. var self=this;
  17277. var result;
  17278. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  17279. return $core.withContext(function($ctx1) {
  17280. var $1,$2,$3,$4;
  17281. var $early={};
  17282. try {
  17283. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  17284. return $core.withContext(function($ctx2) {
  17285. $1=$recv(self["@write"])._isEmpty();
  17286. if($core.assert($1)){
  17287. $2=$recv(self["@readIndex"]).__gt((1));
  17288. if($core.assert($2)){
  17289. self["@read"]=[];
  17290. self["@read"];
  17291. self["@readIndex"]=(1);
  17292. self["@readIndex"];
  17293. };
  17294. $3=$recv(aBlock)._value();
  17295. throw $early=[$3];
  17296. };
  17297. self["@read"]=self["@write"];
  17298. self["@read"];
  17299. self["@readIndex"]=(1);
  17300. self["@readIndex"];
  17301. self["@write"]=$recv($OrderedCollection())._new();
  17302. self["@write"];
  17303. return $recv(self["@read"])._first();
  17304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17305. }));
  17306. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  17307. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  17308. $4=result;
  17309. return $4;
  17310. }
  17311. catch(e) {if(e===$early)return e[0]; throw e}
  17312. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  17313. },
  17314. args: ["aBlock"],
  17315. 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",
  17316. referencedClasses: ["OrderedCollection"],
  17317. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  17318. }),
  17319. $globals.Queue);
  17320. $core.addMethod(
  17321. $core.method({
  17322. selector: "nextPut:",
  17323. protocol: 'accessing',
  17324. fn: function (anObject){
  17325. var self=this;
  17326. return $core.withContext(function($ctx1) {
  17327. $recv(self["@write"])._add_(anObject);
  17328. return self;
  17329. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  17330. },
  17331. args: ["anObject"],
  17332. source: "nextPut: anObject\x0a\x09write add: anObject",
  17333. referencedClasses: [],
  17334. messageSends: ["add:"]
  17335. }),
  17336. $globals.Queue);
  17337. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  17338. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  17339. $core.addMethod(
  17340. $core.method({
  17341. selector: "compile:",
  17342. protocol: 'evaluating',
  17343. fn: function (aString){
  17344. var self=this;
  17345. return $core.withContext(function($ctx1) {
  17346. return self.compile(aString);
  17347. return self;
  17348. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  17349. },
  17350. args: ["aString"],
  17351. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  17352. referencedClasses: [],
  17353. messageSends: []
  17354. }),
  17355. $globals.RegularExpression);
  17356. $core.addMethod(
  17357. $core.method({
  17358. selector: "exec:",
  17359. protocol: 'evaluating',
  17360. fn: function (aString){
  17361. var self=this;
  17362. return $core.withContext(function($ctx1) {
  17363. return self.exec(aString) || nil;
  17364. return self;
  17365. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  17366. },
  17367. args: ["aString"],
  17368. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  17369. referencedClasses: [],
  17370. messageSends: []
  17371. }),
  17372. $globals.RegularExpression);
  17373. $core.addMethod(
  17374. $core.method({
  17375. selector: "test:",
  17376. protocol: 'evaluating',
  17377. fn: function (aString){
  17378. var self=this;
  17379. return $core.withContext(function($ctx1) {
  17380. return self.test(aString);
  17381. return self;
  17382. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  17383. },
  17384. args: ["aString"],
  17385. source: "test: aString\x0a\x09<return self.test(aString)>",
  17386. referencedClasses: [],
  17387. messageSends: []
  17388. }),
  17389. $globals.RegularExpression);
  17390. $core.addMethod(
  17391. $core.method({
  17392. selector: "fromString:",
  17393. protocol: 'instance creation',
  17394. fn: function (aString){
  17395. var self=this;
  17396. return $core.withContext(function($ctx1) {
  17397. var $1;
  17398. $1=self._fromString_flag_(aString,"");
  17399. return $1;
  17400. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  17401. },
  17402. args: ["aString"],
  17403. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  17404. referencedClasses: [],
  17405. messageSends: ["fromString:flag:"]
  17406. }),
  17407. $globals.RegularExpression.klass);
  17408. $core.addMethod(
  17409. $core.method({
  17410. selector: "fromString:flag:",
  17411. protocol: 'instance creation',
  17412. fn: function (aString,anotherString){
  17413. var self=this;
  17414. return $core.withContext(function($ctx1) {
  17415. return new RegExp(aString, anotherString);
  17416. return self;
  17417. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  17418. },
  17419. args: ["aString", "anotherString"],
  17420. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  17421. referencedClasses: [],
  17422. messageSends: []
  17423. }),
  17424. $globals.RegularExpression.klass);
  17425. });
  17426. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){"use strict";
  17427. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  17428. $core.addPackage('Kernel-Infrastructure');
  17429. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  17430. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17431. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  17432. $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`.";
  17433. $core.addMethod(
  17434. $core.method({
  17435. selector: "=",
  17436. protocol: 'comparing',
  17437. fn: function (anObject){
  17438. var self=this;
  17439. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  17440. return $core.withContext(function($ctx1) {
  17441. var $2,$1,$3;
  17442. $2=$recv(anObject)._class();
  17443. $ctx1.sendIdx["class"]=1;
  17444. $1=$recv($2).__eq_eq(self._class());
  17445. if(!$core.assert($1)){
  17446. return false;
  17447. };
  17448. $3=$recv($JSObjectProxy())._compareJSObjectOfProxy_withProxy_(self,anObject);
  17449. return $3;
  17450. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  17451. },
  17452. args: ["anObject"],
  17453. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  17454. referencedClasses: ["JSObjectProxy"],
  17455. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  17456. }),
  17457. $globals.JSObjectProxy);
  17458. $core.addMethod(
  17459. $core.method({
  17460. selector: "asJSON",
  17461. protocol: 'enumerating',
  17462. fn: function (){
  17463. var self=this;
  17464. var $1;
  17465. $1=self["@jsObject"];
  17466. return $1;
  17467. },
  17468. args: [],
  17469. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  17470. referencedClasses: [],
  17471. messageSends: []
  17472. }),
  17473. $globals.JSObjectProxy);
  17474. $core.addMethod(
  17475. $core.method({
  17476. selector: "at:",
  17477. protocol: 'accessing',
  17478. fn: function (aString){
  17479. var self=this;
  17480. return $core.withContext(function($ctx1) {
  17481. return self['@jsObject'][aString];
  17482. return self;
  17483. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  17484. },
  17485. args: ["aString"],
  17486. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  17487. referencedClasses: [],
  17488. messageSends: []
  17489. }),
  17490. $globals.JSObjectProxy);
  17491. $core.addMethod(
  17492. $core.method({
  17493. selector: "at:ifAbsent:",
  17494. protocol: 'accessing',
  17495. fn: function (aString,aBlock){
  17496. var self=this;
  17497. return $core.withContext(function($ctx1) {
  17498. var obj = self['@jsObject'];
  17499. return aString in obj ? obj[aString] : aBlock._value();
  17500. ;
  17501. return self;
  17502. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  17503. },
  17504. args: ["aString", "aBlock"],
  17505. 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>",
  17506. referencedClasses: [],
  17507. messageSends: []
  17508. }),
  17509. $globals.JSObjectProxy);
  17510. $core.addMethod(
  17511. $core.method({
  17512. selector: "at:ifPresent:",
  17513. protocol: 'accessing',
  17514. fn: function (aString,aBlock){
  17515. var self=this;
  17516. return $core.withContext(function($ctx1) {
  17517. var obj = self['@jsObject'];
  17518. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  17519. ;
  17520. return self;
  17521. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  17522. },
  17523. args: ["aString", "aBlock"],
  17524. 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>",
  17525. referencedClasses: [],
  17526. messageSends: []
  17527. }),
  17528. $globals.JSObjectProxy);
  17529. $core.addMethod(
  17530. $core.method({
  17531. selector: "at:ifPresent:ifAbsent:",
  17532. protocol: 'accessing',
  17533. fn: function (aString,aBlock,anotherBlock){
  17534. var self=this;
  17535. return $core.withContext(function($ctx1) {
  17536. var obj = self['@jsObject'];
  17537. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  17538. ;
  17539. return self;
  17540. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  17541. },
  17542. args: ["aString", "aBlock", "anotherBlock"],
  17543. 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>",
  17544. referencedClasses: [],
  17545. messageSends: []
  17546. }),
  17547. $globals.JSObjectProxy);
  17548. $core.addMethod(
  17549. $core.method({
  17550. selector: "at:put:",
  17551. protocol: 'accessing',
  17552. fn: function (aString,anObject){
  17553. var self=this;
  17554. return $core.withContext(function($ctx1) {
  17555. return self['@jsObject'][aString] = anObject;
  17556. return self;
  17557. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  17558. },
  17559. args: ["aString", "anObject"],
  17560. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  17561. referencedClasses: [],
  17562. messageSends: []
  17563. }),
  17564. $globals.JSObjectProxy);
  17565. $core.addMethod(
  17566. $core.method({
  17567. selector: "doesNotUnderstand:",
  17568. protocol: 'proxy',
  17569. fn: function (aMessage){
  17570. var self=this;
  17571. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  17572. return $core.withContext(function($ctx1) {
  17573. var $2,$1,$receiver;
  17574. $2=$recv($JSObjectProxy())._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  17575. if(($receiver = $2) == null || $receiver.isNil){
  17576. $1=(
  17577. $ctx1.supercall = true,
  17578. $globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  17579. $ctx1.supercall = false;
  17580. } else {
  17581. var jsSelector;
  17582. jsSelector=$receiver;
  17583. $1=$recv($JSObjectProxy())._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  17584. };
  17585. return $1;
  17586. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  17587. },
  17588. args: ["aMessage"],
  17589. 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 ]",
  17590. referencedClasses: ["JSObjectProxy"],
  17591. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  17592. }),
  17593. $globals.JSObjectProxy);
  17594. $core.addMethod(
  17595. $core.method({
  17596. selector: "in:",
  17597. protocol: 'accessing',
  17598. fn: function (aValuable){
  17599. var self=this;
  17600. return $core.withContext(function($ctx1) {
  17601. var $1;
  17602. $1=$recv(aValuable)._value_(self["@jsObject"]);
  17603. return $1;
  17604. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  17605. },
  17606. args: ["aValuable"],
  17607. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  17608. referencedClasses: [],
  17609. messageSends: ["value:"]
  17610. }),
  17611. $globals.JSObjectProxy);
  17612. $core.addMethod(
  17613. $core.method({
  17614. selector: "jsObject",
  17615. protocol: 'accessing',
  17616. fn: function (){
  17617. var self=this;
  17618. var $1;
  17619. $1=self["@jsObject"];
  17620. return $1;
  17621. },
  17622. args: [],
  17623. source: "jsObject\x0a\x09^ jsObject",
  17624. referencedClasses: [],
  17625. messageSends: []
  17626. }),
  17627. $globals.JSObjectProxy);
  17628. $core.addMethod(
  17629. $core.method({
  17630. selector: "keysAndValuesDo:",
  17631. protocol: 'enumerating',
  17632. fn: function (aBlock){
  17633. var self=this;
  17634. return $core.withContext(function($ctx1) {
  17635. var o = self['@jsObject'];
  17636. for(var i in o) {
  17637. aBlock._value_value_(i, o[i]);
  17638. }
  17639. ;
  17640. return self;
  17641. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  17642. },
  17643. args: ["aBlock"],
  17644. 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>",
  17645. referencedClasses: [],
  17646. messageSends: []
  17647. }),
  17648. $globals.JSObjectProxy);
  17649. $core.addMethod(
  17650. $core.method({
  17651. selector: "printOn:",
  17652. protocol: 'printing',
  17653. fn: function (aStream){
  17654. var self=this;
  17655. return $core.withContext(function($ctx1) {
  17656. $recv(aStream)._nextPutAll_(self._printString());
  17657. return self;
  17658. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  17659. },
  17660. args: ["aStream"],
  17661. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  17662. referencedClasses: [],
  17663. messageSends: ["nextPutAll:", "printString"]
  17664. }),
  17665. $globals.JSObjectProxy);
  17666. $core.addMethod(
  17667. $core.method({
  17668. selector: "printString",
  17669. protocol: 'printing',
  17670. fn: function (){
  17671. var self=this;
  17672. return $core.withContext(function($ctx1) {
  17673. var js = self['@jsObject'];
  17674. return js.toString
  17675. ? js.toString()
  17676. : Object.prototype.toString.call(js)
  17677. ;
  17678. return self;
  17679. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  17680. },
  17681. args: [],
  17682. 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>",
  17683. referencedClasses: [],
  17684. messageSends: []
  17685. }),
  17686. $globals.JSObjectProxy);
  17687. $core.addMethod(
  17688. $core.method({
  17689. selector: "putOn:",
  17690. protocol: 'streaming',
  17691. fn: function (aStream){
  17692. var self=this;
  17693. return $core.withContext(function($ctx1) {
  17694. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  17695. return self;
  17696. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  17697. },
  17698. args: ["aStream"],
  17699. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  17700. referencedClasses: [],
  17701. messageSends: ["nextPutJSObject:"]
  17702. }),
  17703. $globals.JSObjectProxy);
  17704. $core.addMethod(
  17705. $core.method({
  17706. selector: "addObjectVariablesTo:ofProxy:",
  17707. protocol: 'proxy',
  17708. fn: function (aDictionary,aProxy){
  17709. var self=this;
  17710. return $core.withContext(function($ctx1) {
  17711. var jsObject = aProxy['@jsObject'];
  17712. for(var i in jsObject) {
  17713. aDictionary._at_put_(i, jsObject[i]);
  17714. }
  17715. ;
  17716. return self;
  17717. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17718. },
  17719. args: ["aDictionary", "aProxy"],
  17720. 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>",
  17721. referencedClasses: [],
  17722. messageSends: []
  17723. }),
  17724. $globals.JSObjectProxy.klass);
  17725. $core.addMethod(
  17726. $core.method({
  17727. selector: "compareJSObjectOfProxy:withProxy:",
  17728. protocol: 'proxy',
  17729. fn: function (aProxy,anotherProxy){
  17730. var self=this;
  17731. return $core.withContext(function($ctx1) {
  17732. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  17733. return aProxy["@jsObject"] === anotherJSObject;
  17734. return self;
  17735. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  17736. },
  17737. args: ["aProxy", "anotherProxy"],
  17738. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>",
  17739. referencedClasses: [],
  17740. messageSends: []
  17741. }),
  17742. $globals.JSObjectProxy.klass);
  17743. $core.addMethod(
  17744. $core.method({
  17745. selector: "forwardMessage:withArguments:ofProxy:",
  17746. protocol: 'proxy',
  17747. fn: function (aString,anArray,aProxy){
  17748. var self=this;
  17749. return $core.withContext(function($ctx1) {
  17750. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  17751. ;
  17752. return self;
  17753. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17754. },
  17755. args: ["aString", "anArray", "aProxy"],
  17756. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>",
  17757. referencedClasses: [],
  17758. messageSends: []
  17759. }),
  17760. $globals.JSObjectProxy.klass);
  17761. $core.addMethod(
  17762. $core.method({
  17763. selector: "jsObject:ofProxy:",
  17764. protocol: 'proxy',
  17765. fn: function (aJSObject,aProxy){
  17766. var self=this;
  17767. return $core.withContext(function($ctx1) {
  17768. aProxy['@jsObject'] = aJSObject;
  17769. return self;
  17770. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17771. },
  17772. args: ["aJSObject", "aProxy"],
  17773. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<aProxy['@jsObject'] = aJSObject>",
  17774. referencedClasses: [],
  17775. messageSends: []
  17776. }),
  17777. $globals.JSObjectProxy.klass);
  17778. $core.addMethod(
  17779. $core.method({
  17780. selector: "lookupProperty:ofProxy:",
  17781. protocol: 'proxy',
  17782. fn: function (aString,aProxy){
  17783. var self=this;
  17784. return $core.withContext(function($ctx1) {
  17785. return aString in aProxy._jsObject() ? aString : nil;
  17786. return self;
  17787. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17788. },
  17789. args: ["aString", "aProxy"],
  17790. 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>",
  17791. referencedClasses: [],
  17792. messageSends: []
  17793. }),
  17794. $globals.JSObjectProxy.klass);
  17795. $core.addMethod(
  17796. $core.method({
  17797. selector: "on:",
  17798. protocol: 'instance creation',
  17799. fn: function (aJSObject){
  17800. var self=this;
  17801. var instance;
  17802. return $core.withContext(function($ctx1) {
  17803. var $1;
  17804. instance=self._new();
  17805. self._jsObject_ofProxy_(aJSObject,instance);
  17806. $1=instance;
  17807. return $1;
  17808. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  17809. },
  17810. args: ["aJSObject"],
  17811. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  17812. referencedClasses: [],
  17813. messageSends: ["new", "jsObject:ofProxy:"]
  17814. }),
  17815. $globals.JSObjectProxy.klass);
  17816. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  17817. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  17818. $core.addMethod(
  17819. $core.method({
  17820. selector: "addElement:",
  17821. protocol: 'accessing',
  17822. fn: function (anObject){
  17823. var self=this;
  17824. return $core.withContext(function($ctx1) {
  17825. self.elements.addElement(anObject);
  17826. return self;
  17827. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  17828. },
  17829. args: ["anObject"],
  17830. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  17831. referencedClasses: [],
  17832. messageSends: []
  17833. }),
  17834. $globals.Organizer);
  17835. $core.addMethod(
  17836. $core.method({
  17837. selector: "elements",
  17838. protocol: 'accessing',
  17839. fn: function (){
  17840. var self=this;
  17841. return $core.withContext(function($ctx1) {
  17842. var $1;
  17843. $1=$recv(self._basicAt_("elements"))._copy();
  17844. return $1;
  17845. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  17846. },
  17847. args: [],
  17848. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  17849. referencedClasses: [],
  17850. messageSends: ["copy", "basicAt:"]
  17851. }),
  17852. $globals.Organizer);
  17853. $core.addMethod(
  17854. $core.method({
  17855. selector: "removeElement:",
  17856. protocol: 'accessing',
  17857. fn: function (anObject){
  17858. var self=this;
  17859. return $core.withContext(function($ctx1) {
  17860. self.elements.removeElement(anObject);
  17861. return self;
  17862. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  17863. },
  17864. args: ["anObject"],
  17865. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  17866. referencedClasses: [],
  17867. messageSends: []
  17868. }),
  17869. $globals.Organizer);
  17870. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  17871. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  17872. $core.addMethod(
  17873. $core.method({
  17874. selector: "addElement:",
  17875. protocol: 'accessing',
  17876. fn: function (aString){
  17877. var self=this;
  17878. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17879. function $ProtocolAdded(){return $globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  17880. return $core.withContext(function($ctx1) {
  17881. var $1,$2;
  17882. (
  17883. $ctx1.supercall = true,
  17884. $globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply($recv(self), [aString]));
  17885. $ctx1.supercall = false;
  17886. $1=$recv($ProtocolAdded())._new();
  17887. $recv($1)._protocol_(aString);
  17888. $recv($1)._theClass_(self._theClass());
  17889. $2=$recv($1)._yourself();
  17890. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  17891. return self;
  17892. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  17893. },
  17894. args: ["aString"],
  17895. 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)",
  17896. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  17897. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  17898. }),
  17899. $globals.ClassOrganizer);
  17900. $core.addMethod(
  17901. $core.method({
  17902. selector: "removeElement:",
  17903. protocol: 'accessing',
  17904. fn: function (aString){
  17905. var self=this;
  17906. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17907. function $ProtocolRemoved(){return $globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  17908. return $core.withContext(function($ctx1) {
  17909. var $1,$2;
  17910. (
  17911. $ctx1.supercall = true,
  17912. $globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply($recv(self), [aString]));
  17913. $ctx1.supercall = false;
  17914. $1=$recv($ProtocolRemoved())._new();
  17915. $recv($1)._protocol_(aString);
  17916. $recv($1)._theClass_(self._theClass());
  17917. $2=$recv($1)._yourself();
  17918. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  17919. return self;
  17920. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  17921. },
  17922. args: ["aString"],
  17923. 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)",
  17924. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  17925. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  17926. }),
  17927. $globals.ClassOrganizer);
  17928. $core.addMethod(
  17929. $core.method({
  17930. selector: "theClass",
  17931. protocol: 'accessing',
  17932. fn: function (){
  17933. var self=this;
  17934. return $core.withContext(function($ctx1) {
  17935. return self.theClass ;
  17936. return self;
  17937. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  17938. },
  17939. args: [],
  17940. source: "theClass\x0a\x09< return self.theClass >",
  17941. referencedClasses: [],
  17942. messageSends: []
  17943. }),
  17944. $globals.ClassOrganizer);
  17945. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  17946. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  17947. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  17948. $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'";
  17949. $core.addMethod(
  17950. $core.method({
  17951. selector: "basicImports",
  17952. protocol: 'private',
  17953. fn: function (){
  17954. var self=this;
  17955. return $core.withContext(function($ctx1) {
  17956. return self.imports || [];
  17957. return self;
  17958. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  17959. },
  17960. args: [],
  17961. 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 || []>",
  17962. referencedClasses: [],
  17963. messageSends: []
  17964. }),
  17965. $globals.Package);
  17966. $core.addMethod(
  17967. $core.method({
  17968. selector: "basicName:",
  17969. protocol: 'private',
  17970. fn: function (aString){
  17971. var self=this;
  17972. return $core.withContext(function($ctx1) {
  17973. self.pkgName = aString;
  17974. return self;
  17975. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  17976. },
  17977. args: ["aString"],
  17978. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  17979. referencedClasses: [],
  17980. messageSends: []
  17981. }),
  17982. $globals.Package);
  17983. $core.addMethod(
  17984. $core.method({
  17985. selector: "basicTransport",
  17986. protocol: 'private',
  17987. fn: function (){
  17988. var self=this;
  17989. return $core.withContext(function($ctx1) {
  17990. return self.transport;
  17991. return self;
  17992. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  17993. },
  17994. args: [],
  17995. 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>",
  17996. referencedClasses: [],
  17997. messageSends: []
  17998. }),
  17999. $globals.Package);
  18000. $core.addMethod(
  18001. $core.method({
  18002. selector: "beClean",
  18003. protocol: 'accessing',
  18004. fn: function (){
  18005. var self=this;
  18006. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18007. function $PackageClean(){return $globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
  18008. return $core.withContext(function($ctx1) {
  18009. var $1,$2;
  18010. self["@dirty"]=false;
  18011. $1=$recv($PackageClean())._new();
  18012. $recv($1)._package_(self);
  18013. $2=$recv($1)._yourself();
  18014. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  18015. return self;
  18016. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  18017. },
  18018. args: [],
  18019. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18020. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  18021. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18022. }),
  18023. $globals.Package);
  18024. $core.addMethod(
  18025. $core.method({
  18026. selector: "beDirty",
  18027. protocol: 'accessing',
  18028. fn: function (){
  18029. var self=this;
  18030. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18031. function $PackageDirty(){return $globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)}
  18032. return $core.withContext(function($ctx1) {
  18033. var $1,$2;
  18034. self["@dirty"]=true;
  18035. $1=$recv($PackageDirty())._new();
  18036. $recv($1)._package_(self);
  18037. $2=$recv($1)._yourself();
  18038. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  18039. return self;
  18040. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  18041. },
  18042. args: [],
  18043. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18044. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  18045. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18046. }),
  18047. $globals.Package);
  18048. $core.addMethod(
  18049. $core.method({
  18050. selector: "classTemplate",
  18051. protocol: 'accessing',
  18052. fn: function (){
  18053. var self=this;
  18054. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18055. return $core.withContext(function($ctx1) {
  18056. var $3,$4,$2,$5,$6,$7,$1;
  18057. $1=$recv($String())._streamContents_((function(stream){
  18058. return $core.withContext(function($ctx2) {
  18059. $recv(stream)._nextPutAll_("Object");
  18060. $ctx2.sendIdx["nextPutAll:"]=1;
  18061. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  18062. $ctx2.sendIdx["nextPutAll:"]=2;
  18063. $3=$recv($String())._lf();
  18064. $ctx2.sendIdx["lf"]=1;
  18065. $4=$recv($String())._tab();
  18066. $ctx2.sendIdx["tab"]=1;
  18067. $2=$recv($3).__comma($4);
  18068. $ctx2.sendIdx[","]=1;
  18069. $recv(stream)._nextPutAll_($2);
  18070. $ctx2.sendIdx["nextPutAll:"]=3;
  18071. $5=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  18072. $ctx2.sendIdx["nextPutAll:"]=4;
  18073. $5;
  18074. $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  18075. $ctx2.sendIdx[","]=2;
  18076. $recv(stream)._nextPutAll_($6);
  18077. $ctx2.sendIdx["nextPutAll:"]=5;
  18078. $recv(stream)._nextPutAll_("package: '");
  18079. $ctx2.sendIdx["nextPutAll:"]=6;
  18080. $recv(stream)._nextPutAll_(self._name());
  18081. $ctx2.sendIdx["nextPutAll:"]=7;
  18082. $7=$recv(stream)._nextPutAll_("'");
  18083. return $7;
  18084. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18085. }));
  18086. return $1;
  18087. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  18088. },
  18089. args: [],
  18090. 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: '''' ]",
  18091. referencedClasses: ["String"],
  18092. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  18093. }),
  18094. $globals.Package);
  18095. $core.addMethod(
  18096. $core.method({
  18097. selector: "classes",
  18098. protocol: 'classes',
  18099. fn: function (){
  18100. var self=this;
  18101. return $core.withContext(function($ctx1) {
  18102. var $1;
  18103. $1=$recv(self._organization())._elements();
  18104. return $1;
  18105. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  18106. },
  18107. args: [],
  18108. source: "classes\x0a\x09^ self organization elements",
  18109. referencedClasses: [],
  18110. messageSends: ["elements", "organization"]
  18111. }),
  18112. $globals.Package);
  18113. $core.addMethod(
  18114. $core.method({
  18115. selector: "definition",
  18116. protocol: 'accessing',
  18117. fn: function (){
  18118. var self=this;
  18119. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18120. return $core.withContext(function($ctx1) {
  18121. var $2,$4,$5,$3,$7,$6,$9,$10,$8,$11,$12,$1;
  18122. $1=$recv($String())._streamContents_((function(stream){
  18123. return $core.withContext(function($ctx2) {
  18124. $2=$recv(self._class())._name();
  18125. $ctx2.sendIdx["name"]=1;
  18126. $recv(stream)._nextPutAll_($2);
  18127. $ctx2.sendIdx["nextPutAll:"]=1;
  18128. $4=$recv($String())._lf();
  18129. $ctx2.sendIdx["lf"]=1;
  18130. $5=$recv($String())._tab();
  18131. $ctx2.sendIdx["tab"]=1;
  18132. $3=$recv($4).__comma($5);
  18133. $ctx2.sendIdx[","]=1;
  18134. $recv(stream)._nextPutAll_($3);
  18135. $ctx2.sendIdx["nextPutAll:"]=2;
  18136. $recv(stream)._nextPutAll_("named: ");
  18137. $ctx2.sendIdx["nextPutAll:"]=3;
  18138. $7="'".__comma(self._name());
  18139. $ctx2.sendIdx[","]=3;
  18140. $6=$recv($7).__comma("'");
  18141. $ctx2.sendIdx[","]=2;
  18142. $recv(stream)._nextPutAll_($6);
  18143. $ctx2.sendIdx["nextPutAll:"]=4;
  18144. $9=$recv($String())._lf();
  18145. $ctx2.sendIdx["lf"]=2;
  18146. $10=$recv($String())._tab();
  18147. $ctx2.sendIdx["tab"]=2;
  18148. $8=$recv($9).__comma($10);
  18149. $ctx2.sendIdx[","]=4;
  18150. $recv(stream)._nextPutAll_($8);
  18151. $ctx2.sendIdx["nextPutAll:"]=5;
  18152. $recv(stream)._nextPutAll_("imports: ");
  18153. $ctx2.sendIdx["nextPutAll:"]=6;
  18154. $recv(stream)._nextPutAll_(self._importsDefinition());
  18155. $ctx2.sendIdx["nextPutAll:"]=7;
  18156. $11=$recv($recv($String())._lf()).__comma($recv($String())._tab());
  18157. $ctx2.sendIdx[","]=5;
  18158. $recv(stream)._nextPutAll_($11);
  18159. $ctx2.sendIdx["nextPutAll:"]=8;
  18160. $recv(stream)._nextPutAll_("transport: (");
  18161. $ctx2.sendIdx["nextPutAll:"]=9;
  18162. $12=$recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  18163. return $12;
  18164. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18165. }));
  18166. return $1;
  18167. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  18168. },
  18169. args: [],
  18170. 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, ')' ]",
  18171. referencedClasses: ["String"],
  18172. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  18173. }),
  18174. $globals.Package);
  18175. $core.addMethod(
  18176. $core.method({
  18177. selector: "imports",
  18178. protocol: 'accessing',
  18179. fn: function (){
  18180. var self=this;
  18181. return $core.withContext(function($ctx1) {
  18182. var $2,$1,$receiver;
  18183. $2=self["@imports"];
  18184. if(($receiver = $2) == null || $receiver.isNil){
  18185. var parsed;
  18186. parsed=self._importsFromJson_(self._basicImports());
  18187. parsed;
  18188. self._imports_(parsed);
  18189. $1=self["@imports"];
  18190. } else {
  18191. $1=$2;
  18192. };
  18193. return $1;
  18194. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  18195. },
  18196. args: [],
  18197. 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 ]",
  18198. referencedClasses: [],
  18199. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  18200. }),
  18201. $globals.Package);
  18202. $core.addMethod(
  18203. $core.method({
  18204. selector: "imports:",
  18205. protocol: 'accessing',
  18206. fn: function (anArray){
  18207. var self=this;
  18208. return $core.withContext(function($ctx1) {
  18209. self._validateImports_(anArray);
  18210. self["@imports"]=$recv(anArray)._asSet();
  18211. return self;
  18212. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  18213. },
  18214. args: ["anArray"],
  18215. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  18216. referencedClasses: [],
  18217. messageSends: ["validateImports:", "asSet"]
  18218. }),
  18219. $globals.Package);
  18220. $core.addMethod(
  18221. $core.method({
  18222. selector: "importsAsJson",
  18223. protocol: 'converting',
  18224. fn: function (){
  18225. var self=this;
  18226. return $core.withContext(function($ctx1) {
  18227. var $2,$1;
  18228. $1=$recv(self._sortedImportsAsArray())._collect_((function(each){
  18229. return $core.withContext(function($ctx2) {
  18230. $2=$recv(each)._isString();
  18231. if($core.assert($2)){
  18232. return each;
  18233. } else {
  18234. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  18235. $ctx2.sendIdx[","]=1;
  18236. };
  18237. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18238. }));
  18239. return $1;
  18240. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  18241. },
  18242. args: [],
  18243. 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 ]]",
  18244. referencedClasses: [],
  18245. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  18246. }),
  18247. $globals.Package);
  18248. $core.addMethod(
  18249. $core.method({
  18250. selector: "importsDefinition",
  18251. protocol: 'accessing',
  18252. fn: function (){
  18253. var self=this;
  18254. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18255. return $core.withContext(function($ctx1) {
  18256. var $1;
  18257. $1=$recv($String())._streamContents_((function(stream){
  18258. return $core.withContext(function($ctx2) {
  18259. $recv(stream)._nextPutAll_("{");
  18260. $ctx2.sendIdx["nextPutAll:"]=1;
  18261. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  18262. return $core.withContext(function($ctx3) {
  18263. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  18264. $ctx3.sendIdx["nextPutAll:"]=2;
  18265. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  18266. }),(function(){
  18267. return $core.withContext(function($ctx3) {
  18268. return $recv(stream)._nextPutAll_(". ");
  18269. $ctx3.sendIdx["nextPutAll:"]=3;
  18270. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  18271. }));
  18272. return $recv(stream)._nextPutAll_("}");
  18273. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18274. }));
  18275. return $1;
  18276. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  18277. },
  18278. args: [],
  18279. 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: '}' ]",
  18280. referencedClasses: ["String"],
  18281. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  18282. }),
  18283. $globals.Package);
  18284. $core.addMethod(
  18285. $core.method({
  18286. selector: "importsFromJson:",
  18287. protocol: 'converting',
  18288. fn: function (anArray){
  18289. var self=this;
  18290. return $core.withContext(function($ctx1) {
  18291. var $2,$1;
  18292. $1=$recv(anArray)._collect_((function(each){
  18293. var split;
  18294. return $core.withContext(function($ctx2) {
  18295. split=$recv(each)._tokenize_("=");
  18296. split;
  18297. $2=$recv($recv(split)._size()).__eq((1));
  18298. if($core.assert($2)){
  18299. return $recv(split)._first();
  18300. $ctx2.sendIdx["first"]=1;
  18301. } else {
  18302. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  18303. };
  18304. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  18305. }));
  18306. return $1;
  18307. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  18308. },
  18309. args: ["anArray"],
  18310. 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 ]]",
  18311. referencedClasses: [],
  18312. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  18313. }),
  18314. $globals.Package);
  18315. $core.addMethod(
  18316. $core.method({
  18317. selector: "isDirty",
  18318. protocol: 'testing',
  18319. fn: function (){
  18320. var self=this;
  18321. return $core.withContext(function($ctx1) {
  18322. var $2,$1,$receiver;
  18323. $2=self["@dirty"];
  18324. if(($receiver = $2) == null || $receiver.isNil){
  18325. $1=false;
  18326. } else {
  18327. $1=$2;
  18328. };
  18329. return $1;
  18330. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  18331. },
  18332. args: [],
  18333. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  18334. referencedClasses: [],
  18335. messageSends: ["ifNil:"]
  18336. }),
  18337. $globals.Package);
  18338. $core.addMethod(
  18339. $core.method({
  18340. selector: "isPackage",
  18341. protocol: 'testing',
  18342. fn: function (){
  18343. var self=this;
  18344. return true;
  18345. },
  18346. args: [],
  18347. source: "isPackage\x0a\x09^ true",
  18348. referencedClasses: [],
  18349. messageSends: []
  18350. }),
  18351. $globals.Package);
  18352. $core.addMethod(
  18353. $core.method({
  18354. selector: "loadDependencies",
  18355. protocol: 'dependencies',
  18356. fn: function (){
  18357. var self=this;
  18358. var classes,packages;
  18359. return $core.withContext(function($ctx1) {
  18360. var $2,$3,$1;
  18361. classes=self._loadDependencyClasses();
  18362. $2=$recv($recv(classes)._collect_((function(each){
  18363. return $core.withContext(function($ctx2) {
  18364. return $recv(each)._package();
  18365. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18366. })))._asSet();
  18367. $recv($2)._remove_ifAbsent_(self,(function(){
  18368. }));
  18369. $3=$recv($2)._yourself();
  18370. $1=$3;
  18371. return $1;
  18372. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  18373. },
  18374. args: [],
  18375. 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",
  18376. referencedClasses: [],
  18377. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  18378. }),
  18379. $globals.Package);
  18380. $core.addMethod(
  18381. $core.method({
  18382. selector: "loadDependencyClasses",
  18383. protocol: 'dependencies',
  18384. fn: function (){
  18385. var self=this;
  18386. var starCategoryName;
  18387. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18388. return $core.withContext(function($ctx1) {
  18389. var $4,$3,$2,$6,$5,$7,$1;
  18390. starCategoryName="*".__comma(self._name());
  18391. $ctx1.sendIdx[","]=1;
  18392. $4=self._classes();
  18393. $ctx1.sendIdx["classes"]=1;
  18394. $3=$recv($4)._collect_((function(each){
  18395. return $core.withContext(function($ctx2) {
  18396. return $recv(each)._superclass();
  18397. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18398. }));
  18399. $2=$recv($3)._asSet();
  18400. $recv($2)._remove_ifAbsent_(nil,(function(){
  18401. }));
  18402. $recv($2)._addAll_($recv($recv($Smalltalk())._classes())._select_((function(each){
  18403. return $core.withContext(function($ctx2) {
  18404. $6=$recv(each)._protocols();
  18405. $ctx2.sendIdx["protocols"]=1;
  18406. $5=$recv($6).__comma($recv($recv(each)._class())._protocols());
  18407. return $recv($5)._includes_(starCategoryName);
  18408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  18409. })));
  18410. $7=$recv($2)._yourself();
  18411. $1=$7;
  18412. return $1;
  18413. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  18414. },
  18415. args: [],
  18416. 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",
  18417. referencedClasses: ["Smalltalk"],
  18418. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  18419. }),
  18420. $globals.Package);
  18421. $core.addMethod(
  18422. $core.method({
  18423. selector: "name",
  18424. protocol: 'accessing',
  18425. fn: function (){
  18426. var self=this;
  18427. return $core.withContext(function($ctx1) {
  18428. return self.pkgName;
  18429. return self;
  18430. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  18431. },
  18432. args: [],
  18433. source: "name\x0a\x09<return self.pkgName>",
  18434. referencedClasses: [],
  18435. messageSends: []
  18436. }),
  18437. $globals.Package);
  18438. $core.addMethod(
  18439. $core.method({
  18440. selector: "name:",
  18441. protocol: 'accessing',
  18442. fn: function (aString){
  18443. var self=this;
  18444. return $core.withContext(function($ctx1) {
  18445. self._basicName_(aString);
  18446. self._beDirty();
  18447. return self;
  18448. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  18449. },
  18450. args: ["aString"],
  18451. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  18452. referencedClasses: [],
  18453. messageSends: ["basicName:", "beDirty"]
  18454. }),
  18455. $globals.Package);
  18456. $core.addMethod(
  18457. $core.method({
  18458. selector: "organization",
  18459. protocol: 'accessing',
  18460. fn: function (){
  18461. var self=this;
  18462. return $core.withContext(function($ctx1) {
  18463. var $1;
  18464. $1=self._basicAt_("organization");
  18465. return $1;
  18466. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  18467. },
  18468. args: [],
  18469. source: "organization\x0a\x09^ self basicAt: 'organization'",
  18470. referencedClasses: [],
  18471. messageSends: ["basicAt:"]
  18472. }),
  18473. $globals.Package);
  18474. $core.addMethod(
  18475. $core.method({
  18476. selector: "printOn:",
  18477. protocol: 'printing',
  18478. fn: function (aStream){
  18479. var self=this;
  18480. return $core.withContext(function($ctx1) {
  18481. var $1;
  18482. (
  18483. $ctx1.supercall = true,
  18484. $globals.Package.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  18485. $ctx1.supercall = false;
  18486. $recv(aStream)._nextPutAll_(" (");
  18487. $ctx1.sendIdx["nextPutAll:"]=1;
  18488. $recv(aStream)._nextPutAll_(self._name());
  18489. $ctx1.sendIdx["nextPutAll:"]=2;
  18490. $1=$recv(aStream)._nextPutAll_(")");
  18491. return self;
  18492. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  18493. },
  18494. args: ["aStream"],
  18495. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  18496. referencedClasses: [],
  18497. messageSends: ["printOn:", "nextPutAll:", "name"]
  18498. }),
  18499. $globals.Package);
  18500. $core.addMethod(
  18501. $core.method({
  18502. selector: "setupClasses",
  18503. protocol: 'classes',
  18504. fn: function (){
  18505. var self=this;
  18506. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  18507. return $core.withContext(function($ctx1) {
  18508. var $1,$2;
  18509. $1=self._classes();
  18510. $recv($1)._do_((function(each){
  18511. return $core.withContext(function($ctx2) {
  18512. return $recv($recv($ClassBuilder())._new())._setupClass_(each);
  18513. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18514. }));
  18515. $ctx1.sendIdx["do:"]=1;
  18516. $2=$recv($1)._do_((function(each){
  18517. return $core.withContext(function($ctx2) {
  18518. return $recv(each)._initialize();
  18519. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  18520. }));
  18521. return self;
  18522. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  18523. },
  18524. args: [],
  18525. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  18526. referencedClasses: ["ClassBuilder"],
  18527. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  18528. }),
  18529. $globals.Package);
  18530. $core.addMethod(
  18531. $core.method({
  18532. selector: "sortedClasses",
  18533. protocol: 'classes',
  18534. fn: function (){
  18535. var self=this;
  18536. return $core.withContext(function($ctx1) {
  18537. var $1;
  18538. $1=$recv(self._class())._sortedClasses_(self._classes());
  18539. return $1;
  18540. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  18541. },
  18542. args: [],
  18543. 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",
  18544. referencedClasses: [],
  18545. messageSends: ["sortedClasses:", "class", "classes"]
  18546. }),
  18547. $globals.Package);
  18548. $core.addMethod(
  18549. $core.method({
  18550. selector: "sortedImportsAsArray",
  18551. protocol: 'private',
  18552. fn: function (){
  18553. var self=this;
  18554. return $core.withContext(function($ctx1) {
  18555. var $4,$3,$5,$2,$7,$6,$8,$1;
  18556. $1=$recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  18557. return $core.withContext(function($ctx2) {
  18558. $4=$recv(a)._isString();
  18559. $ctx2.sendIdx["isString"]=1;
  18560. $3=$recv($4)._not();
  18561. $5=$recv(b)._isString();
  18562. $ctx2.sendIdx["isString"]=2;
  18563. $2=$recv($3).__and($5);
  18564. return $recv($2)._or_((function(){
  18565. return $core.withContext(function($ctx3) {
  18566. $7=$recv(a)._isString();
  18567. $ctx3.sendIdx["isString"]=3;
  18568. $6=$recv($7).__eq($recv(b)._isString());
  18569. return $recv($6)._and_((function(){
  18570. return $core.withContext(function($ctx4) {
  18571. $8=$recv(a)._value();
  18572. $ctx4.sendIdx["value"]=1;
  18573. return $recv($8).__lt_eq($recv(b)._value());
  18574. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  18575. }));
  18576. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  18577. }));
  18578. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  18579. }));
  18580. return $1;
  18581. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  18582. },
  18583. args: [],
  18584. 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 ]]]",
  18585. referencedClasses: [],
  18586. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  18587. }),
  18588. $globals.Package);
  18589. $core.addMethod(
  18590. $core.method({
  18591. selector: "transport",
  18592. protocol: 'accessing',
  18593. fn: function (){
  18594. var self=this;
  18595. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  18596. return $core.withContext(function($ctx1) {
  18597. var $2,$3,$4,$1,$receiver;
  18598. $2=self["@transport"];
  18599. if(($receiver = $2) == null || $receiver.isNil){
  18600. $3=$recv($PackageTransport())._fromJson_(self._basicTransport());
  18601. $recv($3)._package_(self);
  18602. $4=$recv($3)._yourself();
  18603. self["@transport"]=$4;
  18604. $1=self["@transport"];
  18605. } else {
  18606. $1=$2;
  18607. };
  18608. return $1;
  18609. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  18610. },
  18611. args: [],
  18612. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  18613. referencedClasses: ["PackageTransport"],
  18614. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  18615. }),
  18616. $globals.Package);
  18617. $core.addMethod(
  18618. $core.method({
  18619. selector: "transport:",
  18620. protocol: 'accessing',
  18621. fn: function (aPackageTransport){
  18622. var self=this;
  18623. return $core.withContext(function($ctx1) {
  18624. self["@transport"]=aPackageTransport;
  18625. $recv(aPackageTransport)._package_(self);
  18626. return self;
  18627. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  18628. },
  18629. args: ["aPackageTransport"],
  18630. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  18631. referencedClasses: [],
  18632. messageSends: ["package:"]
  18633. }),
  18634. $globals.Package);
  18635. $core.addMethod(
  18636. $core.method({
  18637. selector: "validateImports:",
  18638. protocol: 'validation',
  18639. fn: function (aCollection){
  18640. var self=this;
  18641. return $core.withContext(function($ctx1) {
  18642. var $1,$2,$5,$4,$3,$6;
  18643. $recv(aCollection)._do_((function(import_){
  18644. return $core.withContext(function($ctx2) {
  18645. $1=$recv(import_)._isString();
  18646. $ctx2.sendIdx["isString"]=1;
  18647. if(!$core.assert($1)){
  18648. $2=$recv(import_)._respondsTo_("key");
  18649. if(!$core.assert($2)){
  18650. self._error_("Imports must be Strings or Associations");
  18651. $ctx2.sendIdx["error:"]=1;
  18652. };
  18653. $5=$recv(import_)._key();
  18654. $ctx2.sendIdx["key"]=1;
  18655. $4=$recv($5)._isString();
  18656. $ctx2.sendIdx["isString"]=2;
  18657. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  18658. if(!$core.assert($3)){
  18659. self._error_("Key and value must be Strings");
  18660. $ctx2.sendIdx["error:"]=2;
  18661. };
  18662. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  18663. if(!$core.assert($6)){
  18664. return self._error_("Keys must be identifiers");
  18665. };
  18666. };
  18667. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  18668. }));
  18669. return self;
  18670. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  18671. },
  18672. args: ["aCollection"],
  18673. 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' ]]]",
  18674. referencedClasses: [],
  18675. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  18676. }),
  18677. $globals.Package);
  18678. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  18679. $core.addMethod(
  18680. $core.method({
  18681. selector: "named:",
  18682. protocol: 'accessing',
  18683. fn: function (aPackageName){
  18684. var self=this;
  18685. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18686. return $core.withContext(function($ctx1) {
  18687. var $1;
  18688. $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
  18689. return $core.withContext(function($ctx2) {
  18690. return $recv($Smalltalk())._createPackage_(aPackageName);
  18691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18692. }));
  18693. return $1;
  18694. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  18695. },
  18696. args: ["aPackageName"],
  18697. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  18698. referencedClasses: ["Smalltalk"],
  18699. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  18700. }),
  18701. $globals.Package.klass);
  18702. $core.addMethod(
  18703. $core.method({
  18704. selector: "named:ifAbsent:",
  18705. protocol: 'accessing',
  18706. fn: function (aPackageName,aBlock){
  18707. var self=this;
  18708. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18709. return $core.withContext(function($ctx1) {
  18710. var $1;
  18711. $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
  18712. return $1;
  18713. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  18714. },
  18715. args: ["aPackageName", "aBlock"],
  18716. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  18717. referencedClasses: ["Smalltalk"],
  18718. messageSends: ["packageAt:ifAbsent:"]
  18719. }),
  18720. $globals.Package.klass);
  18721. $core.addMethod(
  18722. $core.method({
  18723. selector: "named:imports:transport:",
  18724. protocol: 'accessing',
  18725. fn: function (aPackageName,anArray,aTransport){
  18726. var self=this;
  18727. var package_;
  18728. return $core.withContext(function($ctx1) {
  18729. var $1;
  18730. package_=self._named_(aPackageName);
  18731. $recv(package_)._imports_(anArray);
  18732. $recv(package_)._transport_(aTransport);
  18733. $1=package_;
  18734. return $1;
  18735. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  18736. },
  18737. args: ["aPackageName", "anArray", "aTransport"],
  18738. 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",
  18739. referencedClasses: [],
  18740. messageSends: ["named:", "imports:", "transport:"]
  18741. }),
  18742. $globals.Package.klass);
  18743. $core.addMethod(
  18744. $core.method({
  18745. selector: "named:transport:",
  18746. protocol: 'accessing',
  18747. fn: function (aPackageName,aTransport){
  18748. var self=this;
  18749. var package_;
  18750. return $core.withContext(function($ctx1) {
  18751. var $1;
  18752. package_=self._named_(aPackageName);
  18753. $recv(package_)._transport_(aTransport);
  18754. $1=package_;
  18755. return $1;
  18756. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  18757. },
  18758. args: ["aPackageName", "aTransport"],
  18759. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  18760. referencedClasses: [],
  18761. messageSends: ["named:", "transport:"]
  18762. }),
  18763. $globals.Package.klass);
  18764. $core.addMethod(
  18765. $core.method({
  18766. selector: "sortedClasses:",
  18767. protocol: 'sorting',
  18768. fn: function (classes){
  18769. var self=this;
  18770. var children,others,nodes,expandedClasses;
  18771. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  18772. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  18773. return $core.withContext(function($ctx1) {
  18774. var $1,$3,$2,$4;
  18775. children=[];
  18776. others=[];
  18777. $recv(classes)._do_((function(each){
  18778. return $core.withContext(function($ctx2) {
  18779. $1=$recv(classes)._includes_($recv(each)._superclass());
  18780. if($core.assert($1)){
  18781. return $recv(others)._add_(each);
  18782. } else {
  18783. return $recv(children)._add_(each);
  18784. $ctx2.sendIdx["add:"]=1;
  18785. };
  18786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18787. }));
  18788. $ctx1.sendIdx["do:"]=1;
  18789. nodes=$recv(children)._collect_((function(each){
  18790. return $core.withContext(function($ctx2) {
  18791. return $recv($ClassSorterNode())._on_classes_level_(each,others,(0));
  18792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  18793. }));
  18794. nodes=$recv(nodes)._sorted_((function(a,b){
  18795. return $core.withContext(function($ctx2) {
  18796. $3=$recv(a)._theClass();
  18797. $ctx2.sendIdx["theClass"]=1;
  18798. $2=$recv($3)._name();
  18799. $ctx2.sendIdx["name"]=1;
  18800. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  18801. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  18802. }));
  18803. expandedClasses=$recv($Array())._new();
  18804. $recv(nodes)._do_((function(aNode){
  18805. return $core.withContext(function($ctx2) {
  18806. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  18807. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  18808. }));
  18809. $4=expandedClasses;
  18810. return $4;
  18811. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  18812. },
  18813. args: ["classes"],
  18814. 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",
  18815. referencedClasses: ["ClassSorterNode", "Array"],
  18816. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  18817. }),
  18818. $globals.Package.klass);
  18819. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  18820. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  18821. $core.addMethod(
  18822. $core.method({
  18823. selector: "announcer",
  18824. protocol: 'accessing',
  18825. fn: function (){
  18826. var self=this;
  18827. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18828. return $core.withContext(function($ctx1) {
  18829. var $1;
  18830. $1=$recv($SystemAnnouncer())._current();
  18831. return $1;
  18832. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  18833. },
  18834. args: [],
  18835. source: "announcer\x0a\x09^ SystemAnnouncer current",
  18836. referencedClasses: ["SystemAnnouncer"],
  18837. messageSends: ["current"]
  18838. }),
  18839. $globals.PackageStateObserver);
  18840. $core.addMethod(
  18841. $core.method({
  18842. selector: "observeSystem",
  18843. protocol: 'actions',
  18844. fn: function (){
  18845. var self=this;
  18846. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  18847. function $ClassAnnouncement(){return $globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)}
  18848. function $MethodAnnouncement(){return $globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)}
  18849. function $ProtocolAnnouncement(){return $globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)}
  18850. return $core.withContext(function($ctx1) {
  18851. var $1,$2;
  18852. $1=self._announcer();
  18853. $recv($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
  18854. $ctx1.sendIdx["on:send:to:"]=1;
  18855. $recv($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self);
  18856. $ctx1.sendIdx["on:send:to:"]=2;
  18857. $recv($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self);
  18858. $ctx1.sendIdx["on:send:to:"]=3;
  18859. $2=$recv($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self);
  18860. return self;
  18861. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  18862. },
  18863. args: [],
  18864. 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",
  18865. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  18866. messageSends: ["on:send:to:", "announcer"]
  18867. }),
  18868. $globals.PackageStateObserver);
  18869. $core.addMethod(
  18870. $core.method({
  18871. selector: "onClassModification:",
  18872. protocol: 'reactions',
  18873. fn: function (anAnnouncement){
  18874. var self=this;
  18875. return $core.withContext(function($ctx1) {
  18876. var $1,$receiver;
  18877. $1=$recv(anAnnouncement)._theClass();
  18878. if(($receiver = $1) == null || $receiver.isNil){
  18879. $1;
  18880. } else {
  18881. var theClass;
  18882. theClass=$receiver;
  18883. $recv($recv(theClass)._package())._beDirty();
  18884. };
  18885. return self;
  18886. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18887. },
  18888. args: ["anAnnouncement"],
  18889. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  18890. referencedClasses: [],
  18891. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  18892. }),
  18893. $globals.PackageStateObserver);
  18894. $core.addMethod(
  18895. $core.method({
  18896. selector: "onMethodModification:",
  18897. protocol: 'reactions',
  18898. fn: function (anAnnouncement){
  18899. var self=this;
  18900. return $core.withContext(function($ctx1) {
  18901. var $1,$receiver;
  18902. $1=$recv($recv(anAnnouncement)._method())._package();
  18903. if(($receiver = $1) == null || $receiver.isNil){
  18904. $1;
  18905. } else {
  18906. var package_;
  18907. package_=$receiver;
  18908. $recv(package_)._beDirty();
  18909. };
  18910. return self;
  18911. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18912. },
  18913. args: ["anAnnouncement"],
  18914. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  18915. referencedClasses: [],
  18916. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  18917. }),
  18918. $globals.PackageStateObserver);
  18919. $core.addMethod(
  18920. $core.method({
  18921. selector: "onPackageAdded:",
  18922. protocol: 'reactions',
  18923. fn: function (anAnnouncement){
  18924. var self=this;
  18925. return $core.withContext(function($ctx1) {
  18926. $recv($recv(anAnnouncement)._package())._beDirty();
  18927. return self;
  18928. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18929. },
  18930. args: ["anAnnouncement"],
  18931. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  18932. referencedClasses: [],
  18933. messageSends: ["beDirty", "package"]
  18934. }),
  18935. $globals.PackageStateObserver);
  18936. $core.addMethod(
  18937. $core.method({
  18938. selector: "onProtocolModification:",
  18939. protocol: 'reactions',
  18940. fn: function (anAnnouncement){
  18941. var self=this;
  18942. return $core.withContext(function($ctx1) {
  18943. var $1,$receiver;
  18944. $1=$recv(anAnnouncement)._package();
  18945. if(($receiver = $1) == null || $receiver.isNil){
  18946. $1;
  18947. } else {
  18948. var package_;
  18949. package_=$receiver;
  18950. $recv(package_)._beDirty();
  18951. };
  18952. return self;
  18953. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18954. },
  18955. args: ["anAnnouncement"],
  18956. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  18957. referencedClasses: [],
  18958. messageSends: ["ifNotNil:", "package", "beDirty"]
  18959. }),
  18960. $globals.PackageStateObserver);
  18961. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  18962. $core.addMethod(
  18963. $core.method({
  18964. selector: "current",
  18965. protocol: 'accessing',
  18966. fn: function (){
  18967. var self=this;
  18968. return $core.withContext(function($ctx1) {
  18969. var $2,$1,$receiver;
  18970. $2=self["@current"];
  18971. if(($receiver = $2) == null || $receiver.isNil){
  18972. self["@current"]=self._new();
  18973. $1=self["@current"];
  18974. } else {
  18975. $1=$2;
  18976. };
  18977. return $1;
  18978. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  18979. },
  18980. args: [],
  18981. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  18982. referencedClasses: [],
  18983. messageSends: ["ifNil:", "new"]
  18984. }),
  18985. $globals.PackageStateObserver.klass);
  18986. $core.addMethod(
  18987. $core.method({
  18988. selector: "initialize",
  18989. protocol: 'initialization',
  18990. fn: function (){
  18991. var self=this;
  18992. return $core.withContext(function($ctx1) {
  18993. $recv(self._current())._observeSystem();
  18994. return self;
  18995. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  18996. },
  18997. args: [],
  18998. source: "initialize\x0a\x09self current observeSystem",
  18999. referencedClasses: [],
  19000. messageSends: ["observeSystem", "current"]
  19001. }),
  19002. $globals.PackageStateObserver.klass);
  19003. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  19004. $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`";
  19005. $core.addMethod(
  19006. $core.method({
  19007. selector: "defaultValue",
  19008. protocol: 'accessing',
  19009. fn: function (){
  19010. var self=this;
  19011. var $1;
  19012. $1=self["@defaultValue"];
  19013. return $1;
  19014. },
  19015. args: [],
  19016. source: "defaultValue\x0a\x09^ defaultValue",
  19017. referencedClasses: [],
  19018. messageSends: []
  19019. }),
  19020. $globals.Setting);
  19021. $core.addMethod(
  19022. $core.method({
  19023. selector: "defaultValue:",
  19024. protocol: 'accessing',
  19025. fn: function (aStringifiableObject){
  19026. var self=this;
  19027. self["@defaultValue"]=aStringifiableObject;
  19028. return self;
  19029. },
  19030. args: ["aStringifiableObject"],
  19031. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  19032. referencedClasses: [],
  19033. messageSends: []
  19034. }),
  19035. $globals.Setting);
  19036. $core.addMethod(
  19037. $core.method({
  19038. selector: "key",
  19039. protocol: 'accessing',
  19040. fn: function (){
  19041. var self=this;
  19042. var $1;
  19043. $1=self["@key"];
  19044. return $1;
  19045. },
  19046. args: [],
  19047. source: "key\x0a\x09^ key",
  19048. referencedClasses: [],
  19049. messageSends: []
  19050. }),
  19051. $globals.Setting);
  19052. $core.addMethod(
  19053. $core.method({
  19054. selector: "key:",
  19055. protocol: 'accessing',
  19056. fn: function (aString){
  19057. var self=this;
  19058. self["@key"]=aString;
  19059. return self;
  19060. },
  19061. args: ["aString"],
  19062. source: "key: aString\x0a\x09key := aString",
  19063. referencedClasses: [],
  19064. messageSends: []
  19065. }),
  19066. $globals.Setting);
  19067. $core.addMethod(
  19068. $core.method({
  19069. selector: "value",
  19070. protocol: 'accessing',
  19071. fn: function (){
  19072. var self=this;
  19073. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19074. return $core.withContext(function($ctx1) {
  19075. var $1;
  19076. $1=$recv($recv($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
  19077. return $core.withContext(function($ctx2) {
  19078. return self._defaultValue();
  19079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19080. }));
  19081. return $1;
  19082. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19083. },
  19084. args: [],
  19085. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19086. referencedClasses: ["Smalltalk"],
  19087. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19088. }),
  19089. $globals.Setting);
  19090. $core.addMethod(
  19091. $core.method({
  19092. selector: "value:",
  19093. protocol: 'accessing',
  19094. fn: function (aStringifiableObject){
  19095. var self=this;
  19096. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19097. return $core.withContext(function($ctx1) {
  19098. var $1;
  19099. $1=$recv($recv($Smalltalk())._settings())._at_put_(self._key(),aStringifiableObject);
  19100. return $1;
  19101. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  19102. },
  19103. args: ["aStringifiableObject"],
  19104. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  19105. referencedClasses: ["Smalltalk"],
  19106. messageSends: ["at:put:", "settings", "key"]
  19107. }),
  19108. $globals.Setting);
  19109. $core.addMethod(
  19110. $core.method({
  19111. selector: "at:ifAbsent:",
  19112. protocol: 'instance creation',
  19113. fn: function (aString,aDefaultValue){
  19114. var self=this;
  19115. return $core.withContext(function($ctx1) {
  19116. var $2,$3,$1;
  19117. $2=(
  19118. $ctx1.supercall = true,
  19119. $globals.Setting.klass.superclass.fn.prototype._new.apply($recv(self), []));
  19120. $ctx1.supercall = false;
  19121. $recv($2)._key_(aString);
  19122. $recv($2)._defaultValue_(aDefaultValue);
  19123. $3=$recv($2)._yourself();
  19124. $1=$3;
  19125. return $1;
  19126. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  19127. },
  19128. args: ["aString", "aDefaultValue"],
  19129. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  19130. referencedClasses: [],
  19131. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  19132. }),
  19133. $globals.Setting.klass);
  19134. $core.addMethod(
  19135. $core.method({
  19136. selector: "new",
  19137. protocol: 'instance creation',
  19138. fn: function (){
  19139. var self=this;
  19140. return $core.withContext(function($ctx1) {
  19141. self._shouldNotImplement();
  19142. return self;
  19143. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  19144. },
  19145. args: [],
  19146. source: "new\x0a\x09self shouldNotImplement",
  19147. referencedClasses: [],
  19148. messageSends: ["shouldNotImplement"]
  19149. }),
  19150. $globals.Setting.klass);
  19151. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  19152. $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.";
  19153. $core.addMethod(
  19154. $core.method({
  19155. selector: "addGlobalJsVariable:",
  19156. protocol: 'globals',
  19157. fn: function (aString){
  19158. var self=this;
  19159. return $core.withContext(function($ctx1) {
  19160. $recv(self._globalJsVariables())._add_(aString);
  19161. return self;
  19162. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19163. },
  19164. args: ["aString"],
  19165. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  19166. referencedClasses: [],
  19167. messageSends: ["add:", "globalJsVariables"]
  19168. }),
  19169. $globals.SmalltalkImage);
  19170. $core.addMethod(
  19171. $core.method({
  19172. selector: "amdRequire",
  19173. protocol: 'accessing amd',
  19174. fn: function (){
  19175. var self=this;
  19176. return $core.withContext(function($ctx1) {
  19177. var $1;
  19178. $1=$recv(self._core())._at_("amdRequire");
  19179. return $1;
  19180. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  19181. },
  19182. args: [],
  19183. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  19184. referencedClasses: [],
  19185. messageSends: ["at:", "core"]
  19186. }),
  19187. $globals.SmalltalkImage);
  19188. $core.addMethod(
  19189. $core.method({
  19190. selector: "asSmalltalkException:",
  19191. protocol: 'error handling',
  19192. fn: function (anObject){
  19193. var self=this;
  19194. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  19195. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  19196. return $core.withContext(function($ctx1) {
  19197. var $2,$1;
  19198. $2=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  19199. return $core.withContext(function($ctx2) {
  19200. return $recv(anObject)._isKindOf_($Error());
  19201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19202. }));
  19203. if($core.assert($2)){
  19204. $1=anObject;
  19205. } else {
  19206. $1=$recv($JavaScriptException())._on_(anObject);
  19207. };
  19208. return $1;
  19209. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  19210. },
  19211. args: ["anObject"],
  19212. 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 ]",
  19213. referencedClasses: ["Error", "JavaScriptException"],
  19214. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  19215. }),
  19216. $globals.SmalltalkImage);
  19217. $core.addMethod(
  19218. $core.method({
  19219. selector: "basicCreatePackage:",
  19220. protocol: 'private',
  19221. fn: function (packageName){
  19222. var self=this;
  19223. return $core.withContext(function($ctx1) {
  19224. return $core.addPackage(packageName);
  19225. return self;
  19226. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19227. },
  19228. args: ["packageName"],
  19229. 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)>",
  19230. referencedClasses: [],
  19231. messageSends: []
  19232. }),
  19233. $globals.SmalltalkImage);
  19234. $core.addMethod(
  19235. $core.method({
  19236. selector: "basicParse:",
  19237. protocol: 'private',
  19238. fn: function (aString){
  19239. var self=this;
  19240. function $SmalltalkParser(){return $globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
  19241. return $core.withContext(function($ctx1) {
  19242. var $1;
  19243. $1=$recv($SmalltalkParser())._parse_(aString);
  19244. return $1;
  19245. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  19246. },
  19247. args: ["aString"],
  19248. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  19249. referencedClasses: ["SmalltalkParser"],
  19250. messageSends: ["parse:"]
  19251. }),
  19252. $globals.SmalltalkImage);
  19253. $core.addMethod(
  19254. $core.method({
  19255. selector: "basicRegisterPackage:",
  19256. protocol: 'private',
  19257. fn: function (aPackage){
  19258. var self=this;
  19259. return $core.withContext(function($ctx1) {
  19260. $core.packages[aPackage.pkgName]=aPackage;
  19261. return self;
  19262. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  19263. },
  19264. args: ["aPackage"],
  19265. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>",
  19266. referencedClasses: [],
  19267. messageSends: []
  19268. }),
  19269. $globals.SmalltalkImage);
  19270. $core.addMethod(
  19271. $core.method({
  19272. selector: "cancelOptOut:",
  19273. protocol: 'accessing',
  19274. fn: function (anObject){
  19275. var self=this;
  19276. return $core.withContext(function($ctx1) {
  19277. delete anObject.klass;
  19278. return self;
  19279. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19280. },
  19281. args: ["anObject"],
  19282. 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>",
  19283. referencedClasses: [],
  19284. messageSends: []
  19285. }),
  19286. $globals.SmalltalkImage);
  19287. $core.addMethod(
  19288. $core.method({
  19289. selector: "classes",
  19290. protocol: 'classes',
  19291. fn: function (){
  19292. var self=this;
  19293. return $core.withContext(function($ctx1) {
  19294. return $core.classes();
  19295. return self;
  19296. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  19297. },
  19298. args: [],
  19299. source: "classes\x0a\x09<return $core.classes()>",
  19300. referencedClasses: [],
  19301. messageSends: []
  19302. }),
  19303. $globals.SmalltalkImage);
  19304. $core.addMethod(
  19305. $core.method({
  19306. selector: "core",
  19307. protocol: 'accessing',
  19308. fn: function (){
  19309. var self=this;
  19310. return $core.withContext(function($ctx1) {
  19311. return $core;
  19312. return self;
  19313. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  19314. },
  19315. args: [],
  19316. source: "core\x0a\x09<return $core>",
  19317. referencedClasses: [],
  19318. messageSends: []
  19319. }),
  19320. $globals.SmalltalkImage);
  19321. $core.addMethod(
  19322. $core.method({
  19323. selector: "createPackage:",
  19324. protocol: 'packages',
  19325. fn: function (packageName){
  19326. var self=this;
  19327. var package_,announcement;
  19328. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  19329. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19330. return $core.withContext(function($ctx1) {
  19331. var $1,$2,$3;
  19332. package_=self._basicCreatePackage_(packageName);
  19333. $1=$recv($PackageAdded())._new();
  19334. $recv($1)._package_(package_);
  19335. $2=$recv($1)._yourself();
  19336. announcement=$2;
  19337. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  19338. $3=package_;
  19339. return $3;
  19340. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  19341. },
  19342. args: ["packageName"],
  19343. 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",
  19344. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  19345. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  19346. }),
  19347. $globals.SmalltalkImage);
  19348. $core.addMethod(
  19349. $core.method({
  19350. selector: "defaultAmdNamespace",
  19351. protocol: 'accessing amd',
  19352. fn: function (){
  19353. var self=this;
  19354. return $core.withContext(function($ctx1) {
  19355. var $1;
  19356. $1="transport.defaultAmdNamespace"._settingValue();
  19357. return $1;
  19358. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  19359. },
  19360. args: [],
  19361. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  19362. referencedClasses: [],
  19363. messageSends: ["settingValue"]
  19364. }),
  19365. $globals.SmalltalkImage);
  19366. $core.addMethod(
  19367. $core.method({
  19368. selector: "defaultAmdNamespace:",
  19369. protocol: 'accessing amd',
  19370. fn: function (aString){
  19371. var self=this;
  19372. return $core.withContext(function($ctx1) {
  19373. "transport.defaultAmdNamespace"._settingValue_(aString);
  19374. return self;
  19375. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  19376. },
  19377. args: ["aString"],
  19378. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  19379. referencedClasses: [],
  19380. messageSends: ["settingValue:"]
  19381. }),
  19382. $globals.SmalltalkImage);
  19383. $core.addMethod(
  19384. $core.method({
  19385. selector: "deleteClass:",
  19386. protocol: 'private',
  19387. fn: function (aClass){
  19388. var self=this;
  19389. return $core.withContext(function($ctx1) {
  19390. $core.removeClass(aClass);
  19391. return self;
  19392. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19393. },
  19394. args: ["aClass"],
  19395. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>",
  19396. referencedClasses: [],
  19397. messageSends: []
  19398. }),
  19399. $globals.SmalltalkImage);
  19400. $core.addMethod(
  19401. $core.method({
  19402. selector: "deleteGlobalJsVariable:",
  19403. protocol: 'globals',
  19404. fn: function (aString){
  19405. var self=this;
  19406. return $core.withContext(function($ctx1) {
  19407. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  19408. }));
  19409. return self;
  19410. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19411. },
  19412. args: ["aString"],
  19413. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  19414. referencedClasses: [],
  19415. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  19416. }),
  19417. $globals.SmalltalkImage);
  19418. $core.addMethod(
  19419. $core.method({
  19420. selector: "deletePackage:",
  19421. protocol: 'private',
  19422. fn: function (packageName){
  19423. var self=this;
  19424. return $core.withContext(function($ctx1) {
  19425. delete $core.packages[packageName];
  19426. return self;
  19427. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19428. },
  19429. args: ["packageName"],
  19430. 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]>",
  19431. referencedClasses: [],
  19432. messageSends: []
  19433. }),
  19434. $globals.SmalltalkImage);
  19435. $core.addMethod(
  19436. $core.method({
  19437. selector: "existsJsGlobal:",
  19438. protocol: 'testing',
  19439. fn: function (aString){
  19440. var self=this;
  19441. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  19442. return $core.withContext(function($ctx1) {
  19443. var $1;
  19444. $1=$recv($recv($Platform())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  19445. return true;
  19446. }),(function(){
  19447. return false;
  19448. }));
  19449. return $1;
  19450. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  19451. },
  19452. args: ["aString"],
  19453. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  19454. referencedClasses: ["Platform"],
  19455. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  19456. }),
  19457. $globals.SmalltalkImage);
  19458. $core.addMethod(
  19459. $core.method({
  19460. selector: "globalJsVariables",
  19461. protocol: 'globals',
  19462. fn: function (){
  19463. var self=this;
  19464. return $core.withContext(function($ctx1) {
  19465. return $core.globalJsVariables;
  19466. return self;
  19467. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  19468. },
  19469. args: [],
  19470. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return $core.globalJsVariables>",
  19471. referencedClasses: [],
  19472. messageSends: []
  19473. }),
  19474. $globals.SmalltalkImage);
  19475. $core.addMethod(
  19476. $core.method({
  19477. selector: "globals",
  19478. protocol: 'accessing',
  19479. fn: function (){
  19480. var self=this;
  19481. return $core.withContext(function($ctx1) {
  19482. return $globals;
  19483. return self;
  19484. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  19485. },
  19486. args: [],
  19487. source: "globals\x0a\x09<return $globals>",
  19488. referencedClasses: [],
  19489. messageSends: []
  19490. }),
  19491. $globals.SmalltalkImage);
  19492. $core.addMethod(
  19493. $core.method({
  19494. selector: "includesKey:",
  19495. protocol: 'accessing',
  19496. fn: function (aKey){
  19497. var self=this;
  19498. return $core.withContext(function($ctx1) {
  19499. return $core.hasOwnProperty(aKey);
  19500. return self;
  19501. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  19502. },
  19503. args: ["aKey"],
  19504. source: "includesKey: aKey\x0a\x09<return $core.hasOwnProperty(aKey)>",
  19505. referencedClasses: [],
  19506. messageSends: []
  19507. }),
  19508. $globals.SmalltalkImage);
  19509. $core.addMethod(
  19510. $core.method({
  19511. selector: "isSmalltalkObject:",
  19512. protocol: 'testing',
  19513. fn: function (anObject){
  19514. var self=this;
  19515. return $core.withContext(function($ctx1) {
  19516. return anObject.klass != null;
  19517. return self;
  19518. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  19519. },
  19520. args: ["anObject"],
  19521. 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>",
  19522. referencedClasses: [],
  19523. messageSends: []
  19524. }),
  19525. $globals.SmalltalkImage);
  19526. $core.addMethod(
  19527. $core.method({
  19528. selector: "optOut:",
  19529. protocol: 'accessing',
  19530. fn: function (anObject){
  19531. var self=this;
  19532. return $core.withContext(function($ctx1) {
  19533. anObject.klass = null;
  19534. return self;
  19535. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19536. },
  19537. args: ["anObject"],
  19538. 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>",
  19539. referencedClasses: [],
  19540. messageSends: []
  19541. }),
  19542. $globals.SmalltalkImage);
  19543. $core.addMethod(
  19544. $core.method({
  19545. selector: "packageAt:",
  19546. protocol: 'packages',
  19547. fn: function (packageName){
  19548. var self=this;
  19549. return $core.withContext(function($ctx1) {
  19550. return $core.packages[packageName];
  19551. return self;
  19552. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  19553. },
  19554. args: ["packageName"],
  19555. source: "packageAt: packageName\x0a\x09<return $core.packages[packageName]>",
  19556. referencedClasses: [],
  19557. messageSends: []
  19558. }),
  19559. $globals.SmalltalkImage);
  19560. $core.addMethod(
  19561. $core.method({
  19562. selector: "packageAt:ifAbsent:",
  19563. protocol: 'packages',
  19564. fn: function (packageName,aBlock){
  19565. var self=this;
  19566. return $core.withContext(function($ctx1) {
  19567. var $2,$1;
  19568. $2=self._packageAt_(packageName);
  19569. $1=$recv($2)._ifNil_(aBlock);
  19570. return $1;
  19571. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  19572. },
  19573. args: ["packageName", "aBlock"],
  19574. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  19575. referencedClasses: [],
  19576. messageSends: ["ifNil:", "packageAt:"]
  19577. }),
  19578. $globals.SmalltalkImage);
  19579. $core.addMethod(
  19580. $core.method({
  19581. selector: "packages",
  19582. protocol: 'packages',
  19583. fn: function (){
  19584. var self=this;
  19585. return $core.withContext(function($ctx1) {
  19586. return Object.keys($core.packages).map(function(k) {
  19587. return $core.packages[k];
  19588. })
  19589. ;
  19590. return self;
  19591. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  19592. },
  19593. args: [],
  19594. 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>",
  19595. referencedClasses: [],
  19596. messageSends: []
  19597. }),
  19598. $globals.SmalltalkImage);
  19599. $core.addMethod(
  19600. $core.method({
  19601. selector: "parse:",
  19602. protocol: 'accessing',
  19603. fn: function (aString){
  19604. var self=this;
  19605. var result;
  19606. return $core.withContext(function($ctx1) {
  19607. var $2,$3,$1;
  19608. $recv((function(){
  19609. return $core.withContext(function($ctx2) {
  19610. result=self._basicParse_(aString);
  19611. return result;
  19612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19613. }))._tryCatch_((function(ex){
  19614. return $core.withContext(function($ctx2) {
  19615. return $recv(self._parseError_parsing_(ex,aString))._signal();
  19616. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  19617. }));
  19618. $2=result;
  19619. $recv($2)._source_(aString);
  19620. $3=$recv($2)._yourself();
  19621. $1=$3;
  19622. return $1;
  19623. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  19624. },
  19625. args: ["aString"],
  19626. 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",
  19627. referencedClasses: [],
  19628. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  19629. }),
  19630. $globals.SmalltalkImage);
  19631. $core.addMethod(
  19632. $core.method({
  19633. selector: "parseError:parsing:",
  19634. protocol: 'error handling',
  19635. fn: function (anException,aString){
  19636. var self=this;
  19637. function $ParseError(){return $globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  19638. return $core.withContext(function($ctx1) {
  19639. var $2,$8,$7,$6,$9,$5,$4,$3,$1;
  19640. $2=$recv($ParseError())._new();
  19641. $8=$recv(anException)._basicAt_("line");
  19642. $ctx1.sendIdx["basicAt:"]=1;
  19643. $7="Parse error on line ".__comma($8);
  19644. $6=$recv($7).__comma(" column ");
  19645. $ctx1.sendIdx[","]=4;
  19646. $9=$recv(anException)._basicAt_("column");
  19647. $ctx1.sendIdx["basicAt:"]=2;
  19648. $5=$recv($6).__comma($9);
  19649. $ctx1.sendIdx[","]=3;
  19650. $4=$recv($5).__comma(" : Unexpected character ");
  19651. $ctx1.sendIdx[","]=2;
  19652. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  19653. $ctx1.sendIdx[","]=1;
  19654. $1=$recv($2)._messageText_($3);
  19655. return $1;
  19656. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  19657. },
  19658. args: ["anException", "aString"],
  19659. 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')",
  19660. referencedClasses: ["ParseError"],
  19661. messageSends: ["messageText:", "new", ",", "basicAt:"]
  19662. }),
  19663. $globals.SmalltalkImage);
  19664. $core.addMethod(
  19665. $core.method({
  19666. selector: "pseudoVariableNames",
  19667. protocol: 'accessing',
  19668. fn: function (){
  19669. var self=this;
  19670. var $1;
  19671. $1=["self", "super", "nil", "true", "false", "thisContext"];
  19672. return $1;
  19673. },
  19674. args: [],
  19675. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  19676. referencedClasses: [],
  19677. messageSends: []
  19678. }),
  19679. $globals.SmalltalkImage);
  19680. $core.addMethod(
  19681. $core.method({
  19682. selector: "readJSObject:",
  19683. protocol: 'accessing',
  19684. fn: function (anObject){
  19685. var self=this;
  19686. return $core.withContext(function($ctx1) {
  19687. return $core.readJSObject(anObject);
  19688. return self;
  19689. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  19690. },
  19691. args: ["anObject"],
  19692. source: "readJSObject: anObject\x0a\x09<return $core.readJSObject(anObject)>",
  19693. referencedClasses: [],
  19694. messageSends: []
  19695. }),
  19696. $globals.SmalltalkImage);
  19697. $core.addMethod(
  19698. $core.method({
  19699. selector: "removeClass:",
  19700. protocol: 'classes',
  19701. fn: function (aClass){
  19702. var self=this;
  19703. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19704. function $ClassRemoved(){return $globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  19705. return $core.withContext(function($ctx1) {
  19706. var $1,$2,$3;
  19707. $1=$recv(aClass)._isMetaclass();
  19708. if($core.assert($1)){
  19709. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  19710. };
  19711. self._deleteClass_(aClass);
  19712. $2=$recv($ClassRemoved())._new();
  19713. $recv($2)._theClass_(aClass);
  19714. $3=$recv($2)._yourself();
  19715. $recv($recv($SystemAnnouncer())._current())._announce_($3);
  19716. return self;
  19717. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19718. },
  19719. args: ["aClass"],
  19720. 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)",
  19721. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  19722. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  19723. }),
  19724. $globals.SmalltalkImage);
  19725. $core.addMethod(
  19726. $core.method({
  19727. selector: "removePackage:",
  19728. protocol: 'packages',
  19729. fn: function (packageName){
  19730. var self=this;
  19731. var pkg;
  19732. return $core.withContext(function($ctx1) {
  19733. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19734. return $core.withContext(function($ctx2) {
  19735. return self._error_("Missing package: ".__comma(packageName));
  19736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19737. }));
  19738. $recv($recv(pkg)._classes())._do_((function(each){
  19739. return $core.withContext(function($ctx2) {
  19740. return self._removeClass_(each);
  19741. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19742. }));
  19743. self._deletePackage_(packageName);
  19744. return self;
  19745. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  19746. },
  19747. args: ["packageName"],
  19748. 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",
  19749. referencedClasses: [],
  19750. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  19751. }),
  19752. $globals.SmalltalkImage);
  19753. $core.addMethod(
  19754. $core.method({
  19755. selector: "renamePackage:to:",
  19756. protocol: 'packages',
  19757. fn: function (packageName,newName){
  19758. var self=this;
  19759. var pkg;
  19760. return $core.withContext(function($ctx1) {
  19761. var $1,$2,$receiver;
  19762. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19763. return $core.withContext(function($ctx2) {
  19764. $1="Missing package: ".__comma(packageName);
  19765. $ctx2.sendIdx[","]=1;
  19766. return self._error_($1);
  19767. $ctx2.sendIdx["error:"]=1;
  19768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19769. }));
  19770. $2=self._packageAt_(newName);
  19771. if(($receiver = $2) == null || $receiver.isNil){
  19772. $2;
  19773. } else {
  19774. self._error_("Already exists a package called: ".__comma(newName));
  19775. };
  19776. $recv(pkg)._name_(newName);
  19777. self._basicRegisterPackage_(pkg);
  19778. self._deletePackage_(packageName);
  19779. return self;
  19780. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  19781. },
  19782. args: ["packageName", "newName"],
  19783. 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.",
  19784. referencedClasses: [],
  19785. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  19786. }),
  19787. $globals.SmalltalkImage);
  19788. $core.addMethod(
  19789. $core.method({
  19790. selector: "reservedWords",
  19791. protocol: 'accessing',
  19792. fn: function (){
  19793. var self=this;
  19794. return $core.withContext(function($ctx1) {
  19795. return $core.reservedWords;
  19796. return self;
  19797. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  19798. },
  19799. args: [],
  19800. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return $core.reservedWords>",
  19801. referencedClasses: [],
  19802. messageSends: []
  19803. }),
  19804. $globals.SmalltalkImage);
  19805. $core.addMethod(
  19806. $core.method({
  19807. selector: "settings",
  19808. protocol: 'accessing',
  19809. fn: function (){
  19810. var self=this;
  19811. function $SmalltalkSettings(){return $globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
  19812. return $SmalltalkSettings();
  19813. },
  19814. args: [],
  19815. source: "settings\x0a\x09^ SmalltalkSettings",
  19816. referencedClasses: ["SmalltalkSettings"],
  19817. messageSends: []
  19818. }),
  19819. $globals.SmalltalkImage);
  19820. $core.addMethod(
  19821. $core.method({
  19822. selector: "version",
  19823. protocol: 'accessing',
  19824. fn: function (){
  19825. var self=this;
  19826. return "0.15.0-pre";
  19827. },
  19828. args: [],
  19829. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.15.0-pre'",
  19830. referencedClasses: [],
  19831. messageSends: []
  19832. }),
  19833. $globals.SmalltalkImage);
  19834. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  19835. $core.addMethod(
  19836. $core.method({
  19837. selector: "current",
  19838. protocol: 'instance creation',
  19839. fn: function (){
  19840. var self=this;
  19841. return $core.withContext(function($ctx1) {
  19842. var $2,$1,$receiver;
  19843. $2=self["@current"];
  19844. if(($receiver = $2) == null || $receiver.isNil){
  19845. self["@current"]=(
  19846. $ctx1.supercall = true,
  19847. $globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply($recv(self), []));
  19848. $ctx1.supercall = false;
  19849. $1=self["@current"];
  19850. } else {
  19851. self._deprecatedAPI();
  19852. $1=self["@current"];
  19853. };
  19854. return $1;
  19855. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  19856. },
  19857. args: [],
  19858. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  19859. referencedClasses: [],
  19860. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  19861. }),
  19862. $globals.SmalltalkImage.klass);
  19863. $core.addMethod(
  19864. $core.method({
  19865. selector: "initialize",
  19866. protocol: 'initialization',
  19867. fn: function (){
  19868. var self=this;
  19869. var st;
  19870. return $core.withContext(function($ctx1) {
  19871. st=self._current();
  19872. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  19873. return self;
  19874. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  19875. },
  19876. args: [],
  19877. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  19878. referencedClasses: [],
  19879. messageSends: ["current", "at:put:", "globals"]
  19880. }),
  19881. $globals.SmalltalkImage.klass);
  19882. $core.addMethod(
  19883. $core.method({
  19884. selector: "new",
  19885. protocol: 'instance creation',
  19886. fn: function (){
  19887. var self=this;
  19888. return $core.withContext(function($ctx1) {
  19889. self._shouldNotImplement();
  19890. return self;
  19891. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  19892. },
  19893. args: [],
  19894. source: "new\x0a\x09self shouldNotImplement",
  19895. referencedClasses: [],
  19896. messageSends: ["shouldNotImplement"]
  19897. }),
  19898. $globals.SmalltalkImage.klass);
  19899. $core.addMethod(
  19900. $core.method({
  19901. selector: "importsString",
  19902. protocol: '*Kernel-Infrastructure',
  19903. fn: function (){
  19904. var self=this;
  19905. return $core.withContext(function($ctx1) {
  19906. var $3,$2,$1;
  19907. $3=$recv(self._key())._importsString();
  19908. $ctx1.sendIdx["importsString"]=1;
  19909. $2=$recv($3).__comma(" -> ");
  19910. $1=$recv($2).__comma($recv(self._value())._importsString());
  19911. $ctx1.sendIdx[","]=1;
  19912. return $1;
  19913. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  19914. },
  19915. args: [],
  19916. 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",
  19917. referencedClasses: [],
  19918. messageSends: [",", "importsString", "key", "value"]
  19919. }),
  19920. $globals.Association);
  19921. $core.addMethod(
  19922. $core.method({
  19923. selector: "asJavaScriptPropertyName",
  19924. protocol: '*Kernel-Infrastructure',
  19925. fn: function (){
  19926. var self=this;
  19927. return $core.withContext(function($ctx1) {
  19928. return $core.st2prop(self);
  19929. return self;
  19930. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  19931. },
  19932. args: [],
  19933. source: "asJavaScriptPropertyName\x0a<return $core.st2prop(self)>",
  19934. referencedClasses: [],
  19935. messageSends: []
  19936. }),
  19937. $globals.String);
  19938. $core.addMethod(
  19939. $core.method({
  19940. selector: "asSetting",
  19941. protocol: '*Kernel-Infrastructure',
  19942. fn: function (){
  19943. var self=this;
  19944. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19945. return $core.withContext(function($ctx1) {
  19946. var $1;
  19947. $1=$recv($Setting())._at_ifAbsent_(self,nil);
  19948. return $1;
  19949. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  19950. },
  19951. args: [],
  19952. 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",
  19953. referencedClasses: ["Setting"],
  19954. messageSends: ["at:ifAbsent:"]
  19955. }),
  19956. $globals.String);
  19957. $core.addMethod(
  19958. $core.method({
  19959. selector: "asSettingIfAbsent:",
  19960. protocol: '*Kernel-Infrastructure',
  19961. fn: function (aDefaultValue){
  19962. var self=this;
  19963. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19964. return $core.withContext(function($ctx1) {
  19965. var $1;
  19966. $1=$recv($Setting())._at_ifAbsent_(self,aDefaultValue);
  19967. return $1;
  19968. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  19969. },
  19970. args: ["aDefaultValue"],
  19971. 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",
  19972. referencedClasses: ["Setting"],
  19973. messageSends: ["at:ifAbsent:"]
  19974. }),
  19975. $globals.String);
  19976. $core.addMethod(
  19977. $core.method({
  19978. selector: "importsString",
  19979. protocol: '*Kernel-Infrastructure',
  19980. fn: function (){
  19981. var self=this;
  19982. return $core.withContext(function($ctx1) {
  19983. var $1;
  19984. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  19985. $ctx1.sendIdx[","]=1;
  19986. return $1;
  19987. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  19988. },
  19989. args: [],
  19990. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  19991. referencedClasses: [],
  19992. messageSends: [",", "replace:with:"]
  19993. }),
  19994. $globals.String);
  19995. $core.addMethod(
  19996. $core.method({
  19997. selector: "settingValue",
  19998. protocol: '*Kernel-Infrastructure',
  19999. fn: function (){
  20000. var self=this;
  20001. return $core.withContext(function($ctx1) {
  20002. var $1;
  20003. $1=$recv(self._asSetting())._value();
  20004. return $1;
  20005. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  20006. },
  20007. args: [],
  20008. source: "settingValue\x0a\x09^ self asSetting value",
  20009. referencedClasses: [],
  20010. messageSends: ["value", "asSetting"]
  20011. }),
  20012. $globals.String);
  20013. $core.addMethod(
  20014. $core.method({
  20015. selector: "settingValue:",
  20016. protocol: '*Kernel-Infrastructure',
  20017. fn: function (aValue){
  20018. var self=this;
  20019. return $core.withContext(function($ctx1) {
  20020. var $1;
  20021. $1=$recv(self._asSetting())._value_(aValue);
  20022. return $1;
  20023. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  20024. },
  20025. args: ["aValue"],
  20026. 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",
  20027. referencedClasses: [],
  20028. messageSends: ["value:", "asSetting"]
  20029. }),
  20030. $globals.String);
  20031. $core.addMethod(
  20032. $core.method({
  20033. selector: "settingValueIfAbsent:",
  20034. protocol: '*Kernel-Infrastructure',
  20035. fn: function (aDefaultValue){
  20036. var self=this;
  20037. return $core.withContext(function($ctx1) {
  20038. var $1;
  20039. $1=$recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  20040. return $1;
  20041. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20042. },
  20043. args: ["aDefaultValue"],
  20044. 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",
  20045. referencedClasses: [],
  20046. messageSends: ["value", "asSettingIfAbsent:"]
  20047. }),
  20048. $globals.String);
  20049. });
  20050. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20051. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20052. $core.addPackage('Kernel-Exceptions');
  20053. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20054. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20055. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  20056. $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.";
  20057. $core.addMethod(
  20058. $core.method({
  20059. selector: "beHandled",
  20060. protocol: 'accessing',
  20061. fn: function (){
  20062. var self=this;
  20063. return $core.withContext(function($ctx1) {
  20064. self.amberHandled = true;
  20065. return self;
  20066. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20067. },
  20068. args: [],
  20069. source: "beHandled\x0a\x09<self.amberHandled = true>",
  20070. referencedClasses: [],
  20071. messageSends: []
  20072. }),
  20073. $globals.Error);
  20074. $core.addMethod(
  20075. $core.method({
  20076. selector: "beUnhandled",
  20077. protocol: 'accessing',
  20078. fn: function (){
  20079. var self=this;
  20080. return $core.withContext(function($ctx1) {
  20081. self.amberHandled = false;
  20082. return self;
  20083. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20084. },
  20085. args: [],
  20086. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  20087. referencedClasses: [],
  20088. messageSends: []
  20089. }),
  20090. $globals.Error);
  20091. $core.addMethod(
  20092. $core.method({
  20093. selector: "context",
  20094. protocol: 'accessing',
  20095. fn: function (){
  20096. var self=this;
  20097. return $core.withContext(function($ctx1) {
  20098. return self.context;
  20099. return self;
  20100. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20101. },
  20102. args: [],
  20103. source: "context\x0a\x09<return self.context>",
  20104. referencedClasses: [],
  20105. messageSends: []
  20106. }),
  20107. $globals.Error);
  20108. $core.addMethod(
  20109. $core.method({
  20110. selector: "initialize",
  20111. protocol: 'initialization',
  20112. fn: function (){
  20113. var self=this;
  20114. return $core.withContext(function($ctx1) {
  20115. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  20116. return self;
  20117. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20118. },
  20119. args: [],
  20120. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20121. referencedClasses: [],
  20122. messageSends: ["messageText:", ",", "name", "class"]
  20123. }),
  20124. $globals.Error);
  20125. $core.addMethod(
  20126. $core.method({
  20127. selector: "isSmalltalkError",
  20128. protocol: 'testing',
  20129. fn: function (){
  20130. var self=this;
  20131. return $core.withContext(function($ctx1) {
  20132. return self.smalltalkError === true;
  20133. return self;
  20134. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20135. },
  20136. args: [],
  20137. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  20138. referencedClasses: [],
  20139. messageSends: []
  20140. }),
  20141. $globals.Error);
  20142. $core.addMethod(
  20143. $core.method({
  20144. selector: "jsStack",
  20145. protocol: 'accessing',
  20146. fn: function (){
  20147. var self=this;
  20148. return $core.withContext(function($ctx1) {
  20149. return self.stack;
  20150. return self;
  20151. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20152. },
  20153. args: [],
  20154. source: "jsStack\x0a\x09<return self.stack>",
  20155. referencedClasses: [],
  20156. messageSends: []
  20157. }),
  20158. $globals.Error);
  20159. $core.addMethod(
  20160. $core.method({
  20161. selector: "messageText",
  20162. protocol: 'accessing',
  20163. fn: function (){
  20164. var self=this;
  20165. var $1;
  20166. $1=self["@messageText"];
  20167. return $1;
  20168. },
  20169. args: [],
  20170. source: "messageText\x0a\x09^ messageText",
  20171. referencedClasses: [],
  20172. messageSends: []
  20173. }),
  20174. $globals.Error);
  20175. $core.addMethod(
  20176. $core.method({
  20177. selector: "messageText:",
  20178. protocol: 'accessing',
  20179. fn: function (aString){
  20180. var self=this;
  20181. self["@messageText"]=aString;
  20182. return self;
  20183. },
  20184. args: ["aString"],
  20185. source: "messageText: aString\x0a\x09messageText := aString",
  20186. referencedClasses: [],
  20187. messageSends: []
  20188. }),
  20189. $globals.Error);
  20190. $core.addMethod(
  20191. $core.method({
  20192. selector: "resignal",
  20193. protocol: 'signaling',
  20194. fn: function (){
  20195. var self=this;
  20196. return $core.withContext(function($ctx1) {
  20197. self.amberHandled = false;
  20198. throw(self);
  20199. ;
  20200. return self;
  20201. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20202. },
  20203. args: [],
  20204. 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>",
  20205. referencedClasses: [],
  20206. messageSends: []
  20207. }),
  20208. $globals.Error);
  20209. $core.addMethod(
  20210. $core.method({
  20211. selector: "signal",
  20212. protocol: 'signaling',
  20213. fn: function (){
  20214. var self=this;
  20215. return $core.withContext(function($ctx1) {
  20216. self.amberHandled = false;
  20217. self.context = $core.getThisContext();
  20218. self.smalltalkError = true;
  20219. throw self;
  20220. ;
  20221. return self;
  20222. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20223. },
  20224. args: [],
  20225. 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>",
  20226. referencedClasses: [],
  20227. messageSends: []
  20228. }),
  20229. $globals.Error);
  20230. $core.addMethod(
  20231. $core.method({
  20232. selector: "signal:",
  20233. protocol: 'signaling',
  20234. fn: function (aString){
  20235. var self=this;
  20236. return $core.withContext(function($ctx1) {
  20237. self._messageText_(aString);
  20238. self._signal();
  20239. return self;
  20240. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20241. },
  20242. args: ["aString"],
  20243. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20244. referencedClasses: [],
  20245. messageSends: ["messageText:", "signal"]
  20246. }),
  20247. $globals.Error);
  20248. $core.addMethod(
  20249. $core.method({
  20250. selector: "signalerContext",
  20251. protocol: 'accessing',
  20252. fn: function (){
  20253. var self=this;
  20254. return $core.withContext(function($ctx1) {
  20255. var $1;
  20256. $1=self._signalerContextFrom_(self._context());
  20257. return $1;
  20258. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20259. },
  20260. args: [],
  20261. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20262. referencedClasses: [],
  20263. messageSends: ["signalerContextFrom:", "context"]
  20264. }),
  20265. $globals.Error);
  20266. $core.addMethod(
  20267. $core.method({
  20268. selector: "signalerContextFrom:",
  20269. protocol: 'accessing',
  20270. fn: function (aContext){
  20271. var self=this;
  20272. return $core.withContext(function($ctx1) {
  20273. var $4,$3,$2,$1;
  20274. $1=$recv(aContext)._findContextSuchThat_((function(context){
  20275. return $core.withContext(function($ctx2) {
  20276. $4=$recv(context)._receiver();
  20277. $ctx2.sendIdx["receiver"]=1;
  20278. $3=$recv($4).__eq_eq(self);
  20279. $ctx2.sendIdx["=="]=1;
  20280. $2=$recv($3)._or_((function(){
  20281. return $core.withContext(function($ctx3) {
  20282. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  20283. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20284. }));
  20285. return $recv($2)._not();
  20286. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20287. }));
  20288. return $1;
  20289. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20290. },
  20291. args: ["aContext"],
  20292. 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 ]",
  20293. referencedClasses: [],
  20294. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20295. }),
  20296. $globals.Error);
  20297. $core.addMethod(
  20298. $core.method({
  20299. selector: "wasHandled",
  20300. protocol: 'testing',
  20301. fn: function (){
  20302. var self=this;
  20303. return $core.withContext(function($ctx1) {
  20304. return self.amberHandled || false;
  20305. return self;
  20306. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20307. },
  20308. args: [],
  20309. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  20310. referencedClasses: [],
  20311. messageSends: []
  20312. }),
  20313. $globals.Error);
  20314. $core.addMethod(
  20315. $core.method({
  20316. selector: "classTag",
  20317. protocol: 'accessing',
  20318. fn: function (){
  20319. var self=this;
  20320. return "exception";
  20321. },
  20322. args: [],
  20323. 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'",
  20324. referencedClasses: [],
  20325. messageSends: []
  20326. }),
  20327. $globals.Error.klass);
  20328. $core.addMethod(
  20329. $core.method({
  20330. selector: "signal",
  20331. protocol: 'instance creation',
  20332. fn: function (){
  20333. var self=this;
  20334. return $core.withContext(function($ctx1) {
  20335. var $1;
  20336. $1=$recv(self._new())._signal();
  20337. return $1;
  20338. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  20339. },
  20340. args: [],
  20341. source: "signal\x0a\x09^ self new signal",
  20342. referencedClasses: [],
  20343. messageSends: ["signal", "new"]
  20344. }),
  20345. $globals.Error.klass);
  20346. $core.addMethod(
  20347. $core.method({
  20348. selector: "signal:",
  20349. protocol: 'instance creation',
  20350. fn: function (aString){
  20351. var self=this;
  20352. return $core.withContext(function($ctx1) {
  20353. var $1;
  20354. $1=$recv(self._new())._signal_(aString);
  20355. return $1;
  20356. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  20357. },
  20358. args: ["aString"],
  20359. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20360. referencedClasses: [],
  20361. messageSends: ["signal:", "new"]
  20362. }),
  20363. $globals.Error.klass);
  20364. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  20365. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20366. $core.addMethod(
  20367. $core.method({
  20368. selector: "messageText",
  20369. protocol: 'accessing',
  20370. fn: function (){
  20371. var self=this;
  20372. return "Halt encountered";
  20373. },
  20374. args: [],
  20375. source: "messageText\x0a\x09^ 'Halt encountered'",
  20376. referencedClasses: [],
  20377. messageSends: []
  20378. }),
  20379. $globals.Halt);
  20380. $core.addMethod(
  20381. $core.method({
  20382. selector: "signalerContextFrom:",
  20383. protocol: 'accessing',
  20384. fn: function (aContext){
  20385. var self=this;
  20386. return $core.withContext(function($ctx1) {
  20387. var $4,$3,$2,$1;
  20388. $1=$recv(aContext)._findContextSuchThat_((function(context){
  20389. return $core.withContext(function($ctx2) {
  20390. $4=$recv(context)._receiver();
  20391. $ctx2.sendIdx["receiver"]=1;
  20392. $3=$recv($4).__eq_eq(self);
  20393. $ctx2.sendIdx["=="]=1;
  20394. $2=$recv($3)._or_((function(){
  20395. return $core.withContext(function($ctx3) {
  20396. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  20397. return $core.withContext(function($ctx4) {
  20398. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20399. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20400. }));
  20401. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20402. }));
  20403. $ctx2.sendIdx["or:"]=1;
  20404. return $recv($2)._not();
  20405. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20406. }));
  20407. return $1;
  20408. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20409. },
  20410. args: ["aContext"],
  20411. 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 ]",
  20412. referencedClasses: [],
  20413. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20414. }),
  20415. $globals.Halt);
  20416. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  20417. $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:`";
  20418. $core.addMethod(
  20419. $core.method({
  20420. selector: "context:",
  20421. protocol: 'accessing',
  20422. fn: function (aMethodContext){
  20423. var self=this;
  20424. return $core.withContext(function($ctx1) {
  20425. self.context = aMethodContext;
  20426. return self;
  20427. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20428. },
  20429. args: ["aMethodContext"],
  20430. 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>",
  20431. referencedClasses: [],
  20432. messageSends: []
  20433. }),
  20434. $globals.JavaScriptException);
  20435. $core.addMethod(
  20436. $core.method({
  20437. selector: "exception",
  20438. protocol: 'accessing',
  20439. fn: function (){
  20440. var self=this;
  20441. var $1;
  20442. $1=self["@exception"];
  20443. return $1;
  20444. },
  20445. args: [],
  20446. source: "exception\x0a\x09^ exception",
  20447. referencedClasses: [],
  20448. messageSends: []
  20449. }),
  20450. $globals.JavaScriptException);
  20451. $core.addMethod(
  20452. $core.method({
  20453. selector: "exception:",
  20454. protocol: 'accessing',
  20455. fn: function (anException){
  20456. var self=this;
  20457. self["@exception"]=anException;
  20458. return self;
  20459. },
  20460. args: ["anException"],
  20461. source: "exception: anException\x0a\x09exception := anException",
  20462. referencedClasses: [],
  20463. messageSends: []
  20464. }),
  20465. $globals.JavaScriptException);
  20466. $core.addMethod(
  20467. $core.method({
  20468. selector: "messageText",
  20469. protocol: 'accessing',
  20470. fn: function (){
  20471. var self=this;
  20472. return $core.withContext(function($ctx1) {
  20473. return 'JavaScript exception: ' + self["@exception"].toString();
  20474. return self;
  20475. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20476. },
  20477. args: [],
  20478. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  20479. referencedClasses: [],
  20480. messageSends: []
  20481. }),
  20482. $globals.JavaScriptException);
  20483. $core.addMethod(
  20484. $core.method({
  20485. selector: "on:",
  20486. protocol: 'instance creation',
  20487. fn: function (anException){
  20488. var self=this;
  20489. return $core.withContext(function($ctx1) {
  20490. var $2,$3,$1;
  20491. $2=self._new();
  20492. $recv($2)._exception_(anException);
  20493. $3=$recv($2)._yourself();
  20494. $1=$3;
  20495. return $1;
  20496. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  20497. },
  20498. args: ["anException"],
  20499. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20500. referencedClasses: [],
  20501. messageSends: ["exception:", "new", "yourself"]
  20502. }),
  20503. $globals.JavaScriptException.klass);
  20504. $core.addMethod(
  20505. $core.method({
  20506. selector: "on:context:",
  20507. protocol: 'instance creation',
  20508. fn: function (anException,aMethodContext){
  20509. var self=this;
  20510. return $core.withContext(function($ctx1) {
  20511. var $2,$3,$1;
  20512. $2=self._new();
  20513. $recv($2)._exception_(anException);
  20514. $recv($2)._context_(aMethodContext);
  20515. $3=$recv($2)._yourself();
  20516. $1=$3;
  20517. return $1;
  20518. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  20519. },
  20520. args: ["anException", "aMethodContext"],
  20521. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20522. referencedClasses: [],
  20523. messageSends: ["exception:", "new", "context:", "yourself"]
  20524. }),
  20525. $globals.JavaScriptException.klass);
  20526. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  20527. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20528. $core.addMethod(
  20529. $core.method({
  20530. selector: "message",
  20531. protocol: 'accessing',
  20532. fn: function (){
  20533. var self=this;
  20534. var $1;
  20535. $1=self["@message"];
  20536. return $1;
  20537. },
  20538. args: [],
  20539. source: "message\x0a\x09^ message",
  20540. referencedClasses: [],
  20541. messageSends: []
  20542. }),
  20543. $globals.MessageNotUnderstood);
  20544. $core.addMethod(
  20545. $core.method({
  20546. selector: "message:",
  20547. protocol: 'accessing',
  20548. fn: function (aMessage){
  20549. var self=this;
  20550. self["@message"]=aMessage;
  20551. return self;
  20552. },
  20553. args: ["aMessage"],
  20554. source: "message: aMessage\x0a\x09message := aMessage",
  20555. referencedClasses: [],
  20556. messageSends: []
  20557. }),
  20558. $globals.MessageNotUnderstood);
  20559. $core.addMethod(
  20560. $core.method({
  20561. selector: "messageText",
  20562. protocol: 'accessing',
  20563. fn: function (){
  20564. var self=this;
  20565. return $core.withContext(function($ctx1) {
  20566. var $1;
  20567. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  20568. $ctx1.sendIdx[","]=1;
  20569. return $1;
  20570. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20571. },
  20572. args: [],
  20573. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20574. referencedClasses: [],
  20575. messageSends: [",", "asString", "receiver", "selector", "message"]
  20576. }),
  20577. $globals.MessageNotUnderstood);
  20578. $core.addMethod(
  20579. $core.method({
  20580. selector: "receiver",
  20581. protocol: 'accessing',
  20582. fn: function (){
  20583. var self=this;
  20584. var $1;
  20585. $1=self["@receiver"];
  20586. return $1;
  20587. },
  20588. args: [],
  20589. source: "receiver\x0a\x09^ receiver",
  20590. referencedClasses: [],
  20591. messageSends: []
  20592. }),
  20593. $globals.MessageNotUnderstood);
  20594. $core.addMethod(
  20595. $core.method({
  20596. selector: "receiver:",
  20597. protocol: 'accessing',
  20598. fn: function (anObject){
  20599. var self=this;
  20600. self["@receiver"]=anObject;
  20601. return self;
  20602. },
  20603. args: ["anObject"],
  20604. source: "receiver: anObject\x0a\x09receiver := anObject",
  20605. referencedClasses: [],
  20606. messageSends: []
  20607. }),
  20608. $globals.MessageNotUnderstood);
  20609. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  20610. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  20611. $core.addMethod(
  20612. $core.method({
  20613. selector: "object",
  20614. protocol: 'accessing',
  20615. fn: function (){
  20616. var self=this;
  20617. var $1;
  20618. $1=self["@object"];
  20619. return $1;
  20620. },
  20621. args: [],
  20622. source: "object\x0a\x09^ object",
  20623. referencedClasses: [],
  20624. messageSends: []
  20625. }),
  20626. $globals.NonBooleanReceiver);
  20627. $core.addMethod(
  20628. $core.method({
  20629. selector: "object:",
  20630. protocol: 'accessing',
  20631. fn: function (anObject){
  20632. var self=this;
  20633. self["@object"]=anObject;
  20634. return self;
  20635. },
  20636. args: ["anObject"],
  20637. source: "object: anObject\x0a\x09object := anObject",
  20638. referencedClasses: [],
  20639. messageSends: []
  20640. }),
  20641. $globals.NonBooleanReceiver);
  20642. });
  20643. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20644. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20645. $core.addPackage('Kernel-Announcements');
  20646. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  20647. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20648. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  20649. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  20650. $core.addMethod(
  20651. $core.method({
  20652. selector: "announcementClass",
  20653. protocol: 'accessing',
  20654. fn: function (){
  20655. var self=this;
  20656. var $1;
  20657. $1=self["@announcementClass"];
  20658. return $1;
  20659. },
  20660. args: [],
  20661. source: "announcementClass\x0a\x09^ announcementClass",
  20662. referencedClasses: [],
  20663. messageSends: []
  20664. }),
  20665. $globals.AnnouncementSubscription);
  20666. $core.addMethod(
  20667. $core.method({
  20668. selector: "announcementClass:",
  20669. protocol: 'accessing',
  20670. fn: function (aClass){
  20671. var self=this;
  20672. self["@announcementClass"]=aClass;
  20673. return self;
  20674. },
  20675. args: ["aClass"],
  20676. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  20677. referencedClasses: [],
  20678. messageSends: []
  20679. }),
  20680. $globals.AnnouncementSubscription);
  20681. $core.addMethod(
  20682. $core.method({
  20683. selector: "deliver:",
  20684. protocol: 'announcing',
  20685. fn: function (anAnnouncement){
  20686. var self=this;
  20687. return $core.withContext(function($ctx1) {
  20688. var $1;
  20689. $1=self._handlesAnnouncement_(anAnnouncement);
  20690. if($core.assert($1)){
  20691. $recv(self._valuable())._value_(anAnnouncement);
  20692. };
  20693. return self;
  20694. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20695. },
  20696. args: ["anAnnouncement"],
  20697. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  20698. referencedClasses: [],
  20699. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  20700. }),
  20701. $globals.AnnouncementSubscription);
  20702. $core.addMethod(
  20703. $core.method({
  20704. selector: "handlesAnnouncement:",
  20705. protocol: 'announcing',
  20706. fn: function (anAnnouncement){
  20707. var self=this;
  20708. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20709. return $core.withContext(function($ctx1) {
  20710. var $3,$4,$2,$1,$receiver;
  20711. $3=$recv($Smalltalk())._globals();
  20712. $ctx1.sendIdx["globals"]=1;
  20713. $4=$recv(self._announcementClass())._name();
  20714. $ctx1.sendIdx["name"]=1;
  20715. $2=$recv($3)._at_($4);
  20716. $ctx1.sendIdx["at:"]=1;
  20717. if(($receiver = $2) == null || $receiver.isNil){
  20718. return false;
  20719. } else {
  20720. var class_;
  20721. class_=$receiver;
  20722. $1=$recv($recv($recv($Smalltalk())._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  20723. };
  20724. return $1;
  20725. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20726. },
  20727. args: ["anAnnouncement"],
  20728. 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 ]",
  20729. referencedClasses: ["Smalltalk"],
  20730. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  20731. }),
  20732. $globals.AnnouncementSubscription);
  20733. $core.addMethod(
  20734. $core.method({
  20735. selector: "receiver",
  20736. protocol: 'accessing',
  20737. fn: function (){
  20738. var self=this;
  20739. return $core.withContext(function($ctx1) {
  20740. var $1;
  20741. $1=$recv(self._valuable())._receiver();
  20742. return $1;
  20743. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  20744. },
  20745. args: [],
  20746. source: "receiver\x0a\x09^ self valuable receiver",
  20747. referencedClasses: [],
  20748. messageSends: ["receiver", "valuable"]
  20749. }),
  20750. $globals.AnnouncementSubscription);
  20751. $core.addMethod(
  20752. $core.method({
  20753. selector: "valuable",
  20754. protocol: 'accessing',
  20755. fn: function (){
  20756. var self=this;
  20757. var $1;
  20758. $1=self["@valuable"];
  20759. return $1;
  20760. },
  20761. args: [],
  20762. source: "valuable\x0a\x09^ valuable",
  20763. referencedClasses: [],
  20764. messageSends: []
  20765. }),
  20766. $globals.AnnouncementSubscription);
  20767. $core.addMethod(
  20768. $core.method({
  20769. selector: "valuable:",
  20770. protocol: 'accessing',
  20771. fn: function (aValuable){
  20772. var self=this;
  20773. self["@valuable"]=aValuable;
  20774. return self;
  20775. },
  20776. args: ["aValuable"],
  20777. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  20778. referencedClasses: [],
  20779. messageSends: []
  20780. }),
  20781. $globals.AnnouncementSubscription);
  20782. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  20783. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  20784. $core.addMethod(
  20785. $core.method({
  20786. selector: "receiver",
  20787. protocol: 'accessing',
  20788. fn: function (){
  20789. var self=this;
  20790. var $1;
  20791. $1=self["@receiver"];
  20792. return $1;
  20793. },
  20794. args: [],
  20795. source: "receiver\x0a\x09^ receiver",
  20796. referencedClasses: [],
  20797. messageSends: []
  20798. }),
  20799. $globals.AnnouncementValuable);
  20800. $core.addMethod(
  20801. $core.method({
  20802. selector: "receiver:",
  20803. protocol: 'accessing',
  20804. fn: function (anObject){
  20805. var self=this;
  20806. self["@receiver"]=anObject;
  20807. return self;
  20808. },
  20809. args: ["anObject"],
  20810. source: "receiver: anObject\x0a\x09receiver := anObject",
  20811. referencedClasses: [],
  20812. messageSends: []
  20813. }),
  20814. $globals.AnnouncementValuable);
  20815. $core.addMethod(
  20816. $core.method({
  20817. selector: "valuable",
  20818. protocol: 'accessing',
  20819. fn: function (){
  20820. var self=this;
  20821. var $1;
  20822. $1=self["@valuable"];
  20823. return $1;
  20824. },
  20825. args: [],
  20826. source: "valuable\x0a\x09^ valuable",
  20827. referencedClasses: [],
  20828. messageSends: []
  20829. }),
  20830. $globals.AnnouncementValuable);
  20831. $core.addMethod(
  20832. $core.method({
  20833. selector: "valuable:",
  20834. protocol: 'accessing',
  20835. fn: function (anObject){
  20836. var self=this;
  20837. self["@valuable"]=anObject;
  20838. return self;
  20839. },
  20840. args: ["anObject"],
  20841. source: "valuable: anObject\x0a\x09valuable := anObject",
  20842. referencedClasses: [],
  20843. messageSends: []
  20844. }),
  20845. $globals.AnnouncementValuable);
  20846. $core.addMethod(
  20847. $core.method({
  20848. selector: "value",
  20849. protocol: 'evaluating',
  20850. fn: function (){
  20851. var self=this;
  20852. return $core.withContext(function($ctx1) {
  20853. var $1;
  20854. $1=$recv(self._valuable())._value();
  20855. return $1;
  20856. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  20857. },
  20858. args: [],
  20859. source: "value\x0a\x09^ self valuable value",
  20860. referencedClasses: [],
  20861. messageSends: ["value", "valuable"]
  20862. }),
  20863. $globals.AnnouncementValuable);
  20864. $core.addMethod(
  20865. $core.method({
  20866. selector: "value:",
  20867. protocol: 'evaluating',
  20868. fn: function (anObject){
  20869. var self=this;
  20870. return $core.withContext(function($ctx1) {
  20871. var $1;
  20872. $1=$recv(self._valuable())._value_(anObject);
  20873. return $1;
  20874. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  20875. },
  20876. args: ["anObject"],
  20877. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  20878. referencedClasses: [],
  20879. messageSends: ["value:", "valuable"]
  20880. }),
  20881. $globals.AnnouncementValuable);
  20882. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  20883. $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' ].";
  20884. $core.addMethod(
  20885. $core.method({
  20886. selector: "announce:",
  20887. protocol: 'announcing',
  20888. fn: function (anAnnouncement){
  20889. var self=this;
  20890. return $core.withContext(function($ctx1) {
  20891. $recv(self["@subscriptions"])._do_((function(each){
  20892. return $core.withContext(function($ctx2) {
  20893. return $recv(each)._deliver_(anAnnouncement);
  20894. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20895. }));
  20896. return self;
  20897. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  20898. },
  20899. args: ["anAnnouncement"],
  20900. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  20901. referencedClasses: [],
  20902. messageSends: ["do:", "deliver:"]
  20903. }),
  20904. $globals.Announcer);
  20905. $core.addMethod(
  20906. $core.method({
  20907. selector: "initialize",
  20908. protocol: 'initialization',
  20909. fn: function (){
  20910. var self=this;
  20911. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  20912. return $core.withContext(function($ctx1) {
  20913. (
  20914. $ctx1.supercall = true,
  20915. $globals.Announcer.superclass.fn.prototype._initialize.apply($recv(self), []));
  20916. $ctx1.supercall = false;
  20917. self["@subscriptions"]=$recv($OrderedCollection())._new();
  20918. return self;
  20919. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  20920. },
  20921. args: [],
  20922. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  20923. referencedClasses: ["OrderedCollection"],
  20924. messageSends: ["initialize", "new"]
  20925. }),
  20926. $globals.Announcer);
  20927. $core.addMethod(
  20928. $core.method({
  20929. selector: "on:do:",
  20930. protocol: 'subscribing',
  20931. fn: function (aClass,aBlock){
  20932. var self=this;
  20933. return $core.withContext(function($ctx1) {
  20934. self._on_do_for_(aClass,aBlock,nil);
  20935. return self;
  20936. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  20937. },
  20938. args: ["aClass", "aBlock"],
  20939. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  20940. referencedClasses: [],
  20941. messageSends: ["on:do:for:"]
  20942. }),
  20943. $globals.Announcer);
  20944. $core.addMethod(
  20945. $core.method({
  20946. selector: "on:do:for:",
  20947. protocol: 'subscribing',
  20948. fn: function (aClass,aBlock,aReceiver){
  20949. var self=this;
  20950. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20951. function $AnnouncementValuable(){return $globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)}
  20952. return $core.withContext(function($ctx1) {
  20953. var $1,$3,$4,$6,$7,$5,$8,$2;
  20954. $1=self["@subscriptions"];
  20955. $3=$recv($AnnouncementSubscription())._new();
  20956. $ctx1.sendIdx["new"]=1;
  20957. $4=$3;
  20958. $6=$recv($AnnouncementValuable())._new();
  20959. $recv($6)._valuable_(aBlock);
  20960. $recv($6)._receiver_(aReceiver);
  20961. $7=$recv($6)._yourself();
  20962. $ctx1.sendIdx["yourself"]=1;
  20963. $5=$7;
  20964. $recv($4)._valuable_($5);
  20965. $ctx1.sendIdx["valuable:"]=1;
  20966. $recv($3)._announcementClass_(aClass);
  20967. $8=$recv($3)._yourself();
  20968. $2=$8;
  20969. $recv($1)._add_($2);
  20970. return self;
  20971. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  20972. },
  20973. args: ["aClass", "aBlock", "aReceiver"],
  20974. 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)",
  20975. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  20976. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  20977. }),
  20978. $globals.Announcer);
  20979. $core.addMethod(
  20980. $core.method({
  20981. selector: "on:doOnce:",
  20982. protocol: 'subscribing',
  20983. fn: function (aClass,aBlock){
  20984. var self=this;
  20985. var subscription;
  20986. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20987. return $core.withContext(function($ctx1) {
  20988. var $1,$2;
  20989. $1=$recv($AnnouncementSubscription())._new();
  20990. $recv($1)._announcementClass_(aClass);
  20991. $2=$recv($1)._yourself();
  20992. subscription=$2;
  20993. $recv(subscription)._valuable_((function(ann){
  20994. return $core.withContext(function($ctx2) {
  20995. $recv(self["@subscriptions"])._remove_(subscription);
  20996. return $recv(aBlock)._value_(ann);
  20997. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  20998. }));
  20999. $recv(self["@subscriptions"])._add_(subscription);
  21000. return self;
  21001. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  21002. },
  21003. args: ["aClass", "aBlock"],
  21004. 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",
  21005. referencedClasses: ["AnnouncementSubscription"],
  21006. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  21007. }),
  21008. $globals.Announcer);
  21009. $core.addMethod(
  21010. $core.method({
  21011. selector: "on:send:to:",
  21012. protocol: 'subscribing',
  21013. fn: function (aClass,aSelector,anObject){
  21014. var self=this;
  21015. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  21016. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  21017. return $core.withContext(function($ctx1) {
  21018. var $1,$3,$4,$6,$7,$5,$8,$2;
  21019. $1=self["@subscriptions"];
  21020. $3=$recv($AnnouncementSubscription())._new();
  21021. $ctx1.sendIdx["new"]=1;
  21022. $4=$3;
  21023. $6=$recv($MessageSend())._new();
  21024. $recv($6)._receiver_(anObject);
  21025. $recv($6)._selector_(aSelector);
  21026. $7=$recv($6)._yourself();
  21027. $ctx1.sendIdx["yourself"]=1;
  21028. $5=$7;
  21029. $recv($4)._valuable_($5);
  21030. $recv($3)._announcementClass_(aClass);
  21031. $8=$recv($3)._yourself();
  21032. $2=$8;
  21033. $recv($1)._add_($2);
  21034. return self;
  21035. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  21036. },
  21037. args: ["aClass", "aSelector", "anObject"],
  21038. 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)",
  21039. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  21040. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  21041. }),
  21042. $globals.Announcer);
  21043. $core.addMethod(
  21044. $core.method({
  21045. selector: "unsubscribe:",
  21046. protocol: 'subscribing',
  21047. fn: function (anObject){
  21048. var self=this;
  21049. return $core.withContext(function($ctx1) {
  21050. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  21051. return $core.withContext(function($ctx2) {
  21052. return $recv($recv(each)._receiver()).__eq(anObject);
  21053. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21054. }));
  21055. return self;
  21056. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  21057. },
  21058. args: ["anObject"],
  21059. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  21060. referencedClasses: [],
  21061. messageSends: ["reject:", "=", "receiver"]
  21062. }),
  21063. $globals.Announcer);
  21064. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  21065. $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`";
  21066. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  21067. $core.addMethod(
  21068. $core.method({
  21069. selector: "current",
  21070. protocol: 'accessing',
  21071. fn: function (){
  21072. var self=this;
  21073. return $core.withContext(function($ctx1) {
  21074. var $2,$1,$receiver;
  21075. $2=self["@current"];
  21076. if(($receiver = $2) == null || $receiver.isNil){
  21077. self["@current"]=(
  21078. $ctx1.supercall = true,
  21079. $globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply($recv(self), []));
  21080. $ctx1.supercall = false;
  21081. $1=self["@current"];
  21082. } else {
  21083. $1=$2;
  21084. };
  21085. return $1;
  21086. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  21087. },
  21088. args: [],
  21089. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  21090. referencedClasses: [],
  21091. messageSends: ["ifNil:", "new"]
  21092. }),
  21093. $globals.SystemAnnouncer.klass);
  21094. $core.addMethod(
  21095. $core.method({
  21096. selector: "new",
  21097. protocol: 'instance creation',
  21098. fn: function (){
  21099. var self=this;
  21100. return $core.withContext(function($ctx1) {
  21101. self._shouldNotImplement();
  21102. return self;
  21103. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  21104. },
  21105. args: [],
  21106. source: "new\x0a\x09self shouldNotImplement",
  21107. referencedClasses: [],
  21108. messageSends: ["shouldNotImplement"]
  21109. }),
  21110. $globals.SystemAnnouncer.klass);
  21111. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  21112. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  21113. $core.addMethod(
  21114. $core.method({
  21115. selector: "classTag",
  21116. protocol: 'accessing',
  21117. fn: function (){
  21118. var self=this;
  21119. return "announcement";
  21120. },
  21121. args: [],
  21122. 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'",
  21123. referencedClasses: [],
  21124. messageSends: []
  21125. }),
  21126. $globals.SystemAnnouncement.klass);
  21127. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  21128. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  21129. $core.addMethod(
  21130. $core.method({
  21131. selector: "theClass",
  21132. protocol: 'accessing',
  21133. fn: function (){
  21134. var self=this;
  21135. var $1;
  21136. $1=self["@theClass"];
  21137. return $1;
  21138. },
  21139. args: [],
  21140. source: "theClass\x0a\x09^ theClass",
  21141. referencedClasses: [],
  21142. messageSends: []
  21143. }),
  21144. $globals.ClassAnnouncement);
  21145. $core.addMethod(
  21146. $core.method({
  21147. selector: "theClass:",
  21148. protocol: 'accessing',
  21149. fn: function (aClass){
  21150. var self=this;
  21151. self["@theClass"]=aClass;
  21152. return self;
  21153. },
  21154. args: ["aClass"],
  21155. source: "theClass: aClass\x0a\x09theClass := aClass",
  21156. referencedClasses: [],
  21157. messageSends: []
  21158. }),
  21159. $globals.ClassAnnouncement);
  21160. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21161. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  21162. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21163. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  21164. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21165. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  21166. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  21167. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  21168. $core.addMethod(
  21169. $core.method({
  21170. selector: "oldClass",
  21171. protocol: 'accessing',
  21172. fn: function (){
  21173. var self=this;
  21174. var $1;
  21175. $1=self["@oldClass"];
  21176. return $1;
  21177. },
  21178. args: [],
  21179. source: "oldClass\x0a\x09^ oldClass",
  21180. referencedClasses: [],
  21181. messageSends: []
  21182. }),
  21183. $globals.ClassMigrated);
  21184. $core.addMethod(
  21185. $core.method({
  21186. selector: "oldClass:",
  21187. protocol: 'accessing',
  21188. fn: function (aClass){
  21189. var self=this;
  21190. self["@oldClass"]=aClass;
  21191. return self;
  21192. },
  21193. args: ["aClass"],
  21194. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  21195. referencedClasses: [],
  21196. messageSends: []
  21197. }),
  21198. $globals.ClassMigrated);
  21199. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  21200. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  21201. $core.addMethod(
  21202. $core.method({
  21203. selector: "oldPackage",
  21204. protocol: 'accessing',
  21205. fn: function (){
  21206. var self=this;
  21207. var $1;
  21208. $1=self["@oldPackage"];
  21209. return $1;
  21210. },
  21211. args: [],
  21212. source: "oldPackage\x0a\x09^ oldPackage",
  21213. referencedClasses: [],
  21214. messageSends: []
  21215. }),
  21216. $globals.ClassMoved);
  21217. $core.addMethod(
  21218. $core.method({
  21219. selector: "oldPackage:",
  21220. protocol: 'accessing',
  21221. fn: function (aPackage){
  21222. var self=this;
  21223. self["@oldPackage"]=aPackage;
  21224. return self;
  21225. },
  21226. args: ["aPackage"],
  21227. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  21228. referencedClasses: [],
  21229. messageSends: []
  21230. }),
  21231. $globals.ClassMoved);
  21232. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21233. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  21234. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21235. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  21236. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  21237. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  21238. $core.addMethod(
  21239. $core.method({
  21240. selector: "method",
  21241. protocol: 'accessing',
  21242. fn: function (){
  21243. var self=this;
  21244. var $1;
  21245. $1=self["@method"];
  21246. return $1;
  21247. },
  21248. args: [],
  21249. source: "method\x0a\x09^ method",
  21250. referencedClasses: [],
  21251. messageSends: []
  21252. }),
  21253. $globals.MethodAnnouncement);
  21254. $core.addMethod(
  21255. $core.method({
  21256. selector: "method:",
  21257. protocol: 'accessing',
  21258. fn: function (aCompiledMethod){
  21259. var self=this;
  21260. self["@method"]=aCompiledMethod;
  21261. return self;
  21262. },
  21263. args: ["aCompiledMethod"],
  21264. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  21265. referencedClasses: [],
  21266. messageSends: []
  21267. }),
  21268. $globals.MethodAnnouncement);
  21269. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21270. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  21271. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  21272. $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.";
  21273. $core.addMethod(
  21274. $core.method({
  21275. selector: "oldMethod",
  21276. protocol: 'accessing',
  21277. fn: function (){
  21278. var self=this;
  21279. var $1;
  21280. $1=self["@oldMethod"];
  21281. return $1;
  21282. },
  21283. args: [],
  21284. source: "oldMethod\x0a\x09^ oldMethod",
  21285. referencedClasses: [],
  21286. messageSends: []
  21287. }),
  21288. $globals.MethodModified);
  21289. $core.addMethod(
  21290. $core.method({
  21291. selector: "oldMethod:",
  21292. protocol: 'accessing',
  21293. fn: function (aMethod){
  21294. var self=this;
  21295. self["@oldMethod"]=aMethod;
  21296. return self;
  21297. },
  21298. args: ["aMethod"],
  21299. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  21300. referencedClasses: [],
  21301. messageSends: []
  21302. }),
  21303. $globals.MethodModified);
  21304. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  21305. $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.";
  21306. $core.addMethod(
  21307. $core.method({
  21308. selector: "oldProtocol",
  21309. protocol: 'accessing',
  21310. fn: function (){
  21311. var self=this;
  21312. var $1;
  21313. $1=self["@oldProtocol"];
  21314. return $1;
  21315. },
  21316. args: [],
  21317. source: "oldProtocol\x0a\x09^ oldProtocol",
  21318. referencedClasses: [],
  21319. messageSends: []
  21320. }),
  21321. $globals.MethodMoved);
  21322. $core.addMethod(
  21323. $core.method({
  21324. selector: "oldProtocol:",
  21325. protocol: 'accessing',
  21326. fn: function (aString){
  21327. var self=this;
  21328. self["@oldProtocol"]=aString;
  21329. return self;
  21330. },
  21331. args: ["aString"],
  21332. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  21333. referencedClasses: [],
  21334. messageSends: []
  21335. }),
  21336. $globals.MethodMoved);
  21337. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21338. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  21339. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  21340. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  21341. $core.addMethod(
  21342. $core.method({
  21343. selector: "package",
  21344. protocol: 'accessing',
  21345. fn: function (){
  21346. var self=this;
  21347. var $1;
  21348. $1=self["@package"];
  21349. return $1;
  21350. },
  21351. args: [],
  21352. source: "package\x0a\x09^ package",
  21353. referencedClasses: [],
  21354. messageSends: []
  21355. }),
  21356. $globals.PackageAnnouncement);
  21357. $core.addMethod(
  21358. $core.method({
  21359. selector: "package:",
  21360. protocol: 'accessing',
  21361. fn: function (aPackage){
  21362. var self=this;
  21363. self["@package"]=aPackage;
  21364. return self;
  21365. },
  21366. args: ["aPackage"],
  21367. source: "package: aPackage\x0a\x09package := aPackage",
  21368. referencedClasses: [],
  21369. messageSends: []
  21370. }),
  21371. $globals.PackageAnnouncement);
  21372. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21373. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  21374. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21375. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  21376. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21377. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  21378. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21379. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  21380. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  21381. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  21382. $core.addMethod(
  21383. $core.method({
  21384. selector: "package",
  21385. protocol: 'accessing',
  21386. fn: function (){
  21387. var self=this;
  21388. return $core.withContext(function($ctx1) {
  21389. var $2,$1,$receiver;
  21390. $2=self._theClass();
  21391. if(($receiver = $2) == null || $receiver.isNil){
  21392. $1=$2;
  21393. } else {
  21394. var class_;
  21395. class_=$receiver;
  21396. $1=$recv(class_)._packageOfProtocol_(self._protocol());
  21397. };
  21398. return $1;
  21399. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  21400. },
  21401. args: [],
  21402. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  21403. referencedClasses: [],
  21404. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  21405. }),
  21406. $globals.ProtocolAnnouncement);
  21407. $core.addMethod(
  21408. $core.method({
  21409. selector: "protocol",
  21410. protocol: 'accessing',
  21411. fn: function (){
  21412. var self=this;
  21413. var $1;
  21414. $1=self["@protocol"];
  21415. return $1;
  21416. },
  21417. args: [],
  21418. source: "protocol\x0a\x09^ protocol",
  21419. referencedClasses: [],
  21420. messageSends: []
  21421. }),
  21422. $globals.ProtocolAnnouncement);
  21423. $core.addMethod(
  21424. $core.method({
  21425. selector: "protocol:",
  21426. protocol: 'accessing',
  21427. fn: function (aString){
  21428. var self=this;
  21429. self["@protocol"]=aString;
  21430. return self;
  21431. },
  21432. args: ["aString"],
  21433. source: "protocol: aString\x0a\x09protocol := aString",
  21434. referencedClasses: [],
  21435. messageSends: []
  21436. }),
  21437. $globals.ProtocolAnnouncement);
  21438. $core.addMethod(
  21439. $core.method({
  21440. selector: "theClass",
  21441. protocol: 'accessing',
  21442. fn: function (){
  21443. var self=this;
  21444. var $1;
  21445. $1=self["@theClass"];
  21446. return $1;
  21447. },
  21448. args: [],
  21449. source: "theClass\x0a\x09^ theClass",
  21450. referencedClasses: [],
  21451. messageSends: []
  21452. }),
  21453. $globals.ProtocolAnnouncement);
  21454. $core.addMethod(
  21455. $core.method({
  21456. selector: "theClass:",
  21457. protocol: 'accessing',
  21458. fn: function (aClass){
  21459. var self=this;
  21460. self["@theClass"]=aClass;
  21461. return self;
  21462. },
  21463. args: ["aClass"],
  21464. source: "theClass: aClass\x0a\x09theClass := aClass",
  21465. referencedClasses: [],
  21466. messageSends: []
  21467. }),
  21468. $globals.ProtocolAnnouncement);
  21469. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21470. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  21471. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21472. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  21473. });
  21474. 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";
  21475. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  21476. $core.addPackage('Platform-Services');
  21477. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  21478. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21479. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  21480. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  21481. $core.addMethod(
  21482. $core.method({
  21483. selector: "handleError:",
  21484. protocol: 'error handling',
  21485. fn: function (anError){
  21486. var self=this;
  21487. return $core.withContext(function($ctx1) {
  21488. var $1,$receiver;
  21489. $1=$recv(anError)._context();
  21490. $ctx1.sendIdx["context"]=1;
  21491. if(($receiver = $1) == null || $receiver.isNil){
  21492. $1;
  21493. } else {
  21494. self._logErrorContext_($recv(anError)._context());
  21495. };
  21496. self._logError_(anError);
  21497. return self;
  21498. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21499. },
  21500. args: ["anError"],
  21501. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  21502. referencedClasses: [],
  21503. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  21504. }),
  21505. $globals.ConsoleErrorHandler);
  21506. $core.addMethod(
  21507. $core.method({
  21508. selector: "log:",
  21509. protocol: 'private',
  21510. fn: function (aString){
  21511. var self=this;
  21512. return $core.withContext(function($ctx1) {
  21513. $recv(console)._log_(aString);
  21514. return self;
  21515. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  21516. },
  21517. args: ["aString"],
  21518. source: "log: aString\x0a\x09console log: aString",
  21519. referencedClasses: [],
  21520. messageSends: ["log:"]
  21521. }),
  21522. $globals.ConsoleErrorHandler);
  21523. $core.addMethod(
  21524. $core.method({
  21525. selector: "logContext:",
  21526. protocol: 'private',
  21527. fn: function (aContext){
  21528. var self=this;
  21529. return $core.withContext(function($ctx1) {
  21530. var $1,$receiver;
  21531. $1=$recv(aContext)._home();
  21532. $ctx1.sendIdx["home"]=1;
  21533. if(($receiver = $1) == null || $receiver.isNil){
  21534. $1;
  21535. } else {
  21536. self._logContext_($recv(aContext)._home());
  21537. };
  21538. self._log_($recv(aContext)._asString());
  21539. return self;
  21540. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21541. },
  21542. args: ["aContext"],
  21543. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  21544. referencedClasses: [],
  21545. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  21546. }),
  21547. $globals.ConsoleErrorHandler);
  21548. $core.addMethod(
  21549. $core.method({
  21550. selector: "logError:",
  21551. protocol: 'private',
  21552. fn: function (anError){
  21553. var self=this;
  21554. return $core.withContext(function($ctx1) {
  21555. self._log_($recv(anError)._messageText());
  21556. return self;
  21557. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21558. },
  21559. args: ["anError"],
  21560. source: "logError: anError\x0a\x09self log: anError messageText",
  21561. referencedClasses: [],
  21562. messageSends: ["log:", "messageText"]
  21563. }),
  21564. $globals.ConsoleErrorHandler);
  21565. $core.addMethod(
  21566. $core.method({
  21567. selector: "logErrorContext:",
  21568. protocol: 'private',
  21569. fn: function (aContext){
  21570. var self=this;
  21571. return $core.withContext(function($ctx1) {
  21572. var $1,$receiver;
  21573. if(($receiver = aContext) == null || $receiver.isNil){
  21574. aContext;
  21575. } else {
  21576. $1=$recv(aContext)._home();
  21577. $ctx1.sendIdx["home"]=1;
  21578. if(($receiver = $1) == null || $receiver.isNil){
  21579. $1;
  21580. } else {
  21581. self._logContext_($recv(aContext)._home());
  21582. };
  21583. };
  21584. return self;
  21585. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21586. },
  21587. args: ["aContext"],
  21588. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  21589. referencedClasses: [],
  21590. messageSends: ["ifNotNil:", "home", "logContext:"]
  21591. }),
  21592. $globals.ConsoleErrorHandler);
  21593. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  21594. $core.addMethod(
  21595. $core.method({
  21596. selector: "initialize",
  21597. protocol: 'initialization',
  21598. fn: function (){
  21599. var self=this;
  21600. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  21601. return $core.withContext(function($ctx1) {
  21602. $recv($ErrorHandler())._registerIfNone_(self._new());
  21603. return self;
  21604. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  21605. },
  21606. args: [],
  21607. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  21608. referencedClasses: ["ErrorHandler"],
  21609. messageSends: ["registerIfNone:", "new"]
  21610. }),
  21611. $globals.ConsoleErrorHandler.klass);
  21612. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  21613. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  21614. $core.addMethod(
  21615. $core.method({
  21616. selector: "clear",
  21617. protocol: 'printing',
  21618. fn: function (){
  21619. var self=this;
  21620. return self;
  21621. },
  21622. args: [],
  21623. source: "clear\x0a\x09\x22no op\x22",
  21624. referencedClasses: [],
  21625. messageSends: []
  21626. }),
  21627. $globals.ConsoleTranscript);
  21628. $core.addMethod(
  21629. $core.method({
  21630. selector: "cr",
  21631. protocol: 'printing',
  21632. fn: function (){
  21633. var self=this;
  21634. return self;
  21635. },
  21636. args: [],
  21637. source: "cr\x0a\x09\x22no op\x22",
  21638. referencedClasses: [],
  21639. messageSends: []
  21640. }),
  21641. $globals.ConsoleTranscript);
  21642. $core.addMethod(
  21643. $core.method({
  21644. selector: "open",
  21645. protocol: 'actions',
  21646. fn: function (){
  21647. var self=this;
  21648. return self;
  21649. },
  21650. args: [],
  21651. source: "open",
  21652. referencedClasses: [],
  21653. messageSends: []
  21654. }),
  21655. $globals.ConsoleTranscript);
  21656. $core.addMethod(
  21657. $core.method({
  21658. selector: "show:",
  21659. protocol: 'printing',
  21660. fn: function (anObject){
  21661. var self=this;
  21662. return $core.withContext(function($ctx1) {
  21663. console.log(String($recv(anObject)._asString()));
  21664. return self;
  21665. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  21666. },
  21667. args: ["anObject"],
  21668. 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()))>",
  21669. referencedClasses: [],
  21670. messageSends: []
  21671. }),
  21672. $globals.ConsoleTranscript);
  21673. $core.addMethod(
  21674. $core.method({
  21675. selector: "initialize",
  21676. protocol: 'initialization',
  21677. fn: function (){
  21678. var self=this;
  21679. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  21680. return $core.withContext(function($ctx1) {
  21681. $recv($Transcript())._registerIfNone_(self._new());
  21682. return self;
  21683. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  21684. },
  21685. args: [],
  21686. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  21687. referencedClasses: ["Transcript"],
  21688. messageSends: ["registerIfNone:", "new"]
  21689. }),
  21690. $globals.ConsoleTranscript.klass);
  21691. $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services');
  21692. $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 }.";
  21693. $core.addMethod(
  21694. $core.method({
  21695. selector: "ajax:",
  21696. protocol: 'actions',
  21697. fn: function (anObject){
  21698. var self=this;
  21699. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  21700. return $core.withContext(function($ctx1) {
  21701. var $1;
  21702. self._deprecatedAPI();
  21703. $1=$recv($PlatformInterface())._ajax_(anObject);
  21704. return $1;
  21705. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
  21706. },
  21707. args: ["anObject"],
  21708. source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject",
  21709. referencedClasses: ["PlatformInterface"],
  21710. messageSends: ["deprecatedAPI", "ajax:"]
  21711. }),
  21712. $globals.InterfacingObject);
  21713. $core.addMethod(
  21714. $core.method({
  21715. selector: "alert:",
  21716. protocol: 'actions',
  21717. fn: function (aString){
  21718. var self=this;
  21719. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21720. return $core.withContext(function($ctx1) {
  21721. var $1;
  21722. $1=$recv($Terminal())._alert_(aString);
  21723. return $1;
  21724. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
  21725. },
  21726. args: ["aString"],
  21727. source: "alert: aString\x0a\x09^ Terminal alert: aString",
  21728. referencedClasses: ["Terminal"],
  21729. messageSends: ["alert:"]
  21730. }),
  21731. $globals.InterfacingObject);
  21732. $core.addMethod(
  21733. $core.method({
  21734. selector: "confirm:",
  21735. protocol: 'actions',
  21736. fn: function (aString){
  21737. var self=this;
  21738. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21739. return $core.withContext(function($ctx1) {
  21740. var $1;
  21741. $1=$recv($Terminal())._confirm_(aString);
  21742. return $1;
  21743. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
  21744. },
  21745. args: ["aString"],
  21746. source: "confirm: aString\x0a\x09^ Terminal confirm: aString",
  21747. referencedClasses: ["Terminal"],
  21748. messageSends: ["confirm:"]
  21749. }),
  21750. $globals.InterfacingObject);
  21751. $core.addMethod(
  21752. $core.method({
  21753. selector: "prompt:",
  21754. protocol: 'actions',
  21755. fn: function (aString){
  21756. var self=this;
  21757. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21758. return $core.withContext(function($ctx1) {
  21759. var $1;
  21760. $1=$recv($Terminal())._prompt_(aString);
  21761. return $1;
  21762. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
  21763. },
  21764. args: ["aString"],
  21765. source: "prompt: aString\x0a\x09^ Terminal prompt: aString",
  21766. referencedClasses: ["Terminal"],
  21767. messageSends: ["prompt:"]
  21768. }),
  21769. $globals.InterfacingObject);
  21770. $core.addMethod(
  21771. $core.method({
  21772. selector: "prompt:default:",
  21773. protocol: 'actions',
  21774. fn: function (aString,defaultString){
  21775. var self=this;
  21776. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21777. return $core.withContext(function($ctx1) {
  21778. var $1;
  21779. $1=$recv($Terminal())._prompt_default_(aString,defaultString);
  21780. return $1;
  21781. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
  21782. },
  21783. args: ["aString", "defaultString"],
  21784. source: "prompt: aString default: defaultString\x0a\x09^ Terminal prompt: aString default: defaultString",
  21785. referencedClasses: ["Terminal"],
  21786. messageSends: ["prompt:default:"]
  21787. }),
  21788. $globals.InterfacingObject);
  21789. $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
  21790. $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.";
  21791. $core.addMethod(
  21792. $core.method({
  21793. selector: "addInstVarNamed:to:",
  21794. protocol: 'compiling',
  21795. fn: function (aString,aClass){
  21796. var self=this;
  21797. return $core.withContext(function($ctx1) {
  21798. var $1,$2,$3,$4,$5;
  21799. $1=self._classBuilder();
  21800. $2=$recv(aClass)._superclass();
  21801. $3=$recv(aClass)._name();
  21802. $ctx1.sendIdx["name"]=1;
  21803. $4=$recv($recv(aClass)._instanceVariableNames())._copy();
  21804. $recv($4)._add_(aString);
  21805. $5=$recv($4)._yourself();
  21806. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,$recv($recv(aClass)._package())._name());
  21807. return self;
  21808. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  21809. },
  21810. args: ["aString", "aClass"],
  21811. 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",
  21812. referencedClasses: [],
  21813. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  21814. }),
  21815. $globals.Environment);
  21816. $core.addMethod(
  21817. $core.method({
  21818. selector: "allSelectors",
  21819. protocol: 'accessing',
  21820. fn: function (){
  21821. var self=this;
  21822. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21823. return $core.withContext(function($ctx1) {
  21824. var $1;
  21825. $1=$recv($recv($Smalltalk())._core())._allSelectors();
  21826. return $1;
  21827. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  21828. },
  21829. args: [],
  21830. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  21831. referencedClasses: ["Smalltalk"],
  21832. messageSends: ["allSelectors", "core"]
  21833. }),
  21834. $globals.Environment);
  21835. $core.addMethod(
  21836. $core.method({
  21837. selector: "availableClassNames",
  21838. protocol: 'accessing',
  21839. fn: function (){
  21840. var self=this;
  21841. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21842. return $core.withContext(function($ctx1) {
  21843. var $1;
  21844. $1=$recv($recv($Smalltalk())._classes())._collect_((function(each){
  21845. return $core.withContext(function($ctx2) {
  21846. return $recv(each)._name();
  21847. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21848. }));
  21849. return $1;
  21850. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  21851. },
  21852. args: [],
  21853. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  21854. referencedClasses: ["Smalltalk"],
  21855. messageSends: ["collect:", "classes", "name"]
  21856. }),
  21857. $globals.Environment);
  21858. $core.addMethod(
  21859. $core.method({
  21860. selector: "availablePackageNames",
  21861. protocol: 'accessing',
  21862. fn: function (){
  21863. var self=this;
  21864. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21865. return $core.withContext(function($ctx1) {
  21866. var $1;
  21867. $1=$recv($recv($Smalltalk())._packages())._collect_((function(each){
  21868. return $core.withContext(function($ctx2) {
  21869. return $recv(each)._name();
  21870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21871. }));
  21872. return $1;
  21873. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  21874. },
  21875. args: [],
  21876. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  21877. referencedClasses: ["Smalltalk"],
  21878. messageSends: ["collect:", "packages", "name"]
  21879. }),
  21880. $globals.Environment);
  21881. $core.addMethod(
  21882. $core.method({
  21883. selector: "availableProtocolsFor:",
  21884. protocol: 'accessing',
  21885. fn: function (aClass){
  21886. var self=this;
  21887. var protocols;
  21888. return $core.withContext(function($ctx1) {
  21889. var $1,$2,$receiver;
  21890. protocols=$recv(aClass)._protocols();
  21891. $1=$recv(aClass)._superclass();
  21892. $ctx1.sendIdx["superclass"]=1;
  21893. if(($receiver = $1) == null || $receiver.isNil){
  21894. $1;
  21895. } else {
  21896. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  21897. };
  21898. $2=$recv($recv($recv(protocols)._asSet())._asArray())._sort();
  21899. return $2;
  21900. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  21901. },
  21902. args: ["aClass"],
  21903. 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",
  21904. referencedClasses: [],
  21905. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  21906. }),
  21907. $globals.Environment);
  21908. $core.addMethod(
  21909. $core.method({
  21910. selector: "classBuilder",
  21911. protocol: 'accessing',
  21912. fn: function (){
  21913. var self=this;
  21914. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  21915. return $core.withContext(function($ctx1) {
  21916. var $1;
  21917. $1=$recv($ClassBuilder())._new();
  21918. return $1;
  21919. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  21920. },
  21921. args: [],
  21922. source: "classBuilder\x0a\x09^ ClassBuilder new",
  21923. referencedClasses: ["ClassBuilder"],
  21924. messageSends: ["new"]
  21925. }),
  21926. $globals.Environment);
  21927. $core.addMethod(
  21928. $core.method({
  21929. selector: "classNamed:",
  21930. protocol: 'accessing',
  21931. fn: function (aString){
  21932. var self=this;
  21933. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21934. return $core.withContext(function($ctx1) {
  21935. var $2,$1,$receiver;
  21936. $2=$recv($recv($Smalltalk())._globals())._at_($recv(aString)._asSymbol());
  21937. if(($receiver = $2) == null || $receiver.isNil){
  21938. $1=self._error_("Invalid class name");
  21939. } else {
  21940. $1=$2;
  21941. };
  21942. return $1;
  21943. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  21944. },
  21945. args: ["aString"],
  21946. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  21947. referencedClasses: ["Smalltalk"],
  21948. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  21949. }),
  21950. $globals.Environment);
  21951. $core.addMethod(
  21952. $core.method({
  21953. selector: "classes",
  21954. protocol: 'accessing',
  21955. fn: function (){
  21956. var self=this;
  21957. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21958. return $core.withContext(function($ctx1) {
  21959. var $1;
  21960. $1=$recv($Smalltalk())._classes();
  21961. return $1;
  21962. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  21963. },
  21964. args: [],
  21965. source: "classes\x0a\x09^ Smalltalk classes",
  21966. referencedClasses: ["Smalltalk"],
  21967. messageSends: ["classes"]
  21968. }),
  21969. $globals.Environment);
  21970. $core.addMethod(
  21971. $core.method({
  21972. selector: "commitPackage:onSuccess:onError:",
  21973. protocol: 'actions',
  21974. fn: function (aPackage,aBlock,anotherBlock){
  21975. var self=this;
  21976. return $core.withContext(function($ctx1) {
  21977. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  21978. return self;
  21979. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  21980. },
  21981. args: ["aPackage", "aBlock", "anotherBlock"],
  21982. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  21983. referencedClasses: [],
  21984. messageSends: ["commitOnSuccess:onError:", "transport"]
  21985. }),
  21986. $globals.Environment);
  21987. $core.addMethod(
  21988. $core.method({
  21989. selector: "compileClassComment:for:",
  21990. protocol: 'compiling',
  21991. fn: function (aString,aClass){
  21992. var self=this;
  21993. return $core.withContext(function($ctx1) {
  21994. $recv(aClass)._comment_(aString);
  21995. return self;
  21996. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  21997. },
  21998. args: ["aString", "aClass"],
  21999. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  22000. referencedClasses: [],
  22001. messageSends: ["comment:"]
  22002. }),
  22003. $globals.Environment);
  22004. $core.addMethod(
  22005. $core.method({
  22006. selector: "compileClassDefinition:",
  22007. protocol: 'compiling',
  22008. fn: function (aString){
  22009. var self=this;
  22010. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  22011. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  22012. return $core.withContext(function($ctx1) {
  22013. $recv((function(){
  22014. return $core.withContext(function($ctx2) {
  22015. return self._evaluate_for_(aString,$recv($DoIt())._new());
  22016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22017. }))._on_do_($Error(),(function(error){
  22018. return $core.withContext(function($ctx2) {
  22019. return self._alert_($recv(error)._messageText());
  22020. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  22021. }));
  22022. return self;
  22023. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  22024. },
  22025. args: ["aString"],
  22026. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  22027. referencedClasses: ["DoIt", "Error"],
  22028. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  22029. }),
  22030. $globals.Environment);
  22031. $core.addMethod(
  22032. $core.method({
  22033. selector: "compileMethod:for:protocol:",
  22034. protocol: 'compiling',
  22035. fn: function (sourceCode,class_,protocol){
  22036. var self=this;
  22037. return $core.withContext(function($ctx1) {
  22038. var $1;
  22039. $1=$recv(class_)._compile_protocol_(sourceCode,protocol);
  22040. return $1;
  22041. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  22042. },
  22043. args: ["sourceCode", "class", "protocol"],
  22044. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  22045. referencedClasses: [],
  22046. messageSends: ["compile:protocol:"]
  22047. }),
  22048. $globals.Environment);
  22049. $core.addMethod(
  22050. $core.method({
  22051. selector: "copyClass:to:",
  22052. protocol: 'actions',
  22053. fn: function (aClass,aClassName){
  22054. var self=this;
  22055. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22056. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  22057. return $core.withContext(function($ctx1) {
  22058. var $1,$2,$receiver;
  22059. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  22060. if(($receiver = $1) == null || $receiver.isNil){
  22061. $1;
  22062. } else {
  22063. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22064. $ctx1.sendIdx[","]=1;
  22065. self._error_($2);
  22066. };
  22067. $recv($recv($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  22068. return self;
  22069. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22070. },
  22071. args: ["aClass", "aClassName"],
  22072. 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",
  22073. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22074. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  22075. }),
  22076. $globals.Environment);
  22077. $core.addMethod(
  22078. $core.method({
  22079. selector: "doItReceiver",
  22080. protocol: 'accessing',
  22081. fn: function (){
  22082. var self=this;
  22083. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  22084. return $core.withContext(function($ctx1) {
  22085. var $1;
  22086. $1=$recv($DoIt())._new();
  22087. return $1;
  22088. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  22089. },
  22090. args: [],
  22091. source: "doItReceiver\x0a\x09^ DoIt new",
  22092. referencedClasses: ["DoIt"],
  22093. messageSends: ["new"]
  22094. }),
  22095. $globals.Environment);
  22096. $core.addMethod(
  22097. $core.method({
  22098. selector: "evaluate:for:",
  22099. protocol: 'evaluating',
  22100. fn: function (aString,anObject){
  22101. var self=this;
  22102. function $Evaluator(){return $globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
  22103. return $core.withContext(function($ctx1) {
  22104. var $1;
  22105. $1=$recv($Evaluator())._evaluate_for_(aString,anObject);
  22106. return $1;
  22107. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  22108. },
  22109. args: ["aString", "anObject"],
  22110. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  22111. referencedClasses: ["Evaluator"],
  22112. messageSends: ["evaluate:for:"]
  22113. }),
  22114. $globals.Environment);
  22115. $core.addMethod(
  22116. $core.method({
  22117. selector: "evaluate:on:do:",
  22118. protocol: 'error handling',
  22119. fn: function (aBlock,anErrorClass,exceptionBlock){
  22120. var self=this;
  22121. return $core.withContext(function($ctx1) {
  22122. var $1;
  22123. $recv(aBlock)._tryCatch_((function(exception){
  22124. return $core.withContext(function($ctx2) {
  22125. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  22126. if($core.assert($1)){
  22127. return $recv(exceptionBlock)._value_(exception);
  22128. } else {
  22129. return $recv(exception)._resignal();
  22130. };
  22131. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  22132. }));
  22133. return self;
  22134. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  22135. },
  22136. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  22137. 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 ] ]",
  22138. referencedClasses: [],
  22139. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  22140. }),
  22141. $globals.Environment);
  22142. $core.addMethod(
  22143. $core.method({
  22144. selector: "inspect:",
  22145. protocol: 'actions',
  22146. fn: function (anObject){
  22147. var self=this;
  22148. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  22149. return $core.withContext(function($ctx1) {
  22150. $recv($Inspector())._inspect_(anObject);
  22151. return self;
  22152. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  22153. },
  22154. args: ["anObject"],
  22155. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  22156. referencedClasses: ["Inspector"],
  22157. messageSends: ["inspect:"]
  22158. }),
  22159. $globals.Environment);
  22160. $core.addMethod(
  22161. $core.method({
  22162. selector: "moveClass:toPackage:",
  22163. protocol: 'actions',
  22164. fn: function (aClass,aPackageName){
  22165. var self=this;
  22166. var package_;
  22167. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  22168. return $core.withContext(function($ctx1) {
  22169. var $1,$2,$receiver;
  22170. package_=$recv($Package())._named_(aPackageName);
  22171. $1=package_;
  22172. if(($receiver = $1) == null || $receiver.isNil){
  22173. self._error_("Invalid package name");
  22174. } else {
  22175. $1;
  22176. };
  22177. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  22178. if($core.assert($2)){
  22179. return self;
  22180. };
  22181. $recv(aClass)._package_(package_);
  22182. return self;
  22183. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  22184. },
  22185. args: ["aClass", "aPackageName"],
  22186. 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",
  22187. referencedClasses: ["Package"],
  22188. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  22189. }),
  22190. $globals.Environment);
  22191. $core.addMethod(
  22192. $core.method({
  22193. selector: "moveMethod:toClass:",
  22194. protocol: 'actions',
  22195. fn: function (aMethod,aClassName){
  22196. var self=this;
  22197. var destinationClass;
  22198. return $core.withContext(function($ctx1) {
  22199. var $2,$3,$1,$5,$4;
  22200. destinationClass=self._classNamed_(aClassName);
  22201. $2=destinationClass;
  22202. $3=$recv(aMethod)._methodClass();
  22203. $ctx1.sendIdx["methodClass"]=1;
  22204. $1=$recv($2).__eq_eq($3);
  22205. if($core.assert($1)){
  22206. return self;
  22207. };
  22208. $5=$recv(aMethod)._methodClass();
  22209. $ctx1.sendIdx["methodClass"]=2;
  22210. $4=$recv($5)._isMetaclass();
  22211. if($core.assert($4)){
  22212. destinationClass=$recv(destinationClass)._class();
  22213. destinationClass;
  22214. };
  22215. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  22216. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22217. return self;
  22218. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  22219. },
  22220. args: ["aMethod", "aClassName"],
  22221. 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",
  22222. referencedClasses: [],
  22223. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  22224. }),
  22225. $globals.Environment);
  22226. $core.addMethod(
  22227. $core.method({
  22228. selector: "moveMethod:toProtocol:",
  22229. protocol: 'actions',
  22230. fn: function (aMethod,aProtocol){
  22231. var self=this;
  22232. return $core.withContext(function($ctx1) {
  22233. $recv(aMethod)._protocol_(aProtocol);
  22234. return self;
  22235. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  22236. },
  22237. args: ["aMethod", "aProtocol"],
  22238. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  22239. referencedClasses: [],
  22240. messageSends: ["protocol:"]
  22241. }),
  22242. $globals.Environment);
  22243. $core.addMethod(
  22244. $core.method({
  22245. selector: "packages",
  22246. protocol: 'accessing',
  22247. fn: function (){
  22248. var self=this;
  22249. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22250. return $core.withContext(function($ctx1) {
  22251. var $1;
  22252. $1=$recv($Smalltalk())._packages();
  22253. return $1;
  22254. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  22255. },
  22256. args: [],
  22257. source: "packages\x0a\x09^ Smalltalk packages",
  22258. referencedClasses: ["Smalltalk"],
  22259. messageSends: ["packages"]
  22260. }),
  22261. $globals.Environment);
  22262. $core.addMethod(
  22263. $core.method({
  22264. selector: "registerErrorHandler:",
  22265. protocol: 'services',
  22266. fn: function (anErrorHandler){
  22267. var self=this;
  22268. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  22269. return $core.withContext(function($ctx1) {
  22270. $recv($ErrorHandler())._register_(anErrorHandler);
  22271. return self;
  22272. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  22273. },
  22274. args: ["anErrorHandler"],
  22275. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  22276. referencedClasses: ["ErrorHandler"],
  22277. messageSends: ["register:"]
  22278. }),
  22279. $globals.Environment);
  22280. $core.addMethod(
  22281. $core.method({
  22282. selector: "registerFinder:",
  22283. protocol: 'services',
  22284. fn: function (aFinder){
  22285. var self=this;
  22286. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  22287. return $core.withContext(function($ctx1) {
  22288. $recv($Finder())._register_(aFinder);
  22289. return self;
  22290. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  22291. },
  22292. args: ["aFinder"],
  22293. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  22294. referencedClasses: ["Finder"],
  22295. messageSends: ["register:"]
  22296. }),
  22297. $globals.Environment);
  22298. $core.addMethod(
  22299. $core.method({
  22300. selector: "registerInspector:",
  22301. protocol: 'services',
  22302. fn: function (anInspector){
  22303. var self=this;
  22304. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  22305. return $core.withContext(function($ctx1) {
  22306. $recv($Inspector())._register_(anInspector);
  22307. return self;
  22308. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  22309. },
  22310. args: ["anInspector"],
  22311. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  22312. referencedClasses: ["Inspector"],
  22313. messageSends: ["register:"]
  22314. }),
  22315. $globals.Environment);
  22316. $core.addMethod(
  22317. $core.method({
  22318. selector: "registerProgressHandler:",
  22319. protocol: 'services',
  22320. fn: function (aProgressHandler){
  22321. var self=this;
  22322. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  22323. return $core.withContext(function($ctx1) {
  22324. $recv($ProgressHandler())._register_(aProgressHandler);
  22325. return self;
  22326. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  22327. },
  22328. args: ["aProgressHandler"],
  22329. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  22330. referencedClasses: ["ProgressHandler"],
  22331. messageSends: ["register:"]
  22332. }),
  22333. $globals.Environment);
  22334. $core.addMethod(
  22335. $core.method({
  22336. selector: "registerTranscript:",
  22337. protocol: 'services',
  22338. fn: function (aTranscript){
  22339. var self=this;
  22340. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  22341. return $core.withContext(function($ctx1) {
  22342. $recv($Transcript())._register_(aTranscript);
  22343. return self;
  22344. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  22345. },
  22346. args: ["aTranscript"],
  22347. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  22348. referencedClasses: ["Transcript"],
  22349. messageSends: ["register:"]
  22350. }),
  22351. $globals.Environment);
  22352. $core.addMethod(
  22353. $core.method({
  22354. selector: "removeClass:",
  22355. protocol: 'actions',
  22356. fn: function (aClass){
  22357. var self=this;
  22358. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22359. return $core.withContext(function($ctx1) {
  22360. $recv($Smalltalk())._removeClass_(aClass);
  22361. return self;
  22362. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  22363. },
  22364. args: ["aClass"],
  22365. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  22366. referencedClasses: ["Smalltalk"],
  22367. messageSends: ["removeClass:"]
  22368. }),
  22369. $globals.Environment);
  22370. $core.addMethod(
  22371. $core.method({
  22372. selector: "removeMethod:",
  22373. protocol: 'actions',
  22374. fn: function (aMethod){
  22375. var self=this;
  22376. return $core.withContext(function($ctx1) {
  22377. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22378. return self;
  22379. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  22380. },
  22381. args: ["aMethod"],
  22382. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  22383. referencedClasses: [],
  22384. messageSends: ["removeCompiledMethod:", "methodClass"]
  22385. }),
  22386. $globals.Environment);
  22387. $core.addMethod(
  22388. $core.method({
  22389. selector: "removeProtocol:from:",
  22390. protocol: 'actions',
  22391. fn: function (aString,aClass){
  22392. var self=this;
  22393. return $core.withContext(function($ctx1) {
  22394. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22395. return $core.withContext(function($ctx2) {
  22396. return $recv(aClass)._removeCompiledMethod_(each);
  22397. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22398. }));
  22399. return self;
  22400. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  22401. },
  22402. args: ["aString", "aClass"],
  22403. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  22404. referencedClasses: [],
  22405. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  22406. }),
  22407. $globals.Environment);
  22408. $core.addMethod(
  22409. $core.method({
  22410. selector: "renameClass:to:",
  22411. protocol: 'actions',
  22412. fn: function (aClass,aClassName){
  22413. var self=this;
  22414. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22415. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  22416. return $core.withContext(function($ctx1) {
  22417. var $1,$2,$receiver;
  22418. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  22419. if(($receiver = $1) == null || $receiver.isNil){
  22420. $1;
  22421. } else {
  22422. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22423. $ctx1.sendIdx[","]=1;
  22424. self._error_($2);
  22425. };
  22426. $recv($recv($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  22427. return self;
  22428. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22429. },
  22430. args: ["aClass", "aClassName"],
  22431. 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",
  22432. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22433. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  22434. }),
  22435. $globals.Environment);
  22436. $core.addMethod(
  22437. $core.method({
  22438. selector: "renamePackage:to:",
  22439. protocol: 'actions',
  22440. fn: function (aPackageName,aNewPackageName){
  22441. var self=this;
  22442. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22443. return $core.withContext(function($ctx1) {
  22444. var $1,$2,$receiver;
  22445. $1=$recv($recv($Smalltalk())._globals())._at_(aNewPackageName);
  22446. if(($receiver = $1) == null || $receiver.isNil){
  22447. $1;
  22448. } else {
  22449. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  22450. $ctx1.sendIdx[","]=1;
  22451. self._error_($2);
  22452. };
  22453. $recv($Smalltalk())._renamePackage_to_(aPackageName,aNewPackageName);
  22454. return self;
  22455. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  22456. },
  22457. args: ["aPackageName", "aNewPackageName"],
  22458. 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",
  22459. referencedClasses: ["Smalltalk"],
  22460. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  22461. }),
  22462. $globals.Environment);
  22463. $core.addMethod(
  22464. $core.method({
  22465. selector: "renameProtocol:to:in:",
  22466. protocol: 'actions',
  22467. fn: function (aString,anotherString,aClass){
  22468. var self=this;
  22469. return $core.withContext(function($ctx1) {
  22470. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22471. return $core.withContext(function($ctx2) {
  22472. return $recv(each)._protocol_(anotherString);
  22473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22474. }));
  22475. return self;
  22476. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  22477. },
  22478. args: ["aString", "anotherString", "aClass"],
  22479. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  22480. referencedClasses: [],
  22481. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  22482. }),
  22483. $globals.Environment);
  22484. $core.addMethod(
  22485. $core.method({
  22486. selector: "setClassCommentOf:to:",
  22487. protocol: 'actions',
  22488. fn: function (aClass,aString){
  22489. var self=this;
  22490. return $core.withContext(function($ctx1) {
  22491. $recv(aClass)._comment_(aString);
  22492. return self;
  22493. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  22494. },
  22495. args: ["aClass", "aString"],
  22496. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  22497. referencedClasses: [],
  22498. messageSends: ["comment:"]
  22499. }),
  22500. $globals.Environment);
  22501. $core.addMethod(
  22502. $core.method({
  22503. selector: "systemAnnouncer",
  22504. protocol: 'accessing',
  22505. fn: function (){
  22506. var self=this;
  22507. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22508. return $core.withContext(function($ctx1) {
  22509. var $1;
  22510. $1=$recv($recv($recv($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  22511. return $1;
  22512. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  22513. },
  22514. args: [],
  22515. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  22516. referencedClasses: ["Smalltalk"],
  22517. messageSends: ["current", "at:", "globals"]
  22518. }),
  22519. $globals.Environment);
  22520. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  22521. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  22522. $core.addMethod(
  22523. $core.method({
  22524. selector: "do:on:displaying:",
  22525. protocol: 'progress handling',
  22526. fn: function (aBlock,aCollection,aString){
  22527. var self=this;
  22528. return $core.withContext(function($ctx1) {
  22529. $recv(aCollection)._do_(aBlock);
  22530. return self;
  22531. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  22532. },
  22533. args: ["aBlock", "aCollection", "aString"],
  22534. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  22535. referencedClasses: [],
  22536. messageSends: ["do:"]
  22537. }),
  22538. $globals.NullProgressHandler);
  22539. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  22540. $core.addMethod(
  22541. $core.method({
  22542. selector: "initialize",
  22543. protocol: 'initialization',
  22544. fn: function (){
  22545. var self=this;
  22546. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  22547. return $core.withContext(function($ctx1) {
  22548. $recv($ProgressHandler())._registerIfNone_(self._new());
  22549. return self;
  22550. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  22551. },
  22552. args: [],
  22553. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  22554. referencedClasses: ["ProgressHandler"],
  22555. messageSends: ["registerIfNone:", "new"]
  22556. }),
  22557. $globals.NullProgressHandler.klass);
  22558. $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
  22559. $globals.PlatformInterface.comment="Deprecated. Use `Platform` or `Terminal`.";
  22560. $core.addMethod(
  22561. $core.method({
  22562. selector: "ajax:",
  22563. protocol: 'actions',
  22564. fn: function (anObject){
  22565. var self=this;
  22566. function $JQuery(){return $globals.JQuery||(typeof JQuery=="undefined"?nil:JQuery)}
  22567. return $core.withContext(function($ctx1) {
  22568. var $1,$receiver;
  22569. self._deprecatedAPI_("Use Platform newXhr or dedicated library.");
  22570. if(($receiver = $JQuery()) == null || $receiver.isNil){
  22571. $1=self._error_("JQuery wrapper not loaded, cannot do AJAX.");
  22572. } else {
  22573. $1=$recv($recv($JQuery())._current())._ajax_(anObject);
  22574. };
  22575. return $1;
  22576. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
  22577. },
  22578. args: ["anObject"],
  22579. 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.' ]",
  22580. referencedClasses: ["JQuery"],
  22581. messageSends: ["deprecatedAPI:", "ifNotNil:ifNil:", "ajax:", "current", "error:"]
  22582. }),
  22583. $globals.PlatformInterface.klass);
  22584. $core.addMethod(
  22585. $core.method({
  22586. selector: "alert:",
  22587. protocol: 'actions',
  22588. fn: function (aString){
  22589. var self=this;
  22590. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22591. return $core.withContext(function($ctx1) {
  22592. var $1;
  22593. self._deprecatedAPI_("Use Terminal alert:");
  22594. $1=$recv($Terminal())._alert_(aString);
  22595. return $1;
  22596. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
  22597. },
  22598. args: ["aString"],
  22599. source: "alert: aString\x0a\x09self deprecatedAPI: 'Use Terminal alert:'.\x0a\x09^ Terminal alert: aString",
  22600. referencedClasses: ["Terminal"],
  22601. messageSends: ["deprecatedAPI:", "alert:"]
  22602. }),
  22603. $globals.PlatformInterface.klass);
  22604. $core.addMethod(
  22605. $core.method({
  22606. selector: "confirm:",
  22607. protocol: 'actions',
  22608. fn: function (aString){
  22609. var self=this;
  22610. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22611. return $core.withContext(function($ctx1) {
  22612. var $1;
  22613. self._deprecatedAPI_("Use Terminal confirm:");
  22614. $1=$recv($Terminal())._confirm_(aString);
  22615. return $1;
  22616. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
  22617. },
  22618. args: ["aString"],
  22619. source: "confirm: aString\x0a\x09self deprecatedAPI: 'Use Terminal confirm:'.\x0a\x09^ Terminal confirm: aString",
  22620. referencedClasses: ["Terminal"],
  22621. messageSends: ["deprecatedAPI:", "confirm:"]
  22622. }),
  22623. $globals.PlatformInterface.klass);
  22624. $core.addMethod(
  22625. $core.method({
  22626. selector: "existsGlobal:",
  22627. protocol: 'actions',
  22628. fn: function (aString){
  22629. var self=this;
  22630. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  22631. return $core.withContext(function($ctx1) {
  22632. var $1;
  22633. self._deprecatedAPI_("Use Smalltalk existsJsGlobal:");
  22634. $1=$recv($recv($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  22635. return true;
  22636. }),(function(){
  22637. return false;
  22638. }));
  22639. return $1;
  22640. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
  22641. },
  22642. args: ["aString"],
  22643. 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 ]",
  22644. referencedClasses: ["PlatformInterface"],
  22645. messageSends: ["deprecatedAPI:", "at:ifPresent:ifAbsent:", "globals"]
  22646. }),
  22647. $globals.PlatformInterface.klass);
  22648. $core.addMethod(
  22649. $core.method({
  22650. selector: "globals",
  22651. protocol: 'accessing',
  22652. fn: function (){
  22653. var self=this;
  22654. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  22655. return $core.withContext(function($ctx1) {
  22656. var $1;
  22657. self._deprecatedAPI_("Use Platform globals");
  22658. $1=$recv($Platform())._globals();
  22659. return $1;
  22660. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
  22661. },
  22662. args: [],
  22663. source: "globals\x0a\x09self deprecatedAPI: 'Use Platform globals'.\x0a\x09^ Platform globals",
  22664. referencedClasses: ["Platform"],
  22665. messageSends: ["deprecatedAPI:", "globals"]
  22666. }),
  22667. $globals.PlatformInterface.klass);
  22668. $core.addMethod(
  22669. $core.method({
  22670. selector: "newXhr",
  22671. protocol: 'actions',
  22672. fn: function (){
  22673. var self=this;
  22674. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  22675. return $core.withContext(function($ctx1) {
  22676. var $1;
  22677. self._deprecatedAPI_("Use Platform newXhr");
  22678. $1=$recv($Platform())._newXhr();
  22679. return $1;
  22680. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)});
  22681. },
  22682. args: [],
  22683. source: "newXhr\x0a\x09self deprecatedAPI: 'Use Platform newXhr'.\x0a\x09^ Platform newXhr",
  22684. referencedClasses: ["Platform"],
  22685. messageSends: ["deprecatedAPI:", "newXhr"]
  22686. }),
  22687. $globals.PlatformInterface.klass);
  22688. $core.addMethod(
  22689. $core.method({
  22690. selector: "prompt:",
  22691. protocol: 'actions',
  22692. fn: function (aString){
  22693. var self=this;
  22694. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22695. return $core.withContext(function($ctx1) {
  22696. var $1;
  22697. self._deprecatedAPI_("Use Terminal prompt:");
  22698. $1=$recv($Terminal())._prompt_(aString);
  22699. return $1;
  22700. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
  22701. },
  22702. args: ["aString"],
  22703. source: "prompt: aString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:'.\x0a\x09^ Terminal prompt: aString",
  22704. referencedClasses: ["Terminal"],
  22705. messageSends: ["deprecatedAPI:", "prompt:"]
  22706. }),
  22707. $globals.PlatformInterface.klass);
  22708. $core.addMethod(
  22709. $core.method({
  22710. selector: "prompt:default:",
  22711. protocol: 'actions',
  22712. fn: function (aString,defaultString){
  22713. var self=this;
  22714. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22715. return $core.withContext(function($ctx1) {
  22716. var $1;
  22717. self._deprecatedAPI_("Use Terminal prompt:default:");
  22718. $1=$recv($Terminal())._prompt_default_(aString,defaultString);
  22719. return $1;
  22720. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
  22721. },
  22722. args: ["aString", "defaultString"],
  22723. source: "prompt: aString default: defaultString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:default:'.\x0a\x09^ Terminal prompt: aString default: defaultString",
  22724. referencedClasses: ["Terminal"],
  22725. messageSends: ["deprecatedAPI:", "prompt:default:"]
  22726. }),
  22727. $globals.PlatformInterface.klass);
  22728. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  22729. $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.";
  22730. $globals.Service.klass.iVarNames = ['current'];
  22731. $core.addMethod(
  22732. $core.method({
  22733. selector: "current",
  22734. protocol: 'accessing',
  22735. fn: function (){
  22736. var self=this;
  22737. var $1;
  22738. $1=self["@current"];
  22739. return $1;
  22740. },
  22741. args: [],
  22742. source: "current\x0a\x09^ current",
  22743. referencedClasses: [],
  22744. messageSends: []
  22745. }),
  22746. $globals.Service.klass);
  22747. $core.addMethod(
  22748. $core.method({
  22749. selector: "new",
  22750. protocol: 'instance creation',
  22751. fn: function (){
  22752. var self=this;
  22753. return $core.withContext(function($ctx1) {
  22754. self._shouldNotImplement();
  22755. return self;
  22756. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  22757. },
  22758. args: [],
  22759. source: "new\x0a\x09self shouldNotImplement",
  22760. referencedClasses: [],
  22761. messageSends: ["shouldNotImplement"]
  22762. }),
  22763. $globals.Service.klass);
  22764. $core.addMethod(
  22765. $core.method({
  22766. selector: "register:",
  22767. protocol: 'registration',
  22768. fn: function (anObject){
  22769. var self=this;
  22770. self["@current"]=anObject;
  22771. return self;
  22772. },
  22773. args: ["anObject"],
  22774. source: "register: anObject\x0a\x09current := anObject",
  22775. referencedClasses: [],
  22776. messageSends: []
  22777. }),
  22778. $globals.Service.klass);
  22779. $core.addMethod(
  22780. $core.method({
  22781. selector: "registerIfNone:",
  22782. protocol: 'registration',
  22783. fn: function (anObject){
  22784. var self=this;
  22785. return $core.withContext(function($ctx1) {
  22786. var $1,$receiver;
  22787. $1=self._current();
  22788. if(($receiver = $1) == null || $receiver.isNil){
  22789. self._register_(anObject);
  22790. } else {
  22791. $1;
  22792. };
  22793. return self;
  22794. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  22795. },
  22796. args: ["anObject"],
  22797. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  22798. referencedClasses: [],
  22799. messageSends: ["ifNil:", "current", "register:"]
  22800. }),
  22801. $globals.Service.klass);
  22802. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  22803. $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.";
  22804. $core.addMethod(
  22805. $core.method({
  22806. selector: "handleError:",
  22807. protocol: 'error handling',
  22808. fn: function (anError){
  22809. var self=this;
  22810. return $core.withContext(function($ctx1) {
  22811. self._handleUnhandledError_(anError);
  22812. return self;
  22813. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  22814. },
  22815. args: ["anError"],
  22816. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  22817. referencedClasses: [],
  22818. messageSends: ["handleUnhandledError:"]
  22819. }),
  22820. $globals.ErrorHandler.klass);
  22821. $core.addMethod(
  22822. $core.method({
  22823. selector: "handleUnhandledError:",
  22824. protocol: 'error handling',
  22825. fn: function (anError){
  22826. var self=this;
  22827. return $core.withContext(function($ctx1) {
  22828. var $1,$2;
  22829. $1=$recv(anError)._wasHandled();
  22830. if($core.assert($1)){
  22831. return self;
  22832. };
  22833. $2=$recv(self._current())._handleError_(anError);
  22834. return $2;
  22835. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  22836. },
  22837. args: ["anError"],
  22838. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  22839. referencedClasses: [],
  22840. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  22841. }),
  22842. $globals.ErrorHandler.klass);
  22843. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  22844. $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.";
  22845. $core.addMethod(
  22846. $core.method({
  22847. selector: "findClass:",
  22848. protocol: 'finding',
  22849. fn: function (aClass){
  22850. var self=this;
  22851. return $core.withContext(function($ctx1) {
  22852. var $1;
  22853. $1=$recv(self._current())._findClass_(aClass);
  22854. return $1;
  22855. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  22856. },
  22857. args: ["aClass"],
  22858. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  22859. referencedClasses: [],
  22860. messageSends: ["findClass:", "current"]
  22861. }),
  22862. $globals.Finder.klass);
  22863. $core.addMethod(
  22864. $core.method({
  22865. selector: "findMethod:",
  22866. protocol: 'finding',
  22867. fn: function (aCompiledMethod){
  22868. var self=this;
  22869. return $core.withContext(function($ctx1) {
  22870. var $1;
  22871. $1=$recv(self._current())._findMethod_(aCompiledMethod);
  22872. return $1;
  22873. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  22874. },
  22875. args: ["aCompiledMethod"],
  22876. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  22877. referencedClasses: [],
  22878. messageSends: ["findMethod:", "current"]
  22879. }),
  22880. $globals.Finder.klass);
  22881. $core.addMethod(
  22882. $core.method({
  22883. selector: "findString:",
  22884. protocol: 'finding',
  22885. fn: function (aString){
  22886. var self=this;
  22887. return $core.withContext(function($ctx1) {
  22888. var $1;
  22889. $1=$recv(self._current())._findString_(aString);
  22890. return $1;
  22891. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  22892. },
  22893. args: ["aString"],
  22894. source: "findString: aString\x0a\x09^ self current findString: aString",
  22895. referencedClasses: [],
  22896. messageSends: ["findString:", "current"]
  22897. }),
  22898. $globals.Finder.klass);
  22899. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  22900. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  22901. $core.addMethod(
  22902. $core.method({
  22903. selector: "inspect:",
  22904. protocol: 'inspecting',
  22905. fn: function (anObject){
  22906. var self=this;
  22907. return $core.withContext(function($ctx1) {
  22908. var $1;
  22909. $1=$recv(self._current())._inspect_(anObject);
  22910. return $1;
  22911. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  22912. },
  22913. args: ["anObject"],
  22914. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  22915. referencedClasses: [],
  22916. messageSends: ["inspect:", "current"]
  22917. }),
  22918. $globals.Inspector.klass);
  22919. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  22920. $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";
  22921. $core.addMethod(
  22922. $core.method({
  22923. selector: "globals",
  22924. protocol: 'accessing',
  22925. fn: function (){
  22926. var self=this;
  22927. return $core.withContext(function($ctx1) {
  22928. var $1;
  22929. $1=$recv(self._current())._globals();
  22930. return $1;
  22931. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  22932. },
  22933. args: [],
  22934. source: "globals\x0a\x09^ self current globals",
  22935. referencedClasses: [],
  22936. messageSends: ["globals", "current"]
  22937. }),
  22938. $globals.Platform.klass);
  22939. $core.addMethod(
  22940. $core.method({
  22941. selector: "newXhr",
  22942. protocol: 'accessing',
  22943. fn: function (){
  22944. var self=this;
  22945. return $core.withContext(function($ctx1) {
  22946. var $1;
  22947. $1=$recv(self._current())._newXhr();
  22948. return $1;
  22949. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  22950. },
  22951. args: [],
  22952. source: "newXhr\x0a\x09^ self current newXhr",
  22953. referencedClasses: [],
  22954. messageSends: ["newXhr", "current"]
  22955. }),
  22956. $globals.Platform.klass);
  22957. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  22958. $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`.";
  22959. $core.addMethod(
  22960. $core.method({
  22961. selector: "do:on:displaying:",
  22962. protocol: 'progress handling',
  22963. fn: function (aBlock,aCollection,aString){
  22964. var self=this;
  22965. return $core.withContext(function($ctx1) {
  22966. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  22967. return self;
  22968. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  22969. },
  22970. args: ["aBlock", "aCollection", "aString"],
  22971. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  22972. referencedClasses: [],
  22973. messageSends: ["do:on:displaying:", "current"]
  22974. }),
  22975. $globals.ProgressHandler.klass);
  22976. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  22977. $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:'.";
  22978. $core.addMethod(
  22979. $core.method({
  22980. selector: "alert:",
  22981. protocol: 'dialogs',
  22982. fn: function (aString){
  22983. var self=this;
  22984. return $core.withContext(function($ctx1) {
  22985. var $1;
  22986. $1=$recv(self._current())._alert_(aString);
  22987. return $1;
  22988. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  22989. },
  22990. args: ["aString"],
  22991. source: "alert: aString\x0a\x09^ self current alert: aString",
  22992. referencedClasses: [],
  22993. messageSends: ["alert:", "current"]
  22994. }),
  22995. $globals.Terminal.klass);
  22996. $core.addMethod(
  22997. $core.method({
  22998. selector: "confirm:",
  22999. protocol: 'dialogs',
  23000. fn: function (aString){
  23001. var self=this;
  23002. return $core.withContext(function($ctx1) {
  23003. var $1;
  23004. $1=$recv(self._current())._confirm_(aString);
  23005. return $1;
  23006. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  23007. },
  23008. args: ["aString"],
  23009. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  23010. referencedClasses: [],
  23011. messageSends: ["confirm:", "current"]
  23012. }),
  23013. $globals.Terminal.klass);
  23014. $core.addMethod(
  23015. $core.method({
  23016. selector: "prompt:",
  23017. protocol: 'dialogs',
  23018. fn: function (aString){
  23019. var self=this;
  23020. return $core.withContext(function($ctx1) {
  23021. var $1;
  23022. $1=$recv(self._current())._prompt_(aString);
  23023. return $1;
  23024. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  23025. },
  23026. args: ["aString"],
  23027. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  23028. referencedClasses: [],
  23029. messageSends: ["prompt:", "current"]
  23030. }),
  23031. $globals.Terminal.klass);
  23032. $core.addMethod(
  23033. $core.method({
  23034. selector: "prompt:default:",
  23035. protocol: 'dialogs',
  23036. fn: function (aString,defaultString){
  23037. var self=this;
  23038. return $core.withContext(function($ctx1) {
  23039. var $1;
  23040. $1=$recv(self._current())._prompt_default_(aString,defaultString);
  23041. return $1;
  23042. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  23043. },
  23044. args: ["aString", "defaultString"],
  23045. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  23046. referencedClasses: [],
  23047. messageSends: ["prompt:default:", "current"]
  23048. }),
  23049. $globals.Terminal.klass);
  23050. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  23051. $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.";
  23052. $core.addMethod(
  23053. $core.method({
  23054. selector: "clear",
  23055. protocol: 'printing',
  23056. fn: function (){
  23057. var self=this;
  23058. return $core.withContext(function($ctx1) {
  23059. $recv(self._current())._clear();
  23060. return self;
  23061. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  23062. },
  23063. args: [],
  23064. source: "clear\x0a\x09self current clear",
  23065. referencedClasses: [],
  23066. messageSends: ["clear", "current"]
  23067. }),
  23068. $globals.Transcript.klass);
  23069. $core.addMethod(
  23070. $core.method({
  23071. selector: "cr",
  23072. protocol: 'printing',
  23073. fn: function (){
  23074. var self=this;
  23075. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  23076. return $core.withContext(function($ctx1) {
  23077. $recv(self._current())._show_($recv($String())._cr());
  23078. return self;
  23079. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  23080. },
  23081. args: [],
  23082. source: "cr\x0a\x09self current show: String cr",
  23083. referencedClasses: ["String"],
  23084. messageSends: ["show:", "current", "cr"]
  23085. }),
  23086. $globals.Transcript.klass);
  23087. $core.addMethod(
  23088. $core.method({
  23089. selector: "inspect:",
  23090. protocol: 'printing',
  23091. fn: function (anObject){
  23092. var self=this;
  23093. return $core.withContext(function($ctx1) {
  23094. self._show_(anObject);
  23095. return self;
  23096. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  23097. },
  23098. args: ["anObject"],
  23099. source: "inspect: anObject\x0a\x09self show: anObject",
  23100. referencedClasses: [],
  23101. messageSends: ["show:"]
  23102. }),
  23103. $globals.Transcript.klass);
  23104. $core.addMethod(
  23105. $core.method({
  23106. selector: "open",
  23107. protocol: 'instance creation',
  23108. fn: function (){
  23109. var self=this;
  23110. return $core.withContext(function($ctx1) {
  23111. $recv(self._current())._open();
  23112. return self;
  23113. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  23114. },
  23115. args: [],
  23116. source: "open\x0a\x09self current open",
  23117. referencedClasses: [],
  23118. messageSends: ["open", "current"]
  23119. }),
  23120. $globals.Transcript.klass);
  23121. $core.addMethod(
  23122. $core.method({
  23123. selector: "show:",
  23124. protocol: 'printing',
  23125. fn: function (anObject){
  23126. var self=this;
  23127. return $core.withContext(function($ctx1) {
  23128. $recv(self._current())._show_(anObject);
  23129. return self;
  23130. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  23131. },
  23132. args: ["anObject"],
  23133. source: "show: anObject\x0a\x09self current show: anObject",
  23134. referencedClasses: [],
  23135. messageSends: ["show:", "current"]
  23136. }),
  23137. $globals.Transcript.klass);
  23138. $core.addMethod(
  23139. $core.method({
  23140. selector: "inspectOn:",
  23141. protocol: '*Platform-Services',
  23142. fn: function (anInspector){
  23143. var self=this;
  23144. var variables;
  23145. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23146. return $core.withContext(function($ctx1) {
  23147. var $1;
  23148. variables=$recv($Dictionary())._new();
  23149. $recv(variables)._at_put_("#self",self);
  23150. $ctx1.sendIdx["at:put:"]=1;
  23151. $recv(variables)._at_put_("#keys",self._keys());
  23152. $ctx1.sendIdx["at:put:"]=2;
  23153. self._keysAndValuesDo_((function(key,value){
  23154. return $core.withContext(function($ctx2) {
  23155. return $recv(variables)._at_put_(key,value);
  23156. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23157. }));
  23158. $recv(anInspector)._setLabel_(self._printString());
  23159. $1=$recv(anInspector)._setVariables_(variables);
  23160. return self;
  23161. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  23162. },
  23163. args: ["anInspector"],
  23164. 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",
  23165. referencedClasses: ["Dictionary"],
  23166. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  23167. }),
  23168. $globals.AssociativeCollection);
  23169. $core.addMethod(
  23170. $core.method({
  23171. selector: "inspectOn:",
  23172. protocol: '*Platform-Services',
  23173. fn: function (anInspector){
  23174. var self=this;
  23175. var variables;
  23176. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23177. return $core.withContext(function($ctx1) {
  23178. var $1;
  23179. variables=$recv($Dictionary())._new();
  23180. $recv(variables)._at_put_("#self",self);
  23181. $ctx1.sendIdx["at:put:"]=1;
  23182. self._withIndexDo_((function(each,i){
  23183. return $core.withContext(function($ctx2) {
  23184. return $recv(variables)._at_put_(i,each);
  23185. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  23186. }));
  23187. $recv(anInspector)._setLabel_(self._printString());
  23188. $1=$recv(anInspector)._setVariables_(variables);
  23189. return self;
  23190. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  23191. },
  23192. args: ["anInspector"],
  23193. 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",
  23194. referencedClasses: ["Dictionary"],
  23195. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  23196. }),
  23197. $globals.Collection);
  23198. $core.addMethod(
  23199. $core.method({
  23200. selector: "inspectOn:",
  23201. protocol: '*Platform-Services',
  23202. fn: function (anInspector){
  23203. var self=this;
  23204. var variables;
  23205. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23206. return $core.withContext(function($ctx1) {
  23207. var $1;
  23208. variables=$recv($Dictionary())._new();
  23209. $recv(variables)._at_put_("#self",self);
  23210. $ctx1.sendIdx["at:put:"]=1;
  23211. $recv(variables)._at_put_("#year",self._year());
  23212. $ctx1.sendIdx["at:put:"]=2;
  23213. $recv(variables)._at_put_("#month",self._month());
  23214. $ctx1.sendIdx["at:put:"]=3;
  23215. $recv(variables)._at_put_("#day",self._day());
  23216. $ctx1.sendIdx["at:put:"]=4;
  23217. $recv(variables)._at_put_("#hours",self._hours());
  23218. $ctx1.sendIdx["at:put:"]=5;
  23219. $recv(variables)._at_put_("#minutes",self._minutes());
  23220. $ctx1.sendIdx["at:put:"]=6;
  23221. $recv(variables)._at_put_("#seconds",self._seconds());
  23222. $ctx1.sendIdx["at:put:"]=7;
  23223. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  23224. $recv(anInspector)._setLabel_(self._printString());
  23225. $1=$recv(anInspector)._setVariables_(variables);
  23226. return self;
  23227. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  23228. },
  23229. args: ["anInspector"],
  23230. 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",
  23231. referencedClasses: ["Dictionary"],
  23232. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  23233. }),
  23234. $globals.Date);
  23235. $core.addMethod(
  23236. $core.method({
  23237. selector: "inspectOn:",
  23238. protocol: '*Platform-Services',
  23239. fn: function (anInspector){
  23240. var self=this;
  23241. var variables;
  23242. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23243. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  23244. return $core.withContext(function($ctx1) {
  23245. variables=$recv($Dictionary())._new();
  23246. $recv(variables)._at_put_("#self",self._jsObject());
  23247. $recv(anInspector)._setLabel_(self._printString());
  23248. $recv($JSObjectProxy())._addObjectVariablesTo_ofProxy_(variables,self);
  23249. $recv(anInspector)._setVariables_(variables);
  23250. return self;
  23251. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  23252. },
  23253. args: ["anInspector"],
  23254. 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",
  23255. referencedClasses: ["Dictionary", "JSObjectProxy"],
  23256. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  23257. }),
  23258. $globals.JSObjectProxy);
  23259. $core.addMethod(
  23260. $core.method({
  23261. selector: "inspectOn:",
  23262. protocol: '*Platform-Services',
  23263. fn: function (anInspector){
  23264. var self=this;
  23265. var variables;
  23266. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23267. return $core.withContext(function($ctx1) {
  23268. var $1;
  23269. variables=$recv($Dictionary())._new();
  23270. $recv(variables)._at_put_("#self",self);
  23271. $ctx1.sendIdx["at:put:"]=1;
  23272. $recv(variables)._at_put_("#home",self._home());
  23273. $ctx1.sendIdx["at:put:"]=2;
  23274. $recv(variables)._at_put_("#receiver",self._receiver());
  23275. $ctx1.sendIdx["at:put:"]=3;
  23276. $recv(variables)._at_put_("#selector",self._selector());
  23277. $ctx1.sendIdx["at:put:"]=4;
  23278. $recv(variables)._at_put_("#locals",self._locals());
  23279. $ctx1.sendIdx["at:put:"]=5;
  23280. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  23281. return $core.withContext(function($ctx2) {
  23282. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23284. }));
  23285. $recv(anInspector)._setLabel_(self._printString());
  23286. $1=$recv(anInspector)._setVariables_(variables);
  23287. return self;
  23288. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  23289. },
  23290. args: ["anInspector"],
  23291. 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",
  23292. referencedClasses: ["Dictionary"],
  23293. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23294. }),
  23295. $globals.MethodContext);
  23296. $core.addMethod(
  23297. $core.method({
  23298. selector: "inspectOn:",
  23299. protocol: '*Platform-Services',
  23300. fn: function (anInspector){
  23301. var self=this;
  23302. var variables;
  23303. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23304. return $core.withContext(function($ctx1) {
  23305. var $1;
  23306. variables=$recv($Dictionary())._new();
  23307. $recv(variables)._at_put_("#self",self);
  23308. $ctx1.sendIdx["at:put:"]=1;
  23309. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  23310. return $core.withContext(function($ctx2) {
  23311. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23313. }));
  23314. $recv(anInspector)._setLabel_(self._printString());
  23315. $1=$recv(anInspector)._setVariables_(variables);
  23316. return self;
  23317. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  23318. },
  23319. args: ["anInspector"],
  23320. 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",
  23321. referencedClasses: ["Dictionary"],
  23322. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23323. }),
  23324. $globals.Object);
  23325. $core.addMethod(
  23326. $core.method({
  23327. selector: "do:displayingProgress:",
  23328. protocol: '*Platform-Services',
  23329. fn: function (aBlock,aString){
  23330. var self=this;
  23331. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  23332. return $core.withContext(function($ctx1) {
  23333. $recv($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  23334. return self;
  23335. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  23336. },
  23337. args: ["aBlock", "aString"],
  23338. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  23339. referencedClasses: ["ProgressHandler"],
  23340. messageSends: ["do:on:displaying:"]
  23341. }),
  23342. $globals.SequenceableCollection);
  23343. $core.addMethod(
  23344. $core.method({
  23345. selector: "inspectOn:",
  23346. protocol: '*Platform-Services',
  23347. fn: function (anInspector){
  23348. var self=this;
  23349. var variables,i;
  23350. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23351. return $core.withContext(function($ctx1) {
  23352. var $1;
  23353. variables=$recv($Dictionary())._new();
  23354. $recv(variables)._at_put_("#self",self);
  23355. $ctx1.sendIdx["at:put:"]=1;
  23356. i=(1);
  23357. self._do_((function(each){
  23358. return $core.withContext(function($ctx2) {
  23359. $recv(variables)._at_put_(i,each);
  23360. i=$recv(i).__plus((1));
  23361. return i;
  23362. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23363. }));
  23364. $recv(anInspector)._setLabel_(self._printString());
  23365. $1=$recv(anInspector)._setVariables_(variables);
  23366. return self;
  23367. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  23368. },
  23369. args: ["anInspector"],
  23370. 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",
  23371. referencedClasses: ["Dictionary"],
  23372. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  23373. }),
  23374. $globals.Set);
  23375. $core.addMethod(
  23376. $core.method({
  23377. selector: "inspectOn:",
  23378. protocol: '*Platform-Services',
  23379. fn: function (anInspector){
  23380. var self=this;
  23381. var label;
  23382. return $core.withContext(function($ctx1) {
  23383. var $3,$2,$1,$5,$4;
  23384. (
  23385. $ctx1.supercall = true,
  23386. $globals.String.superclass.fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  23387. $ctx1.supercall = false;
  23388. $3=self._printString();
  23389. $ctx1.sendIdx["printString"]=1;
  23390. $2=$recv($3)._size();
  23391. $1=$recv($2).__gt((30));
  23392. if($core.assert($1)){
  23393. $5=self._printString();
  23394. $ctx1.sendIdx["printString"]=2;
  23395. $4=$recv($5)._copyFrom_to_((1),(30));
  23396. label=$recv($4).__comma("...'");
  23397. label;
  23398. } else {
  23399. label=self._printString();
  23400. label;
  23401. };
  23402. $recv(anInspector)._setLabel_(label);
  23403. return self;
  23404. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  23405. },
  23406. args: ["anInspector"],
  23407. 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",
  23408. referencedClasses: [],
  23409. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  23410. }),
  23411. $globals.String);
  23412. });
  23413. define("amber_core/Platform-Node", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23414. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  23415. $core.addPackage('Platform-Node');
  23416. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  23417. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23418. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  23419. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  23420. $core.addMethod(
  23421. $core.method({
  23422. selector: "globals",
  23423. protocol: 'accessing',
  23424. fn: function (){
  23425. var self=this;
  23426. var $1;
  23427. $1=global;
  23428. return $1;
  23429. },
  23430. args: [],
  23431. source: "globals\x0a\x09^ global",
  23432. referencedClasses: [],
  23433. messageSends: []
  23434. }),
  23435. $globals.NodePlatform);
  23436. $core.addMethod(
  23437. $core.method({
  23438. selector: "newXhr",
  23439. protocol: 'accessing',
  23440. fn: function (){
  23441. var self=this;
  23442. function $XMLHttpRequest(){return $globals.XMLHttpRequest||(typeof XMLHttpRequest=="undefined"?nil:XMLHttpRequest)}
  23443. return $core.withContext(function($ctx1) {
  23444. var $1,$receiver;
  23445. if(($receiver = $XMLHttpRequest()) == null || $receiver.isNil){
  23446. self._error_("XMLHttpRequest not available.");
  23447. } else {
  23448. $1=$recv($XMLHttpRequest())._new();
  23449. return $1;
  23450. };
  23451. return self;
  23452. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  23453. },
  23454. args: [],
  23455. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  23456. referencedClasses: ["XMLHttpRequest"],
  23457. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  23458. }),
  23459. $globals.NodePlatform);
  23460. $core.addMethod(
  23461. $core.method({
  23462. selector: "initialize",
  23463. protocol: 'testing',
  23464. fn: function (){
  23465. var self=this;
  23466. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  23467. return $core.withContext(function($ctx1) {
  23468. var $1;
  23469. $1=self._isFeasible();
  23470. if($core.assert($1)){
  23471. $recv($Platform())._registerIfNone_(self._new());
  23472. };
  23473. return self;
  23474. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  23475. },
  23476. args: [],
  23477. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  23478. referencedClasses: ["Platform"],
  23479. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  23480. }),
  23481. $globals.NodePlatform.klass);
  23482. $core.addMethod(
  23483. $core.method({
  23484. selector: "isFeasible",
  23485. protocol: 'testing',
  23486. fn: function (){
  23487. var self=this;
  23488. return $core.withContext(function($ctx1) {
  23489. return typeof global !== "undefined";
  23490. return self;
  23491. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  23492. },
  23493. args: [],
  23494. source: "isFeasible\x0a<return typeof global !== \x22undefined\x22>",
  23495. referencedClasses: [],
  23496. messageSends: []
  23497. }),
  23498. $globals.NodePlatform.klass);
  23499. });
  23500. define('amber/deploy',[
  23501. './helpers',
  23502. // --- packages of the core Amber begin here ---
  23503. 'amber_core/Kernel-Objects',
  23504. 'amber_core/Kernel-Classes',
  23505. 'amber_core/Kernel-Methods',
  23506. 'amber_core/Kernel-Collections',
  23507. 'amber_core/Kernel-Infrastructure',
  23508. 'amber_core/Kernel-Exceptions',
  23509. 'amber_core/Kernel-Announcements',
  23510. 'amber_core/Platform-Services',
  23511. 'amber_core/Platform-Browser'
  23512. // --- packages of the core Amber end here ---
  23513. ], function (amber) { return amber; });
  23514. define("amber/parser", ["./boot"], function($boot) {
  23515. var $globals = $boot.globals, nil = $boot.nil;
  23516. $globals.SmalltalkParser = (function() {
  23517. /*
  23518. * Generated by PEG.js 0.8.0.
  23519. *
  23520. * http://pegjs.majda.cz/
  23521. */
  23522. function peg$subclass(child, parent) {
  23523. function ctor() { this.constructor = child; }
  23524. ctor.prototype = parent.prototype;
  23525. child.prototype = new ctor();
  23526. }
  23527. function SyntaxError(message, expected, found, offset, line, column) {
  23528. this.message = message;
  23529. this.expected = expected;
  23530. this.found = found;
  23531. this.offset = offset;
  23532. this.line = line;
  23533. this.column = column;
  23534. this.name = "SyntaxError";
  23535. }
  23536. peg$subclass(SyntaxError, Error);
  23537. function parse(input) {
  23538. var options = arguments.length > 1 ? arguments[1] : {},
  23539. peg$FAILED = {},
  23540. peg$startRuleFunctions = { start: peg$parsestart },
  23541. peg$startRuleFunction = peg$parsestart,
  23542. peg$c0 = [],
  23543. peg$c1 = peg$FAILED,
  23544. peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  23545. peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" },
  23546. peg$c4 = "\"",
  23547. peg$c5 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  23548. peg$c6 = /^[^"]/,
  23549. peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" },
  23550. peg$c8 = /^[a-zA-Z]/,
  23551. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  23552. peg$c10 = /^[a-zA-Z0-9]/,
  23553. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  23554. peg$c12 = function(first, others) {return first + others.join("");},
  23555. peg$c13 = ":",
  23556. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  23557. peg$c15 = function(first, last) {return first + last;},
  23558. peg$c16 = /^[a-zA-Z0-9:]/,
  23559. peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" },
  23560. peg$c18 = /^[A-Z]/,
  23561. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  23562. peg$c20 = "'",
  23563. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  23564. peg$c22 = "''",
  23565. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  23566. peg$c24 = function() {return "'";},
  23567. peg$c25 = /^[^']/,
  23568. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  23569. peg$c27 = function(val) {
  23570. return $globals.ValueNode._new()
  23571. ._position_((line()).__at(column()))
  23572. ._source_(text())
  23573. ._value_(val.join(""));
  23574. },
  23575. peg$c28 = "$",
  23576. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  23577. peg$c30 = { type: "any", description: "any character" },
  23578. peg$c31 = function(char) {
  23579. return $globals.ValueNode._new()
  23580. ._position_((line()).__at(column()))
  23581. ._source_(text())
  23582. ._value_(char);
  23583. },
  23584. peg$c32 = "#",
  23585. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  23586. peg$c34 = function(rest) {return rest;},
  23587. peg$c35 = function(node) {return node._value();},
  23588. peg$c36 = function(val) {
  23589. return $globals.ValueNode._new()
  23590. ._position_((line()).__at(column()))
  23591. ._source_(text())
  23592. ._value_(val);
  23593. },
  23594. peg$c37 = function(n) {
  23595. return $globals.ValueNode._new()
  23596. ._position_((line()).__at(column()))
  23597. ._source_(text())
  23598. ._value_(n);
  23599. },
  23600. peg$c38 = "e",
  23601. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  23602. peg$c40 = function(n) {return parseFloat(n.join(""));},
  23603. peg$c41 = null,
  23604. peg$c42 = "-",
  23605. peg$c43 = { type: "literal", value: "-", description: "\"-\"" },
  23606. peg$c44 = "16r",
  23607. peg$c45 = { type: "literal", value: "16r", description: "\"16r\"" },
  23608. peg$c46 = /^[0-9a-fA-F]/,
  23609. peg$c47 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  23610. peg$c48 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  23611. peg$c49 = /^[0-9]/,
  23612. peg$c50 = { type: "class", value: "[0-9]", description: "[0-9]" },
  23613. peg$c51 = ".",
  23614. peg$c52 = { type: "literal", value: ".", description: "\".\"" },
  23615. peg$c53 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  23616. peg$c54 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  23617. peg$c55 = "#(",
  23618. peg$c56 = { type: "literal", value: "#(", description: "\"#(\"" },
  23619. peg$c57 = "(",
  23620. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  23621. peg$c59 = function(lit) {return lit._value();},
  23622. peg$c60 = ")",
  23623. peg$c61 = { type: "literal", value: ")", description: "\")\"" },
  23624. peg$c62 = function(lits) {
  23625. return $globals.ValueNode._new()
  23626. ._position_((line()).__at(column()))
  23627. ._source_(text())
  23628. ._value_(lits);
  23629. },
  23630. peg$c63 = "{",
  23631. peg$c64 = { type: "literal", value: "{", description: "\"{\"" },
  23632. peg$c65 = "}",
  23633. peg$c66 = { type: "literal", value: "}", description: "\"}\"" },
  23634. peg$c67 = function(expressions) {
  23635. return $globals.DynamicArrayNode._new()
  23636. ._position_((line()).__at(column()))
  23637. ._source_(text())
  23638. ._nodes_(expressions || []);
  23639. },
  23640. peg$c68 = "#{",
  23641. peg$c69 = { type: "literal", value: "#{", description: "\"#{\"" },
  23642. peg$c70 = function(expressions) {
  23643. return $globals.DynamicDictionaryNode._new()
  23644. ._position_((line()).__at(column()))
  23645. ._source_(text())
  23646. ._nodes_(expressions || []);
  23647. },
  23648. peg$c71 = "true",
  23649. peg$c72 = { type: "literal", value: "true", description: "\"true\"" },
  23650. peg$c73 = function() {return true;},
  23651. peg$c74 = "false",
  23652. peg$c75 = { type: "literal", value: "false", description: "\"false\"" },
  23653. peg$c76 = function() {return false;},
  23654. peg$c77 = "nil",
  23655. peg$c78 = { type: "literal", value: "nil", description: "\"nil\"" },
  23656. peg$c79 = function() {return nil;},
  23657. peg$c80 = function(val) {
  23658. return $globals.ValueNode._new()
  23659. ._position_((line()).__at(column()))
  23660. ._source_(text())
  23661. ._value_(val);
  23662. },
  23663. peg$c81 = function(identifier) {
  23664. return $globals.VariableNode._new()
  23665. ._position_((line()).__at(column()))
  23666. ._source_(text())
  23667. ._value_(identifier);
  23668. },
  23669. peg$c82 = function(key, arg) {return {key:key, arg:arg};},
  23670. peg$c83 = /^[\\+*\/=><,@%~|&\-]/,
  23671. peg$c84 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" },
  23672. peg$c85 = function(bin) {return bin.join("");},
  23673. peg$c86 = function(pairs) {
  23674. var keywords = [];
  23675. var params = [];
  23676. var i = 0;
  23677. for(i = 0; i < pairs.length; i++){
  23678. keywords.push(pairs[i].key);
  23679. }
  23680. for(i = 0; i < pairs.length; i++){
  23681. params.push(pairs[i].arg);
  23682. }
  23683. return [keywords.join(""), params];
  23684. },
  23685. peg$c87 = function(selector, arg) {return [selector, [arg]];},
  23686. peg$c88 = function(selector) {return [selector, []];},
  23687. peg$c89 = function(expression) {return expression;},
  23688. peg$c90 = function(first, others) { return [first].concat(others); },
  23689. peg$c91 = ":=",
  23690. peg$c92 = { type: "literal", value: ":=", description: "\":=\"" },
  23691. peg$c93 = function(variable, expression) {
  23692. return $globals.AssignmentNode._new()
  23693. ._position_((line()).__at(column()))
  23694. ._source_(text())
  23695. ._left_(variable)
  23696. ._right_(expression);
  23697. },
  23698. peg$c94 = "^",
  23699. peg$c95 = { type: "literal", value: "^", description: "\"^\"" },
  23700. peg$c96 = function(expression) {
  23701. return $globals.ReturnNode._new()
  23702. ._position_((line()).__at(column()))
  23703. ._source_(text())
  23704. ._nodes_([expression]);
  23705. },
  23706. peg$c97 = "|",
  23707. peg$c98 = { type: "literal", value: "|", description: "\"|\"" },
  23708. peg$c99 = function(variable) {return variable;},
  23709. peg$c100 = function(vars) {return vars;},
  23710. peg$c101 = function(param) {return param;},
  23711. peg$c102 = function(params) {return params;},
  23712. peg$c103 = function(ret) {return [ret];},
  23713. peg$c104 = function(exps, ret) {
  23714. var expressions = exps;
  23715. expressions.push(ret);
  23716. return expressions;
  23717. },
  23718. peg$c105 = function(expressions) {
  23719. return expressions || [];
  23720. },
  23721. peg$c106 = function(temps, statements) {
  23722. return $globals.SequenceNode._new()
  23723. ._position_((line()).__at(column()))
  23724. ._source_(text())
  23725. ._temps_(temps || [])
  23726. ._nodes_(statements || []);
  23727. },
  23728. peg$c107 = "[",
  23729. peg$c108 = { type: "literal", value: "[", description: "\"[\"" },
  23730. peg$c109 = "]",
  23731. peg$c110 = { type: "literal", value: "]", description: "\"]\"" },
  23732. peg$c111 = function(params, sequence) {
  23733. return $globals.BlockNode._new()
  23734. ._position_((line()).__at(column()))
  23735. ._source_(text())
  23736. ._parameters_(params || [])
  23737. ._nodes_([sequence._asBlockSequenceNode()]);
  23738. },
  23739. peg$c112 = void 0,
  23740. peg$c113 = function(selector) {
  23741. return $globals.SendNode._new()
  23742. ._position_((line()).__at(column()))
  23743. ._source_(text())
  23744. ._selector_(selector);
  23745. },
  23746. peg$c114 = function(message, tail) {
  23747. if(tail) {
  23748. return tail._valueForReceiver_(message);
  23749. }
  23750. else {
  23751. return message;
  23752. }
  23753. },
  23754. peg$c115 = function(receiver, tail) {
  23755. if(tail) {
  23756. return tail._valueForReceiver_(receiver);
  23757. }
  23758. else {
  23759. return receiver;
  23760. }
  23761. },
  23762. peg$c116 = function(selector, arg) {
  23763. return $globals.SendNode._new()
  23764. ._position_((line()).__at(column()))
  23765. ._source_(text())
  23766. ._selector_(selector)
  23767. ._arguments_([arg]);
  23768. },
  23769. peg$c117 = function(message, tail) {
  23770. if(tail) {
  23771. return tail._valueForReceiver_(message);
  23772. }
  23773. else {
  23774. return message;
  23775. }
  23776. },
  23777. peg$c118 = function(pairs) {
  23778. var selector = [];
  23779. var args = [];
  23780. for(var i = 0; i < pairs.length; i++) {
  23781. selector.push(pairs[i].key);
  23782. args.push(pairs[i].arg);
  23783. }
  23784. return $globals.SendNode._new()
  23785. ._position_((line()).__at(column()))
  23786. ._source_(text())
  23787. ._selector_(selector.join(""))
  23788. ._arguments_(args);
  23789. },
  23790. peg$c119 = function(receiver, tail) {
  23791. return tail._valueForReceiver_(receiver);
  23792. },
  23793. peg$c120 = ";",
  23794. peg$c121 = { type: "literal", value: ";", description: "\";\"" },
  23795. peg$c122 = function(mess) {return mess;},
  23796. peg$c123 = function(send, messages) {
  23797. var cascade = [];
  23798. cascade.push(send);
  23799. for(var i = 0; i < messages.length; i++) {
  23800. cascade.push(messages[i]);
  23801. }
  23802. return $globals.CascadeNode._new()
  23803. ._position_((line()).__at(column()))
  23804. ._source_(text())
  23805. ._receiver_(send._receiver())
  23806. ._nodes_(cascade);
  23807. },
  23808. peg$c124 = "<",
  23809. peg$c125 = { type: "literal", value: "<", description: "\"<\"" },
  23810. peg$c126 = ">>",
  23811. peg$c127 = { type: "literal", value: ">>", description: "\">>\"" },
  23812. peg$c128 = function() {return ">";},
  23813. peg$c129 = /^[^>]/,
  23814. peg$c130 = { type: "class", value: "[^>]", description: "[^>]" },
  23815. peg$c131 = ">",
  23816. peg$c132 = { type: "literal", value: ">", description: "\">\"" },
  23817. peg$c133 = function(val) {
  23818. return $globals.JSStatementNode._new()
  23819. ._position_((line()).__at(column()))
  23820. ._source_(val.join(""))
  23821. },
  23822. peg$c134 = function(pattern, sequence) {
  23823. return $globals.MethodNode._new()
  23824. ._position_((line()).__at(column()))
  23825. ._source_(text())
  23826. ._selector_(pattern[0])
  23827. ._arguments_(pattern[1])
  23828. ._nodes_([sequence]);
  23829. },
  23830. peg$c135 = function(send) { return send._selector() === "->" },
  23831. peg$c136 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  23832. peg$c137 = function(first, others) { return first.concat.apply(first, others); },
  23833. peg$currPos = 0,
  23834. peg$reportedPos = 0,
  23835. peg$cachedPos = 0,
  23836. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
  23837. peg$maxFailPos = 0,
  23838. peg$maxFailExpected = [],
  23839. peg$silentFails = 0,
  23840. peg$cache = {},
  23841. peg$result;
  23842. if ("startRule" in options) {
  23843. if (!(options.startRule in peg$startRuleFunctions)) {
  23844. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  23845. }
  23846. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  23847. }
  23848. function text() {
  23849. return input.substring(peg$reportedPos, peg$currPos);
  23850. }
  23851. function offset() {
  23852. return peg$reportedPos;
  23853. }
  23854. function line() {
  23855. return peg$computePosDetails(peg$reportedPos).line;
  23856. }
  23857. function column() {
  23858. return peg$computePosDetails(peg$reportedPos).column;
  23859. }
  23860. function expected(description) {
  23861. throw peg$buildException(
  23862. null,
  23863. [{ type: "other", description: description }],
  23864. peg$reportedPos
  23865. );
  23866. }
  23867. function error(message) {
  23868. throw peg$buildException(message, null, peg$reportedPos);
  23869. }
  23870. function peg$computePosDetails(pos) {
  23871. function advance(details, startPos, endPos) {
  23872. var p, ch;
  23873. for (p = startPos; p < endPos; p++) {
  23874. ch = input.charAt(p);
  23875. if (ch === "\n") {
  23876. if (!details.seenCR) { details.line++; }
  23877. details.column = 1;
  23878. details.seenCR = false;
  23879. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  23880. details.line++;
  23881. details.column = 1;
  23882. details.seenCR = true;
  23883. } else {
  23884. details.column++;
  23885. details.seenCR = false;
  23886. }
  23887. }
  23888. }
  23889. if (peg$cachedPos !== pos) {
  23890. if (peg$cachedPos > pos) {
  23891. peg$cachedPos = 0;
  23892. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
  23893. }
  23894. advance(peg$cachedPosDetails, peg$cachedPos, pos);
  23895. peg$cachedPos = pos;
  23896. }
  23897. return peg$cachedPosDetails;
  23898. }
  23899. function peg$fail(expected) {
  23900. if (peg$currPos < peg$maxFailPos) { return; }
  23901. if (peg$currPos > peg$maxFailPos) {
  23902. peg$maxFailPos = peg$currPos;
  23903. peg$maxFailExpected = [];
  23904. }
  23905. peg$maxFailExpected.push(expected);
  23906. }
  23907. function peg$buildException(message, expected, pos) {
  23908. function cleanupExpected(expected) {
  23909. var i = 1;
  23910. expected.sort(function(a, b) {
  23911. if (a.description < b.description) {
  23912. return -1;
  23913. } else if (a.description > b.description) {
  23914. return 1;
  23915. } else {
  23916. return 0;
  23917. }
  23918. });
  23919. while (i < expected.length) {
  23920. if (expected[i - 1] === expected[i]) {
  23921. expected.splice(i, 1);
  23922. } else {
  23923. i++;
  23924. }
  23925. }
  23926. }
  23927. function buildMessage(expected, found) {
  23928. function stringEscape(s) {
  23929. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  23930. return s
  23931. .replace(/\\/g, '\\\\')
  23932. .replace(/"/g, '\\"')
  23933. .replace(/\x08/g, '\\b')
  23934. .replace(/\t/g, '\\t')
  23935. .replace(/\n/g, '\\n')
  23936. .replace(/\f/g, '\\f')
  23937. .replace(/\r/g, '\\r')
  23938. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  23939. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  23940. .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  23941. .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  23942. }
  23943. var expectedDescs = new Array(expected.length),
  23944. expectedDesc, foundDesc, i;
  23945. for (i = 0; i < expected.length; i++) {
  23946. expectedDescs[i] = expected[i].description;
  23947. }
  23948. expectedDesc = expected.length > 1
  23949. ? expectedDescs.slice(0, -1).join(", ")
  23950. + " or "
  23951. + expectedDescs[expected.length - 1]
  23952. : expectedDescs[0];
  23953. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  23954. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  23955. }
  23956. var posDetails = peg$computePosDetails(pos),
  23957. found = pos < input.length ? input.charAt(pos) : null;
  23958. if (expected !== null) {
  23959. cleanupExpected(expected);
  23960. }
  23961. return new SyntaxError(
  23962. message !== null ? message : buildMessage(expected, found),
  23963. expected,
  23964. found,
  23965. pos,
  23966. posDetails.line,
  23967. posDetails.column
  23968. );
  23969. }
  23970. function peg$parsestart() {
  23971. var s0;
  23972. var key = peg$currPos * 60 + 0,
  23973. cached = peg$cache[key];
  23974. if (cached) {
  23975. peg$currPos = cached.nextPos;
  23976. return cached.result;
  23977. }
  23978. s0 = peg$parsemethod();
  23979. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  23980. return s0;
  23981. }
  23982. function peg$parseseparator() {
  23983. var s0, s1;
  23984. var key = peg$currPos * 60 + 1,
  23985. cached = peg$cache[key];
  23986. if (cached) {
  23987. peg$currPos = cached.nextPos;
  23988. return cached.result;
  23989. }
  23990. s0 = [];
  23991. if (peg$c2.test(input.charAt(peg$currPos))) {
  23992. s1 = input.charAt(peg$currPos);
  23993. peg$currPos++;
  23994. } else {
  23995. s1 = peg$FAILED;
  23996. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23997. }
  23998. if (s1 !== peg$FAILED) {
  23999. while (s1 !== peg$FAILED) {
  24000. s0.push(s1);
  24001. if (peg$c2.test(input.charAt(peg$currPos))) {
  24002. s1 = input.charAt(peg$currPos);
  24003. peg$currPos++;
  24004. } else {
  24005. s1 = peg$FAILED;
  24006. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24007. }
  24008. }
  24009. } else {
  24010. s0 = peg$c1;
  24011. }
  24012. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24013. return s0;
  24014. }
  24015. function peg$parsecomments() {
  24016. var s0, s1, s2, s3, s4;
  24017. var key = peg$currPos * 60 + 2,
  24018. cached = peg$cache[key];
  24019. if (cached) {
  24020. peg$currPos = cached.nextPos;
  24021. return cached.result;
  24022. }
  24023. s0 = [];
  24024. s1 = peg$currPos;
  24025. if (input.charCodeAt(peg$currPos) === 34) {
  24026. s2 = peg$c4;
  24027. peg$currPos++;
  24028. } else {
  24029. s2 = peg$FAILED;
  24030. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24031. }
  24032. if (s2 !== peg$FAILED) {
  24033. s3 = [];
  24034. if (peg$c6.test(input.charAt(peg$currPos))) {
  24035. s4 = input.charAt(peg$currPos);
  24036. peg$currPos++;
  24037. } else {
  24038. s4 = peg$FAILED;
  24039. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24040. }
  24041. while (s4 !== peg$FAILED) {
  24042. s3.push(s4);
  24043. if (peg$c6.test(input.charAt(peg$currPos))) {
  24044. s4 = input.charAt(peg$currPos);
  24045. peg$currPos++;
  24046. } else {
  24047. s4 = peg$FAILED;
  24048. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24049. }
  24050. }
  24051. if (s3 !== peg$FAILED) {
  24052. if (input.charCodeAt(peg$currPos) === 34) {
  24053. s4 = peg$c4;
  24054. peg$currPos++;
  24055. } else {
  24056. s4 = peg$FAILED;
  24057. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24058. }
  24059. if (s4 !== peg$FAILED) {
  24060. s2 = [s2, s3, s4];
  24061. s1 = s2;
  24062. } else {
  24063. peg$currPos = s1;
  24064. s1 = peg$c1;
  24065. }
  24066. } else {
  24067. peg$currPos = s1;
  24068. s1 = peg$c1;
  24069. }
  24070. } else {
  24071. peg$currPos = s1;
  24072. s1 = peg$c1;
  24073. }
  24074. if (s1 !== peg$FAILED) {
  24075. while (s1 !== peg$FAILED) {
  24076. s0.push(s1);
  24077. s1 = peg$currPos;
  24078. if (input.charCodeAt(peg$currPos) === 34) {
  24079. s2 = peg$c4;
  24080. peg$currPos++;
  24081. } else {
  24082. s2 = peg$FAILED;
  24083. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24084. }
  24085. if (s2 !== peg$FAILED) {
  24086. s3 = [];
  24087. if (peg$c6.test(input.charAt(peg$currPos))) {
  24088. s4 = input.charAt(peg$currPos);
  24089. peg$currPos++;
  24090. } else {
  24091. s4 = peg$FAILED;
  24092. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24093. }
  24094. while (s4 !== peg$FAILED) {
  24095. s3.push(s4);
  24096. if (peg$c6.test(input.charAt(peg$currPos))) {
  24097. s4 = input.charAt(peg$currPos);
  24098. peg$currPos++;
  24099. } else {
  24100. s4 = peg$FAILED;
  24101. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24102. }
  24103. }
  24104. if (s3 !== peg$FAILED) {
  24105. if (input.charCodeAt(peg$currPos) === 34) {
  24106. s4 = peg$c4;
  24107. peg$currPos++;
  24108. } else {
  24109. s4 = peg$FAILED;
  24110. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24111. }
  24112. if (s4 !== peg$FAILED) {
  24113. s2 = [s2, s3, s4];
  24114. s1 = s2;
  24115. } else {
  24116. peg$currPos = s1;
  24117. s1 = peg$c1;
  24118. }
  24119. } else {
  24120. peg$currPos = s1;
  24121. s1 = peg$c1;
  24122. }
  24123. } else {
  24124. peg$currPos = s1;
  24125. s1 = peg$c1;
  24126. }
  24127. }
  24128. } else {
  24129. s0 = peg$c1;
  24130. }
  24131. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24132. return s0;
  24133. }
  24134. function peg$parsews() {
  24135. var s0, s1;
  24136. var key = peg$currPos * 60 + 3,
  24137. cached = peg$cache[key];
  24138. if (cached) {
  24139. peg$currPos = cached.nextPos;
  24140. return cached.result;
  24141. }
  24142. s0 = [];
  24143. s1 = peg$parseseparator();
  24144. if (s1 === peg$FAILED) {
  24145. s1 = peg$parsecomments();
  24146. }
  24147. while (s1 !== peg$FAILED) {
  24148. s0.push(s1);
  24149. s1 = peg$parseseparator();
  24150. if (s1 === peg$FAILED) {
  24151. s1 = peg$parsecomments();
  24152. }
  24153. }
  24154. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24155. return s0;
  24156. }
  24157. function peg$parseidentifier() {
  24158. var s0, s1, s2, s3;
  24159. var key = peg$currPos * 60 + 4,
  24160. cached = peg$cache[key];
  24161. if (cached) {
  24162. peg$currPos = cached.nextPos;
  24163. return cached.result;
  24164. }
  24165. s0 = peg$currPos;
  24166. if (peg$c8.test(input.charAt(peg$currPos))) {
  24167. s1 = input.charAt(peg$currPos);
  24168. peg$currPos++;
  24169. } else {
  24170. s1 = peg$FAILED;
  24171. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24172. }
  24173. if (s1 !== peg$FAILED) {
  24174. s2 = [];
  24175. if (peg$c10.test(input.charAt(peg$currPos))) {
  24176. s3 = input.charAt(peg$currPos);
  24177. peg$currPos++;
  24178. } else {
  24179. s3 = peg$FAILED;
  24180. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24181. }
  24182. while (s3 !== peg$FAILED) {
  24183. s2.push(s3);
  24184. if (peg$c10.test(input.charAt(peg$currPos))) {
  24185. s3 = input.charAt(peg$currPos);
  24186. peg$currPos++;
  24187. } else {
  24188. s3 = peg$FAILED;
  24189. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24190. }
  24191. }
  24192. if (s2 !== peg$FAILED) {
  24193. peg$reportedPos = s0;
  24194. s1 = peg$c12(s1, s2);
  24195. s0 = s1;
  24196. } else {
  24197. peg$currPos = s0;
  24198. s0 = peg$c1;
  24199. }
  24200. } else {
  24201. peg$currPos = s0;
  24202. s0 = peg$c1;
  24203. }
  24204. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24205. return s0;
  24206. }
  24207. function peg$parsekeyword() {
  24208. var s0, s1, s2;
  24209. var key = peg$currPos * 60 + 5,
  24210. cached = peg$cache[key];
  24211. if (cached) {
  24212. peg$currPos = cached.nextPos;
  24213. return cached.result;
  24214. }
  24215. s0 = peg$currPos;
  24216. s1 = peg$parseidentifier();
  24217. if (s1 !== peg$FAILED) {
  24218. if (input.charCodeAt(peg$currPos) === 58) {
  24219. s2 = peg$c13;
  24220. peg$currPos++;
  24221. } else {
  24222. s2 = peg$FAILED;
  24223. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  24224. }
  24225. if (s2 !== peg$FAILED) {
  24226. peg$reportedPos = s0;
  24227. s1 = peg$c15(s1, s2);
  24228. s0 = s1;
  24229. } else {
  24230. peg$currPos = s0;
  24231. s0 = peg$c1;
  24232. }
  24233. } else {
  24234. peg$currPos = s0;
  24235. s0 = peg$c1;
  24236. }
  24237. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24238. return s0;
  24239. }
  24240. function peg$parseselector() {
  24241. var s0, s1, s2, s3;
  24242. var key = peg$currPos * 60 + 6,
  24243. cached = peg$cache[key];
  24244. if (cached) {
  24245. peg$currPos = cached.nextPos;
  24246. return cached.result;
  24247. }
  24248. s0 = peg$currPos;
  24249. if (peg$c8.test(input.charAt(peg$currPos))) {
  24250. s1 = input.charAt(peg$currPos);
  24251. peg$currPos++;
  24252. } else {
  24253. s1 = peg$FAILED;
  24254. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24255. }
  24256. if (s1 !== peg$FAILED) {
  24257. s2 = [];
  24258. if (peg$c16.test(input.charAt(peg$currPos))) {
  24259. s3 = input.charAt(peg$currPos);
  24260. peg$currPos++;
  24261. } else {
  24262. s3 = peg$FAILED;
  24263. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24264. }
  24265. while (s3 !== peg$FAILED) {
  24266. s2.push(s3);
  24267. if (peg$c16.test(input.charAt(peg$currPos))) {
  24268. s3 = input.charAt(peg$currPos);
  24269. peg$currPos++;
  24270. } else {
  24271. s3 = peg$FAILED;
  24272. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24273. }
  24274. }
  24275. if (s2 !== peg$FAILED) {
  24276. peg$reportedPos = s0;
  24277. s1 = peg$c12(s1, s2);
  24278. s0 = s1;
  24279. } else {
  24280. peg$currPos = s0;
  24281. s0 = peg$c1;
  24282. }
  24283. } else {
  24284. peg$currPos = s0;
  24285. s0 = peg$c1;
  24286. }
  24287. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24288. return s0;
  24289. }
  24290. function peg$parseclassName() {
  24291. var s0, s1, s2, s3;
  24292. var key = peg$currPos * 60 + 7,
  24293. cached = peg$cache[key];
  24294. if (cached) {
  24295. peg$currPos = cached.nextPos;
  24296. return cached.result;
  24297. }
  24298. s0 = peg$currPos;
  24299. if (peg$c18.test(input.charAt(peg$currPos))) {
  24300. s1 = input.charAt(peg$currPos);
  24301. peg$currPos++;
  24302. } else {
  24303. s1 = peg$FAILED;
  24304. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  24305. }
  24306. if (s1 !== peg$FAILED) {
  24307. s2 = [];
  24308. if (peg$c10.test(input.charAt(peg$currPos))) {
  24309. s3 = input.charAt(peg$currPos);
  24310. peg$currPos++;
  24311. } else {
  24312. s3 = peg$FAILED;
  24313. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24314. }
  24315. while (s3 !== peg$FAILED) {
  24316. s2.push(s3);
  24317. if (peg$c10.test(input.charAt(peg$currPos))) {
  24318. s3 = input.charAt(peg$currPos);
  24319. peg$currPos++;
  24320. } else {
  24321. s3 = peg$FAILED;
  24322. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24323. }
  24324. }
  24325. if (s2 !== peg$FAILED) {
  24326. peg$reportedPos = s0;
  24327. s1 = peg$c12(s1, s2);
  24328. s0 = s1;
  24329. } else {
  24330. peg$currPos = s0;
  24331. s0 = peg$c1;
  24332. }
  24333. } else {
  24334. peg$currPos = s0;
  24335. s0 = peg$c1;
  24336. }
  24337. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24338. return s0;
  24339. }
  24340. function peg$parsestring() {
  24341. var s0, s1, s2, s3, s4;
  24342. var key = peg$currPos * 60 + 8,
  24343. cached = peg$cache[key];
  24344. if (cached) {
  24345. peg$currPos = cached.nextPos;
  24346. return cached.result;
  24347. }
  24348. s0 = peg$currPos;
  24349. if (input.charCodeAt(peg$currPos) === 39) {
  24350. s1 = peg$c20;
  24351. peg$currPos++;
  24352. } else {
  24353. s1 = peg$FAILED;
  24354. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24355. }
  24356. if (s1 !== peg$FAILED) {
  24357. s2 = [];
  24358. s3 = peg$currPos;
  24359. if (input.substr(peg$currPos, 2) === peg$c22) {
  24360. s4 = peg$c22;
  24361. peg$currPos += 2;
  24362. } else {
  24363. s4 = peg$FAILED;
  24364. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24365. }
  24366. if (s4 !== peg$FAILED) {
  24367. peg$reportedPos = s3;
  24368. s4 = peg$c24();
  24369. }
  24370. s3 = s4;
  24371. if (s3 === peg$FAILED) {
  24372. if (peg$c25.test(input.charAt(peg$currPos))) {
  24373. s3 = input.charAt(peg$currPos);
  24374. peg$currPos++;
  24375. } else {
  24376. s3 = peg$FAILED;
  24377. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24378. }
  24379. }
  24380. while (s3 !== peg$FAILED) {
  24381. s2.push(s3);
  24382. s3 = peg$currPos;
  24383. if (input.substr(peg$currPos, 2) === peg$c22) {
  24384. s4 = peg$c22;
  24385. peg$currPos += 2;
  24386. } else {
  24387. s4 = peg$FAILED;
  24388. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24389. }
  24390. if (s4 !== peg$FAILED) {
  24391. peg$reportedPos = s3;
  24392. s4 = peg$c24();
  24393. }
  24394. s3 = s4;
  24395. if (s3 === peg$FAILED) {
  24396. if (peg$c25.test(input.charAt(peg$currPos))) {
  24397. s3 = input.charAt(peg$currPos);
  24398. peg$currPos++;
  24399. } else {
  24400. s3 = peg$FAILED;
  24401. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24402. }
  24403. }
  24404. }
  24405. if (s2 !== peg$FAILED) {
  24406. if (input.charCodeAt(peg$currPos) === 39) {
  24407. s3 = peg$c20;
  24408. peg$currPos++;
  24409. } else {
  24410. s3 = peg$FAILED;
  24411. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24412. }
  24413. if (s3 !== peg$FAILED) {
  24414. peg$reportedPos = s0;
  24415. s1 = peg$c27(s2);
  24416. s0 = s1;
  24417. } else {
  24418. peg$currPos = s0;
  24419. s0 = peg$c1;
  24420. }
  24421. } else {
  24422. peg$currPos = s0;
  24423. s0 = peg$c1;
  24424. }
  24425. } else {
  24426. peg$currPos = s0;
  24427. s0 = peg$c1;
  24428. }
  24429. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24430. return s0;
  24431. }
  24432. function peg$parsecharacter() {
  24433. var s0, s1, s2;
  24434. var key = peg$currPos * 60 + 9,
  24435. cached = peg$cache[key];
  24436. if (cached) {
  24437. peg$currPos = cached.nextPos;
  24438. return cached.result;
  24439. }
  24440. s0 = peg$currPos;
  24441. if (input.charCodeAt(peg$currPos) === 36) {
  24442. s1 = peg$c28;
  24443. peg$currPos++;
  24444. } else {
  24445. s1 = peg$FAILED;
  24446. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  24447. }
  24448. if (s1 !== peg$FAILED) {
  24449. if (input.length > peg$currPos) {
  24450. s2 = input.charAt(peg$currPos);
  24451. peg$currPos++;
  24452. } else {
  24453. s2 = peg$FAILED;
  24454. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  24455. }
  24456. if (s2 !== peg$FAILED) {
  24457. peg$reportedPos = s0;
  24458. s1 = peg$c31(s2);
  24459. s0 = s1;
  24460. } else {
  24461. peg$currPos = s0;
  24462. s0 = peg$c1;
  24463. }
  24464. } else {
  24465. peg$currPos = s0;
  24466. s0 = peg$c1;
  24467. }
  24468. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24469. return s0;
  24470. }
  24471. function peg$parsesymbol() {
  24472. var s0, s1, s2;
  24473. var key = peg$currPos * 60 + 10,
  24474. cached = peg$cache[key];
  24475. if (cached) {
  24476. peg$currPos = cached.nextPos;
  24477. return cached.result;
  24478. }
  24479. s0 = peg$currPos;
  24480. if (input.charCodeAt(peg$currPos) === 35) {
  24481. s1 = peg$c32;
  24482. peg$currPos++;
  24483. } else {
  24484. s1 = peg$FAILED;
  24485. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  24486. }
  24487. if (s1 !== peg$FAILED) {
  24488. s2 = peg$parsebareSymbol();
  24489. if (s2 !== peg$FAILED) {
  24490. peg$reportedPos = s0;
  24491. s1 = peg$c34(s2);
  24492. s0 = s1;
  24493. } else {
  24494. peg$currPos = s0;
  24495. s0 = peg$c1;
  24496. }
  24497. } else {
  24498. peg$currPos = s0;
  24499. s0 = peg$c1;
  24500. }
  24501. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24502. return s0;
  24503. }
  24504. function peg$parsebareSymbol() {
  24505. var s0, s1, s2;
  24506. var key = peg$currPos * 60 + 11,
  24507. cached = peg$cache[key];
  24508. if (cached) {
  24509. peg$currPos = cached.nextPos;
  24510. return cached.result;
  24511. }
  24512. s0 = peg$currPos;
  24513. s1 = peg$parseselector();
  24514. if (s1 === peg$FAILED) {
  24515. s1 = peg$parsebinarySelector();
  24516. if (s1 === peg$FAILED) {
  24517. s1 = peg$currPos;
  24518. s2 = peg$parsestring();
  24519. if (s2 !== peg$FAILED) {
  24520. peg$reportedPos = s1;
  24521. s2 = peg$c35(s2);
  24522. }
  24523. s1 = s2;
  24524. }
  24525. }
  24526. if (s1 !== peg$FAILED) {
  24527. peg$reportedPos = s0;
  24528. s1 = peg$c36(s1);
  24529. }
  24530. s0 = s1;
  24531. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24532. return s0;
  24533. }
  24534. function peg$parsenumber() {
  24535. var s0, s1;
  24536. var key = peg$currPos * 60 + 12,
  24537. cached = peg$cache[key];
  24538. if (cached) {
  24539. peg$currPos = cached.nextPos;
  24540. return cached.result;
  24541. }
  24542. s0 = peg$currPos;
  24543. s1 = peg$parsenumberExp();
  24544. if (s1 === peg$FAILED) {
  24545. s1 = peg$parsehex();
  24546. if (s1 === peg$FAILED) {
  24547. s1 = peg$parsefloat();
  24548. if (s1 === peg$FAILED) {
  24549. s1 = peg$parseinteger();
  24550. }
  24551. }
  24552. }
  24553. if (s1 !== peg$FAILED) {
  24554. peg$reportedPos = s0;
  24555. s1 = peg$c37(s1);
  24556. }
  24557. s0 = s1;
  24558. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24559. return s0;
  24560. }
  24561. function peg$parsenumberExp() {
  24562. var s0, s1, s2, s3, s4;
  24563. var key = peg$currPos * 60 + 13,
  24564. cached = peg$cache[key];
  24565. if (cached) {
  24566. peg$currPos = cached.nextPos;
  24567. return cached.result;
  24568. }
  24569. s0 = peg$currPos;
  24570. s1 = peg$currPos;
  24571. s2 = peg$parsefloat();
  24572. if (s2 === peg$FAILED) {
  24573. s2 = peg$parseinteger();
  24574. }
  24575. if (s2 !== peg$FAILED) {
  24576. if (input.charCodeAt(peg$currPos) === 101) {
  24577. s3 = peg$c38;
  24578. peg$currPos++;
  24579. } else {
  24580. s3 = peg$FAILED;
  24581. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  24582. }
  24583. if (s3 !== peg$FAILED) {
  24584. s4 = peg$parseinteger();
  24585. if (s4 !== peg$FAILED) {
  24586. s2 = [s2, s3, s4];
  24587. s1 = s2;
  24588. } else {
  24589. peg$currPos = s1;
  24590. s1 = peg$c1;
  24591. }
  24592. } else {
  24593. peg$currPos = s1;
  24594. s1 = peg$c1;
  24595. }
  24596. } else {
  24597. peg$currPos = s1;
  24598. s1 = peg$c1;
  24599. }
  24600. if (s1 !== peg$FAILED) {
  24601. peg$reportedPos = s0;
  24602. s1 = peg$c40(s1);
  24603. }
  24604. s0 = s1;
  24605. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24606. return s0;
  24607. }
  24608. function peg$parsehex() {
  24609. var s0, s1, s2, s3, s4;
  24610. var key = peg$currPos * 60 + 14,
  24611. cached = peg$cache[key];
  24612. if (cached) {
  24613. peg$currPos = cached.nextPos;
  24614. return cached.result;
  24615. }
  24616. s0 = peg$currPos;
  24617. if (input.charCodeAt(peg$currPos) === 45) {
  24618. s1 = peg$c42;
  24619. peg$currPos++;
  24620. } else {
  24621. s1 = peg$FAILED;
  24622. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24623. }
  24624. if (s1 === peg$FAILED) {
  24625. s1 = peg$c41;
  24626. }
  24627. if (s1 !== peg$FAILED) {
  24628. if (input.substr(peg$currPos, 3) === peg$c44) {
  24629. s2 = peg$c44;
  24630. peg$currPos += 3;
  24631. } else {
  24632. s2 = peg$FAILED;
  24633. if (peg$silentFails === 0) { peg$fail(peg$c45); }
  24634. }
  24635. if (s2 !== peg$FAILED) {
  24636. s3 = [];
  24637. if (peg$c46.test(input.charAt(peg$currPos))) {
  24638. s4 = input.charAt(peg$currPos);
  24639. peg$currPos++;
  24640. } else {
  24641. s4 = peg$FAILED;
  24642. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  24643. }
  24644. if (s4 !== peg$FAILED) {
  24645. while (s4 !== peg$FAILED) {
  24646. s3.push(s4);
  24647. if (peg$c46.test(input.charAt(peg$currPos))) {
  24648. s4 = input.charAt(peg$currPos);
  24649. peg$currPos++;
  24650. } else {
  24651. s4 = peg$FAILED;
  24652. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  24653. }
  24654. }
  24655. } else {
  24656. s3 = peg$c1;
  24657. }
  24658. if (s3 !== peg$FAILED) {
  24659. peg$reportedPos = s0;
  24660. s1 = peg$c48(s1, s3);
  24661. s0 = s1;
  24662. } else {
  24663. peg$currPos = s0;
  24664. s0 = peg$c1;
  24665. }
  24666. } else {
  24667. peg$currPos = s0;
  24668. s0 = peg$c1;
  24669. }
  24670. } else {
  24671. peg$currPos = s0;
  24672. s0 = peg$c1;
  24673. }
  24674. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24675. return s0;
  24676. }
  24677. function peg$parsefloat() {
  24678. var s0, s1, s2, s3, s4, s5;
  24679. var key = peg$currPos * 60 + 15,
  24680. cached = peg$cache[key];
  24681. if (cached) {
  24682. peg$currPos = cached.nextPos;
  24683. return cached.result;
  24684. }
  24685. s0 = peg$currPos;
  24686. if (input.charCodeAt(peg$currPos) === 45) {
  24687. s1 = peg$c42;
  24688. peg$currPos++;
  24689. } else {
  24690. s1 = peg$FAILED;
  24691. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24692. }
  24693. if (s1 === peg$FAILED) {
  24694. s1 = peg$c41;
  24695. }
  24696. if (s1 !== peg$FAILED) {
  24697. s2 = [];
  24698. if (peg$c49.test(input.charAt(peg$currPos))) {
  24699. s3 = input.charAt(peg$currPos);
  24700. peg$currPos++;
  24701. } else {
  24702. s3 = peg$FAILED;
  24703. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24704. }
  24705. if (s3 !== peg$FAILED) {
  24706. while (s3 !== peg$FAILED) {
  24707. s2.push(s3);
  24708. if (peg$c49.test(input.charAt(peg$currPos))) {
  24709. s3 = input.charAt(peg$currPos);
  24710. peg$currPos++;
  24711. } else {
  24712. s3 = peg$FAILED;
  24713. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24714. }
  24715. }
  24716. } else {
  24717. s2 = peg$c1;
  24718. }
  24719. if (s2 !== peg$FAILED) {
  24720. if (input.charCodeAt(peg$currPos) === 46) {
  24721. s3 = peg$c51;
  24722. peg$currPos++;
  24723. } else {
  24724. s3 = peg$FAILED;
  24725. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  24726. }
  24727. if (s3 !== peg$FAILED) {
  24728. s4 = [];
  24729. if (peg$c49.test(input.charAt(peg$currPos))) {
  24730. s5 = input.charAt(peg$currPos);
  24731. peg$currPos++;
  24732. } else {
  24733. s5 = peg$FAILED;
  24734. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24735. }
  24736. if (s5 !== peg$FAILED) {
  24737. while (s5 !== peg$FAILED) {
  24738. s4.push(s5);
  24739. if (peg$c49.test(input.charAt(peg$currPos))) {
  24740. s5 = input.charAt(peg$currPos);
  24741. peg$currPos++;
  24742. } else {
  24743. s5 = peg$FAILED;
  24744. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24745. }
  24746. }
  24747. } else {
  24748. s4 = peg$c1;
  24749. }
  24750. if (s4 !== peg$FAILED) {
  24751. peg$reportedPos = s0;
  24752. s1 = peg$c53(s1, s2, s4);
  24753. s0 = s1;
  24754. } else {
  24755. peg$currPos = s0;
  24756. s0 = peg$c1;
  24757. }
  24758. } else {
  24759. peg$currPos = s0;
  24760. s0 = peg$c1;
  24761. }
  24762. } else {
  24763. peg$currPos = s0;
  24764. s0 = peg$c1;
  24765. }
  24766. } else {
  24767. peg$currPos = s0;
  24768. s0 = peg$c1;
  24769. }
  24770. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24771. return s0;
  24772. }
  24773. function peg$parseinteger() {
  24774. var s0, s1, s2, s3;
  24775. var key = peg$currPos * 60 + 16,
  24776. cached = peg$cache[key];
  24777. if (cached) {
  24778. peg$currPos = cached.nextPos;
  24779. return cached.result;
  24780. }
  24781. s0 = peg$currPos;
  24782. if (input.charCodeAt(peg$currPos) === 45) {
  24783. s1 = peg$c42;
  24784. peg$currPos++;
  24785. } else {
  24786. s1 = peg$FAILED;
  24787. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24788. }
  24789. if (s1 === peg$FAILED) {
  24790. s1 = peg$c41;
  24791. }
  24792. if (s1 !== peg$FAILED) {
  24793. s2 = [];
  24794. if (peg$c49.test(input.charAt(peg$currPos))) {
  24795. s3 = input.charAt(peg$currPos);
  24796. peg$currPos++;
  24797. } else {
  24798. s3 = peg$FAILED;
  24799. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24800. }
  24801. if (s3 !== peg$FAILED) {
  24802. while (s3 !== peg$FAILED) {
  24803. s2.push(s3);
  24804. if (peg$c49.test(input.charAt(peg$currPos))) {
  24805. s3 = input.charAt(peg$currPos);
  24806. peg$currPos++;
  24807. } else {
  24808. s3 = peg$FAILED;
  24809. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24810. }
  24811. }
  24812. } else {
  24813. s2 = peg$c1;
  24814. }
  24815. if (s2 !== peg$FAILED) {
  24816. peg$reportedPos = s0;
  24817. s1 = peg$c54(s1, s2);
  24818. s0 = s1;
  24819. } else {
  24820. peg$currPos = s0;
  24821. s0 = peg$c1;
  24822. }
  24823. } else {
  24824. peg$currPos = s0;
  24825. s0 = peg$c1;
  24826. }
  24827. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24828. return s0;
  24829. }
  24830. function peg$parseliteralArray() {
  24831. var s0, s1, s2;
  24832. var key = peg$currPos * 60 + 17,
  24833. cached = peg$cache[key];
  24834. if (cached) {
  24835. peg$currPos = cached.nextPos;
  24836. return cached.result;
  24837. }
  24838. s0 = peg$currPos;
  24839. if (input.substr(peg$currPos, 2) === peg$c55) {
  24840. s1 = peg$c55;
  24841. peg$currPos += 2;
  24842. } else {
  24843. s1 = peg$FAILED;
  24844. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  24845. }
  24846. if (s1 !== peg$FAILED) {
  24847. s2 = peg$parseliteralArrayRest();
  24848. if (s2 !== peg$FAILED) {
  24849. peg$reportedPos = s0;
  24850. s1 = peg$c34(s2);
  24851. s0 = s1;
  24852. } else {
  24853. peg$currPos = s0;
  24854. s0 = peg$c1;
  24855. }
  24856. } else {
  24857. peg$currPos = s0;
  24858. s0 = peg$c1;
  24859. }
  24860. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24861. return s0;
  24862. }
  24863. function peg$parsebareLiteralArray() {
  24864. var s0, s1, s2;
  24865. var key = peg$currPos * 60 + 18,
  24866. cached = peg$cache[key];
  24867. if (cached) {
  24868. peg$currPos = cached.nextPos;
  24869. return cached.result;
  24870. }
  24871. s0 = peg$currPos;
  24872. if (input.charCodeAt(peg$currPos) === 40) {
  24873. s1 = peg$c57;
  24874. peg$currPos++;
  24875. } else {
  24876. s1 = peg$FAILED;
  24877. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  24878. }
  24879. if (s1 !== peg$FAILED) {
  24880. s2 = peg$parseliteralArrayRest();
  24881. if (s2 !== peg$FAILED) {
  24882. peg$reportedPos = s0;
  24883. s1 = peg$c34(s2);
  24884. s0 = s1;
  24885. } else {
  24886. peg$currPos = s0;
  24887. s0 = peg$c1;
  24888. }
  24889. } else {
  24890. peg$currPos = s0;
  24891. s0 = peg$c1;
  24892. }
  24893. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24894. return s0;
  24895. }
  24896. function peg$parseliteralArrayRest() {
  24897. var s0, s1, s2, s3, s4;
  24898. var key = peg$currPos * 60 + 19,
  24899. cached = peg$cache[key];
  24900. if (cached) {
  24901. peg$currPos = cached.nextPos;
  24902. return cached.result;
  24903. }
  24904. s0 = peg$currPos;
  24905. s1 = [];
  24906. s2 = peg$currPos;
  24907. s3 = peg$parsews();
  24908. if (s3 !== peg$FAILED) {
  24909. s4 = peg$parseparseTimeLiteral();
  24910. if (s4 === peg$FAILED) {
  24911. s4 = peg$parsebareLiteralArray();
  24912. if (s4 === peg$FAILED) {
  24913. s4 = peg$parsebareSymbol();
  24914. }
  24915. }
  24916. if (s4 !== peg$FAILED) {
  24917. peg$reportedPos = s2;
  24918. s3 = peg$c59(s4);
  24919. s2 = s3;
  24920. } else {
  24921. peg$currPos = s2;
  24922. s2 = peg$c1;
  24923. }
  24924. } else {
  24925. peg$currPos = s2;
  24926. s2 = peg$c1;
  24927. }
  24928. while (s2 !== peg$FAILED) {
  24929. s1.push(s2);
  24930. s2 = peg$currPos;
  24931. s3 = peg$parsews();
  24932. if (s3 !== peg$FAILED) {
  24933. s4 = peg$parseparseTimeLiteral();
  24934. if (s4 === peg$FAILED) {
  24935. s4 = peg$parsebareLiteralArray();
  24936. if (s4 === peg$FAILED) {
  24937. s4 = peg$parsebareSymbol();
  24938. }
  24939. }
  24940. if (s4 !== peg$FAILED) {
  24941. peg$reportedPos = s2;
  24942. s3 = peg$c59(s4);
  24943. s2 = s3;
  24944. } else {
  24945. peg$currPos = s2;
  24946. s2 = peg$c1;
  24947. }
  24948. } else {
  24949. peg$currPos = s2;
  24950. s2 = peg$c1;
  24951. }
  24952. }
  24953. if (s1 !== peg$FAILED) {
  24954. s2 = peg$parsews();
  24955. if (s2 !== peg$FAILED) {
  24956. if (input.charCodeAt(peg$currPos) === 41) {
  24957. s3 = peg$c60;
  24958. peg$currPos++;
  24959. } else {
  24960. s3 = peg$FAILED;
  24961. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  24962. }
  24963. if (s3 !== peg$FAILED) {
  24964. peg$reportedPos = s0;
  24965. s1 = peg$c62(s1);
  24966. s0 = s1;
  24967. } else {
  24968. peg$currPos = s0;
  24969. s0 = peg$c1;
  24970. }
  24971. } else {
  24972. peg$currPos = s0;
  24973. s0 = peg$c1;
  24974. }
  24975. } else {
  24976. peg$currPos = s0;
  24977. s0 = peg$c1;
  24978. }
  24979. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24980. return s0;
  24981. }
  24982. function peg$parsedynamicArray() {
  24983. var s0, s1, s2, s3, s4, s5, s6;
  24984. var key = peg$currPos * 60 + 20,
  24985. cached = peg$cache[key];
  24986. if (cached) {
  24987. peg$currPos = cached.nextPos;
  24988. return cached.result;
  24989. }
  24990. s0 = peg$currPos;
  24991. if (input.charCodeAt(peg$currPos) === 123) {
  24992. s1 = peg$c63;
  24993. peg$currPos++;
  24994. } else {
  24995. s1 = peg$FAILED;
  24996. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  24997. }
  24998. if (s1 !== peg$FAILED) {
  24999. s2 = peg$parsews();
  25000. if (s2 !== peg$FAILED) {
  25001. s3 = peg$parseexpressions();
  25002. if (s3 === peg$FAILED) {
  25003. s3 = peg$c41;
  25004. }
  25005. if (s3 !== peg$FAILED) {
  25006. s4 = peg$parsews();
  25007. if (s4 !== peg$FAILED) {
  25008. if (input.charCodeAt(peg$currPos) === 46) {
  25009. s5 = peg$c51;
  25010. peg$currPos++;
  25011. } else {
  25012. s5 = peg$FAILED;
  25013. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25014. }
  25015. if (s5 === peg$FAILED) {
  25016. s5 = peg$c41;
  25017. }
  25018. if (s5 !== peg$FAILED) {
  25019. if (input.charCodeAt(peg$currPos) === 125) {
  25020. s6 = peg$c65;
  25021. peg$currPos++;
  25022. } else {
  25023. s6 = peg$FAILED;
  25024. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  25025. }
  25026. if (s6 !== peg$FAILED) {
  25027. peg$reportedPos = s0;
  25028. s1 = peg$c67(s3);
  25029. s0 = s1;
  25030. } else {
  25031. peg$currPos = s0;
  25032. s0 = peg$c1;
  25033. }
  25034. } else {
  25035. peg$currPos = s0;
  25036. s0 = peg$c1;
  25037. }
  25038. } else {
  25039. peg$currPos = s0;
  25040. s0 = peg$c1;
  25041. }
  25042. } else {
  25043. peg$currPos = s0;
  25044. s0 = peg$c1;
  25045. }
  25046. } else {
  25047. peg$currPos = s0;
  25048. s0 = peg$c1;
  25049. }
  25050. } else {
  25051. peg$currPos = s0;
  25052. s0 = peg$c1;
  25053. }
  25054. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25055. return s0;
  25056. }
  25057. function peg$parsedynamicDictionary() {
  25058. var s0, s1, s2, s3, s4, s5;
  25059. var key = peg$currPos * 60 + 21,
  25060. cached = peg$cache[key];
  25061. if (cached) {
  25062. peg$currPos = cached.nextPos;
  25063. return cached.result;
  25064. }
  25065. s0 = peg$currPos;
  25066. if (input.substr(peg$currPos, 2) === peg$c68) {
  25067. s1 = peg$c68;
  25068. peg$currPos += 2;
  25069. } else {
  25070. s1 = peg$FAILED;
  25071. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  25072. }
  25073. if (s1 !== peg$FAILED) {
  25074. s2 = peg$parsews();
  25075. if (s2 !== peg$FAILED) {
  25076. s3 = peg$parseassociations();
  25077. if (s3 === peg$FAILED) {
  25078. s3 = peg$c41;
  25079. }
  25080. if (s3 !== peg$FAILED) {
  25081. s4 = peg$parsews();
  25082. if (s4 !== peg$FAILED) {
  25083. if (input.charCodeAt(peg$currPos) === 125) {
  25084. s5 = peg$c65;
  25085. peg$currPos++;
  25086. } else {
  25087. s5 = peg$FAILED;
  25088. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  25089. }
  25090. if (s5 !== peg$FAILED) {
  25091. peg$reportedPos = s0;
  25092. s1 = peg$c70(s3);
  25093. s0 = s1;
  25094. } else {
  25095. peg$currPos = s0;
  25096. s0 = peg$c1;
  25097. }
  25098. } else {
  25099. peg$currPos = s0;
  25100. s0 = peg$c1;
  25101. }
  25102. } else {
  25103. peg$currPos = s0;
  25104. s0 = peg$c1;
  25105. }
  25106. } else {
  25107. peg$currPos = s0;
  25108. s0 = peg$c1;
  25109. }
  25110. } else {
  25111. peg$currPos = s0;
  25112. s0 = peg$c1;
  25113. }
  25114. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25115. return s0;
  25116. }
  25117. function peg$parsepseudoVariable() {
  25118. var s0, s1, s2;
  25119. var key = peg$currPos * 60 + 22,
  25120. cached = peg$cache[key];
  25121. if (cached) {
  25122. peg$currPos = cached.nextPos;
  25123. return cached.result;
  25124. }
  25125. s0 = peg$currPos;
  25126. s1 = peg$currPos;
  25127. if (input.substr(peg$currPos, 4) === peg$c71) {
  25128. s2 = peg$c71;
  25129. peg$currPos += 4;
  25130. } else {
  25131. s2 = peg$FAILED;
  25132. if (peg$silentFails === 0) { peg$fail(peg$c72); }
  25133. }
  25134. if (s2 !== peg$FAILED) {
  25135. peg$reportedPos = s1;
  25136. s2 = peg$c73();
  25137. }
  25138. s1 = s2;
  25139. if (s1 === peg$FAILED) {
  25140. s1 = peg$currPos;
  25141. if (input.substr(peg$currPos, 5) === peg$c74) {
  25142. s2 = peg$c74;
  25143. peg$currPos += 5;
  25144. } else {
  25145. s2 = peg$FAILED;
  25146. if (peg$silentFails === 0) { peg$fail(peg$c75); }
  25147. }
  25148. if (s2 !== peg$FAILED) {
  25149. peg$reportedPos = s1;
  25150. s2 = peg$c76();
  25151. }
  25152. s1 = s2;
  25153. if (s1 === peg$FAILED) {
  25154. s1 = peg$currPos;
  25155. if (input.substr(peg$currPos, 3) === peg$c77) {
  25156. s2 = peg$c77;
  25157. peg$currPos += 3;
  25158. } else {
  25159. s2 = peg$FAILED;
  25160. if (peg$silentFails === 0) { peg$fail(peg$c78); }
  25161. }
  25162. if (s2 !== peg$FAILED) {
  25163. peg$reportedPos = s1;
  25164. s2 = peg$c79();
  25165. }
  25166. s1 = s2;
  25167. }
  25168. }
  25169. if (s1 !== peg$FAILED) {
  25170. peg$reportedPos = s0;
  25171. s1 = peg$c80(s1);
  25172. }
  25173. s0 = s1;
  25174. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25175. return s0;
  25176. }
  25177. function peg$parseparseTimeLiteral() {
  25178. var s0;
  25179. var key = peg$currPos * 60 + 23,
  25180. cached = peg$cache[key];
  25181. if (cached) {
  25182. peg$currPos = cached.nextPos;
  25183. return cached.result;
  25184. }
  25185. s0 = peg$parsepseudoVariable();
  25186. if (s0 === peg$FAILED) {
  25187. s0 = peg$parsenumber();
  25188. if (s0 === peg$FAILED) {
  25189. s0 = peg$parseliteralArray();
  25190. if (s0 === peg$FAILED) {
  25191. s0 = peg$parsestring();
  25192. if (s0 === peg$FAILED) {
  25193. s0 = peg$parsesymbol();
  25194. if (s0 === peg$FAILED) {
  25195. s0 = peg$parsecharacter();
  25196. }
  25197. }
  25198. }
  25199. }
  25200. }
  25201. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25202. return s0;
  25203. }
  25204. function peg$parseruntimeLiteral() {
  25205. var s0;
  25206. var key = peg$currPos * 60 + 24,
  25207. cached = peg$cache[key];
  25208. if (cached) {
  25209. peg$currPos = cached.nextPos;
  25210. return cached.result;
  25211. }
  25212. s0 = peg$parsedynamicDictionary();
  25213. if (s0 === peg$FAILED) {
  25214. s0 = peg$parsedynamicArray();
  25215. if (s0 === peg$FAILED) {
  25216. s0 = peg$parseblock();
  25217. }
  25218. }
  25219. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25220. return s0;
  25221. }
  25222. function peg$parseliteral() {
  25223. var s0;
  25224. var key = peg$currPos * 60 + 25,
  25225. cached = peg$cache[key];
  25226. if (cached) {
  25227. peg$currPos = cached.nextPos;
  25228. return cached.result;
  25229. }
  25230. s0 = peg$parseruntimeLiteral();
  25231. if (s0 === peg$FAILED) {
  25232. s0 = peg$parseparseTimeLiteral();
  25233. }
  25234. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25235. return s0;
  25236. }
  25237. function peg$parsevariable() {
  25238. var s0, s1;
  25239. var key = peg$currPos * 60 + 26,
  25240. cached = peg$cache[key];
  25241. if (cached) {
  25242. peg$currPos = cached.nextPos;
  25243. return cached.result;
  25244. }
  25245. s0 = peg$currPos;
  25246. s1 = peg$parseidentifier();
  25247. if (s1 !== peg$FAILED) {
  25248. peg$reportedPos = s0;
  25249. s1 = peg$c81(s1);
  25250. }
  25251. s0 = s1;
  25252. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25253. return s0;
  25254. }
  25255. function peg$parsekeywordPair() {
  25256. var s0, s1, s2, s3, s4;
  25257. var key = peg$currPos * 60 + 27,
  25258. cached = peg$cache[key];
  25259. if (cached) {
  25260. peg$currPos = cached.nextPos;
  25261. return cached.result;
  25262. }
  25263. s0 = peg$currPos;
  25264. s1 = peg$parsews();
  25265. if (s1 !== peg$FAILED) {
  25266. s2 = peg$parsekeyword();
  25267. if (s2 !== peg$FAILED) {
  25268. s3 = peg$parsews();
  25269. if (s3 !== peg$FAILED) {
  25270. s4 = peg$parsebinarySend();
  25271. if (s4 !== peg$FAILED) {
  25272. peg$reportedPos = s0;
  25273. s1 = peg$c82(s2, s4);
  25274. s0 = s1;
  25275. } else {
  25276. peg$currPos = s0;
  25277. s0 = peg$c1;
  25278. }
  25279. } else {
  25280. peg$currPos = s0;
  25281. s0 = peg$c1;
  25282. }
  25283. } else {
  25284. peg$currPos = s0;
  25285. s0 = peg$c1;
  25286. }
  25287. } else {
  25288. peg$currPos = s0;
  25289. s0 = peg$c1;
  25290. }
  25291. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25292. return s0;
  25293. }
  25294. function peg$parsebinarySelector() {
  25295. var s0, s1, s2;
  25296. var key = peg$currPos * 60 + 28,
  25297. cached = peg$cache[key];
  25298. if (cached) {
  25299. peg$currPos = cached.nextPos;
  25300. return cached.result;
  25301. }
  25302. s0 = peg$currPos;
  25303. s1 = [];
  25304. if (peg$c83.test(input.charAt(peg$currPos))) {
  25305. s2 = input.charAt(peg$currPos);
  25306. peg$currPos++;
  25307. } else {
  25308. s2 = peg$FAILED;
  25309. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  25310. }
  25311. if (s2 !== peg$FAILED) {
  25312. while (s2 !== peg$FAILED) {
  25313. s1.push(s2);
  25314. if (peg$c83.test(input.charAt(peg$currPos))) {
  25315. s2 = input.charAt(peg$currPos);
  25316. peg$currPos++;
  25317. } else {
  25318. s2 = peg$FAILED;
  25319. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  25320. }
  25321. }
  25322. } else {
  25323. s1 = peg$c1;
  25324. }
  25325. if (s1 !== peg$FAILED) {
  25326. peg$reportedPos = s0;
  25327. s1 = peg$c85(s1);
  25328. }
  25329. s0 = s1;
  25330. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25331. return s0;
  25332. }
  25333. function peg$parsekeywordPattern() {
  25334. var s0, s1, s2, s3, s4, s5, s6;
  25335. var key = peg$currPos * 60 + 29,
  25336. cached = peg$cache[key];
  25337. if (cached) {
  25338. peg$currPos = cached.nextPos;
  25339. return cached.result;
  25340. }
  25341. s0 = peg$currPos;
  25342. s1 = [];
  25343. s2 = peg$currPos;
  25344. s3 = peg$parsews();
  25345. if (s3 !== peg$FAILED) {
  25346. s4 = peg$parsekeyword();
  25347. if (s4 !== peg$FAILED) {
  25348. s5 = peg$parsews();
  25349. if (s5 !== peg$FAILED) {
  25350. s6 = peg$parseidentifier();
  25351. if (s6 !== peg$FAILED) {
  25352. peg$reportedPos = s2;
  25353. s3 = peg$c82(s4, s6);
  25354. s2 = s3;
  25355. } else {
  25356. peg$currPos = s2;
  25357. s2 = peg$c1;
  25358. }
  25359. } else {
  25360. peg$currPos = s2;
  25361. s2 = peg$c1;
  25362. }
  25363. } else {
  25364. peg$currPos = s2;
  25365. s2 = peg$c1;
  25366. }
  25367. } else {
  25368. peg$currPos = s2;
  25369. s2 = peg$c1;
  25370. }
  25371. if (s2 !== peg$FAILED) {
  25372. while (s2 !== peg$FAILED) {
  25373. s1.push(s2);
  25374. s2 = peg$currPos;
  25375. s3 = peg$parsews();
  25376. if (s3 !== peg$FAILED) {
  25377. s4 = peg$parsekeyword();
  25378. if (s4 !== peg$FAILED) {
  25379. s5 = peg$parsews();
  25380. if (s5 !== peg$FAILED) {
  25381. s6 = peg$parseidentifier();
  25382. if (s6 !== peg$FAILED) {
  25383. peg$reportedPos = s2;
  25384. s3 = peg$c82(s4, s6);
  25385. s2 = s3;
  25386. } else {
  25387. peg$currPos = s2;
  25388. s2 = peg$c1;
  25389. }
  25390. } else {
  25391. peg$currPos = s2;
  25392. s2 = peg$c1;
  25393. }
  25394. } else {
  25395. peg$currPos = s2;
  25396. s2 = peg$c1;
  25397. }
  25398. } else {
  25399. peg$currPos = s2;
  25400. s2 = peg$c1;
  25401. }
  25402. }
  25403. } else {
  25404. s1 = peg$c1;
  25405. }
  25406. if (s1 !== peg$FAILED) {
  25407. peg$reportedPos = s0;
  25408. s1 = peg$c86(s1);
  25409. }
  25410. s0 = s1;
  25411. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25412. return s0;
  25413. }
  25414. function peg$parsebinaryPattern() {
  25415. var s0, s1, s2, s3, s4;
  25416. var key = peg$currPos * 60 + 30,
  25417. cached = peg$cache[key];
  25418. if (cached) {
  25419. peg$currPos = cached.nextPos;
  25420. return cached.result;
  25421. }
  25422. s0 = peg$currPos;
  25423. s1 = peg$parsews();
  25424. if (s1 !== peg$FAILED) {
  25425. s2 = peg$parsebinarySelector();
  25426. if (s2 !== peg$FAILED) {
  25427. s3 = peg$parsews();
  25428. if (s3 !== peg$FAILED) {
  25429. s4 = peg$parseidentifier();
  25430. if (s4 !== peg$FAILED) {
  25431. peg$reportedPos = s0;
  25432. s1 = peg$c87(s2, s4);
  25433. s0 = s1;
  25434. } else {
  25435. peg$currPos = s0;
  25436. s0 = peg$c1;
  25437. }
  25438. } else {
  25439. peg$currPos = s0;
  25440. s0 = peg$c1;
  25441. }
  25442. } else {
  25443. peg$currPos = s0;
  25444. s0 = peg$c1;
  25445. }
  25446. } else {
  25447. peg$currPos = s0;
  25448. s0 = peg$c1;
  25449. }
  25450. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25451. return s0;
  25452. }
  25453. function peg$parseunaryPattern() {
  25454. var s0, s1, s2;
  25455. var key = peg$currPos * 60 + 31,
  25456. cached = peg$cache[key];
  25457. if (cached) {
  25458. peg$currPos = cached.nextPos;
  25459. return cached.result;
  25460. }
  25461. s0 = peg$currPos;
  25462. s1 = peg$parsews();
  25463. if (s1 !== peg$FAILED) {
  25464. s2 = peg$parseidentifier();
  25465. if (s2 !== peg$FAILED) {
  25466. peg$reportedPos = s0;
  25467. s1 = peg$c88(s2);
  25468. s0 = s1;
  25469. } else {
  25470. peg$currPos = s0;
  25471. s0 = peg$c1;
  25472. }
  25473. } else {
  25474. peg$currPos = s0;
  25475. s0 = peg$c1;
  25476. }
  25477. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25478. return s0;
  25479. }
  25480. function peg$parseexpression() {
  25481. var s0;
  25482. var key = peg$currPos * 60 + 32,
  25483. cached = peg$cache[key];
  25484. if (cached) {
  25485. peg$currPos = cached.nextPos;
  25486. return cached.result;
  25487. }
  25488. s0 = peg$parseassignment();
  25489. if (s0 === peg$FAILED) {
  25490. s0 = peg$parsecascade();
  25491. if (s0 === peg$FAILED) {
  25492. s0 = peg$parsekeywordSend();
  25493. if (s0 === peg$FAILED) {
  25494. s0 = peg$parsebinarySend();
  25495. }
  25496. }
  25497. }
  25498. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25499. return s0;
  25500. }
  25501. function peg$parseexpressionList() {
  25502. var s0, s1, s2, s3, s4;
  25503. var key = peg$currPos * 60 + 33,
  25504. cached = peg$cache[key];
  25505. if (cached) {
  25506. peg$currPos = cached.nextPos;
  25507. return cached.result;
  25508. }
  25509. s0 = peg$currPos;
  25510. s1 = peg$parsews();
  25511. if (s1 !== peg$FAILED) {
  25512. if (input.charCodeAt(peg$currPos) === 46) {
  25513. s2 = peg$c51;
  25514. peg$currPos++;
  25515. } else {
  25516. s2 = peg$FAILED;
  25517. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25518. }
  25519. if (s2 !== peg$FAILED) {
  25520. s3 = peg$parsews();
  25521. if (s3 !== peg$FAILED) {
  25522. s4 = peg$parseexpression();
  25523. if (s4 !== peg$FAILED) {
  25524. peg$reportedPos = s0;
  25525. s1 = peg$c89(s4);
  25526. s0 = s1;
  25527. } else {
  25528. peg$currPos = s0;
  25529. s0 = peg$c1;
  25530. }
  25531. } else {
  25532. peg$currPos = s0;
  25533. s0 = peg$c1;
  25534. }
  25535. } else {
  25536. peg$currPos = s0;
  25537. s0 = peg$c1;
  25538. }
  25539. } else {
  25540. peg$currPos = s0;
  25541. s0 = peg$c1;
  25542. }
  25543. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25544. return s0;
  25545. }
  25546. function peg$parseexpressions() {
  25547. var s0, s1, s2, s3;
  25548. var key = peg$currPos * 60 + 34,
  25549. cached = peg$cache[key];
  25550. if (cached) {
  25551. peg$currPos = cached.nextPos;
  25552. return cached.result;
  25553. }
  25554. s0 = peg$currPos;
  25555. s1 = peg$parseexpression();
  25556. if (s1 !== peg$FAILED) {
  25557. s2 = [];
  25558. s3 = peg$parseexpressionList();
  25559. while (s3 !== peg$FAILED) {
  25560. s2.push(s3);
  25561. s3 = peg$parseexpressionList();
  25562. }
  25563. if (s2 !== peg$FAILED) {
  25564. peg$reportedPos = s0;
  25565. s1 = peg$c90(s1, s2);
  25566. s0 = s1;
  25567. } else {
  25568. peg$currPos = s0;
  25569. s0 = peg$c1;
  25570. }
  25571. } else {
  25572. peg$currPos = s0;
  25573. s0 = peg$c1;
  25574. }
  25575. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25576. return s0;
  25577. }
  25578. function peg$parseassignment() {
  25579. var s0, s1, s2, s3, s4, s5;
  25580. var key = peg$currPos * 60 + 35,
  25581. cached = peg$cache[key];
  25582. if (cached) {
  25583. peg$currPos = cached.nextPos;
  25584. return cached.result;
  25585. }
  25586. s0 = peg$currPos;
  25587. s1 = peg$parsevariable();
  25588. if (s1 !== peg$FAILED) {
  25589. s2 = peg$parsews();
  25590. if (s2 !== peg$FAILED) {
  25591. if (input.substr(peg$currPos, 2) === peg$c91) {
  25592. s3 = peg$c91;
  25593. peg$currPos += 2;
  25594. } else {
  25595. s3 = peg$FAILED;
  25596. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  25597. }
  25598. if (s3 !== peg$FAILED) {
  25599. s4 = peg$parsews();
  25600. if (s4 !== peg$FAILED) {
  25601. s5 = peg$parseexpression();
  25602. if (s5 !== peg$FAILED) {
  25603. peg$reportedPos = s0;
  25604. s1 = peg$c93(s1, s5);
  25605. s0 = s1;
  25606. } else {
  25607. peg$currPos = s0;
  25608. s0 = peg$c1;
  25609. }
  25610. } else {
  25611. peg$currPos = s0;
  25612. s0 = peg$c1;
  25613. }
  25614. } else {
  25615. peg$currPos = s0;
  25616. s0 = peg$c1;
  25617. }
  25618. } else {
  25619. peg$currPos = s0;
  25620. s0 = peg$c1;
  25621. }
  25622. } else {
  25623. peg$currPos = s0;
  25624. s0 = peg$c1;
  25625. }
  25626. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25627. return s0;
  25628. }
  25629. function peg$parseret() {
  25630. var s0, s1, s2, s3, s4, s5;
  25631. var key = peg$currPos * 60 + 36,
  25632. cached = peg$cache[key];
  25633. if (cached) {
  25634. peg$currPos = cached.nextPos;
  25635. return cached.result;
  25636. }
  25637. s0 = peg$currPos;
  25638. if (input.charCodeAt(peg$currPos) === 94) {
  25639. s1 = peg$c94;
  25640. peg$currPos++;
  25641. } else {
  25642. s1 = peg$FAILED;
  25643. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  25644. }
  25645. if (s1 !== peg$FAILED) {
  25646. s2 = peg$parsews();
  25647. if (s2 !== peg$FAILED) {
  25648. s3 = peg$parseexpression();
  25649. if (s3 !== peg$FAILED) {
  25650. s4 = peg$parsews();
  25651. if (s4 !== peg$FAILED) {
  25652. if (input.charCodeAt(peg$currPos) === 46) {
  25653. s5 = peg$c51;
  25654. peg$currPos++;
  25655. } else {
  25656. s5 = peg$FAILED;
  25657. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25658. }
  25659. if (s5 === peg$FAILED) {
  25660. s5 = peg$c41;
  25661. }
  25662. if (s5 !== peg$FAILED) {
  25663. peg$reportedPos = s0;
  25664. s1 = peg$c96(s3);
  25665. s0 = s1;
  25666. } else {
  25667. peg$currPos = s0;
  25668. s0 = peg$c1;
  25669. }
  25670. } else {
  25671. peg$currPos = s0;
  25672. s0 = peg$c1;
  25673. }
  25674. } else {
  25675. peg$currPos = s0;
  25676. s0 = peg$c1;
  25677. }
  25678. } else {
  25679. peg$currPos = s0;
  25680. s0 = peg$c1;
  25681. }
  25682. } else {
  25683. peg$currPos = s0;
  25684. s0 = peg$c1;
  25685. }
  25686. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25687. return s0;
  25688. }
  25689. function peg$parsetemps() {
  25690. var s0, s1, s2, s3, s4, s5;
  25691. var key = peg$currPos * 60 + 37,
  25692. cached = peg$cache[key];
  25693. if (cached) {
  25694. peg$currPos = cached.nextPos;
  25695. return cached.result;
  25696. }
  25697. s0 = peg$currPos;
  25698. if (input.charCodeAt(peg$currPos) === 124) {
  25699. s1 = peg$c97;
  25700. peg$currPos++;
  25701. } else {
  25702. s1 = peg$FAILED;
  25703. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25704. }
  25705. if (s1 !== peg$FAILED) {
  25706. s2 = [];
  25707. s3 = peg$currPos;
  25708. s4 = peg$parsews();
  25709. if (s4 !== peg$FAILED) {
  25710. s5 = peg$parseidentifier();
  25711. if (s5 !== peg$FAILED) {
  25712. peg$reportedPos = s3;
  25713. s4 = peg$c99(s5);
  25714. s3 = s4;
  25715. } else {
  25716. peg$currPos = s3;
  25717. s3 = peg$c1;
  25718. }
  25719. } else {
  25720. peg$currPos = s3;
  25721. s3 = peg$c1;
  25722. }
  25723. while (s3 !== peg$FAILED) {
  25724. s2.push(s3);
  25725. s3 = peg$currPos;
  25726. s4 = peg$parsews();
  25727. if (s4 !== peg$FAILED) {
  25728. s5 = peg$parseidentifier();
  25729. if (s5 !== peg$FAILED) {
  25730. peg$reportedPos = s3;
  25731. s4 = peg$c99(s5);
  25732. s3 = s4;
  25733. } else {
  25734. peg$currPos = s3;
  25735. s3 = peg$c1;
  25736. }
  25737. } else {
  25738. peg$currPos = s3;
  25739. s3 = peg$c1;
  25740. }
  25741. }
  25742. if (s2 !== peg$FAILED) {
  25743. s3 = peg$parsews();
  25744. if (s3 !== peg$FAILED) {
  25745. if (input.charCodeAt(peg$currPos) === 124) {
  25746. s4 = peg$c97;
  25747. peg$currPos++;
  25748. } else {
  25749. s4 = peg$FAILED;
  25750. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25751. }
  25752. if (s4 !== peg$FAILED) {
  25753. peg$reportedPos = s0;
  25754. s1 = peg$c100(s2);
  25755. s0 = s1;
  25756. } else {
  25757. peg$currPos = s0;
  25758. s0 = peg$c1;
  25759. }
  25760. } else {
  25761. peg$currPos = s0;
  25762. s0 = peg$c1;
  25763. }
  25764. } else {
  25765. peg$currPos = s0;
  25766. s0 = peg$c1;
  25767. }
  25768. } else {
  25769. peg$currPos = s0;
  25770. s0 = peg$c1;
  25771. }
  25772. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25773. return s0;
  25774. }
  25775. function peg$parseblockParamList() {
  25776. var s0, s1, s2, s3, s4, s5, s6;
  25777. var key = peg$currPos * 60 + 38,
  25778. cached = peg$cache[key];
  25779. if (cached) {
  25780. peg$currPos = cached.nextPos;
  25781. return cached.result;
  25782. }
  25783. s0 = peg$currPos;
  25784. s1 = [];
  25785. s2 = peg$currPos;
  25786. s3 = peg$parsews();
  25787. if (s3 !== peg$FAILED) {
  25788. if (input.charCodeAt(peg$currPos) === 58) {
  25789. s4 = peg$c13;
  25790. peg$currPos++;
  25791. } else {
  25792. s4 = peg$FAILED;
  25793. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25794. }
  25795. if (s4 !== peg$FAILED) {
  25796. s5 = peg$parsews();
  25797. if (s5 !== peg$FAILED) {
  25798. s6 = peg$parseidentifier();
  25799. if (s6 !== peg$FAILED) {
  25800. peg$reportedPos = s2;
  25801. s3 = peg$c101(s6);
  25802. s2 = s3;
  25803. } else {
  25804. peg$currPos = s2;
  25805. s2 = peg$c1;
  25806. }
  25807. } else {
  25808. peg$currPos = s2;
  25809. s2 = peg$c1;
  25810. }
  25811. } else {
  25812. peg$currPos = s2;
  25813. s2 = peg$c1;
  25814. }
  25815. } else {
  25816. peg$currPos = s2;
  25817. s2 = peg$c1;
  25818. }
  25819. if (s2 !== peg$FAILED) {
  25820. while (s2 !== peg$FAILED) {
  25821. s1.push(s2);
  25822. s2 = peg$currPos;
  25823. s3 = peg$parsews();
  25824. if (s3 !== peg$FAILED) {
  25825. if (input.charCodeAt(peg$currPos) === 58) {
  25826. s4 = peg$c13;
  25827. peg$currPos++;
  25828. } else {
  25829. s4 = peg$FAILED;
  25830. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25831. }
  25832. if (s4 !== peg$FAILED) {
  25833. s5 = peg$parsews();
  25834. if (s5 !== peg$FAILED) {
  25835. s6 = peg$parseidentifier();
  25836. if (s6 !== peg$FAILED) {
  25837. peg$reportedPos = s2;
  25838. s3 = peg$c101(s6);
  25839. s2 = s3;
  25840. } else {
  25841. peg$currPos = s2;
  25842. s2 = peg$c1;
  25843. }
  25844. } else {
  25845. peg$currPos = s2;
  25846. s2 = peg$c1;
  25847. }
  25848. } else {
  25849. peg$currPos = s2;
  25850. s2 = peg$c1;
  25851. }
  25852. } else {
  25853. peg$currPos = s2;
  25854. s2 = peg$c1;
  25855. }
  25856. }
  25857. } else {
  25858. s1 = peg$c1;
  25859. }
  25860. if (s1 !== peg$FAILED) {
  25861. s2 = peg$parsews();
  25862. if (s2 !== peg$FAILED) {
  25863. if (input.charCodeAt(peg$currPos) === 124) {
  25864. s3 = peg$c97;
  25865. peg$currPos++;
  25866. } else {
  25867. s3 = peg$FAILED;
  25868. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25869. }
  25870. if (s3 !== peg$FAILED) {
  25871. peg$reportedPos = s0;
  25872. s1 = peg$c102(s1);
  25873. s0 = s1;
  25874. } else {
  25875. peg$currPos = s0;
  25876. s0 = peg$c1;
  25877. }
  25878. } else {
  25879. peg$currPos = s0;
  25880. s0 = peg$c1;
  25881. }
  25882. } else {
  25883. peg$currPos = s0;
  25884. s0 = peg$c1;
  25885. }
  25886. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25887. return s0;
  25888. }
  25889. function peg$parsesubexpression() {
  25890. var s0, s1, s2, s3, s4, s5;
  25891. var key = peg$currPos * 60 + 39,
  25892. cached = peg$cache[key];
  25893. if (cached) {
  25894. peg$currPos = cached.nextPos;
  25895. return cached.result;
  25896. }
  25897. s0 = peg$currPos;
  25898. if (input.charCodeAt(peg$currPos) === 40) {
  25899. s1 = peg$c57;
  25900. peg$currPos++;
  25901. } else {
  25902. s1 = peg$FAILED;
  25903. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25904. }
  25905. if (s1 !== peg$FAILED) {
  25906. s2 = peg$parsews();
  25907. if (s2 !== peg$FAILED) {
  25908. s3 = peg$parseexpression();
  25909. if (s3 !== peg$FAILED) {
  25910. s4 = peg$parsews();
  25911. if (s4 !== peg$FAILED) {
  25912. if (input.charCodeAt(peg$currPos) === 41) {
  25913. s5 = peg$c60;
  25914. peg$currPos++;
  25915. } else {
  25916. s5 = peg$FAILED;
  25917. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  25918. }
  25919. if (s5 !== peg$FAILED) {
  25920. peg$reportedPos = s0;
  25921. s1 = peg$c89(s3);
  25922. s0 = s1;
  25923. } else {
  25924. peg$currPos = s0;
  25925. s0 = peg$c1;
  25926. }
  25927. } else {
  25928. peg$currPos = s0;
  25929. s0 = peg$c1;
  25930. }
  25931. } else {
  25932. peg$currPos = s0;
  25933. s0 = peg$c1;
  25934. }
  25935. } else {
  25936. peg$currPos = s0;
  25937. s0 = peg$c1;
  25938. }
  25939. } else {
  25940. peg$currPos = s0;
  25941. s0 = peg$c1;
  25942. }
  25943. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25944. return s0;
  25945. }
  25946. function peg$parsestatements() {
  25947. var s0, s1, s2, s3, s4, s5, s6, s7;
  25948. var key = peg$currPos * 60 + 40,
  25949. cached = peg$cache[key];
  25950. if (cached) {
  25951. peg$currPos = cached.nextPos;
  25952. return cached.result;
  25953. }
  25954. s0 = peg$currPos;
  25955. s1 = peg$parseret();
  25956. if (s1 !== peg$FAILED) {
  25957. s2 = [];
  25958. if (input.charCodeAt(peg$currPos) === 46) {
  25959. s3 = peg$c51;
  25960. peg$currPos++;
  25961. } else {
  25962. s3 = peg$FAILED;
  25963. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25964. }
  25965. while (s3 !== peg$FAILED) {
  25966. s2.push(s3);
  25967. if (input.charCodeAt(peg$currPos) === 46) {
  25968. s3 = peg$c51;
  25969. peg$currPos++;
  25970. } else {
  25971. s3 = peg$FAILED;
  25972. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25973. }
  25974. }
  25975. if (s2 !== peg$FAILED) {
  25976. peg$reportedPos = s0;
  25977. s1 = peg$c103(s1);
  25978. s0 = s1;
  25979. } else {
  25980. peg$currPos = s0;
  25981. s0 = peg$c1;
  25982. }
  25983. } else {
  25984. peg$currPos = s0;
  25985. s0 = peg$c1;
  25986. }
  25987. if (s0 === peg$FAILED) {
  25988. s0 = peg$currPos;
  25989. s1 = peg$parseexpressions();
  25990. if (s1 !== peg$FAILED) {
  25991. s2 = peg$parsews();
  25992. if (s2 !== peg$FAILED) {
  25993. s3 = [];
  25994. if (input.charCodeAt(peg$currPos) === 46) {
  25995. s4 = peg$c51;
  25996. peg$currPos++;
  25997. } else {
  25998. s4 = peg$FAILED;
  25999. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26000. }
  26001. if (s4 !== peg$FAILED) {
  26002. while (s4 !== peg$FAILED) {
  26003. s3.push(s4);
  26004. if (input.charCodeAt(peg$currPos) === 46) {
  26005. s4 = peg$c51;
  26006. peg$currPos++;
  26007. } else {
  26008. s4 = peg$FAILED;
  26009. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26010. }
  26011. }
  26012. } else {
  26013. s3 = peg$c1;
  26014. }
  26015. if (s3 !== peg$FAILED) {
  26016. s4 = peg$parsews();
  26017. if (s4 !== peg$FAILED) {
  26018. s5 = peg$parseret();
  26019. if (s5 !== peg$FAILED) {
  26020. s6 = [];
  26021. if (input.charCodeAt(peg$currPos) === 46) {
  26022. s7 = peg$c51;
  26023. peg$currPos++;
  26024. } else {
  26025. s7 = peg$FAILED;
  26026. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26027. }
  26028. while (s7 !== peg$FAILED) {
  26029. s6.push(s7);
  26030. if (input.charCodeAt(peg$currPos) === 46) {
  26031. s7 = peg$c51;
  26032. peg$currPos++;
  26033. } else {
  26034. s7 = peg$FAILED;
  26035. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26036. }
  26037. }
  26038. if (s6 !== peg$FAILED) {
  26039. peg$reportedPos = s0;
  26040. s1 = peg$c104(s1, s5);
  26041. s0 = s1;
  26042. } else {
  26043. peg$currPos = s0;
  26044. s0 = peg$c1;
  26045. }
  26046. } else {
  26047. peg$currPos = s0;
  26048. s0 = peg$c1;
  26049. }
  26050. } else {
  26051. peg$currPos = s0;
  26052. s0 = peg$c1;
  26053. }
  26054. } else {
  26055. peg$currPos = s0;
  26056. s0 = peg$c1;
  26057. }
  26058. } else {
  26059. peg$currPos = s0;
  26060. s0 = peg$c1;
  26061. }
  26062. } else {
  26063. peg$currPos = s0;
  26064. s0 = peg$c1;
  26065. }
  26066. if (s0 === peg$FAILED) {
  26067. s0 = peg$currPos;
  26068. s1 = peg$parseexpressions();
  26069. if (s1 === peg$FAILED) {
  26070. s1 = peg$c41;
  26071. }
  26072. if (s1 !== peg$FAILED) {
  26073. s2 = [];
  26074. if (input.charCodeAt(peg$currPos) === 46) {
  26075. s3 = peg$c51;
  26076. peg$currPos++;
  26077. } else {
  26078. s3 = peg$FAILED;
  26079. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26080. }
  26081. while (s3 !== peg$FAILED) {
  26082. s2.push(s3);
  26083. if (input.charCodeAt(peg$currPos) === 46) {
  26084. s3 = peg$c51;
  26085. peg$currPos++;
  26086. } else {
  26087. s3 = peg$FAILED;
  26088. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26089. }
  26090. }
  26091. if (s2 !== peg$FAILED) {
  26092. peg$reportedPos = s0;
  26093. s1 = peg$c105(s1);
  26094. s0 = s1;
  26095. } else {
  26096. peg$currPos = s0;
  26097. s0 = peg$c1;
  26098. }
  26099. } else {
  26100. peg$currPos = s0;
  26101. s0 = peg$c1;
  26102. }
  26103. }
  26104. }
  26105. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26106. return s0;
  26107. }
  26108. function peg$parsesequence() {
  26109. var s0;
  26110. var key = peg$currPos * 60 + 41,
  26111. cached = peg$cache[key];
  26112. if (cached) {
  26113. peg$currPos = cached.nextPos;
  26114. return cached.result;
  26115. }
  26116. s0 = peg$parsejsStatement();
  26117. if (s0 === peg$FAILED) {
  26118. s0 = peg$parsestSequence();
  26119. }
  26120. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26121. return s0;
  26122. }
  26123. function peg$parsestSequence() {
  26124. var s0, s1, s2, s3, s4;
  26125. var key = peg$currPos * 60 + 42,
  26126. cached = peg$cache[key];
  26127. if (cached) {
  26128. peg$currPos = cached.nextPos;
  26129. return cached.result;
  26130. }
  26131. s0 = peg$currPos;
  26132. s1 = peg$parsetemps();
  26133. if (s1 === peg$FAILED) {
  26134. s1 = peg$c41;
  26135. }
  26136. if (s1 !== peg$FAILED) {
  26137. s2 = peg$parsews();
  26138. if (s2 !== peg$FAILED) {
  26139. s3 = peg$parsestatements();
  26140. if (s3 === peg$FAILED) {
  26141. s3 = peg$c41;
  26142. }
  26143. if (s3 !== peg$FAILED) {
  26144. s4 = peg$parsews();
  26145. if (s4 !== peg$FAILED) {
  26146. peg$reportedPos = s0;
  26147. s1 = peg$c106(s1, s3);
  26148. s0 = s1;
  26149. } else {
  26150. peg$currPos = s0;
  26151. s0 = peg$c1;
  26152. }
  26153. } else {
  26154. peg$currPos = s0;
  26155. s0 = peg$c1;
  26156. }
  26157. } else {
  26158. peg$currPos = s0;
  26159. s0 = peg$c1;
  26160. }
  26161. } else {
  26162. peg$currPos = s0;
  26163. s0 = peg$c1;
  26164. }
  26165. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26166. return s0;
  26167. }
  26168. function peg$parseblock() {
  26169. var s0, s1, s2, s3, s4, s5, s6;
  26170. var key = peg$currPos * 60 + 43,
  26171. cached = peg$cache[key];
  26172. if (cached) {
  26173. peg$currPos = cached.nextPos;
  26174. return cached.result;
  26175. }
  26176. s0 = peg$currPos;
  26177. if (input.charCodeAt(peg$currPos) === 91) {
  26178. s1 = peg$c107;
  26179. peg$currPos++;
  26180. } else {
  26181. s1 = peg$FAILED;
  26182. if (peg$silentFails === 0) { peg$fail(peg$c108); }
  26183. }
  26184. if (s1 !== peg$FAILED) {
  26185. s2 = peg$parseblockParamList();
  26186. if (s2 === peg$FAILED) {
  26187. s2 = peg$c41;
  26188. }
  26189. if (s2 !== peg$FAILED) {
  26190. s3 = peg$parsews();
  26191. if (s3 !== peg$FAILED) {
  26192. s4 = peg$parsesequence();
  26193. if (s4 === peg$FAILED) {
  26194. s4 = peg$c41;
  26195. }
  26196. if (s4 !== peg$FAILED) {
  26197. s5 = peg$parsews();
  26198. if (s5 !== peg$FAILED) {
  26199. if (input.charCodeAt(peg$currPos) === 93) {
  26200. s6 = peg$c109;
  26201. peg$currPos++;
  26202. } else {
  26203. s6 = peg$FAILED;
  26204. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  26205. }
  26206. if (s6 !== peg$FAILED) {
  26207. peg$reportedPos = s0;
  26208. s1 = peg$c111(s2, s4);
  26209. s0 = s1;
  26210. } else {
  26211. peg$currPos = s0;
  26212. s0 = peg$c1;
  26213. }
  26214. } else {
  26215. peg$currPos = s0;
  26216. s0 = peg$c1;
  26217. }
  26218. } else {
  26219. peg$currPos = s0;
  26220. s0 = peg$c1;
  26221. }
  26222. } else {
  26223. peg$currPos = s0;
  26224. s0 = peg$c1;
  26225. }
  26226. } else {
  26227. peg$currPos = s0;
  26228. s0 = peg$c1;
  26229. }
  26230. } else {
  26231. peg$currPos = s0;
  26232. s0 = peg$c1;
  26233. }
  26234. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26235. return s0;
  26236. }
  26237. function peg$parseoperand() {
  26238. var s0;
  26239. var key = peg$currPos * 60 + 44,
  26240. cached = peg$cache[key];
  26241. if (cached) {
  26242. peg$currPos = cached.nextPos;
  26243. return cached.result;
  26244. }
  26245. s0 = peg$parseliteral();
  26246. if (s0 === peg$FAILED) {
  26247. s0 = peg$parsevariable();
  26248. if (s0 === peg$FAILED) {
  26249. s0 = peg$parsesubexpression();
  26250. }
  26251. }
  26252. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26253. return s0;
  26254. }
  26255. function peg$parseunaryMessage() {
  26256. var s0, s1, s2, s3, s4;
  26257. var key = peg$currPos * 60 + 45,
  26258. cached = peg$cache[key];
  26259. if (cached) {
  26260. peg$currPos = cached.nextPos;
  26261. return cached.result;
  26262. }
  26263. s0 = peg$currPos;
  26264. s1 = peg$parsews();
  26265. if (s1 !== peg$FAILED) {
  26266. s2 = peg$parseidentifier();
  26267. if (s2 !== peg$FAILED) {
  26268. s3 = peg$currPos;
  26269. peg$silentFails++;
  26270. if (input.charCodeAt(peg$currPos) === 58) {
  26271. s4 = peg$c13;
  26272. peg$currPos++;
  26273. } else {
  26274. s4 = peg$FAILED;
  26275. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26276. }
  26277. peg$silentFails--;
  26278. if (s4 === peg$FAILED) {
  26279. s3 = peg$c112;
  26280. } else {
  26281. peg$currPos = s3;
  26282. s3 = peg$c1;
  26283. }
  26284. if (s3 !== peg$FAILED) {
  26285. peg$reportedPos = s0;
  26286. s1 = peg$c113(s2);
  26287. s0 = s1;
  26288. } else {
  26289. peg$currPos = s0;
  26290. s0 = peg$c1;
  26291. }
  26292. } else {
  26293. peg$currPos = s0;
  26294. s0 = peg$c1;
  26295. }
  26296. } else {
  26297. peg$currPos = s0;
  26298. s0 = peg$c1;
  26299. }
  26300. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26301. return s0;
  26302. }
  26303. function peg$parseunaryTail() {
  26304. var s0, s1, s2, s3, s4;
  26305. var key = peg$currPos * 60 + 46,
  26306. cached = peg$cache[key];
  26307. if (cached) {
  26308. peg$currPos = cached.nextPos;
  26309. return cached.result;
  26310. }
  26311. s0 = peg$currPos;
  26312. s1 = peg$parseunaryMessage();
  26313. if (s1 !== peg$FAILED) {
  26314. s2 = peg$parsews();
  26315. if (s2 !== peg$FAILED) {
  26316. s3 = peg$parseunaryTail();
  26317. if (s3 === peg$FAILED) {
  26318. s3 = peg$c41;
  26319. }
  26320. if (s3 !== peg$FAILED) {
  26321. s4 = peg$parsews();
  26322. if (s4 !== peg$FAILED) {
  26323. peg$reportedPos = s0;
  26324. s1 = peg$c114(s1, s3);
  26325. s0 = s1;
  26326. } else {
  26327. peg$currPos = s0;
  26328. s0 = peg$c1;
  26329. }
  26330. } else {
  26331. peg$currPos = s0;
  26332. s0 = peg$c1;
  26333. }
  26334. } else {
  26335. peg$currPos = s0;
  26336. s0 = peg$c1;
  26337. }
  26338. } else {
  26339. peg$currPos = s0;
  26340. s0 = peg$c1;
  26341. }
  26342. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26343. return s0;
  26344. }
  26345. function peg$parseunarySend() {
  26346. var s0, s1, s2, s3;
  26347. var key = peg$currPos * 60 + 47,
  26348. cached = peg$cache[key];
  26349. if (cached) {
  26350. peg$currPos = cached.nextPos;
  26351. return cached.result;
  26352. }
  26353. s0 = peg$currPos;
  26354. s1 = peg$parseoperand();
  26355. if (s1 !== peg$FAILED) {
  26356. s2 = peg$parsews();
  26357. if (s2 !== peg$FAILED) {
  26358. s3 = peg$parseunaryTail();
  26359. if (s3 === peg$FAILED) {
  26360. s3 = peg$c41;
  26361. }
  26362. if (s3 !== peg$FAILED) {
  26363. peg$reportedPos = s0;
  26364. s1 = peg$c115(s1, s3);
  26365. s0 = s1;
  26366. } else {
  26367. peg$currPos = s0;
  26368. s0 = peg$c1;
  26369. }
  26370. } else {
  26371. peg$currPos = s0;
  26372. s0 = peg$c1;
  26373. }
  26374. } else {
  26375. peg$currPos = s0;
  26376. s0 = peg$c1;
  26377. }
  26378. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26379. return s0;
  26380. }
  26381. function peg$parsebinaryMessage() {
  26382. var s0, s1, s2, s3, s4;
  26383. var key = peg$currPos * 60 + 48,
  26384. cached = peg$cache[key];
  26385. if (cached) {
  26386. peg$currPos = cached.nextPos;
  26387. return cached.result;
  26388. }
  26389. s0 = peg$currPos;
  26390. s1 = peg$parsews();
  26391. if (s1 !== peg$FAILED) {
  26392. s2 = peg$parsebinarySelector();
  26393. if (s2 !== peg$FAILED) {
  26394. s3 = peg$parsews();
  26395. if (s3 !== peg$FAILED) {
  26396. s4 = peg$parseunarySend();
  26397. if (s4 === peg$FAILED) {
  26398. s4 = peg$parseoperand();
  26399. }
  26400. if (s4 !== peg$FAILED) {
  26401. peg$reportedPos = s0;
  26402. s1 = peg$c116(s2, s4);
  26403. s0 = s1;
  26404. } else {
  26405. peg$currPos = s0;
  26406. s0 = peg$c1;
  26407. }
  26408. } else {
  26409. peg$currPos = s0;
  26410. s0 = peg$c1;
  26411. }
  26412. } else {
  26413. peg$currPos = s0;
  26414. s0 = peg$c1;
  26415. }
  26416. } else {
  26417. peg$currPos = s0;
  26418. s0 = peg$c1;
  26419. }
  26420. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26421. return s0;
  26422. }
  26423. function peg$parsebinaryTail() {
  26424. var s0, s1, s2;
  26425. var key = peg$currPos * 60 + 49,
  26426. cached = peg$cache[key];
  26427. if (cached) {
  26428. peg$currPos = cached.nextPos;
  26429. return cached.result;
  26430. }
  26431. s0 = peg$currPos;
  26432. s1 = peg$parsebinaryMessage();
  26433. if (s1 !== peg$FAILED) {
  26434. s2 = peg$parsebinaryTail();
  26435. if (s2 === peg$FAILED) {
  26436. s2 = peg$c41;
  26437. }
  26438. if (s2 !== peg$FAILED) {
  26439. peg$reportedPos = s0;
  26440. s1 = peg$c117(s1, s2);
  26441. s0 = s1;
  26442. } else {
  26443. peg$currPos = s0;
  26444. s0 = peg$c1;
  26445. }
  26446. } else {
  26447. peg$currPos = s0;
  26448. s0 = peg$c1;
  26449. }
  26450. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26451. return s0;
  26452. }
  26453. function peg$parsebinarySend() {
  26454. var s0, s1, s2;
  26455. var key = peg$currPos * 60 + 50,
  26456. cached = peg$cache[key];
  26457. if (cached) {
  26458. peg$currPos = cached.nextPos;
  26459. return cached.result;
  26460. }
  26461. s0 = peg$currPos;
  26462. s1 = peg$parseunarySend();
  26463. if (s1 !== peg$FAILED) {
  26464. s2 = peg$parsebinaryTail();
  26465. if (s2 === peg$FAILED) {
  26466. s2 = peg$c41;
  26467. }
  26468. if (s2 !== peg$FAILED) {
  26469. peg$reportedPos = s0;
  26470. s1 = peg$c115(s1, s2);
  26471. s0 = s1;
  26472. } else {
  26473. peg$currPos = s0;
  26474. s0 = peg$c1;
  26475. }
  26476. } else {
  26477. peg$currPos = s0;
  26478. s0 = peg$c1;
  26479. }
  26480. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26481. return s0;
  26482. }
  26483. function peg$parsekeywordMessage() {
  26484. var s0, s1, s2;
  26485. var key = peg$currPos * 60 + 51,
  26486. cached = peg$cache[key];
  26487. if (cached) {
  26488. peg$currPos = cached.nextPos;
  26489. return cached.result;
  26490. }
  26491. s0 = peg$currPos;
  26492. s1 = [];
  26493. s2 = peg$parsekeywordPair();
  26494. if (s2 !== peg$FAILED) {
  26495. while (s2 !== peg$FAILED) {
  26496. s1.push(s2);
  26497. s2 = peg$parsekeywordPair();
  26498. }
  26499. } else {
  26500. s1 = peg$c1;
  26501. }
  26502. if (s1 !== peg$FAILED) {
  26503. peg$reportedPos = s0;
  26504. s1 = peg$c118(s1);
  26505. }
  26506. s0 = s1;
  26507. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26508. return s0;
  26509. }
  26510. function peg$parsekeywordSend() {
  26511. var s0, s1, s2;
  26512. var key = peg$currPos * 60 + 52,
  26513. cached = peg$cache[key];
  26514. if (cached) {
  26515. peg$currPos = cached.nextPos;
  26516. return cached.result;
  26517. }
  26518. s0 = peg$currPos;
  26519. s1 = peg$parsebinarySend();
  26520. if (s1 !== peg$FAILED) {
  26521. s2 = peg$parsekeywordMessage();
  26522. if (s2 !== peg$FAILED) {
  26523. peg$reportedPos = s0;
  26524. s1 = peg$c119(s1, s2);
  26525. s0 = s1;
  26526. } else {
  26527. peg$currPos = s0;
  26528. s0 = peg$c1;
  26529. }
  26530. } else {
  26531. peg$currPos = s0;
  26532. s0 = peg$c1;
  26533. }
  26534. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26535. return s0;
  26536. }
  26537. function peg$parsemessage() {
  26538. var s0;
  26539. var key = peg$currPos * 60 + 53,
  26540. cached = peg$cache[key];
  26541. if (cached) {
  26542. peg$currPos = cached.nextPos;
  26543. return cached.result;
  26544. }
  26545. s0 = peg$parsebinaryMessage();
  26546. if (s0 === peg$FAILED) {
  26547. s0 = peg$parseunaryMessage();
  26548. if (s0 === peg$FAILED) {
  26549. s0 = peg$parsekeywordMessage();
  26550. }
  26551. }
  26552. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26553. return s0;
  26554. }
  26555. function peg$parsecascade() {
  26556. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  26557. var key = peg$currPos * 60 + 54,
  26558. cached = peg$cache[key];
  26559. if (cached) {
  26560. peg$currPos = cached.nextPos;
  26561. return cached.result;
  26562. }
  26563. s0 = peg$currPos;
  26564. s1 = peg$parsews();
  26565. if (s1 !== peg$FAILED) {
  26566. s2 = peg$parsekeywordSend();
  26567. if (s2 === peg$FAILED) {
  26568. s2 = peg$parsebinarySend();
  26569. }
  26570. if (s2 !== peg$FAILED) {
  26571. s3 = [];
  26572. s4 = peg$currPos;
  26573. s5 = peg$parsews();
  26574. if (s5 !== peg$FAILED) {
  26575. if (input.charCodeAt(peg$currPos) === 59) {
  26576. s6 = peg$c120;
  26577. peg$currPos++;
  26578. } else {
  26579. s6 = peg$FAILED;
  26580. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  26581. }
  26582. if (s6 !== peg$FAILED) {
  26583. s7 = peg$parsews();
  26584. if (s7 !== peg$FAILED) {
  26585. s8 = peg$parsemessage();
  26586. if (s8 !== peg$FAILED) {
  26587. peg$reportedPos = s4;
  26588. s5 = peg$c122(s8);
  26589. s4 = s5;
  26590. } else {
  26591. peg$currPos = s4;
  26592. s4 = peg$c1;
  26593. }
  26594. } else {
  26595. peg$currPos = s4;
  26596. s4 = peg$c1;
  26597. }
  26598. } else {
  26599. peg$currPos = s4;
  26600. s4 = peg$c1;
  26601. }
  26602. } else {
  26603. peg$currPos = s4;
  26604. s4 = peg$c1;
  26605. }
  26606. if (s4 !== peg$FAILED) {
  26607. while (s4 !== peg$FAILED) {
  26608. s3.push(s4);
  26609. s4 = peg$currPos;
  26610. s5 = peg$parsews();
  26611. if (s5 !== peg$FAILED) {
  26612. if (input.charCodeAt(peg$currPos) === 59) {
  26613. s6 = peg$c120;
  26614. peg$currPos++;
  26615. } else {
  26616. s6 = peg$FAILED;
  26617. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  26618. }
  26619. if (s6 !== peg$FAILED) {
  26620. s7 = peg$parsews();
  26621. if (s7 !== peg$FAILED) {
  26622. s8 = peg$parsemessage();
  26623. if (s8 !== peg$FAILED) {
  26624. peg$reportedPos = s4;
  26625. s5 = peg$c122(s8);
  26626. s4 = s5;
  26627. } else {
  26628. peg$currPos = s4;
  26629. s4 = peg$c1;
  26630. }
  26631. } else {
  26632. peg$currPos = s4;
  26633. s4 = peg$c1;
  26634. }
  26635. } else {
  26636. peg$currPos = s4;
  26637. s4 = peg$c1;
  26638. }
  26639. } else {
  26640. peg$currPos = s4;
  26641. s4 = peg$c1;
  26642. }
  26643. }
  26644. } else {
  26645. s3 = peg$c1;
  26646. }
  26647. if (s3 !== peg$FAILED) {
  26648. peg$reportedPos = s0;
  26649. s1 = peg$c123(s2, s3);
  26650. s0 = s1;
  26651. } else {
  26652. peg$currPos = s0;
  26653. s0 = peg$c1;
  26654. }
  26655. } else {
  26656. peg$currPos = s0;
  26657. s0 = peg$c1;
  26658. }
  26659. } else {
  26660. peg$currPos = s0;
  26661. s0 = peg$c1;
  26662. }
  26663. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26664. return s0;
  26665. }
  26666. function peg$parsejsStatement() {
  26667. var s0, s1, s2, s3, s4;
  26668. var key = peg$currPos * 60 + 55,
  26669. cached = peg$cache[key];
  26670. if (cached) {
  26671. peg$currPos = cached.nextPos;
  26672. return cached.result;
  26673. }
  26674. s0 = peg$currPos;
  26675. if (input.charCodeAt(peg$currPos) === 60) {
  26676. s1 = peg$c124;
  26677. peg$currPos++;
  26678. } else {
  26679. s1 = peg$FAILED;
  26680. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26681. }
  26682. if (s1 !== peg$FAILED) {
  26683. s2 = [];
  26684. s3 = peg$currPos;
  26685. if (input.substr(peg$currPos, 2) === peg$c126) {
  26686. s4 = peg$c126;
  26687. peg$currPos += 2;
  26688. } else {
  26689. s4 = peg$FAILED;
  26690. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26691. }
  26692. if (s4 !== peg$FAILED) {
  26693. peg$reportedPos = s3;
  26694. s4 = peg$c128();
  26695. }
  26696. s3 = s4;
  26697. if (s3 === peg$FAILED) {
  26698. if (peg$c129.test(input.charAt(peg$currPos))) {
  26699. s3 = input.charAt(peg$currPos);
  26700. peg$currPos++;
  26701. } else {
  26702. s3 = peg$FAILED;
  26703. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26704. }
  26705. }
  26706. while (s3 !== peg$FAILED) {
  26707. s2.push(s3);
  26708. s3 = peg$currPos;
  26709. if (input.substr(peg$currPos, 2) === peg$c126) {
  26710. s4 = peg$c126;
  26711. peg$currPos += 2;
  26712. } else {
  26713. s4 = peg$FAILED;
  26714. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26715. }
  26716. if (s4 !== peg$FAILED) {
  26717. peg$reportedPos = s3;
  26718. s4 = peg$c128();
  26719. }
  26720. s3 = s4;
  26721. if (s3 === peg$FAILED) {
  26722. if (peg$c129.test(input.charAt(peg$currPos))) {
  26723. s3 = input.charAt(peg$currPos);
  26724. peg$currPos++;
  26725. } else {
  26726. s3 = peg$FAILED;
  26727. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26728. }
  26729. }
  26730. }
  26731. if (s2 !== peg$FAILED) {
  26732. if (input.charCodeAt(peg$currPos) === 62) {
  26733. s3 = peg$c131;
  26734. peg$currPos++;
  26735. } else {
  26736. s3 = peg$FAILED;
  26737. if (peg$silentFails === 0) { peg$fail(peg$c132); }
  26738. }
  26739. if (s3 !== peg$FAILED) {
  26740. peg$reportedPos = s0;
  26741. s1 = peg$c133(s2);
  26742. s0 = s1;
  26743. } else {
  26744. peg$currPos = s0;
  26745. s0 = peg$c1;
  26746. }
  26747. } else {
  26748. peg$currPos = s0;
  26749. s0 = peg$c1;
  26750. }
  26751. } else {
  26752. peg$currPos = s0;
  26753. s0 = peg$c1;
  26754. }
  26755. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26756. return s0;
  26757. }
  26758. function peg$parsemethod() {
  26759. var s0, s1, s2, s3, s4;
  26760. var key = peg$currPos * 60 + 56,
  26761. cached = peg$cache[key];
  26762. if (cached) {
  26763. peg$currPos = cached.nextPos;
  26764. return cached.result;
  26765. }
  26766. s0 = peg$currPos;
  26767. s1 = peg$parsekeywordPattern();
  26768. if (s1 === peg$FAILED) {
  26769. s1 = peg$parsebinaryPattern();
  26770. if (s1 === peg$FAILED) {
  26771. s1 = peg$parseunaryPattern();
  26772. }
  26773. }
  26774. if (s1 !== peg$FAILED) {
  26775. s2 = peg$parsews();
  26776. if (s2 !== peg$FAILED) {
  26777. s3 = peg$parsesequence();
  26778. if (s3 === peg$FAILED) {
  26779. s3 = peg$c41;
  26780. }
  26781. if (s3 !== peg$FAILED) {
  26782. s4 = peg$parsews();
  26783. if (s4 !== peg$FAILED) {
  26784. peg$reportedPos = s0;
  26785. s1 = peg$c134(s1, s3);
  26786. s0 = s1;
  26787. } else {
  26788. peg$currPos = s0;
  26789. s0 = peg$c1;
  26790. }
  26791. } else {
  26792. peg$currPos = s0;
  26793. s0 = peg$c1;
  26794. }
  26795. } else {
  26796. peg$currPos = s0;
  26797. s0 = peg$c1;
  26798. }
  26799. } else {
  26800. peg$currPos = s0;
  26801. s0 = peg$c1;
  26802. }
  26803. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26804. return s0;
  26805. }
  26806. function peg$parseassociationSend() {
  26807. var s0, s1, s2;
  26808. var key = peg$currPos * 60 + 57,
  26809. cached = peg$cache[key];
  26810. if (cached) {
  26811. peg$currPos = cached.nextPos;
  26812. return cached.result;
  26813. }
  26814. s0 = peg$currPos;
  26815. s1 = peg$parsebinarySend();
  26816. if (s1 !== peg$FAILED) {
  26817. peg$reportedPos = peg$currPos;
  26818. s2 = peg$c135(s1);
  26819. if (s2) {
  26820. s2 = peg$c112;
  26821. } else {
  26822. s2 = peg$c1;
  26823. }
  26824. if (s2 !== peg$FAILED) {
  26825. peg$reportedPos = s0;
  26826. s1 = peg$c136(s1);
  26827. s0 = s1;
  26828. } else {
  26829. peg$currPos = s0;
  26830. s0 = peg$c1;
  26831. }
  26832. } else {
  26833. peg$currPos = s0;
  26834. s0 = peg$c1;
  26835. }
  26836. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26837. return s0;
  26838. }
  26839. function peg$parseassociationList() {
  26840. var s0, s1, s2, s3, s4;
  26841. var key = peg$currPos * 60 + 58,
  26842. cached = peg$cache[key];
  26843. if (cached) {
  26844. peg$currPos = cached.nextPos;
  26845. return cached.result;
  26846. }
  26847. s0 = peg$currPos;
  26848. s1 = peg$parsews();
  26849. if (s1 !== peg$FAILED) {
  26850. if (input.charCodeAt(peg$currPos) === 46) {
  26851. s2 = peg$c51;
  26852. peg$currPos++;
  26853. } else {
  26854. s2 = peg$FAILED;
  26855. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26856. }
  26857. if (s2 !== peg$FAILED) {
  26858. s3 = peg$parsews();
  26859. if (s3 !== peg$FAILED) {
  26860. s4 = peg$parseassociationSend();
  26861. if (s4 !== peg$FAILED) {
  26862. peg$reportedPos = s0;
  26863. s1 = peg$c89(s4);
  26864. s0 = s1;
  26865. } else {
  26866. peg$currPos = s0;
  26867. s0 = peg$c1;
  26868. }
  26869. } else {
  26870. peg$currPos = s0;
  26871. s0 = peg$c1;
  26872. }
  26873. } else {
  26874. peg$currPos = s0;
  26875. s0 = peg$c1;
  26876. }
  26877. } else {
  26878. peg$currPos = s0;
  26879. s0 = peg$c1;
  26880. }
  26881. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26882. return s0;
  26883. }
  26884. function peg$parseassociations() {
  26885. var s0, s1, s2, s3;
  26886. var key = peg$currPos * 60 + 59,
  26887. cached = peg$cache[key];
  26888. if (cached) {
  26889. peg$currPos = cached.nextPos;
  26890. return cached.result;
  26891. }
  26892. s0 = peg$currPos;
  26893. s1 = peg$parseassociationSend();
  26894. if (s1 !== peg$FAILED) {
  26895. s2 = [];
  26896. s3 = peg$parseassociationList();
  26897. while (s3 !== peg$FAILED) {
  26898. s2.push(s3);
  26899. s3 = peg$parseassociationList();
  26900. }
  26901. if (s2 !== peg$FAILED) {
  26902. peg$reportedPos = s0;
  26903. s1 = peg$c137(s1, s2);
  26904. s0 = s1;
  26905. } else {
  26906. peg$currPos = s0;
  26907. s0 = peg$c1;
  26908. }
  26909. } else {
  26910. peg$currPos = s0;
  26911. s0 = peg$c1;
  26912. }
  26913. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26914. return s0;
  26915. }
  26916. peg$result = peg$startRuleFunction();
  26917. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  26918. return peg$result;
  26919. } else {
  26920. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  26921. peg$fail({ type: "end", description: "end of input" });
  26922. }
  26923. throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
  26924. }
  26925. }
  26926. return {
  26927. SyntaxError: SyntaxError,
  26928. parse: parse
  26929. };
  26930. })();
  26931. });
  26932. 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";
  26933. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  26934. $core.addPackage('Platform-ImportExport');
  26935. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  26936. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  26937. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  26938. $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.";
  26939. $core.addMethod(
  26940. $core.method({
  26941. selector: "classNameFor:",
  26942. protocol: 'convenience',
  26943. fn: function (aClass){
  26944. var self=this;
  26945. return $core.withContext(function($ctx1) {
  26946. var $2,$3,$4,$1;
  26947. $2=$recv(aClass)._isMetaclass();
  26948. if($core.assert($2)){
  26949. $3=$recv($recv(aClass)._instanceClass())._name();
  26950. $ctx1.sendIdx["name"]=1;
  26951. $1=$recv($3).__comma(" class");
  26952. } else {
  26953. $4=$recv(aClass)._isNil();
  26954. if($core.assert($4)){
  26955. $1="nil";
  26956. } else {
  26957. $1=$recv(aClass)._name();
  26958. };
  26959. };
  26960. return $1;
  26961. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  26962. },
  26963. args: ["aClass"],
  26964. 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 ] ]",
  26965. referencedClasses: [],
  26966. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  26967. }),
  26968. $globals.AbstractExporter);
  26969. $core.addMethod(
  26970. $core.method({
  26971. selector: "exportPackage:on:",
  26972. protocol: 'output',
  26973. fn: function (aPackage,aStream){
  26974. var self=this;
  26975. return $core.withContext(function($ctx1) {
  26976. self._subclassResponsibility();
  26977. return self;
  26978. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  26979. },
  26980. args: ["aPackage", "aStream"],
  26981. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  26982. referencedClasses: [],
  26983. messageSends: ["subclassResponsibility"]
  26984. }),
  26985. $globals.AbstractExporter);
  26986. $core.addMethod(
  26987. $core.method({
  26988. selector: "extensionMethodsOfPackage:",
  26989. protocol: 'accessing',
  26990. fn: function (aPackage){
  26991. var self=this;
  26992. var result;
  26993. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  26994. return $core.withContext(function($ctx1) {
  26995. var $1;
  26996. result=$recv($OrderedCollection())._new();
  26997. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  26998. return $core.withContext(function($ctx2) {
  26999. return $recv(result)._addAll_($recv(each)._methods());
  27000. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27001. }));
  27002. $1=result;
  27003. return $1;
  27004. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  27005. },
  27006. args: ["aPackage"],
  27007. 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",
  27008. referencedClasses: ["OrderedCollection"],
  27009. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  27010. }),
  27011. $globals.AbstractExporter);
  27012. $core.addMethod(
  27013. $core.method({
  27014. selector: "extensionProtocolsOfPackage:",
  27015. protocol: 'accessing',
  27016. fn: function (aPackage){
  27017. var self=this;
  27018. var extensionName,result;
  27019. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27020. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27021. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  27022. return $core.withContext(function($ctx1) {
  27023. var $1,$2,$3,$4;
  27024. $1=$recv(aPackage)._name();
  27025. $ctx1.sendIdx["name"]=1;
  27026. extensionName="*".__comma($1);
  27027. result=$recv($OrderedCollection())._new();
  27028. $recv($recv($recv($recv($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
  27029. return $core.withContext(function($ctx2) {
  27030. $2=$recv(a)._name();
  27031. $ctx2.sendIdx["name"]=2;
  27032. return $recv($2).__lt($recv(b)._name());
  27033. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27034. })))._do_((function(each){
  27035. return $core.withContext(function($ctx2) {
  27036. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  27037. return $core.withContext(function($ctx3) {
  27038. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  27039. if($core.assert($3)){
  27040. return $recv(result)._add_($recv($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  27041. };
  27042. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  27043. }));
  27044. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27045. }));
  27046. $ctx1.sendIdx["do:"]=1;
  27047. $4=result;
  27048. return $4;
  27049. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  27050. },
  27051. args: ["aPackage"],
  27052. 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",
  27053. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  27054. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  27055. }),
  27056. $globals.AbstractExporter);
  27057. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27058. $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.";
  27059. $core.addMethod(
  27060. $core.method({
  27061. selector: "chunkEscape:",
  27062. protocol: 'convenience',
  27063. fn: function (aString){
  27064. var self=this;
  27065. return $core.withContext(function($ctx1) {
  27066. var $1;
  27067. $1=$recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  27068. return $1;
  27069. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  27070. },
  27071. args: ["aString"],
  27072. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  27073. referencedClasses: [],
  27074. messageSends: ["trimBoth", "replace:with:"]
  27075. }),
  27076. $globals.ChunkExporter);
  27077. $core.addMethod(
  27078. $core.method({
  27079. selector: "exportCategoryEpilogueOf:on:",
  27080. protocol: 'output',
  27081. fn: function (aCategory,aStream){
  27082. var self=this;
  27083. return $core.withContext(function($ctx1) {
  27084. var $1;
  27085. $recv(aStream)._nextPutAll_(" !");
  27086. $recv(aStream)._lf();
  27087. $ctx1.sendIdx["lf"]=1;
  27088. $1=$recv(aStream)._lf();
  27089. return self;
  27090. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27091. },
  27092. args: ["aCategory", "aStream"],
  27093. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27094. referencedClasses: [],
  27095. messageSends: ["nextPutAll:", "lf"]
  27096. }),
  27097. $globals.ChunkExporter);
  27098. $core.addMethod(
  27099. $core.method({
  27100. selector: "exportCategoryPrologueOf:on:",
  27101. protocol: 'output',
  27102. fn: function (aCategory,aStream){
  27103. var self=this;
  27104. return $core.withContext(function($ctx1) {
  27105. var $1,$3,$2;
  27106. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  27107. $ctx1.sendIdx[","]=1;
  27108. $recv(aStream)._nextPutAll_($1);
  27109. $ctx1.sendIdx["nextPutAll:"]=1;
  27110. $3=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  27111. $ctx1.sendIdx[","]=2;
  27112. $2=$recv(aStream)._nextPutAll_($3);
  27113. return self;
  27114. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27115. },
  27116. args: ["aCategory", "aStream"],
  27117. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  27118. referencedClasses: [],
  27119. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27120. }),
  27121. $globals.ChunkExporter);
  27122. $core.addMethod(
  27123. $core.method({
  27124. selector: "exportDefinitionOf:on:",
  27125. protocol: 'output',
  27126. fn: function (aClass,aStream){
  27127. var self=this;
  27128. return $core.withContext(function($ctx1) {
  27129. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  27130. $1=self._classNameFor_($recv(aClass)._superclass());
  27131. $ctx1.sendIdx["classNameFor:"]=1;
  27132. $recv(aStream)._nextPutAll_($1);
  27133. $ctx1.sendIdx["nextPutAll:"]=1;
  27134. $3=self._classNameFor_(aClass);
  27135. $ctx1.sendIdx["classNameFor:"]=2;
  27136. $2=" subclass: #".__comma($3);
  27137. $ctx1.sendIdx[","]=1;
  27138. $recv(aStream)._nextPutAll_($2);
  27139. $ctx1.sendIdx["nextPutAll:"]=2;
  27140. $recv(aStream)._lf();
  27141. $ctx1.sendIdx["lf"]=1;
  27142. $recv(aStream)._tab();
  27143. $ctx1.sendIdx["tab"]=1;
  27144. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  27145. $ctx1.sendIdx["nextPutAll:"]=3;
  27146. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27147. return $core.withContext(function($ctx2) {
  27148. return $recv(aStream)._nextPutAll_(each);
  27149. $ctx2.sendIdx["nextPutAll:"]=4;
  27150. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27151. }),(function(){
  27152. return $core.withContext(function($ctx2) {
  27153. return $recv(aStream)._nextPutAll_(" ");
  27154. $ctx2.sendIdx["nextPutAll:"]=5;
  27155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27156. }));
  27157. $recv(aStream)._nextPutAll_("'");
  27158. $ctx1.sendIdx["nextPutAll:"]=6;
  27159. $recv(aStream)._lf();
  27160. $ctx1.sendIdx["lf"]=2;
  27161. $recv(aStream)._tab();
  27162. $6="package: '".__comma($recv(aClass)._category());
  27163. $ctx1.sendIdx[","]=3;
  27164. $5=$recv($6).__comma("'!");
  27165. $ctx1.sendIdx[","]=2;
  27166. $recv(aStream)._nextPutAll_($5);
  27167. $ctx1.sendIdx["nextPutAll:"]=7;
  27168. $7=$recv(aStream)._lf();
  27169. $ctx1.sendIdx["lf"]=3;
  27170. $9=$recv(aClass)._comment();
  27171. $ctx1.sendIdx["comment"]=1;
  27172. $8=$recv($9)._notEmpty();
  27173. if($core.assert($8)){
  27174. $11="!".__comma(self._classNameFor_(aClass));
  27175. $ctx1.sendIdx[","]=5;
  27176. $10=$recv($11).__comma(" commentStamp!");
  27177. $ctx1.sendIdx[","]=4;
  27178. $recv(aStream)._nextPutAll_($10);
  27179. $ctx1.sendIdx["nextPutAll:"]=8;
  27180. $recv(aStream)._lf();
  27181. $ctx1.sendIdx["lf"]=4;
  27182. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  27183. $12=$recv(aStream)._lf();
  27184. $ctx1.sendIdx["lf"]=5;
  27185. $12;
  27186. };
  27187. $recv(aStream)._lf();
  27188. return self;
  27189. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27190. },
  27191. args: ["aClass", "aStream"],
  27192. 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",
  27193. referencedClasses: [],
  27194. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
  27195. }),
  27196. $globals.ChunkExporter);
  27197. $core.addMethod(
  27198. $core.method({
  27199. selector: "exportMetaDefinitionOf:on:",
  27200. protocol: 'output',
  27201. fn: function (aClass,aStream){
  27202. var self=this;
  27203. return $core.withContext(function($ctx1) {
  27204. var $3,$2,$1,$5,$4,$6,$7;
  27205. $3=$recv(aClass)._class();
  27206. $ctx1.sendIdx["class"]=1;
  27207. $2=$recv($3)._instanceVariableNames();
  27208. $ctx1.sendIdx["instanceVariableNames"]=1;
  27209. $1=$recv($2)._isEmpty();
  27210. if(!$core.assert($1)){
  27211. $5=$recv(aClass)._class();
  27212. $ctx1.sendIdx["class"]=2;
  27213. $4=self._classNameFor_($5);
  27214. $recv(aStream)._nextPutAll_($4);
  27215. $ctx1.sendIdx["nextPutAll:"]=1;
  27216. $6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  27217. $ctx1.sendIdx["nextPutAll:"]=2;
  27218. $6;
  27219. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27220. return $core.withContext(function($ctx2) {
  27221. return $recv(aStream)._nextPutAll_(each);
  27222. $ctx2.sendIdx["nextPutAll:"]=3;
  27223. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27224. }),(function(){
  27225. return $core.withContext(function($ctx2) {
  27226. return $recv(aStream)._nextPutAll_(" ");
  27227. $ctx2.sendIdx["nextPutAll:"]=4;
  27228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27229. }));
  27230. $recv(aStream)._nextPutAll_("'!");
  27231. $recv(aStream)._lf();
  27232. $ctx1.sendIdx["lf"]=1;
  27233. $7=$recv(aStream)._lf();
  27234. $7;
  27235. };
  27236. return self;
  27237. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27238. },
  27239. args: ["aClass", "aStream"],
  27240. 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 ]",
  27241. referencedClasses: [],
  27242. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  27243. }),
  27244. $globals.ChunkExporter);
  27245. $core.addMethod(
  27246. $core.method({
  27247. selector: "exportMethod:on:",
  27248. protocol: 'output',
  27249. fn: function (aMethod,aStream){
  27250. var self=this;
  27251. return $core.withContext(function($ctx1) {
  27252. var $1;
  27253. $recv(aStream)._lf();
  27254. $ctx1.sendIdx["lf"]=1;
  27255. $recv(aStream)._lf();
  27256. $ctx1.sendIdx["lf"]=2;
  27257. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  27258. $ctx1.sendIdx["nextPutAll:"]=1;
  27259. $recv(aStream)._lf();
  27260. $1=$recv(aStream)._nextPutAll_("!");
  27261. return self;
  27262. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  27263. },
  27264. args: ["aMethod", "aStream"],
  27265. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  27266. referencedClasses: [],
  27267. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  27268. }),
  27269. $globals.ChunkExporter);
  27270. $core.addMethod(
  27271. $core.method({
  27272. selector: "exportPackage:on:",
  27273. protocol: 'output',
  27274. fn: function (aPackage,aStream){
  27275. var self=this;
  27276. return $core.withContext(function($ctx1) {
  27277. var $1,$2;
  27278. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27279. $1=self._exportPackageImportsOf_on_(aPackage,aStream);
  27280. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27281. return $core.withContext(function($ctx2) {
  27282. self._exportDefinitionOf_on_(each,aStream);
  27283. $2=self._ownMethodProtocolsOfClass_(each);
  27284. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  27285. self._exportProtocols_on_($2,aStream);
  27286. $ctx2.sendIdx["exportProtocols:on:"]=1;
  27287. self._exportMetaDefinitionOf_on_(each,aStream);
  27288. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  27289. $ctx2.sendIdx["exportProtocols:on:"]=2;
  27290. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27291. }));
  27292. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  27293. return self;
  27294. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27295. },
  27296. args: ["aPackage", "aStream"],
  27297. 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",
  27298. referencedClasses: [],
  27299. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  27300. }),
  27301. $globals.ChunkExporter);
  27302. $core.addMethod(
  27303. $core.method({
  27304. selector: "exportPackageDefinitionOf:on:",
  27305. protocol: 'output',
  27306. fn: function (aPackage,aStream){
  27307. var self=this;
  27308. return $core.withContext(function($ctx1) {
  27309. var $1,$2;
  27310. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  27311. $ctx1.sendIdx[","]=1;
  27312. $recv(aStream)._nextPutAll_($1);
  27313. $2=$recv(aStream)._lf();
  27314. return self;
  27315. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27316. },
  27317. args: ["aPackage", "aStream"],
  27318. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  27319. referencedClasses: [],
  27320. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27321. }),
  27322. $globals.ChunkExporter);
  27323. $core.addMethod(
  27324. $core.method({
  27325. selector: "exportPackageImportsOf:on:",
  27326. protocol: 'output',
  27327. fn: function (aPackage,aStream){
  27328. var self=this;
  27329. return $core.withContext(function($ctx1) {
  27330. var $1;
  27331. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  27332. return $core.withContext(function($ctx2) {
  27333. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  27334. $ctx2.sendIdx["nextPutAll:"]=1;
  27335. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27336. $ctx2.sendIdx["nextPutAll:"]=2;
  27337. $recv(aStream)._nextPutAll_("') imports: ");
  27338. $ctx2.sendIdx["nextPutAll:"]=3;
  27339. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  27340. $ctx2.sendIdx["nextPutAll:"]=4;
  27341. $recv(aStream)._nextPutAll_("!");
  27342. $1=$recv(aStream)._lf();
  27343. return $1;
  27344. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27345. }));
  27346. return self;
  27347. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27348. },
  27349. args: ["aPackage", "aStream"],
  27350. 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 ]",
  27351. referencedClasses: [],
  27352. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  27353. }),
  27354. $globals.ChunkExporter);
  27355. $core.addMethod(
  27356. $core.method({
  27357. selector: "exportProtocol:on:",
  27358. protocol: 'output',
  27359. fn: function (aProtocol,aStream){
  27360. var self=this;
  27361. return $core.withContext(function($ctx1) {
  27362. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  27363. $recv($recv(aProtocol)._methods())._do_((function(method){
  27364. return $core.withContext(function($ctx2) {
  27365. return self._exportMethod_on_(method,aStream);
  27366. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  27367. }));
  27368. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  27369. return self;
  27370. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27371. },
  27372. args: ["aProtocol", "aStream"],
  27373. 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",
  27374. referencedClasses: [],
  27375. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  27376. }),
  27377. $globals.ChunkExporter);
  27378. $core.addMethod(
  27379. $core.method({
  27380. selector: "exportProtocolEpilogueOf:on:",
  27381. protocol: 'output',
  27382. fn: function (aProtocol,aStream){
  27383. var self=this;
  27384. return $core.withContext(function($ctx1) {
  27385. var $1;
  27386. $recv(aStream)._nextPutAll_(" !");
  27387. $recv(aStream)._lf();
  27388. $ctx1.sendIdx["lf"]=1;
  27389. $1=$recv(aStream)._lf();
  27390. return self;
  27391. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27392. },
  27393. args: ["aProtocol", "aStream"],
  27394. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27395. referencedClasses: [],
  27396. messageSends: ["nextPutAll:", "lf"]
  27397. }),
  27398. $globals.ChunkExporter);
  27399. $core.addMethod(
  27400. $core.method({
  27401. selector: "exportProtocolPrologueOf:on:",
  27402. protocol: 'output',
  27403. fn: function (aProtocol,aStream){
  27404. var self=this;
  27405. return $core.withContext(function($ctx1) {
  27406. var $1,$3,$2;
  27407. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  27408. $ctx1.sendIdx[","]=1;
  27409. $recv(aStream)._nextPutAll_($1);
  27410. $ctx1.sendIdx["nextPutAll:"]=1;
  27411. $3=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  27412. $ctx1.sendIdx[","]=2;
  27413. $2=$recv(aStream)._nextPutAll_($3);
  27414. return self;
  27415. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27416. },
  27417. args: ["aProtocol", "aStream"],
  27418. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  27419. referencedClasses: [],
  27420. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27421. }),
  27422. $globals.ChunkExporter);
  27423. $core.addMethod(
  27424. $core.method({
  27425. selector: "exportProtocols:on:",
  27426. protocol: 'output',
  27427. fn: function (aCollection,aStream){
  27428. var self=this;
  27429. return $core.withContext(function($ctx1) {
  27430. $recv(aCollection)._do_((function(each){
  27431. return $core.withContext(function($ctx2) {
  27432. return self._exportProtocol_on_(each,aStream);
  27433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27434. }));
  27435. return self;
  27436. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  27437. },
  27438. args: ["aCollection", "aStream"],
  27439. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  27440. referencedClasses: [],
  27441. messageSends: ["do:", "exportProtocol:on:"]
  27442. }),
  27443. $globals.ChunkExporter);
  27444. $core.addMethod(
  27445. $core.method({
  27446. selector: "extensionCategoriesOfPackage:",
  27447. protocol: 'accessing',
  27448. fn: function (aPackage){
  27449. var self=this;
  27450. var name,map,result;
  27451. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27452. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  27453. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27454. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27455. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  27456. return $core.withContext(function($ctx1) {
  27457. var $1,$2;
  27458. name=$recv(aPackage)._name();
  27459. result=$recv($OrderedCollection())._new();
  27460. $ctx1.sendIdx["new"]=1;
  27461. $recv($recv($Package())._sortedClasses_($recv($Smalltalk())._classes()))._do_((function(each){
  27462. return $core.withContext(function($ctx2) {
  27463. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  27464. return $core.withContext(function($ctx3) {
  27465. map=$recv($Dictionary())._new();
  27466. map;
  27467. $recv(aClass)._protocolsDo_((function(category,methods){
  27468. return $core.withContext(function($ctx4) {
  27469. $1=$recv(category).__eq("*".__comma(name));
  27470. if($core.assert($1)){
  27471. return $recv(map)._at_put_(category,methods);
  27472. };
  27473. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  27474. }));
  27475. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27476. return $core.withContext(function($ctx4) {
  27477. return $recv(a).__lt_eq(b);
  27478. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  27479. })))._collect_((function(category){
  27480. return $core.withContext(function($ctx4) {
  27481. return $recv($MethodCategory())._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  27482. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  27483. })));
  27484. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  27485. }));
  27486. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27487. }));
  27488. $ctx1.sendIdx["do:"]=1;
  27489. $2=result;
  27490. return $2;
  27491. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  27492. },
  27493. args: ["aPackage"],
  27494. 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",
  27495. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  27496. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27497. }),
  27498. $globals.ChunkExporter);
  27499. $core.addMethod(
  27500. $core.method({
  27501. selector: "ownCategoriesOfClass:",
  27502. protocol: 'accessing',
  27503. fn: function (aClass){
  27504. var self=this;
  27505. var map;
  27506. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27507. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  27508. return $core.withContext(function($ctx1) {
  27509. var $1,$2;
  27510. map=$recv($Dictionary())._new();
  27511. $recv(aClass)._protocolsDo_((function(each,methods){
  27512. return $core.withContext(function($ctx2) {
  27513. $1=$recv(each)._match_("^\x5c*");
  27514. if(!$core.assert($1)){
  27515. return $recv(map)._at_put_(each,methods);
  27516. };
  27517. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  27518. }));
  27519. $2=$recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27520. return $core.withContext(function($ctx2) {
  27521. return $recv(a).__lt_eq(b);
  27522. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  27523. })))._collect_((function(each){
  27524. return $core.withContext(function($ctx2) {
  27525. return $recv($MethodCategory())._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  27526. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27527. }));
  27528. return $2;
  27529. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  27530. },
  27531. args: ["aClass"],
  27532. 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) ]",
  27533. referencedClasses: ["Dictionary", "MethodCategory"],
  27534. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27535. }),
  27536. $globals.ChunkExporter);
  27537. $core.addMethod(
  27538. $core.method({
  27539. selector: "ownCategoriesOfMetaClass:",
  27540. protocol: 'accessing',
  27541. fn: function (aClass){
  27542. var self=this;
  27543. return $core.withContext(function($ctx1) {
  27544. var $1;
  27545. $1=self._ownCategoriesOfClass_($recv(aClass)._class());
  27546. return $1;
  27547. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  27548. },
  27549. args: ["aClass"],
  27550. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  27551. referencedClasses: [],
  27552. messageSends: ["ownCategoriesOfClass:", "class"]
  27553. }),
  27554. $globals.ChunkExporter);
  27555. $core.addMethod(
  27556. $core.method({
  27557. selector: "ownMethodProtocolsOfClass:",
  27558. protocol: 'accessing',
  27559. fn: function (aClass){
  27560. var self=this;
  27561. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  27562. return $core.withContext(function($ctx1) {
  27563. var $1;
  27564. $1=$recv($recv(aClass)._ownProtocols())._collect_((function(each){
  27565. return $core.withContext(function($ctx2) {
  27566. return $recv($ExportMethodProtocol())._name_theClass_(each,aClass);
  27567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27568. }));
  27569. return $1;
  27570. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  27571. },
  27572. args: ["aClass"],
  27573. 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 ]",
  27574. referencedClasses: ["ExportMethodProtocol"],
  27575. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  27576. }),
  27577. $globals.ChunkExporter);
  27578. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27579. $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.).";
  27580. $core.addMethod(
  27581. $core.method({
  27582. selector: "exportDefinitionOf:on:",
  27583. protocol: 'output',
  27584. fn: function (aClass,aStream){
  27585. var self=this;
  27586. return $core.withContext(function($ctx1) {
  27587. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10;
  27588. $recv(aStream)._lf();
  27589. $ctx1.sendIdx["lf"]=1;
  27590. $recv(aStream)._nextPutAll_("$core.addClass(");
  27591. $ctx1.sendIdx["nextPutAll:"]=1;
  27592. $2="'".__comma(self._classNameFor_(aClass));
  27593. $ctx1.sendIdx[","]=2;
  27594. $1=$recv($2).__comma("', ");
  27595. $ctx1.sendIdx[","]=1;
  27596. $recv(aStream)._nextPutAll_($1);
  27597. $ctx1.sendIdx["nextPutAll:"]=2;
  27598. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  27599. $ctx1.sendIdx["jsClassNameFor:"]=1;
  27600. $recv(aStream)._nextPutAll_($3);
  27601. $ctx1.sendIdx["nextPutAll:"]=3;
  27602. $4=$recv(aStream)._nextPutAll_(", [");
  27603. $ctx1.sendIdx["nextPutAll:"]=4;
  27604. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27605. return $core.withContext(function($ctx2) {
  27606. $6="'".__comma(each);
  27607. $ctx2.sendIdx[","]=4;
  27608. $5=$recv($6).__comma("'");
  27609. $ctx2.sendIdx[","]=3;
  27610. return $recv(aStream)._nextPutAll_($5);
  27611. $ctx2.sendIdx["nextPutAll:"]=5;
  27612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27613. }),(function(){
  27614. return $core.withContext(function($ctx2) {
  27615. return $recv(aStream)._nextPutAll_(", ");
  27616. $ctx2.sendIdx["nextPutAll:"]=6;
  27617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27618. }));
  27619. $recv(aStream)._nextPutAll_("], '");
  27620. $ctx1.sendIdx["nextPutAll:"]=7;
  27621. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  27622. $ctx1.sendIdx["nextPutAll:"]=8;
  27623. $7=$recv(aStream)._nextPutAll_(");");
  27624. $ctx1.sendIdx["nextPutAll:"]=9;
  27625. $9=$recv(aClass)._comment();
  27626. $ctx1.sendIdx["comment"]=1;
  27627. $8=$recv($9)._notEmpty();
  27628. if($core.assert($8)){
  27629. $recv(aStream)._lf();
  27630. $ctx1.sendIdx["lf"]=2;
  27631. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27632. $ctx1.sendIdx["nextPutAll:"]=10;
  27633. $recv(aStream)._lf();
  27634. $ctx1.sendIdx["lf"]=3;
  27635. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  27636. $ctx1.sendIdx["nextPutAll:"]=11;
  27637. $recv(aStream)._nextPutAll_(".comment=");
  27638. $ctx1.sendIdx["nextPutAll:"]=12;
  27639. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  27640. $ctx1.sendIdx["nextPutAll:"]=13;
  27641. $recv(aStream)._nextPutAll_(";");
  27642. $ctx1.sendIdx["nextPutAll:"]=14;
  27643. $recv(aStream)._lf();
  27644. $ctx1.sendIdx["lf"]=4;
  27645. $10=$recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27646. $10;
  27647. };
  27648. $recv(aStream)._lf();
  27649. return self;
  27650. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27651. },
  27652. args: ["aClass", "aStream"],
  27653. 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",
  27654. referencedClasses: [],
  27655. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"]
  27656. }),
  27657. $globals.Exporter);
  27658. $core.addMethod(
  27659. $core.method({
  27660. selector: "exportMetaDefinitionOf:on:",
  27661. protocol: 'output',
  27662. fn: function (aClass,aStream){
  27663. var self=this;
  27664. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  27665. return $core.withContext(function($ctx1) {
  27666. var $3,$2,$1,$5,$4,$6,$8,$7;
  27667. $recv(aStream)._lf();
  27668. $ctx1.sendIdx["lf"]=1;
  27669. $3=$recv(aClass)._class();
  27670. $ctx1.sendIdx["class"]=1;
  27671. $2=$recv($3)._instanceVariableNames();
  27672. $ctx1.sendIdx["instanceVariableNames"]=1;
  27673. $1=$recv($2)._isEmpty();
  27674. if(!$core.assert($1)){
  27675. $5=$recv(aClass)._class();
  27676. $ctx1.sendIdx["class"]=2;
  27677. $4=self._jsClassNameFor_($5);
  27678. $recv(aStream)._nextPutAll_($4);
  27679. $ctx1.sendIdx["nextPutAll:"]=1;
  27680. $6=$recv(aStream)._nextPutAll_(".iVarNames = [");
  27681. $ctx1.sendIdx["nextPutAll:"]=2;
  27682. $6;
  27683. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27684. return $core.withContext(function($ctx2) {
  27685. $8="'".__comma(each);
  27686. $ctx2.sendIdx[","]=2;
  27687. $7=$recv($8).__comma("'");
  27688. $ctx2.sendIdx[","]=1;
  27689. return $recv(aStream)._nextPutAll_($7);
  27690. $ctx2.sendIdx["nextPutAll:"]=3;
  27691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27692. }),(function(){
  27693. return $core.withContext(function($ctx2) {
  27694. return $recv(aStream)._nextPutAll_(",");
  27695. $ctx2.sendIdx["nextPutAll:"]=4;
  27696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27697. }));
  27698. $recv(aStream)._nextPutAll_("];".__comma($recv($String())._lf()));
  27699. };
  27700. return self;
  27701. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27702. },
  27703. args: ["aClass", "aStream"],
  27704. 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 ]",
  27705. referencedClasses: ["String"],
  27706. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  27707. }),
  27708. $globals.Exporter);
  27709. $core.addMethod(
  27710. $core.method({
  27711. selector: "exportMethod:on:",
  27712. protocol: 'output',
  27713. fn: function (aMethod,aStream){
  27714. var self=this;
  27715. return $core.withContext(function($ctx1) {
  27716. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$17;
  27717. $recv(aStream)._nextPutAll_("$core.addMethod(");
  27718. $ctx1.sendIdx["nextPutAll:"]=1;
  27719. $recv(aStream)._lf();
  27720. $ctx1.sendIdx["lf"]=1;
  27721. $recv(aStream)._nextPutAll_("$core.method({");
  27722. $ctx1.sendIdx["nextPutAll:"]=2;
  27723. $recv(aStream)._lf();
  27724. $ctx1.sendIdx["lf"]=2;
  27725. $3=$recv($recv(aMethod)._selector())._asJavascript();
  27726. $ctx1.sendIdx["asJavascript"]=1;
  27727. $2="selector: ".__comma($3);
  27728. $ctx1.sendIdx[","]=2;
  27729. $1=$recv($2).__comma(",");
  27730. $ctx1.sendIdx[","]=1;
  27731. $recv(aStream)._nextPutAll_($1);
  27732. $ctx1.sendIdx["nextPutAll:"]=3;
  27733. $recv(aStream)._lf();
  27734. $ctx1.sendIdx["lf"]=3;
  27735. $5="protocol: '".__comma($recv(aMethod)._protocol());
  27736. $ctx1.sendIdx[","]=4;
  27737. $4=$recv($5).__comma("',");
  27738. $ctx1.sendIdx[","]=3;
  27739. $recv(aStream)._nextPutAll_($4);
  27740. $ctx1.sendIdx["nextPutAll:"]=4;
  27741. $recv(aStream)._lf();
  27742. $ctx1.sendIdx["lf"]=4;
  27743. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  27744. $ctx1.sendIdx[","]=6;
  27745. $6=$recv($7).__comma(",");
  27746. $ctx1.sendIdx[","]=5;
  27747. $recv(aStream)._nextPutAll_($6);
  27748. $ctx1.sendIdx["nextPutAll:"]=5;
  27749. $recv(aStream)._lf();
  27750. $ctx1.sendIdx["lf"]=5;
  27751. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27752. $ctx1.sendIdx["nextPutAll:"]=6;
  27753. $recv(aStream)._lf();
  27754. $ctx1.sendIdx["lf"]=6;
  27755. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  27756. $ctx1.sendIdx["asJavascript"]=2;
  27757. $9="args: ".__comma($10);
  27758. $ctx1.sendIdx[","]=8;
  27759. $8=$recv($9).__comma(",");
  27760. $ctx1.sendIdx[","]=7;
  27761. $recv(aStream)._nextPutAll_($8);
  27762. $ctx1.sendIdx["nextPutAll:"]=7;
  27763. $recv(aStream)._lf();
  27764. $ctx1.sendIdx["lf"]=7;
  27765. $13=$recv($recv(aMethod)._source())._asJavascript();
  27766. $ctx1.sendIdx["asJavascript"]=3;
  27767. $12="source: ".__comma($13);
  27768. $ctx1.sendIdx[","]=10;
  27769. $11=$recv($12).__comma(",");
  27770. $ctx1.sendIdx[","]=9;
  27771. $recv(aStream)._nextPutAll_($11);
  27772. $ctx1.sendIdx["nextPutAll:"]=8;
  27773. $recv(aStream)._lf();
  27774. $ctx1.sendIdx["lf"]=8;
  27775. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  27776. $ctx1.sendIdx["asJavascript"]=4;
  27777. $15="referencedClasses: ".__comma($16);
  27778. $ctx1.sendIdx[","]=12;
  27779. $14=$recv($15).__comma(",");
  27780. $ctx1.sendIdx[","]=11;
  27781. $recv(aStream)._nextPutAll_($14);
  27782. $ctx1.sendIdx["nextPutAll:"]=9;
  27783. $recv(aStream)._lf();
  27784. $ctx1.sendIdx["lf"]=9;
  27785. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27786. $ctx1.sendIdx["nextPutAll:"]=10;
  27787. $recv(aStream)._lf();
  27788. $ctx1.sendIdx["lf"]=10;
  27789. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  27790. $ctx1.sendIdx["nextPutAll:"]=11;
  27791. $recv(aStream)._lf();
  27792. $ctx1.sendIdx["lf"]=11;
  27793. $recv(aStream)._nextPutAll_("}),");
  27794. $ctx1.sendIdx["nextPutAll:"]=12;
  27795. $recv(aStream)._lf();
  27796. $ctx1.sendIdx["lf"]=12;
  27797. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  27798. $ctx1.sendIdx["nextPutAll:"]=13;
  27799. $recv(aStream)._nextPutAll_(");");
  27800. $recv(aStream)._lf();
  27801. $ctx1.sendIdx["lf"]=13;
  27802. $17=$recv(aStream)._lf();
  27803. return self;
  27804. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  27805. },
  27806. args: ["aMethod", "aStream"],
  27807. 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",
  27808. referencedClasses: [],
  27809. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  27810. }),
  27811. $globals.Exporter);
  27812. $core.addMethod(
  27813. $core.method({
  27814. selector: "exportPackage:on:",
  27815. protocol: 'output',
  27816. fn: function (aPackage,aStream){
  27817. var self=this;
  27818. return $core.withContext(function($ctx1) {
  27819. var $1,$2;
  27820. self._exportPackagePrologueOf_on_(aPackage,aStream);
  27821. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27822. self._exportPackageContextOf_on_(aPackage,aStream);
  27823. self._exportPackageImportsOf_on_(aPackage,aStream);
  27824. $1=self._exportPackageTransportOf_on_(aPackage,aStream);
  27825. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27826. return $core.withContext(function($ctx2) {
  27827. self._exportDefinitionOf_on_(each,aStream);
  27828. $2=$recv(each)._ownMethods();
  27829. $ctx2.sendIdx["ownMethods"]=1;
  27830. $recv($2)._do_((function(method){
  27831. return $core.withContext(function($ctx3) {
  27832. return self._exportMethod_on_(method,aStream);
  27833. $ctx3.sendIdx["exportMethod:on:"]=1;
  27834. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  27835. }));
  27836. $ctx2.sendIdx["do:"]=2;
  27837. self._exportMetaDefinitionOf_on_(each,aStream);
  27838. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  27839. return $core.withContext(function($ctx3) {
  27840. return self._exportMethod_on_(method,aStream);
  27841. $ctx3.sendIdx["exportMethod:on:"]=2;
  27842. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  27843. }));
  27844. $ctx2.sendIdx["do:"]=3;
  27845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27846. }));
  27847. $ctx1.sendIdx["do:"]=1;
  27848. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  27849. return $core.withContext(function($ctx2) {
  27850. return self._exportMethod_on_(each,aStream);
  27851. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27852. }));
  27853. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  27854. return self;
  27855. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27856. },
  27857. args: ["aPackage", "aStream"],
  27858. 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",
  27859. referencedClasses: [],
  27860. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  27861. }),
  27862. $globals.Exporter);
  27863. $core.addMethod(
  27864. $core.method({
  27865. selector: "exportPackageContextOf:on:",
  27866. protocol: 'output',
  27867. fn: function (aPackage,aStream){
  27868. var self=this;
  27869. return $core.withContext(function($ctx1) {
  27870. var $1;
  27871. $recv(aStream)._nextPutAll_("$core.packages[");
  27872. $ctx1.sendIdx["nextPutAll:"]=1;
  27873. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27874. $ctx1.sendIdx["nextPutAll:"]=2;
  27875. $recv(aStream)._nextPutAll_("].innerEval = ");
  27876. $ctx1.sendIdx["nextPutAll:"]=3;
  27877. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  27878. $ctx1.sendIdx["nextPutAll:"]=4;
  27879. $recv(aStream)._nextPutAll_(";");
  27880. $1=$recv(aStream)._lf();
  27881. return self;
  27882. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27883. },
  27884. args: ["aPackage", "aStream"],
  27885. 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",
  27886. referencedClasses: [],
  27887. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  27888. }),
  27889. $globals.Exporter);
  27890. $core.addMethod(
  27891. $core.method({
  27892. selector: "exportPackageDefinitionOf:on:",
  27893. protocol: 'output',
  27894. fn: function (aPackage,aStream){
  27895. var self=this;
  27896. return $core.withContext(function($ctx1) {
  27897. var $1,$2;
  27898. $recv(aStream)._nextPutAll_("$core.addPackage(");
  27899. $ctx1.sendIdx["nextPutAll:"]=1;
  27900. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  27901. $ctx1.sendIdx[","]=1;
  27902. $recv(aStream)._nextPutAll_($1);
  27903. $2=$recv(aStream)._lf();
  27904. return self;
  27905. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27906. },
  27907. args: ["aPackage", "aStream"],
  27908. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  27909. referencedClasses: [],
  27910. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27911. }),
  27912. $globals.Exporter);
  27913. $core.addMethod(
  27914. $core.method({
  27915. selector: "exportPackageEpilogueOf:on:",
  27916. protocol: 'output',
  27917. fn: function (aPackage,aStream){
  27918. var self=this;
  27919. return $core.withContext(function($ctx1) {
  27920. self._subclassResponsibility();
  27921. return self;
  27922. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27923. },
  27924. args: ["aPackage", "aStream"],
  27925. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27926. referencedClasses: [],
  27927. messageSends: ["subclassResponsibility"]
  27928. }),
  27929. $globals.Exporter);
  27930. $core.addMethod(
  27931. $core.method({
  27932. selector: "exportPackageImportsOf:on:",
  27933. protocol: 'output',
  27934. fn: function (aPackage,aStream){
  27935. var self=this;
  27936. return $core.withContext(function($ctx1) {
  27937. var $1,$2;
  27938. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  27939. return $core.withContext(function($ctx2) {
  27940. $recv(aStream)._nextPutAll_("$core.packages[");
  27941. $ctx2.sendIdx["nextPutAll:"]=1;
  27942. $1=$recv($recv(aPackage)._name())._asJavascript();
  27943. $ctx2.sendIdx["asJavascript"]=1;
  27944. $recv(aStream)._nextPutAll_($1);
  27945. $ctx2.sendIdx["nextPutAll:"]=2;
  27946. $recv(aStream)._nextPutAll_("].imports = ");
  27947. $ctx2.sendIdx["nextPutAll:"]=3;
  27948. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  27949. $ctx2.sendIdx["nextPutAll:"]=4;
  27950. $recv(aStream)._nextPutAll_(";");
  27951. $2=$recv(aStream)._lf();
  27952. return $2;
  27953. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27954. }));
  27955. return self;
  27956. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27957. },
  27958. args: ["aPackage", "aStream"],
  27959. 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 ]",
  27960. referencedClasses: [],
  27961. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  27962. }),
  27963. $globals.Exporter);
  27964. $core.addMethod(
  27965. $core.method({
  27966. selector: "exportPackagePrologueOf:on:",
  27967. protocol: 'output',
  27968. fn: function (aPackage,aStream){
  27969. var self=this;
  27970. return $core.withContext(function($ctx1) {
  27971. self._subclassResponsibility();
  27972. return self;
  27973. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27974. },
  27975. args: ["aPackage", "aStream"],
  27976. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27977. referencedClasses: [],
  27978. messageSends: ["subclassResponsibility"]
  27979. }),
  27980. $globals.Exporter);
  27981. $core.addMethod(
  27982. $core.method({
  27983. selector: "exportPackageTransportOf:on:",
  27984. protocol: 'output',
  27985. fn: function (aPackage,aStream){
  27986. var self=this;
  27987. return $core.withContext(function($ctx1) {
  27988. var $1;
  27989. $recv(aStream)._nextPutAll_("$core.packages[");
  27990. $ctx1.sendIdx["nextPutAll:"]=1;
  27991. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27992. $ctx1.sendIdx["nextPutAll:"]=2;
  27993. $recv(aStream)._nextPutAll_("].transport = ");
  27994. $ctx1.sendIdx["nextPutAll:"]=3;
  27995. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  27996. $ctx1.sendIdx["nextPutAll:"]=4;
  27997. $recv(aStream)._nextPutAll_(";");
  27998. $1=$recv(aStream)._lf();
  27999. return self;
  28000. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28001. },
  28002. args: ["aPackage", "aStream"],
  28003. 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",
  28004. referencedClasses: [],
  28005. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  28006. }),
  28007. $globals.Exporter);
  28008. $core.addMethod(
  28009. $core.method({
  28010. selector: "jsClassNameFor:",
  28011. protocol: 'convenience',
  28012. fn: function (aClass){
  28013. var self=this;
  28014. return $core.withContext(function($ctx1) {
  28015. var $2,$1,$receiver;
  28016. $2=$recv(aClass)._isMetaclass();
  28017. if($core.assert($2)){
  28018. $1=$recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  28019. $ctx1.sendIdx[","]=1;
  28020. } else {
  28021. if(($receiver = aClass) == null || $receiver.isNil){
  28022. $1="null";
  28023. } else {
  28024. $1="$globals.".__comma($recv(aClass)._name());
  28025. };
  28026. };
  28027. return $1;
  28028. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  28029. },
  28030. args: ["aClass"],
  28031. 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 ] ]",
  28032. referencedClasses: [],
  28033. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  28034. }),
  28035. $globals.Exporter);
  28036. $core.addMethod(
  28037. $core.method({
  28038. selector: "ownMethodsOfClass:",
  28039. protocol: 'accessing',
  28040. fn: function (aClass){
  28041. var self=this;
  28042. return $core.withContext(function($ctx1) {
  28043. var $2,$1;
  28044. $1=$recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  28045. return $core.withContext(function($ctx2) {
  28046. $2=$recv(a)._selector();
  28047. $ctx2.sendIdx["selector"]=1;
  28048. return $recv($2).__lt_eq($recv(b)._selector());
  28049. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28050. })))._reject_((function(each){
  28051. return $core.withContext(function($ctx2) {
  28052. return $recv($recv(each)._protocol())._match_("^\x5c*");
  28053. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28054. }));
  28055. return $1;
  28056. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  28057. },
  28058. args: ["aClass"],
  28059. 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*') ]",
  28060. referencedClasses: [],
  28061. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  28062. }),
  28063. $globals.Exporter);
  28064. $core.addMethod(
  28065. $core.method({
  28066. selector: "ownMethodsOfMetaClass:",
  28067. protocol: 'accessing',
  28068. fn: function (aClass){
  28069. var self=this;
  28070. return $core.withContext(function($ctx1) {
  28071. var $1;
  28072. $1=self._ownMethodsOfClass_($recv(aClass)._class());
  28073. return $1;
  28074. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  28075. },
  28076. args: ["aClass"],
  28077. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  28078. referencedClasses: [],
  28079. messageSends: ["ownMethodsOfClass:", "class"]
  28080. }),
  28081. $globals.Exporter);
  28082. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  28083. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  28084. $core.addMethod(
  28085. $core.method({
  28086. selector: "amdNamesOfPackages:",
  28087. protocol: 'private',
  28088. fn: function (anArray){
  28089. var self=this;
  28090. return $core.withContext(function($ctx1) {
  28091. var $2,$1;
  28092. $1=$recv($recv(anArray)._select_((function(each){
  28093. return $core.withContext(function($ctx2) {
  28094. $2=self._amdNamespaceOfPackage_(each);
  28095. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  28096. return $recv($2)._notNil();
  28097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28098. })))._collect_((function(each){
  28099. return $core.withContext(function($ctx2) {
  28100. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  28101. $ctx2.sendIdx[","]=1;
  28102. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28103. }));
  28104. return $1;
  28105. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  28106. },
  28107. args: ["anArray"],
  28108. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  28109. referencedClasses: [],
  28110. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  28111. }),
  28112. $globals.AmdExporter);
  28113. $core.addMethod(
  28114. $core.method({
  28115. selector: "amdNamespaceOfPackage:",
  28116. protocol: 'private',
  28117. fn: function (aPackage){
  28118. var self=this;
  28119. return $core.withContext(function($ctx1) {
  28120. var $4,$3,$2,$1;
  28121. $4=$recv(aPackage)._transport();
  28122. $ctx1.sendIdx["transport"]=1;
  28123. $3=$recv($4)._type();
  28124. $2=$recv($3).__eq("amd");
  28125. if($core.assert($2)){
  28126. $1=$recv($recv(aPackage)._transport())._namespace();
  28127. } else {
  28128. $1=nil;
  28129. };
  28130. return $1;
  28131. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  28132. },
  28133. args: ["aPackage"],
  28134. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  28135. referencedClasses: [],
  28136. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  28137. }),
  28138. $globals.AmdExporter);
  28139. $core.addMethod(
  28140. $core.method({
  28141. selector: "exportPackageEpilogueOf:on:",
  28142. protocol: 'output',
  28143. fn: function (aPackage,aStream){
  28144. var self=this;
  28145. return $core.withContext(function($ctx1) {
  28146. var $1;
  28147. $recv(aStream)._nextPutAll_("});");
  28148. $1=$recv(aStream)._lf();
  28149. return self;
  28150. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  28151. },
  28152. args: ["aPackage", "aStream"],
  28153. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  28154. referencedClasses: [],
  28155. messageSends: ["nextPutAll:", "lf"]
  28156. }),
  28157. $globals.AmdExporter);
  28158. $core.addMethod(
  28159. $core.method({
  28160. selector: "exportPackagePrologueOf:on:",
  28161. protocol: 'output',
  28162. fn: function (aPackage,aStream){
  28163. var self=this;
  28164. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  28165. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28166. return $core.withContext(function($ctx1) {
  28167. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14,$18;
  28168. pragmaStart="";
  28169. pragmaEnd="";
  28170. importsForOutput=self._importsForOutput_(aPackage);
  28171. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  28172. $1=$recv(importsForOutput)._value();
  28173. $ctx1.sendIdx["value"]=1;
  28174. $recv($1)._ifNotEmpty_((function(){
  28175. return $core.withContext(function($ctx2) {
  28176. $3=$recv($String())._lf();
  28177. $ctx2.sendIdx["lf"]=1;
  28178. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  28179. $ctx2.sendIdx[","]=2;
  28180. $4=$recv($String())._lf();
  28181. $ctx2.sendIdx["lf"]=2;
  28182. pragmaStart=$recv($2).__comma($4);
  28183. $ctx2.sendIdx[","]=1;
  28184. pragmaStart;
  28185. $6=$recv($String())._lf();
  28186. $ctx2.sendIdx["lf"]=3;
  28187. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  28188. $ctx2.sendIdx[","]=4;
  28189. $7=$recv($String())._lf();
  28190. $ctx2.sendIdx["lf"]=4;
  28191. pragmaEnd=$recv($5).__comma($7);
  28192. $ctx2.sendIdx[","]=3;
  28193. return pragmaEnd;
  28194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28195. }));
  28196. $recv(aStream)._nextPutAll_("define(\x22");
  28197. $ctx1.sendIdx["nextPutAll:"]=1;
  28198. $recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  28199. $ctx1.sendIdx["nextPutAll:"]=2;
  28200. $recv(aStream)._nextPutAll_("/");
  28201. $ctx1.sendIdx["nextPutAll:"]=3;
  28202. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  28203. $ctx1.sendIdx["nextPutAll:"]=4;
  28204. $recv(aStream)._nextPutAll_("\x22, ");
  28205. $ctx1.sendIdx["nextPutAll:"]=5;
  28206. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  28207. $ctx1.sendIdx[","]=7;
  28208. $12=$recv($13).__comma([":2:"]);
  28209. $ctx1.sendIdx[","]=6;
  28210. $11=$recv($12).__comma(loadDependencies);
  28211. $ctx1.sendIdx[","]=5;
  28212. $10=$recv($11)._asJavascript();
  28213. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  28214. $ctx1.sendIdx["replace:with:"]=2;
  28215. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  28216. $ctx1.sendIdx["replace:with:"]=1;
  28217. $recv(aStream)._nextPutAll_($8);
  28218. $ctx1.sendIdx["nextPutAll:"]=6;
  28219. $recv(aStream)._nextPutAll_(", function(");
  28220. $ctx1.sendIdx["nextPutAll:"]=7;
  28221. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  28222. $ctx1.sendIdx[","]=8;
  28223. $16=$recv($17)._join_(",");
  28224. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  28225. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  28226. $ctx1.sendIdx["replace:with:"]=3;
  28227. $recv(aStream)._nextPutAll_($14);
  28228. $ctx1.sendIdx["nextPutAll:"]=8;
  28229. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  28230. $ctx1.sendIdx["nextPutAll:"]=9;
  28231. $recv(aStream)._lf();
  28232. $ctx1.sendIdx["lf"]=5;
  28233. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;");
  28234. $18=$recv(aStream)._lf();
  28235. return self;
  28236. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  28237. },
  28238. args: ["aPackage", "aStream"],
  28239. 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",
  28240. referencedClasses: ["String"],
  28241. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"]
  28242. }),
  28243. $globals.AmdExporter);
  28244. $core.addMethod(
  28245. $core.method({
  28246. selector: "importsForOutput:",
  28247. protocol: 'private',
  28248. fn: function (aPackage){
  28249. var self=this;
  28250. var namedImports,anonImports,importVarNames;
  28251. return $core.withContext(function($ctx1) {
  28252. var $1,$2;
  28253. namedImports=[];
  28254. anonImports=[];
  28255. importVarNames=[];
  28256. $recv($recv(aPackage)._imports())._do_((function(each){
  28257. return $core.withContext(function($ctx2) {
  28258. $1=$recv(each)._isString();
  28259. if($core.assert($1)){
  28260. return $recv(anonImports)._add_(each);
  28261. $ctx2.sendIdx["add:"]=1;
  28262. } else {
  28263. $recv(namedImports)._add_($recv(each)._value());
  28264. $ctx2.sendIdx["add:"]=2;
  28265. return $recv(importVarNames)._add_($recv(each)._key());
  28266. };
  28267. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28268. }));
  28269. $2=$recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  28270. return $2;
  28271. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  28272. },
  28273. args: ["aPackage"],
  28274. 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)",
  28275. referencedClasses: [],
  28276. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  28277. }),
  28278. $globals.AmdExporter);
  28279. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  28280. $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";
  28281. $core.addMethod(
  28282. $core.method({
  28283. selector: "last",
  28284. protocol: 'accessing',
  28285. fn: function (){
  28286. var self=this;
  28287. var $1;
  28288. $1=self["@last"];
  28289. return $1;
  28290. },
  28291. args: [],
  28292. source: "last\x0a\x09^ last",
  28293. referencedClasses: [],
  28294. messageSends: []
  28295. }),
  28296. $globals.ChunkParser);
  28297. $core.addMethod(
  28298. $core.method({
  28299. selector: "nextChunk",
  28300. protocol: 'reading',
  28301. fn: function (){
  28302. var self=this;
  28303. var char,result,chunk;
  28304. return $core.withContext(function($ctx1) {
  28305. var $1,$2,$3,$4;
  28306. var $early={};
  28307. try {
  28308. result=""._writeStream();
  28309. $recv((function(){
  28310. return $core.withContext(function($ctx2) {
  28311. char=$recv(self["@stream"])._next();
  28312. $ctx2.sendIdx["next"]=1;
  28313. char;
  28314. return $recv(char)._notNil();
  28315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28316. }))._whileTrue_((function(){
  28317. return $core.withContext(function($ctx2) {
  28318. $1=$recv(char).__eq("!");
  28319. $ctx2.sendIdx["="]=1;
  28320. if($core.assert($1)){
  28321. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  28322. if($core.assert($2)){
  28323. $recv(self["@stream"])._next();
  28324. } else {
  28325. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  28326. $3=self["@last"];
  28327. throw $early=[$3];
  28328. };
  28329. };
  28330. return $recv(result)._nextPut_(char);
  28331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28332. }));
  28333. self["@last"]=nil;
  28334. $4=self["@last"];
  28335. return $4;
  28336. }
  28337. catch(e) {if(e===$early)return e[0]; throw e}
  28338. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  28339. },
  28340. args: [],
  28341. 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",
  28342. referencedClasses: [],
  28343. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  28344. }),
  28345. $globals.ChunkParser);
  28346. $core.addMethod(
  28347. $core.method({
  28348. selector: "stream:",
  28349. protocol: 'accessing',
  28350. fn: function (aStream){
  28351. var self=this;
  28352. self["@stream"]=aStream;
  28353. return self;
  28354. },
  28355. args: ["aStream"],
  28356. source: "stream: aStream\x0a\x09stream := aStream",
  28357. referencedClasses: [],
  28358. messageSends: []
  28359. }),
  28360. $globals.ChunkParser);
  28361. $core.addMethod(
  28362. $core.method({
  28363. selector: "on:",
  28364. protocol: 'instance creation',
  28365. fn: function (aStream){
  28366. var self=this;
  28367. return $core.withContext(function($ctx1) {
  28368. var $1;
  28369. $1=$recv(self._new())._stream_(aStream);
  28370. return $1;
  28371. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  28372. },
  28373. args: ["aStream"],
  28374. source: "on: aStream\x0a\x09^ self new stream: aStream",
  28375. referencedClasses: [],
  28376. messageSends: ["stream:", "new"]
  28377. }),
  28378. $globals.ChunkParser.klass);
  28379. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  28380. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  28381. $core.addMethod(
  28382. $core.method({
  28383. selector: "class:",
  28384. protocol: 'accessing',
  28385. fn: function (aClass){
  28386. var self=this;
  28387. self["@class"]=aClass;
  28388. return self;
  28389. },
  28390. args: ["aClass"],
  28391. source: "class: aClass\x0a\x09class := aClass",
  28392. referencedClasses: [],
  28393. messageSends: []
  28394. }),
  28395. $globals.ClassCommentReader);
  28396. $core.addMethod(
  28397. $core.method({
  28398. selector: "initialize",
  28399. protocol: 'initialization',
  28400. fn: function (){
  28401. var self=this;
  28402. return $core.withContext(function($ctx1) {
  28403. (
  28404. $ctx1.supercall = true,
  28405. $globals.ClassCommentReader.superclass.fn.prototype._initialize.apply($recv(self), []));
  28406. $ctx1.supercall = false;
  28407. return self;
  28408. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  28409. },
  28410. args: [],
  28411. source: "initialize\x0a\x09super initialize.",
  28412. referencedClasses: [],
  28413. messageSends: ["initialize"]
  28414. }),
  28415. $globals.ClassCommentReader);
  28416. $core.addMethod(
  28417. $core.method({
  28418. selector: "scanFrom:",
  28419. protocol: 'fileIn',
  28420. fn: function (aChunkParser){
  28421. var self=this;
  28422. var chunk;
  28423. return $core.withContext(function($ctx1) {
  28424. var $1;
  28425. chunk=$recv(aChunkParser)._nextChunk();
  28426. $1=$recv(chunk)._isEmpty();
  28427. if(!$core.assert($1)){
  28428. self._setComment_(chunk);
  28429. };
  28430. return self;
  28431. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  28432. },
  28433. args: ["aChunkParser"],
  28434. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  28435. referencedClasses: [],
  28436. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
  28437. }),
  28438. $globals.ClassCommentReader);
  28439. $core.addMethod(
  28440. $core.method({
  28441. selector: "setComment:",
  28442. protocol: 'private',
  28443. fn: function (aString){
  28444. var self=this;
  28445. return $core.withContext(function($ctx1) {
  28446. $recv(self["@class"])._comment_(aString);
  28447. return self;
  28448. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  28449. },
  28450. args: ["aString"],
  28451. source: "setComment: aString\x0a\x09class comment: aString",
  28452. referencedClasses: [],
  28453. messageSends: ["comment:"]
  28454. }),
  28455. $globals.ClassCommentReader);
  28456. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  28457. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  28458. $core.addMethod(
  28459. $core.method({
  28460. selector: "class:category:",
  28461. protocol: 'accessing',
  28462. fn: function (aClass,aString){
  28463. var self=this;
  28464. self["@class"]=aClass;
  28465. self["@category"]=aString;
  28466. return self;
  28467. },
  28468. args: ["aClass", "aString"],
  28469. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  28470. referencedClasses: [],
  28471. messageSends: []
  28472. }),
  28473. $globals.ClassProtocolReader);
  28474. $core.addMethod(
  28475. $core.method({
  28476. selector: "compileMethod:",
  28477. protocol: 'private',
  28478. fn: function (aString){
  28479. var self=this;
  28480. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  28481. return $core.withContext(function($ctx1) {
  28482. $recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  28483. return self;
  28484. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  28485. },
  28486. args: ["aString"],
  28487. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  28488. referencedClasses: ["Compiler"],
  28489. messageSends: ["install:forClass:protocol:", "new"]
  28490. }),
  28491. $globals.ClassProtocolReader);
  28492. $core.addMethod(
  28493. $core.method({
  28494. selector: "initialize",
  28495. protocol: 'initialization',
  28496. fn: function (){
  28497. var self=this;
  28498. return $core.withContext(function($ctx1) {
  28499. (
  28500. $ctx1.supercall = true,
  28501. $globals.ClassProtocolReader.superclass.fn.prototype._initialize.apply($recv(self), []));
  28502. $ctx1.supercall = false;
  28503. return self;
  28504. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  28505. },
  28506. args: [],
  28507. source: "initialize\x0a\x09super initialize.",
  28508. referencedClasses: [],
  28509. messageSends: ["initialize"]
  28510. }),
  28511. $globals.ClassProtocolReader);
  28512. $core.addMethod(
  28513. $core.method({
  28514. selector: "scanFrom:",
  28515. protocol: 'fileIn',
  28516. fn: function (aChunkParser){
  28517. var self=this;
  28518. var chunk;
  28519. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  28520. return $core.withContext(function($ctx1) {
  28521. $recv((function(){
  28522. return $core.withContext(function($ctx2) {
  28523. chunk=$recv(aChunkParser)._nextChunk();
  28524. chunk;
  28525. return $recv(chunk)._isEmpty();
  28526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28527. }))._whileFalse_((function(){
  28528. return $core.withContext(function($ctx2) {
  28529. return self._compileMethod_(chunk);
  28530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28531. }));
  28532. $recv($recv($ClassBuilder())._new())._setupClass_(self["@class"]);
  28533. return self;
  28534. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  28535. },
  28536. args: ["aChunkParser"],
  28537. 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",
  28538. referencedClasses: ["ClassBuilder"],
  28539. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
  28540. }),
  28541. $globals.ClassProtocolReader);
  28542. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  28543. $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.";
  28544. $core.addMethod(
  28545. $core.method({
  28546. selector: "methods",
  28547. protocol: 'accessing',
  28548. fn: function (){
  28549. var self=this;
  28550. return $core.withContext(function($ctx1) {
  28551. var $2,$1;
  28552. $1=$recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  28553. return $core.withContext(function($ctx2) {
  28554. $2=$recv(a)._selector();
  28555. $ctx2.sendIdx["selector"]=1;
  28556. return $recv($2).__lt_eq($recv(b)._selector());
  28557. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28558. }));
  28559. return $1;
  28560. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  28561. },
  28562. args: [],
  28563. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  28564. referencedClasses: [],
  28565. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  28566. }),
  28567. $globals.ExportMethodProtocol);
  28568. $core.addMethod(
  28569. $core.method({
  28570. selector: "name",
  28571. protocol: 'accessing',
  28572. fn: function (){
  28573. var self=this;
  28574. var $1;
  28575. $1=self["@name"];
  28576. return $1;
  28577. },
  28578. args: [],
  28579. source: "name\x0a\x09^ name",
  28580. referencedClasses: [],
  28581. messageSends: []
  28582. }),
  28583. $globals.ExportMethodProtocol);
  28584. $core.addMethod(
  28585. $core.method({
  28586. selector: "name:",
  28587. protocol: 'accessing',
  28588. fn: function (aString){
  28589. var self=this;
  28590. self["@name"]=aString;
  28591. return self;
  28592. },
  28593. args: ["aString"],
  28594. source: "name: aString\x0a\x09name := aString",
  28595. referencedClasses: [],
  28596. messageSends: []
  28597. }),
  28598. $globals.ExportMethodProtocol);
  28599. $core.addMethod(
  28600. $core.method({
  28601. selector: "theClass",
  28602. protocol: 'accessing',
  28603. fn: function (){
  28604. var self=this;
  28605. var $1;
  28606. $1=self["@theClass"];
  28607. return $1;
  28608. },
  28609. args: [],
  28610. source: "theClass\x0a\x09^ theClass",
  28611. referencedClasses: [],
  28612. messageSends: []
  28613. }),
  28614. $globals.ExportMethodProtocol);
  28615. $core.addMethod(
  28616. $core.method({
  28617. selector: "theClass:",
  28618. protocol: 'accessing',
  28619. fn: function (aClass){
  28620. var self=this;
  28621. self["@theClass"]=aClass;
  28622. return self;
  28623. },
  28624. args: ["aClass"],
  28625. source: "theClass: aClass\x0a\x09theClass := aClass",
  28626. referencedClasses: [],
  28627. messageSends: []
  28628. }),
  28629. $globals.ExportMethodProtocol);
  28630. $core.addMethod(
  28631. $core.method({
  28632. selector: "name:theClass:",
  28633. protocol: 'instance creation',
  28634. fn: function (aString,aClass){
  28635. var self=this;
  28636. return $core.withContext(function($ctx1) {
  28637. var $2,$3,$1;
  28638. $2=self._new();
  28639. $recv($2)._name_(aString);
  28640. $recv($2)._theClass_(aClass);
  28641. $3=$recv($2)._yourself();
  28642. $1=$3;
  28643. return $1;
  28644. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  28645. },
  28646. args: ["aString", "aClass"],
  28647. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  28648. referencedClasses: [],
  28649. messageSends: ["name:", "new", "theClass:", "yourself"]
  28650. }),
  28651. $globals.ExportMethodProtocol.klass);
  28652. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  28653. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  28654. $core.addMethod(
  28655. $core.method({
  28656. selector: "import:",
  28657. protocol: 'fileIn',
  28658. fn: function (aStream){
  28659. var self=this;
  28660. var chunk,result,parser,lastEmpty;
  28661. function $ChunkParser(){return $globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  28662. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  28663. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  28664. return $core.withContext(function($ctx1) {
  28665. var $1,$2;
  28666. parser=$recv($ChunkParser())._on_(aStream);
  28667. lastEmpty=false;
  28668. self["@lastSection"]="n/a, not started";
  28669. self["@lastChunk"]=nil;
  28670. $recv((function(){
  28671. return $core.withContext(function($ctx2) {
  28672. $recv((function(){
  28673. return $core.withContext(function($ctx3) {
  28674. chunk=$recv(parser)._nextChunk();
  28675. chunk;
  28676. return $recv(chunk)._isNil();
  28677. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28678. }))._whileFalse_((function(){
  28679. return $core.withContext(function($ctx3) {
  28680. $1=$recv(chunk)._isEmpty();
  28681. if($core.assert($1)){
  28682. lastEmpty=true;
  28683. return lastEmpty;
  28684. } else {
  28685. self["@lastSection"]=chunk;
  28686. self["@lastSection"];
  28687. result=$recv($recv($Compiler())._new())._evaluateExpression_(chunk);
  28688. result;
  28689. $2=lastEmpty;
  28690. if($core.assert($2)){
  28691. lastEmpty=false;
  28692. lastEmpty;
  28693. return $recv(result)._scanFrom_(parser);
  28694. };
  28695. };
  28696. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28697. }));
  28698. self["@lastSection"]="n/a, finished";
  28699. return self["@lastSection"];
  28700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28701. }))._on_do_($Error(),(function(e){
  28702. return $core.withContext(function($ctx2) {
  28703. self["@lastChunk"]=$recv(parser)._last();
  28704. self["@lastChunk"];
  28705. return $recv(e)._resignal();
  28706. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  28707. }));
  28708. return self;
  28709. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  28710. },
  28711. args: ["aStream"],
  28712. 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 ].",
  28713. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  28714. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  28715. }),
  28716. $globals.Importer);
  28717. $core.addMethod(
  28718. $core.method({
  28719. selector: "lastChunk",
  28720. protocol: 'accessing',
  28721. fn: function (){
  28722. var self=this;
  28723. var $1;
  28724. $1=self["@lastChunk"];
  28725. return $1;
  28726. },
  28727. args: [],
  28728. source: "lastChunk\x0a\x09^ lastChunk",
  28729. referencedClasses: [],
  28730. messageSends: []
  28731. }),
  28732. $globals.Importer);
  28733. $core.addMethod(
  28734. $core.method({
  28735. selector: "lastSection",
  28736. protocol: 'accessing',
  28737. fn: function (){
  28738. var self=this;
  28739. var $1;
  28740. $1=self["@lastSection"];
  28741. return $1;
  28742. },
  28743. args: [],
  28744. source: "lastSection\x0a\x09^ lastSection",
  28745. referencedClasses: [],
  28746. messageSends: []
  28747. }),
  28748. $globals.Importer);
  28749. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  28750. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  28751. $core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport');
  28752. $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.";
  28753. $core.addMethod(
  28754. $core.method({
  28755. selector: "ajaxPutAt:data:onSuccess:onError:",
  28756. protocol: 'private',
  28757. fn: function (aURL,aString,aBlock,anotherBlock){
  28758. var self=this;
  28759. var xhr;
  28760. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  28761. return $core.withContext(function($ctx1) {
  28762. var $1,$4,$3,$2;
  28763. xhr=$recv($Platform())._newXhr();
  28764. $recv(xhr)._open_url_async_("PUT",aURL,true);
  28765. $recv(xhr)._onreadystatechange_((function(){
  28766. return $core.withContext(function($ctx2) {
  28767. $1=$recv($recv(xhr)._readyState()).__eq((4));
  28768. if($core.assert($1)){
  28769. $4=$recv(xhr)._status();
  28770. $ctx2.sendIdx["status"]=1;
  28771. $3=$recv($4).__gt_eq((200));
  28772. $2=$recv($3)._and_((function(){
  28773. return $core.withContext(function($ctx3) {
  28774. return $recv($recv(xhr)._status()).__lt((300));
  28775. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28776. }));
  28777. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  28778. };
  28779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28780. }));
  28781. $recv(xhr)._send_(aString);
  28782. return self;
  28783. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  28784. },
  28785. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  28786. 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",
  28787. referencedClasses: ["Platform"],
  28788. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  28789. }),
  28790. $globals.PackageHandler);
  28791. $core.addMethod(
  28792. $core.method({
  28793. selector: "chunkContentsFor:",
  28794. protocol: 'accessing',
  28795. fn: function (aPackage){
  28796. var self=this;
  28797. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28798. return $core.withContext(function($ctx1) {
  28799. var $1;
  28800. $1=$recv($String())._streamContents_((function(str){
  28801. return $core.withContext(function($ctx2) {
  28802. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  28803. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28804. }));
  28805. return $1;
  28806. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28807. },
  28808. args: ["aPackage"],
  28809. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  28810. referencedClasses: ["String"],
  28811. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  28812. }),
  28813. $globals.PackageHandler);
  28814. $core.addMethod(
  28815. $core.method({
  28816. selector: "chunkExporter",
  28817. protocol: 'factory',
  28818. fn: function (){
  28819. var self=this;
  28820. return $core.withContext(function($ctx1) {
  28821. var $1;
  28822. $1=$recv(self._chunkExporterClass())._new();
  28823. return $1;
  28824. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  28825. },
  28826. args: [],
  28827. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  28828. referencedClasses: [],
  28829. messageSends: ["new", "chunkExporterClass"]
  28830. }),
  28831. $globals.PackageHandler);
  28832. $core.addMethod(
  28833. $core.method({
  28834. selector: "chunkExporterClass",
  28835. protocol: 'accessing',
  28836. fn: function (){
  28837. var self=this;
  28838. function $ChunkExporter(){return $globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  28839. return $ChunkExporter();
  28840. },
  28841. args: [],
  28842. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  28843. referencedClasses: ["ChunkExporter"],
  28844. messageSends: []
  28845. }),
  28846. $globals.PackageHandler);
  28847. $core.addMethod(
  28848. $core.method({
  28849. selector: "commit:",
  28850. protocol: 'committing',
  28851. fn: function (aPackage){
  28852. var self=this;
  28853. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  28854. return $core.withContext(function($ctx1) {
  28855. var $1,$2,$3,$4;
  28856. self._commit_onSuccess_onError_(aPackage,(function(){
  28857. }),(function(error){
  28858. return $core.withContext(function($ctx2) {
  28859. $1=$recv($PackageCommitError())._new();
  28860. $2=$1;
  28861. $3=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  28862. $ctx2.sendIdx[","]=1;
  28863. $recv($2)._messageText_($3);
  28864. $4=$recv($1)._signal();
  28865. return $4;
  28866. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  28867. }));
  28868. return self;
  28869. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  28870. },
  28871. args: ["aPackage"],
  28872. 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 ]",
  28873. referencedClasses: ["PackageCommitError"],
  28874. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  28875. }),
  28876. $globals.PackageHandler);
  28877. $core.addMethod(
  28878. $core.method({
  28879. selector: "commit:onSuccess:onError:",
  28880. protocol: 'committing',
  28881. fn: function (aPackage,aBlock,anotherBlock){
  28882. var self=this;
  28883. return $core.withContext(function($ctx1) {
  28884. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  28885. return $core.withContext(function($ctx2) {
  28886. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  28887. return $core.withContext(function($ctx3) {
  28888. $recv(aPackage)._beClean();
  28889. return $recv(aBlock)._value();
  28890. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28891. }),anotherBlock);
  28892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28893. }),anotherBlock);
  28894. return self;
  28895. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28896. },
  28897. args: ["aPackage", "aBlock", "anotherBlock"],
  28898. 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",
  28899. referencedClasses: [],
  28900. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  28901. }),
  28902. $globals.PackageHandler);
  28903. $core.addMethod(
  28904. $core.method({
  28905. selector: "commitJsFileFor:onSuccess:onError:",
  28906. protocol: 'committing',
  28907. fn: function (aPackage,aBlock,anotherBlock){
  28908. var self=this;
  28909. return $core.withContext(function($ctx1) {
  28910. var $2,$1;
  28911. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28912. $ctx1.sendIdx[","]=2;
  28913. $1=$recv($2).__comma(".js");
  28914. $ctx1.sendIdx[","]=1;
  28915. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  28916. return self;
  28917. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28918. },
  28919. args: ["aPackage", "aBlock", "anotherBlock"],
  28920. 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",
  28921. referencedClasses: [],
  28922. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  28923. }),
  28924. $globals.PackageHandler);
  28925. $core.addMethod(
  28926. $core.method({
  28927. selector: "commitPathJsFor:",
  28928. protocol: 'accessing',
  28929. fn: function (aPackage){
  28930. var self=this;
  28931. return $core.withContext(function($ctx1) {
  28932. self._subclassResponsibility();
  28933. return self;
  28934. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28935. },
  28936. args: ["aPackage"],
  28937. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  28938. referencedClasses: [],
  28939. messageSends: ["subclassResponsibility"]
  28940. }),
  28941. $globals.PackageHandler);
  28942. $core.addMethod(
  28943. $core.method({
  28944. selector: "commitPathStFor:",
  28945. protocol: 'accessing',
  28946. fn: function (aPackage){
  28947. var self=this;
  28948. return $core.withContext(function($ctx1) {
  28949. self._subclassResponsibility();
  28950. return self;
  28951. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28952. },
  28953. args: ["aPackage"],
  28954. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  28955. referencedClasses: [],
  28956. messageSends: ["subclassResponsibility"]
  28957. }),
  28958. $globals.PackageHandler);
  28959. $core.addMethod(
  28960. $core.method({
  28961. selector: "commitStFileFor:onSuccess:onError:",
  28962. protocol: 'committing',
  28963. fn: function (aPackage,aBlock,anotherBlock){
  28964. var self=this;
  28965. return $core.withContext(function($ctx1) {
  28966. var $2,$1;
  28967. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28968. $ctx1.sendIdx[","]=2;
  28969. $1=$recv($2).__comma(".st");
  28970. $ctx1.sendIdx[","]=1;
  28971. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  28972. return self;
  28973. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28974. },
  28975. args: ["aPackage", "aBlock", "anotherBlock"],
  28976. 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",
  28977. referencedClasses: [],
  28978. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  28979. }),
  28980. $globals.PackageHandler);
  28981. $core.addMethod(
  28982. $core.method({
  28983. selector: "contentsFor:",
  28984. protocol: 'accessing',
  28985. fn: function (aPackage){
  28986. var self=this;
  28987. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28988. return $core.withContext(function($ctx1) {
  28989. var $1;
  28990. $1=$recv($String())._streamContents_((function(str){
  28991. return $core.withContext(function($ctx2) {
  28992. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  28993. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28994. }));
  28995. return $1;
  28996. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28997. },
  28998. args: ["aPackage"],
  28999. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  29000. referencedClasses: ["String"],
  29001. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  29002. }),
  29003. $globals.PackageHandler);
  29004. $core.addMethod(
  29005. $core.method({
  29006. selector: "exporter",
  29007. protocol: 'factory',
  29008. fn: function (){
  29009. var self=this;
  29010. return $core.withContext(function($ctx1) {
  29011. var $1;
  29012. $1=$recv(self._exporterClass())._new();
  29013. return $1;
  29014. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  29015. },
  29016. args: [],
  29017. source: "exporter\x0a\x09^ self exporterClass new",
  29018. referencedClasses: [],
  29019. messageSends: ["new", "exporterClass"]
  29020. }),
  29021. $globals.PackageHandler);
  29022. $core.addMethod(
  29023. $core.method({
  29024. selector: "exporterClass",
  29025. protocol: 'accessing',
  29026. fn: function (){
  29027. var self=this;
  29028. return $core.withContext(function($ctx1) {
  29029. self._subclassResponsibility();
  29030. return self;
  29031. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  29032. },
  29033. args: [],
  29034. source: "exporterClass\x0a\x09self subclassResponsibility",
  29035. referencedClasses: [],
  29036. messageSends: ["subclassResponsibility"]
  29037. }),
  29038. $globals.PackageHandler);
  29039. $core.addMethod(
  29040. $core.method({
  29041. selector: "load:",
  29042. protocol: 'loading',
  29043. fn: function (aPackage){
  29044. var self=this;
  29045. return $core.withContext(function($ctx1) {
  29046. self._subclassResponsibility();
  29047. return self;
  29048. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  29049. },
  29050. args: ["aPackage"],
  29051. source: "load: aPackage\x0a\x09self subclassResponsibility",
  29052. referencedClasses: [],
  29053. messageSends: ["subclassResponsibility"]
  29054. }),
  29055. $globals.PackageHandler);
  29056. $core.addMethod(
  29057. $core.method({
  29058. selector: "onCommitError:",
  29059. protocol: 'error handling',
  29060. fn: function (anError){
  29061. var self=this;
  29062. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  29063. return $core.withContext(function($ctx1) {
  29064. var $1,$2,$3,$4;
  29065. $1=$recv($PackageCommitError())._new();
  29066. $2=$1;
  29067. $3=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  29068. $ctx1.sendIdx[","]=1;
  29069. $recv($2)._messageText_($3);
  29070. $4=$recv($1)._signal();
  29071. return self;
  29072. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  29073. },
  29074. args: ["anError"],
  29075. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  29076. referencedClasses: ["PackageCommitError"],
  29077. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  29078. }),
  29079. $globals.PackageHandler);
  29080. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  29081. $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.";
  29082. $core.addMethod(
  29083. $core.method({
  29084. selector: "commitPathJsFor:",
  29085. protocol: 'accessing',
  29086. fn: function (aPackage){
  29087. var self=this;
  29088. return $core.withContext(function($ctx1) {
  29089. var $1;
  29090. $1=self._toUrl_(self._namespaceFor_(aPackage));
  29091. return $1;
  29092. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29093. },
  29094. args: ["aPackage"],
  29095. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  29096. referencedClasses: [],
  29097. messageSends: ["toUrl:", "namespaceFor:"]
  29098. }),
  29099. $globals.AmdPackageHandler);
  29100. $core.addMethod(
  29101. $core.method({
  29102. selector: "commitPathStFor:",
  29103. protocol: 'accessing',
  29104. fn: function (aPackage){
  29105. var self=this;
  29106. var path,pathWithout;
  29107. return $core.withContext(function($ctx1) {
  29108. var $1,$3,$2;
  29109. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  29110. $ctx1.sendIdx[","]=1;
  29111. path=self._toUrl_($1);
  29112. pathWithout=self._commitPathJsFor_(aPackage);
  29113. $3=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  29114. if($core.assert($3)){
  29115. $2=pathWithout;
  29116. } else {
  29117. $2=path;
  29118. };
  29119. return $2;
  29120. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  29121. },
  29122. args: ["aPackage"],
  29123. 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 ]",
  29124. referencedClasses: [],
  29125. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  29126. }),
  29127. $globals.AmdPackageHandler);
  29128. $core.addMethod(
  29129. $core.method({
  29130. selector: "exporterClass",
  29131. protocol: 'accessing',
  29132. fn: function (){
  29133. var self=this;
  29134. function $AmdExporter(){return $globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  29135. return $AmdExporter();
  29136. },
  29137. args: [],
  29138. source: "exporterClass\x0a\x09^ AmdExporter",
  29139. referencedClasses: ["AmdExporter"],
  29140. messageSends: []
  29141. }),
  29142. $globals.AmdPackageHandler);
  29143. $core.addMethod(
  29144. $core.method({
  29145. selector: "load:",
  29146. protocol: 'loading',
  29147. fn: function (aPackage){
  29148. var self=this;
  29149. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29150. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  29151. return $core.withContext(function($ctx1) {
  29152. var $1,$3,$2,$receiver;
  29153. $1=$recv($Smalltalk())._amdRequire();
  29154. if(($receiver = $1) == null || $receiver.isNil){
  29155. self._error_("AMD loader not present");
  29156. } else {
  29157. var require;
  29158. require=$receiver;
  29159. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29160. $ctx1.sendIdx[","]=1;
  29161. $2=$recv($Array())._with_($3);
  29162. $recv(require)._value_($2);
  29163. };
  29164. return self;
  29165. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29166. },
  29167. args: ["aPackage"],
  29168. 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 ) ]",
  29169. referencedClasses: ["Smalltalk", "Array"],
  29170. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  29171. }),
  29172. $globals.AmdPackageHandler);
  29173. $core.addMethod(
  29174. $core.method({
  29175. selector: "namespaceFor:",
  29176. protocol: 'committing',
  29177. fn: function (aPackage){
  29178. var self=this;
  29179. return $core.withContext(function($ctx1) {
  29180. var $1;
  29181. $1=$recv($recv(aPackage)._transport())._namespace();
  29182. return $1;
  29183. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29184. },
  29185. args: ["aPackage"],
  29186. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  29187. referencedClasses: [],
  29188. messageSends: ["namespace", "transport"]
  29189. }),
  29190. $globals.AmdPackageHandler);
  29191. $core.addMethod(
  29192. $core.method({
  29193. selector: "toUrl:",
  29194. protocol: 'private',
  29195. fn: function (aString){
  29196. var self=this;
  29197. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29198. return $core.withContext(function($ctx1) {
  29199. var $2,$1,$receiver;
  29200. $2=$recv($Smalltalk())._amdRequire();
  29201. if(($receiver = $2) == null || $receiver.isNil){
  29202. $1=self._error_("AMD loader not present");
  29203. } else {
  29204. var require;
  29205. require=$receiver;
  29206. $1=$recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  29207. };
  29208. return $1;
  29209. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  29210. },
  29211. args: ["aString"],
  29212. 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 ]",
  29213. referencedClasses: ["Smalltalk"],
  29214. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  29215. }),
  29216. $globals.AmdPackageHandler);
  29217. $core.addMethod(
  29218. $core.method({
  29219. selector: "defaultNamespace",
  29220. protocol: 'commit paths',
  29221. fn: function (){
  29222. var self=this;
  29223. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29224. return $core.withContext(function($ctx1) {
  29225. var $1;
  29226. $1=$recv($Smalltalk())._defaultAmdNamespace();
  29227. return $1;
  29228. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  29229. },
  29230. args: [],
  29231. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29232. referencedClasses: ["Smalltalk"],
  29233. messageSends: ["defaultAmdNamespace"]
  29234. }),
  29235. $globals.AmdPackageHandler.klass);
  29236. $core.addMethod(
  29237. $core.method({
  29238. selector: "defaultNamespace:",
  29239. protocol: 'commit paths',
  29240. fn: function (aString){
  29241. var self=this;
  29242. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29243. return $core.withContext(function($ctx1) {
  29244. $recv($Smalltalk())._defaultAmdNamespace_(aString);
  29245. return self;
  29246. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  29247. },
  29248. args: ["aString"],
  29249. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  29250. referencedClasses: ["Smalltalk"],
  29251. messageSends: ["defaultAmdNamespace:"]
  29252. }),
  29253. $globals.AmdPackageHandler.klass);
  29254. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  29255. $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.";
  29256. $core.addMethod(
  29257. $core.method({
  29258. selector: "asJSON",
  29259. protocol: 'converting',
  29260. fn: function (){
  29261. var self=this;
  29262. return $core.withContext(function($ctx1) {
  29263. var $1;
  29264. $1=$globals.HashedCollection._newFromPairs_(["type",self._type()]);
  29265. return $1;
  29266. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  29267. },
  29268. args: [],
  29269. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  29270. referencedClasses: [],
  29271. messageSends: ["type"]
  29272. }),
  29273. $globals.PackageTransport);
  29274. $core.addMethod(
  29275. $core.method({
  29276. selector: "commit",
  29277. protocol: 'committing',
  29278. fn: function (){
  29279. var self=this;
  29280. return $core.withContext(function($ctx1) {
  29281. $recv(self._commitHandler())._commit_(self._package());
  29282. return self;
  29283. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  29284. },
  29285. args: [],
  29286. source: "commit\x0a\x09self commitHandler commit: self package",
  29287. referencedClasses: [],
  29288. messageSends: ["commit:", "commitHandler", "package"]
  29289. }),
  29290. $globals.PackageTransport);
  29291. $core.addMethod(
  29292. $core.method({
  29293. selector: "commitHandler",
  29294. protocol: 'factory',
  29295. fn: function (){
  29296. var self=this;
  29297. return $core.withContext(function($ctx1) {
  29298. var $1;
  29299. $1=$recv(self._commitHandlerClass())._new();
  29300. return $1;
  29301. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  29302. },
  29303. args: [],
  29304. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  29305. referencedClasses: [],
  29306. messageSends: ["new", "commitHandlerClass"]
  29307. }),
  29308. $globals.PackageTransport);
  29309. $core.addMethod(
  29310. $core.method({
  29311. selector: "commitHandlerClass",
  29312. protocol: 'accessing',
  29313. fn: function (){
  29314. var self=this;
  29315. return $core.withContext(function($ctx1) {
  29316. self._subclassResponsibility();
  29317. return self;
  29318. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  29319. },
  29320. args: [],
  29321. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  29322. referencedClasses: [],
  29323. messageSends: ["subclassResponsibility"]
  29324. }),
  29325. $globals.PackageTransport);
  29326. $core.addMethod(
  29327. $core.method({
  29328. selector: "commitOnSuccess:onError:",
  29329. protocol: 'committing',
  29330. fn: function (aBlock,anotherBlock){
  29331. var self=this;
  29332. return $core.withContext(function($ctx1) {
  29333. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  29334. return self;
  29335. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  29336. },
  29337. args: ["aBlock", "anotherBlock"],
  29338. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  29339. referencedClasses: [],
  29340. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  29341. }),
  29342. $globals.PackageTransport);
  29343. $core.addMethod(
  29344. $core.method({
  29345. selector: "definition",
  29346. protocol: 'accessing',
  29347. fn: function (){
  29348. var self=this;
  29349. return "";
  29350. },
  29351. args: [],
  29352. source: "definition\x0a\x09^ ''",
  29353. referencedClasses: [],
  29354. messageSends: []
  29355. }),
  29356. $globals.PackageTransport);
  29357. $core.addMethod(
  29358. $core.method({
  29359. selector: "load",
  29360. protocol: 'loading',
  29361. fn: function (){
  29362. var self=this;
  29363. return $core.withContext(function($ctx1) {
  29364. $recv(self._commitHandler())._load_(self._package());
  29365. return self;
  29366. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  29367. },
  29368. args: [],
  29369. source: "load\x0a\x09self commitHandler load: self package",
  29370. referencedClasses: [],
  29371. messageSends: ["load:", "commitHandler", "package"]
  29372. }),
  29373. $globals.PackageTransport);
  29374. $core.addMethod(
  29375. $core.method({
  29376. selector: "package",
  29377. protocol: 'accessing',
  29378. fn: function (){
  29379. var self=this;
  29380. var $1;
  29381. $1=self["@package"];
  29382. return $1;
  29383. },
  29384. args: [],
  29385. source: "package\x0a\x09^ package",
  29386. referencedClasses: [],
  29387. messageSends: []
  29388. }),
  29389. $globals.PackageTransport);
  29390. $core.addMethod(
  29391. $core.method({
  29392. selector: "package:",
  29393. protocol: 'accessing',
  29394. fn: function (aPackage){
  29395. var self=this;
  29396. self["@package"]=aPackage;
  29397. return self;
  29398. },
  29399. args: ["aPackage"],
  29400. source: "package: aPackage\x0a\x09package := aPackage",
  29401. referencedClasses: [],
  29402. messageSends: []
  29403. }),
  29404. $globals.PackageTransport);
  29405. $core.addMethod(
  29406. $core.method({
  29407. selector: "setupFromJson:",
  29408. protocol: 'initialization',
  29409. fn: function (anObject){
  29410. var self=this;
  29411. return self;
  29412. },
  29413. args: ["anObject"],
  29414. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  29415. referencedClasses: [],
  29416. messageSends: []
  29417. }),
  29418. $globals.PackageTransport);
  29419. $core.addMethod(
  29420. $core.method({
  29421. selector: "type",
  29422. protocol: 'accessing',
  29423. fn: function (){
  29424. var self=this;
  29425. return $core.withContext(function($ctx1) {
  29426. var $1;
  29427. $1=$recv(self._class())._type();
  29428. return $1;
  29429. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  29430. },
  29431. args: [],
  29432. source: "type\x0a\x09^ self class type",
  29433. referencedClasses: [],
  29434. messageSends: ["type", "class"]
  29435. }),
  29436. $globals.PackageTransport);
  29437. $globals.PackageTransport.klass.iVarNames = ['registry'];
  29438. $core.addMethod(
  29439. $core.method({
  29440. selector: "classRegisteredFor:",
  29441. protocol: 'accessing',
  29442. fn: function (aString){
  29443. var self=this;
  29444. return $core.withContext(function($ctx1) {
  29445. var $1;
  29446. $1=$recv(self["@registry"])._at_(aString);
  29447. return $1;
  29448. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  29449. },
  29450. args: ["aString"],
  29451. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  29452. referencedClasses: [],
  29453. messageSends: ["at:"]
  29454. }),
  29455. $globals.PackageTransport.klass);
  29456. $core.addMethod(
  29457. $core.method({
  29458. selector: "defaultType",
  29459. protocol: 'accessing',
  29460. fn: function (){
  29461. var self=this;
  29462. function $AmdPackageTransport(){return $globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  29463. return $core.withContext(function($ctx1) {
  29464. var $1;
  29465. $1=$recv($AmdPackageTransport())._type();
  29466. return $1;
  29467. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  29468. },
  29469. args: [],
  29470. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  29471. referencedClasses: ["AmdPackageTransport"],
  29472. messageSends: ["type"]
  29473. }),
  29474. $globals.PackageTransport.klass);
  29475. $core.addMethod(
  29476. $core.method({
  29477. selector: "for:",
  29478. protocol: 'instance creation',
  29479. fn: function (aString){
  29480. var self=this;
  29481. return $core.withContext(function($ctx1) {
  29482. var $1;
  29483. $1=$recv(self._classRegisteredFor_(aString))._new();
  29484. return $1;
  29485. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  29486. },
  29487. args: ["aString"],
  29488. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  29489. referencedClasses: [],
  29490. messageSends: ["new", "classRegisteredFor:"]
  29491. }),
  29492. $globals.PackageTransport.klass);
  29493. $core.addMethod(
  29494. $core.method({
  29495. selector: "fromJson:",
  29496. protocol: 'instance creation',
  29497. fn: function (anObject){
  29498. var self=this;
  29499. return $core.withContext(function($ctx1) {
  29500. var $1,$3,$4,$2,$receiver;
  29501. if(($receiver = anObject) == null || $receiver.isNil){
  29502. $1=self._for_(self._defaultType());
  29503. $ctx1.sendIdx["for:"]=1;
  29504. return $1;
  29505. } else {
  29506. anObject;
  29507. };
  29508. $3=self._for_($recv(anObject)._type());
  29509. $recv($3)._setupFromJson_(anObject);
  29510. $4=$recv($3)._yourself();
  29511. $2=$4;
  29512. return $2;
  29513. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  29514. },
  29515. args: ["anObject"],
  29516. 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",
  29517. referencedClasses: [],
  29518. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  29519. }),
  29520. $globals.PackageTransport.klass);
  29521. $core.addMethod(
  29522. $core.method({
  29523. selector: "initialize",
  29524. protocol: 'initialization',
  29525. fn: function (){
  29526. var self=this;
  29527. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  29528. return $core.withContext(function($ctx1) {
  29529. var $1;
  29530. (
  29531. $ctx1.supercall = true,
  29532. $globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply($recv(self), []));
  29533. $ctx1.supercall = false;
  29534. $1=self.__eq_eq($PackageTransport());
  29535. if($core.assert($1)){
  29536. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  29537. self["@registry"];
  29538. } else {
  29539. self._register();
  29540. };
  29541. return self;
  29542. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  29543. },
  29544. args: [],
  29545. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  29546. referencedClasses: ["PackageTransport"],
  29547. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  29548. }),
  29549. $globals.PackageTransport.klass);
  29550. $core.addMethod(
  29551. $core.method({
  29552. selector: "register",
  29553. protocol: 'registration',
  29554. fn: function (){
  29555. var self=this;
  29556. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  29557. return $core.withContext(function($ctx1) {
  29558. $recv($PackageTransport())._register_(self);
  29559. return self;
  29560. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  29561. },
  29562. args: [],
  29563. source: "register\x0a\x09PackageTransport register: self",
  29564. referencedClasses: ["PackageTransport"],
  29565. messageSends: ["register:"]
  29566. }),
  29567. $globals.PackageTransport.klass);
  29568. $core.addMethod(
  29569. $core.method({
  29570. selector: "register:",
  29571. protocol: 'registration',
  29572. fn: function (aClass){
  29573. var self=this;
  29574. return $core.withContext(function($ctx1) {
  29575. var $1,$receiver;
  29576. $1=$recv(aClass)._type();
  29577. $ctx1.sendIdx["type"]=1;
  29578. if(($receiver = $1) == null || $receiver.isNil){
  29579. $1;
  29580. } else {
  29581. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  29582. };
  29583. return self;
  29584. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  29585. },
  29586. args: ["aClass"],
  29587. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  29588. referencedClasses: [],
  29589. messageSends: ["ifNotNil:", "type", "at:put:"]
  29590. }),
  29591. $globals.PackageTransport.klass);
  29592. $core.addMethod(
  29593. $core.method({
  29594. selector: "type",
  29595. protocol: 'accessing',
  29596. fn: function (){
  29597. var self=this;
  29598. return nil;
  29599. },
  29600. args: [],
  29601. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  29602. referencedClasses: [],
  29603. messageSends: []
  29604. }),
  29605. $globals.PackageTransport.klass);
  29606. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  29607. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  29608. $core.addMethod(
  29609. $core.method({
  29610. selector: "asJSON",
  29611. protocol: 'converting',
  29612. fn: function (){
  29613. var self=this;
  29614. return $core.withContext(function($ctx1) {
  29615. var $2,$3,$1;
  29616. $2=(
  29617. $ctx1.supercall = true,
  29618. $globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply($recv(self), []));
  29619. $ctx1.supercall = false;
  29620. $recv($2)._at_put_("amdNamespace",self._namespace());
  29621. $3=$recv($2)._yourself();
  29622. $1=$3;
  29623. return $1;
  29624. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  29625. },
  29626. args: [],
  29627. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  29628. referencedClasses: [],
  29629. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  29630. }),
  29631. $globals.AmdPackageTransport);
  29632. $core.addMethod(
  29633. $core.method({
  29634. selector: "commitHandlerClass",
  29635. protocol: 'accessing',
  29636. fn: function (){
  29637. var self=this;
  29638. function $AmdPackageHandler(){return $globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  29639. return $AmdPackageHandler();
  29640. },
  29641. args: [],
  29642. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  29643. referencedClasses: ["AmdPackageHandler"],
  29644. messageSends: []
  29645. }),
  29646. $globals.AmdPackageTransport);
  29647. $core.addMethod(
  29648. $core.method({
  29649. selector: "defaultNamespace",
  29650. protocol: 'defaults',
  29651. fn: function (){
  29652. var self=this;
  29653. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29654. return $core.withContext(function($ctx1) {
  29655. var $1;
  29656. $1=$recv($Smalltalk())._defaultAmdNamespace();
  29657. return $1;
  29658. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  29659. },
  29660. args: [],
  29661. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29662. referencedClasses: ["Smalltalk"],
  29663. messageSends: ["defaultAmdNamespace"]
  29664. }),
  29665. $globals.AmdPackageTransport);
  29666. $core.addMethod(
  29667. $core.method({
  29668. selector: "definition",
  29669. protocol: 'accessing',
  29670. fn: function (){
  29671. var self=this;
  29672. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  29673. return $core.withContext(function($ctx1) {
  29674. var $3,$2,$1;
  29675. $1=$recv($String())._streamContents_((function(stream){
  29676. return $core.withContext(function($ctx2) {
  29677. $recv(stream)._nextPutAll_($recv(self._class())._name());
  29678. $ctx2.sendIdx["nextPutAll:"]=1;
  29679. $recv(stream)._nextPutAll_(" namespace: ");
  29680. $ctx2.sendIdx["nextPutAll:"]=2;
  29681. $3=$recv("'".__comma(self._namespace())).__comma("'");
  29682. $ctx2.sendIdx[","]=1;
  29683. $2=$recv(stream)._nextPutAll_($3);
  29684. return $2;
  29685. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  29686. }));
  29687. return $1;
  29688. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  29689. },
  29690. args: [],
  29691. 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, '''' ]",
  29692. referencedClasses: ["String"],
  29693. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  29694. }),
  29695. $globals.AmdPackageTransport);
  29696. $core.addMethod(
  29697. $core.method({
  29698. selector: "namespace",
  29699. protocol: 'accessing',
  29700. fn: function (){
  29701. var self=this;
  29702. return $core.withContext(function($ctx1) {
  29703. var $2,$1,$receiver;
  29704. $2=self["@namespace"];
  29705. if(($receiver = $2) == null || $receiver.isNil){
  29706. $1=self._defaultNamespace();
  29707. } else {
  29708. $1=$2;
  29709. };
  29710. return $1;
  29711. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  29712. },
  29713. args: [],
  29714. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  29715. referencedClasses: [],
  29716. messageSends: ["ifNil:", "defaultNamespace"]
  29717. }),
  29718. $globals.AmdPackageTransport);
  29719. $core.addMethod(
  29720. $core.method({
  29721. selector: "namespace:",
  29722. protocol: 'accessing',
  29723. fn: function (aString){
  29724. var self=this;
  29725. self["@namespace"]=aString;
  29726. return self;
  29727. },
  29728. args: ["aString"],
  29729. source: "namespace: aString\x0a\x09namespace := aString",
  29730. referencedClasses: [],
  29731. messageSends: []
  29732. }),
  29733. $globals.AmdPackageTransport);
  29734. $core.addMethod(
  29735. $core.method({
  29736. selector: "printOn:",
  29737. protocol: 'printing',
  29738. fn: function (aStream){
  29739. var self=this;
  29740. return $core.withContext(function($ctx1) {
  29741. var $1;
  29742. (
  29743. $ctx1.supercall = true,
  29744. $globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  29745. $ctx1.supercall = false;
  29746. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  29747. $ctx1.sendIdx["nextPutAll:"]=1;
  29748. $recv(aStream)._nextPutAll_(self._namespace());
  29749. $ctx1.sendIdx["nextPutAll:"]=2;
  29750. $1=$recv(aStream)._nextPutAll_(")");
  29751. return self;
  29752. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  29753. },
  29754. args: ["aStream"],
  29755. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  29756. referencedClasses: [],
  29757. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  29758. }),
  29759. $globals.AmdPackageTransport);
  29760. $core.addMethod(
  29761. $core.method({
  29762. selector: "setPath:",
  29763. protocol: 'actions',
  29764. fn: function (aString){
  29765. var self=this;
  29766. return $core.withContext(function($ctx1) {
  29767. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  29768. return self;
  29769. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  29770. },
  29771. args: ["aString"],
  29772. 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}.",
  29773. referencedClasses: [],
  29774. messageSends: ["value:", "basicAt:", "namespace"]
  29775. }),
  29776. $globals.AmdPackageTransport);
  29777. $core.addMethod(
  29778. $core.method({
  29779. selector: "setupFromJson:",
  29780. protocol: 'initialization',
  29781. fn: function (anObject){
  29782. var self=this;
  29783. return $core.withContext(function($ctx1) {
  29784. self._namespace_($recv(anObject)._at_("amdNamespace"));
  29785. return self;
  29786. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  29787. },
  29788. args: ["anObject"],
  29789. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  29790. referencedClasses: [],
  29791. messageSends: ["namespace:", "at:"]
  29792. }),
  29793. $globals.AmdPackageTransport);
  29794. $core.addMethod(
  29795. $core.method({
  29796. selector: "namespace:",
  29797. protocol: 'instance creation',
  29798. fn: function (aString){
  29799. var self=this;
  29800. return $core.withContext(function($ctx1) {
  29801. var $2,$3,$1;
  29802. $2=self._new();
  29803. $recv($2)._namespace_(aString);
  29804. $3=$recv($2)._yourself();
  29805. $1=$3;
  29806. return $1;
  29807. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  29808. },
  29809. args: ["aString"],
  29810. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  29811. referencedClasses: [],
  29812. messageSends: ["namespace:", "new", "yourself"]
  29813. }),
  29814. $globals.AmdPackageTransport.klass);
  29815. $core.addMethod(
  29816. $core.method({
  29817. selector: "type",
  29818. protocol: 'accessing',
  29819. fn: function (){
  29820. var self=this;
  29821. return "amd";
  29822. },
  29823. args: [],
  29824. source: "type\x0a\x09^ 'amd'",
  29825. referencedClasses: [],
  29826. messageSends: []
  29827. }),
  29828. $globals.AmdPackageTransport.klass);
  29829. $core.addMethod(
  29830. $core.method({
  29831. selector: "commentStamp",
  29832. protocol: '*Platform-ImportExport',
  29833. fn: function (){
  29834. var self=this;
  29835. function $ClassCommentReader(){return $globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  29836. return $core.withContext(function($ctx1) {
  29837. var $2,$3,$1;
  29838. $2=$recv($ClassCommentReader())._new();
  29839. $recv($2)._class_(self);
  29840. $3=$recv($2)._yourself();
  29841. $1=$3;
  29842. return $1;
  29843. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  29844. },
  29845. args: [],
  29846. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  29847. referencedClasses: ["ClassCommentReader"],
  29848. messageSends: ["class:", "new", "yourself"]
  29849. }),
  29850. $globals.Behavior);
  29851. $core.addMethod(
  29852. $core.method({
  29853. selector: "commentStamp:prior:",
  29854. protocol: '*Platform-ImportExport',
  29855. fn: function (aStamp,prior){
  29856. var self=this;
  29857. return $core.withContext(function($ctx1) {
  29858. var $1;
  29859. $1=self._commentStamp();
  29860. return $1;
  29861. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  29862. },
  29863. args: ["aStamp", "prior"],
  29864. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  29865. referencedClasses: [],
  29866. messageSends: ["commentStamp"]
  29867. }),
  29868. $globals.Behavior);
  29869. $core.addMethod(
  29870. $core.method({
  29871. selector: "methodsFor:",
  29872. protocol: '*Platform-ImportExport',
  29873. fn: function (aString){
  29874. var self=this;
  29875. function $ClassProtocolReader(){return $globals.ClassProtocolReader||(typeof ClassProtocolReader=="undefined"?nil:ClassProtocolReader)}
  29876. return $core.withContext(function($ctx1) {
  29877. var $2,$3,$1;
  29878. $2=$recv($ClassProtocolReader())._new();
  29879. $recv($2)._class_category_(self,aString);
  29880. $3=$recv($2)._yourself();
  29881. $1=$3;
  29882. return $1;
  29883. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  29884. },
  29885. args: ["aString"],
  29886. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  29887. referencedClasses: ["ClassProtocolReader"],
  29888. messageSends: ["class:category:", "new", "yourself"]
  29889. }),
  29890. $globals.Behavior);
  29891. $core.addMethod(
  29892. $core.method({
  29893. selector: "methodsFor:stamp:",
  29894. protocol: '*Platform-ImportExport',
  29895. fn: function (aString,aStamp){
  29896. var self=this;
  29897. return $core.withContext(function($ctx1) {
  29898. var $1;
  29899. $1=self._methodsFor_(aString);
  29900. return $1;
  29901. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  29902. },
  29903. args: ["aString", "aStamp"],
  29904. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  29905. referencedClasses: [],
  29906. messageSends: ["methodsFor:"]
  29907. }),
  29908. $globals.Behavior);
  29909. $core.addMethod(
  29910. $core.method({
  29911. selector: "commit",
  29912. protocol: '*Platform-ImportExport',
  29913. fn: function (){
  29914. var self=this;
  29915. return $core.withContext(function($ctx1) {
  29916. var $1;
  29917. $1=$recv(self._transport())._commit();
  29918. return $1;
  29919. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  29920. },
  29921. args: [],
  29922. source: "commit\x0a\x09^ self transport commit",
  29923. referencedClasses: [],
  29924. messageSends: ["commit", "transport"]
  29925. }),
  29926. $globals.Package);
  29927. $core.addMethod(
  29928. $core.method({
  29929. selector: "load",
  29930. protocol: '*Platform-ImportExport',
  29931. fn: function (){
  29932. var self=this;
  29933. return $core.withContext(function($ctx1) {
  29934. var $1;
  29935. $1=$recv(self._transport())._load();
  29936. return $1;
  29937. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  29938. },
  29939. args: [],
  29940. source: "load\x0a\x09^ self transport load",
  29941. referencedClasses: [],
  29942. messageSends: ["load", "transport"]
  29943. }),
  29944. $globals.Package);
  29945. $core.addMethod(
  29946. $core.method({
  29947. selector: "loadFromNamespace:",
  29948. protocol: '*Platform-ImportExport',
  29949. fn: function (aString){
  29950. var self=this;
  29951. return $core.withContext(function($ctx1) {
  29952. var $2,$3,$1;
  29953. $2=self._transport();
  29954. $recv($2)._namespace_(aString);
  29955. $3=$recv($2)._load();
  29956. $1=$3;
  29957. return $1;
  29958. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  29959. },
  29960. args: ["aString"],
  29961. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  29962. referencedClasses: [],
  29963. messageSends: ["namespace:", "transport", "load"]
  29964. }),
  29965. $globals.Package);
  29966. $core.addMethod(
  29967. $core.method({
  29968. selector: "load:",
  29969. protocol: '*Platform-ImportExport',
  29970. fn: function (aPackageName){
  29971. var self=this;
  29972. return $core.withContext(function($ctx1) {
  29973. $recv(self._named_(aPackageName))._load();
  29974. return self;
  29975. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  29976. },
  29977. args: ["aPackageName"],
  29978. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  29979. referencedClasses: [],
  29980. messageSends: ["load", "named:"]
  29981. }),
  29982. $globals.Package.klass);
  29983. $core.addMethod(
  29984. $core.method({
  29985. selector: "load:fromNamespace:",
  29986. protocol: '*Platform-ImportExport',
  29987. fn: function (aPackageName,aString){
  29988. var self=this;
  29989. return $core.withContext(function($ctx1) {
  29990. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  29991. return self;
  29992. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  29993. },
  29994. args: ["aPackageName", "aString"],
  29995. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  29996. referencedClasses: [],
  29997. messageSends: ["loadFromNamespace:", "named:"]
  29998. }),
  29999. $globals.Package.klass);
  30000. });
  30001. define("amber_core/Compiler-Exceptions", ["amber/boot", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  30002. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30003. $core.addPackage('Compiler-Exceptions');
  30004. $core.packages["Compiler-Exceptions"].innerEval = function (expr) { return eval(expr); };
  30005. $core.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30006. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Exceptions');
  30007. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  30008. $core.addClass('ParseError', $globals.CompilerError, [], 'Compiler-Exceptions');
  30009. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  30010. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Exceptions');
  30011. $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";
  30012. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Exceptions');
  30013. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  30014. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30015. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  30016. $core.addMethod(
  30017. $core.method({
  30018. selector: "messageText",
  30019. protocol: 'accessing',
  30020. fn: function (){
  30021. var self=this;
  30022. return $core.withContext(function($ctx1) {
  30023. var $1;
  30024. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  30025. return $1;
  30026. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  30027. },
  30028. args: [],
  30029. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  30030. referencedClasses: [],
  30031. messageSends: [",", "variableName"]
  30032. }),
  30033. $globals.InvalidAssignmentError);
  30034. $core.addMethod(
  30035. $core.method({
  30036. selector: "variableName",
  30037. protocol: 'accessing',
  30038. fn: function (){
  30039. var self=this;
  30040. var $1;
  30041. $1=self["@variableName"];
  30042. return $1;
  30043. },
  30044. args: [],
  30045. source: "variableName\x0a\x09^ variableName",
  30046. referencedClasses: [],
  30047. messageSends: []
  30048. }),
  30049. $globals.InvalidAssignmentError);
  30050. $core.addMethod(
  30051. $core.method({
  30052. selector: "variableName:",
  30053. protocol: 'accessing',
  30054. fn: function (aString){
  30055. var self=this;
  30056. self["@variableName"]=aString;
  30057. return self;
  30058. },
  30059. args: ["aString"],
  30060. source: "variableName: aString\x0a\x09variableName := aString",
  30061. referencedClasses: [],
  30062. messageSends: []
  30063. }),
  30064. $globals.InvalidAssignmentError);
  30065. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30066. $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.";
  30067. $core.addMethod(
  30068. $core.method({
  30069. selector: "messageText",
  30070. protocol: 'accessing',
  30071. fn: function (){
  30072. var self=this;
  30073. return $core.withContext(function($ctx1) {
  30074. var $1;
  30075. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  30076. $ctx1.sendIdx[","]=1;
  30077. return $1;
  30078. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  30079. },
  30080. args: [],
  30081. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  30082. referencedClasses: [],
  30083. messageSends: [",", "variableName"]
  30084. }),
  30085. $globals.ShadowingVariableError);
  30086. $core.addMethod(
  30087. $core.method({
  30088. selector: "variableName",
  30089. protocol: 'accessing',
  30090. fn: function (){
  30091. var self=this;
  30092. var $1;
  30093. $1=self["@variableName"];
  30094. return $1;
  30095. },
  30096. args: [],
  30097. source: "variableName\x0a\x09^ variableName",
  30098. referencedClasses: [],
  30099. messageSends: []
  30100. }),
  30101. $globals.ShadowingVariableError);
  30102. $core.addMethod(
  30103. $core.method({
  30104. selector: "variableName:",
  30105. protocol: 'accessing',
  30106. fn: function (aString){
  30107. var self=this;
  30108. self["@variableName"]=aString;
  30109. return self;
  30110. },
  30111. args: ["aString"],
  30112. source: "variableName: aString\x0a\x09variableName := aString",
  30113. referencedClasses: [],
  30114. messageSends: []
  30115. }),
  30116. $globals.ShadowingVariableError);
  30117. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30118. $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.";
  30119. $core.addMethod(
  30120. $core.method({
  30121. selector: "messageText",
  30122. protocol: 'accessing',
  30123. fn: function (){
  30124. var self=this;
  30125. return $core.withContext(function($ctx1) {
  30126. var $1;
  30127. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  30128. $ctx1.sendIdx[","]=1;
  30129. return $1;
  30130. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  30131. },
  30132. args: [],
  30133. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  30134. referencedClasses: [],
  30135. messageSends: [",", "variableName"]
  30136. }),
  30137. $globals.UnknownVariableError);
  30138. $core.addMethod(
  30139. $core.method({
  30140. selector: "variableName",
  30141. protocol: 'accessing',
  30142. fn: function (){
  30143. var self=this;
  30144. var $1;
  30145. $1=self["@variableName"];
  30146. return $1;
  30147. },
  30148. args: [],
  30149. source: "variableName\x0a\x09^ variableName",
  30150. referencedClasses: [],
  30151. messageSends: []
  30152. }),
  30153. $globals.UnknownVariableError);
  30154. $core.addMethod(
  30155. $core.method({
  30156. selector: "variableName:",
  30157. protocol: 'accessing',
  30158. fn: function (aString){
  30159. var self=this;
  30160. self["@variableName"]=aString;
  30161. return self;
  30162. },
  30163. args: ["aString"],
  30164. source: "variableName: aString\x0a\x09variableName := aString",
  30165. referencedClasses: [],
  30166. messageSends: []
  30167. }),
  30168. $globals.UnknownVariableError);
  30169. $core.addClass('RethrowErrorHandler', $globals.Object, [], 'Compiler-Exceptions');
  30170. $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.";
  30171. $core.addMethod(
  30172. $core.method({
  30173. selector: "basicSignal:",
  30174. protocol: 'error handling',
  30175. fn: function (anError){
  30176. var self=this;
  30177. return $core.withContext(function($ctx1) {
  30178. throw anError;
  30179. return self;
  30180. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
  30181. },
  30182. args: ["anError"],
  30183. source: "basicSignal: anError\x0a <throw anError>",
  30184. referencedClasses: [],
  30185. messageSends: []
  30186. }),
  30187. $globals.RethrowErrorHandler);
  30188. $core.addMethod(
  30189. $core.method({
  30190. selector: "handleError:",
  30191. protocol: 'error handling',
  30192. fn: function (anError){
  30193. var self=this;
  30194. return $core.withContext(function($ctx1) {
  30195. self._basicSignal_(anError);
  30196. return self;
  30197. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
  30198. },
  30199. args: ["anError"],
  30200. source: "handleError: anError\x0a self basicSignal: anError",
  30201. referencedClasses: [],
  30202. messageSends: ["basicSignal:"]
  30203. }),
  30204. $globals.RethrowErrorHandler);
  30205. });
  30206. define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Platform-Services", "amber_core/Kernel-Collections"], function($boot){"use strict";
  30207. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30208. $core.addPackage('Compiler-Core');
  30209. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  30210. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30211. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  30212. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  30213. $core.addMethod(
  30214. $core.method({
  30215. selector: "classNameFor:",
  30216. protocol: 'accessing',
  30217. fn: function (aClass){
  30218. var self=this;
  30219. return $core.withContext(function($ctx1) {
  30220. var $2,$3,$4,$1;
  30221. $2=$recv(aClass)._isMetaclass();
  30222. if($core.assert($2)){
  30223. $3=$recv($recv(aClass)._instanceClass())._name();
  30224. $ctx1.sendIdx["name"]=1;
  30225. $1=$recv($3).__comma(".klass");
  30226. } else {
  30227. $4=$recv(aClass)._isNil();
  30228. if($core.assert($4)){
  30229. $1="nil";
  30230. } else {
  30231. $1=$recv(aClass)._name();
  30232. };
  30233. };
  30234. return $1;
  30235. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractCodeGenerator)});
  30236. },
  30237. args: ["aClass"],
  30238. 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 ]]",
  30239. referencedClasses: [],
  30240. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  30241. }),
  30242. $globals.AbstractCodeGenerator);
  30243. $core.addMethod(
  30244. $core.method({
  30245. selector: "compileNode:",
  30246. protocol: 'compiling',
  30247. fn: function (aNode){
  30248. var self=this;
  30249. return $core.withContext(function($ctx1) {
  30250. self._subclassResponsibility();
  30251. return self;
  30252. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  30253. },
  30254. args: ["aNode"],
  30255. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  30256. referencedClasses: [],
  30257. messageSends: ["subclassResponsibility"]
  30258. }),
  30259. $globals.AbstractCodeGenerator);
  30260. $core.addMethod(
  30261. $core.method({
  30262. selector: "currentClass",
  30263. protocol: 'accessing',
  30264. fn: function (){
  30265. var self=this;
  30266. var $1;
  30267. $1=self["@currentClass"];
  30268. return $1;
  30269. },
  30270. args: [],
  30271. source: "currentClass\x0a\x09^ currentClass",
  30272. referencedClasses: [],
  30273. messageSends: []
  30274. }),
  30275. $globals.AbstractCodeGenerator);
  30276. $core.addMethod(
  30277. $core.method({
  30278. selector: "currentClass:",
  30279. protocol: 'accessing',
  30280. fn: function (aClass){
  30281. var self=this;
  30282. self["@currentClass"]=aClass;
  30283. return self;
  30284. },
  30285. args: ["aClass"],
  30286. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30287. referencedClasses: [],
  30288. messageSends: []
  30289. }),
  30290. $globals.AbstractCodeGenerator);
  30291. $core.addMethod(
  30292. $core.method({
  30293. selector: "currentPackage",
  30294. protocol: 'accessing',
  30295. fn: function (){
  30296. var self=this;
  30297. var $1;
  30298. $1=self["@currentPackage"];
  30299. return $1;
  30300. },
  30301. args: [],
  30302. source: "currentPackage\x0a\x09^ currentPackage",
  30303. referencedClasses: [],
  30304. messageSends: []
  30305. }),
  30306. $globals.AbstractCodeGenerator);
  30307. $core.addMethod(
  30308. $core.method({
  30309. selector: "currentPackage:",
  30310. protocol: 'accessing',
  30311. fn: function (anObject){
  30312. var self=this;
  30313. self["@currentPackage"]=anObject;
  30314. return self;
  30315. },
  30316. args: ["anObject"],
  30317. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30318. referencedClasses: [],
  30319. messageSends: []
  30320. }),
  30321. $globals.AbstractCodeGenerator);
  30322. $core.addMethod(
  30323. $core.method({
  30324. selector: "pseudoVariables",
  30325. protocol: 'accessing',
  30326. fn: function (){
  30327. var self=this;
  30328. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30329. return $core.withContext(function($ctx1) {
  30330. var $1;
  30331. $1=$recv($Smalltalk())._pseudoVariableNames();
  30332. return $1;
  30333. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  30334. },
  30335. args: [],
  30336. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  30337. referencedClasses: ["Smalltalk"],
  30338. messageSends: ["pseudoVariableNames"]
  30339. }),
  30340. $globals.AbstractCodeGenerator);
  30341. $core.addMethod(
  30342. $core.method({
  30343. selector: "source",
  30344. protocol: 'accessing',
  30345. fn: function (){
  30346. var self=this;
  30347. return $core.withContext(function($ctx1) {
  30348. var $2,$1,$receiver;
  30349. $2=self["@source"];
  30350. if(($receiver = $2) == null || $receiver.isNil){
  30351. $1="";
  30352. } else {
  30353. $1=$2;
  30354. };
  30355. return $1;
  30356. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  30357. },
  30358. args: [],
  30359. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30360. referencedClasses: [],
  30361. messageSends: ["ifNil:"]
  30362. }),
  30363. $globals.AbstractCodeGenerator);
  30364. $core.addMethod(
  30365. $core.method({
  30366. selector: "source:",
  30367. protocol: 'accessing',
  30368. fn: function (aString){
  30369. var self=this;
  30370. self["@source"]=aString;
  30371. return self;
  30372. },
  30373. args: ["aString"],
  30374. source: "source: aString\x0a\x09source := aString",
  30375. referencedClasses: [],
  30376. messageSends: []
  30377. }),
  30378. $globals.AbstractCodeGenerator);
  30379. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  30380. $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.";
  30381. $core.addMethod(
  30382. $core.method({
  30383. selector: "compileNode:",
  30384. protocol: 'compiling',
  30385. fn: function (aNode){
  30386. var self=this;
  30387. var ir,stream;
  30388. return $core.withContext(function($ctx1) {
  30389. var $2,$3,$1;
  30390. $recv(self._semanticAnalyzer())._visit_(aNode);
  30391. $ctx1.sendIdx["visit:"]=1;
  30392. ir=$recv(self._translator())._visit_(aNode);
  30393. $ctx1.sendIdx["visit:"]=2;
  30394. $2=self._irTranslator();
  30395. $recv($2)._currentClass_(self._currentClass());
  30396. $recv($2)._visit_(ir);
  30397. $3=$recv($2)._contents();
  30398. $1=$3;
  30399. return $1;
  30400. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
  30401. },
  30402. args: ["aNode"],
  30403. 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",
  30404. referencedClasses: [],
  30405. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  30406. }),
  30407. $globals.CodeGenerator);
  30408. $core.addMethod(
  30409. $core.method({
  30410. selector: "irTranslator",
  30411. protocol: 'compiling',
  30412. fn: function (){
  30413. var self=this;
  30414. function $IRJSTranslator(){return $globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  30415. return $core.withContext(function($ctx1) {
  30416. var $1;
  30417. $1=$recv($IRJSTranslator())._new();
  30418. return $1;
  30419. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  30420. },
  30421. args: [],
  30422. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  30423. referencedClasses: ["IRJSTranslator"],
  30424. messageSends: ["new"]
  30425. }),
  30426. $globals.CodeGenerator);
  30427. $core.addMethod(
  30428. $core.method({
  30429. selector: "semanticAnalyzer",
  30430. protocol: 'compiling',
  30431. fn: function (){
  30432. var self=this;
  30433. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  30434. return $core.withContext(function($ctx1) {
  30435. var $2,$3,$1;
  30436. $2=$recv($SemanticAnalyzer())._on_(self._currentClass());
  30437. $recv($2)._thePackage_(self._currentPackage());
  30438. $3=$recv($2)._yourself();
  30439. $1=$3;
  30440. return $1;
  30441. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  30442. },
  30443. args: [],
  30444. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  30445. referencedClasses: ["SemanticAnalyzer"],
  30446. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  30447. }),
  30448. $globals.CodeGenerator);
  30449. $core.addMethod(
  30450. $core.method({
  30451. selector: "translator",
  30452. protocol: 'compiling',
  30453. fn: function (){
  30454. var self=this;
  30455. function $IRASTTranslator(){return $globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  30456. return $core.withContext(function($ctx1) {
  30457. var $2,$3,$1;
  30458. $2=$recv($IRASTTranslator())._new();
  30459. $recv($2)._source_(self._source());
  30460. $recv($2)._theClass_(self._currentClass());
  30461. $3=$recv($2)._yourself();
  30462. $1=$3;
  30463. return $1;
  30464. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  30465. },
  30466. args: [],
  30467. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  30468. referencedClasses: ["IRASTTranslator"],
  30469. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  30470. }),
  30471. $globals.CodeGenerator);
  30472. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  30473. $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`";
  30474. $core.addMethod(
  30475. $core.method({
  30476. selector: "codeGeneratorClass",
  30477. protocol: 'accessing',
  30478. fn: function (){
  30479. var self=this;
  30480. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  30481. return $core.withContext(function($ctx1) {
  30482. var $2,$1,$receiver;
  30483. $2=self["@codeGeneratorClass"];
  30484. if(($receiver = $2) == null || $receiver.isNil){
  30485. $1=$InliningCodeGenerator();
  30486. } else {
  30487. $1=$2;
  30488. };
  30489. return $1;
  30490. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  30491. },
  30492. args: [],
  30493. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  30494. referencedClasses: ["InliningCodeGenerator"],
  30495. messageSends: ["ifNil:"]
  30496. }),
  30497. $globals.Compiler);
  30498. $core.addMethod(
  30499. $core.method({
  30500. selector: "codeGeneratorClass:",
  30501. protocol: 'accessing',
  30502. fn: function (aClass){
  30503. var self=this;
  30504. self["@codeGeneratorClass"]=aClass;
  30505. return self;
  30506. },
  30507. args: ["aClass"],
  30508. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30509. referencedClasses: [],
  30510. messageSends: []
  30511. }),
  30512. $globals.Compiler);
  30513. $core.addMethod(
  30514. $core.method({
  30515. selector: "compile:forClass:protocol:",
  30516. protocol: 'compiling',
  30517. fn: function (aString,aClass,anotherString){
  30518. var self=this;
  30519. return $core.withContext(function($ctx1) {
  30520. var $2,$1;
  30521. self._source_(aString);
  30522. $2=self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  30523. $1=$2;
  30524. return $1;
  30525. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  30526. },
  30527. args: ["aString", "aClass", "anotherString"],
  30528. 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)",
  30529. referencedClasses: [],
  30530. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  30531. }),
  30532. $globals.Compiler);
  30533. $core.addMethod(
  30534. $core.method({
  30535. selector: "compileExpression:on:",
  30536. protocol: 'compiling',
  30537. fn: function (aString,anObject){
  30538. var self=this;
  30539. return $core.withContext(function($ctx1) {
  30540. var $2,$1;
  30541. $2=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30542. $ctx1.sendIdx[","]=1;
  30543. $1=self._compile_forClass_protocol_($2,$recv(anObject)._class(),"**xxxDoIt");
  30544. return $1;
  30545. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  30546. },
  30547. args: ["aString", "anObject"],
  30548. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  30549. referencedClasses: [],
  30550. messageSends: ["compile:forClass:protocol:", ",", "class"]
  30551. }),
  30552. $globals.Compiler);
  30553. $core.addMethod(
  30554. $core.method({
  30555. selector: "compileNode:",
  30556. protocol: 'compiling',
  30557. fn: function (aNode){
  30558. var self=this;
  30559. var generator,result;
  30560. return $core.withContext(function($ctx1) {
  30561. var $1,$2,$3;
  30562. generator=$recv(self._codeGeneratorClass())._new();
  30563. $1=generator;
  30564. $recv($1)._source_(self._source());
  30565. $recv($1)._currentClass_(self._currentClass());
  30566. $2=$recv($1)._currentPackage_(self._currentPackage());
  30567. result=$recv(generator)._compileNode_(aNode);
  30568. self._unknownVariables_([]);
  30569. $3=result;
  30570. return $3;
  30571. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  30572. },
  30573. args: ["aNode"],
  30574. 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",
  30575. referencedClasses: [],
  30576. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  30577. }),
  30578. $globals.Compiler);
  30579. $core.addMethod(
  30580. $core.method({
  30581. selector: "compileNode:forClass:package:",
  30582. protocol: 'compiling',
  30583. fn: function (aNode,aClass,aPackage){
  30584. var self=this;
  30585. return $core.withContext(function($ctx1) {
  30586. var $2,$1;
  30587. self._currentClass_(aClass);
  30588. self._currentPackage_(aPackage);
  30589. $2=self._compileNode_(aNode);
  30590. $1=$2;
  30591. return $1;
  30592. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  30593. },
  30594. args: ["aNode", "aClass", "aPackage"],
  30595. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  30596. referencedClasses: [],
  30597. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  30598. }),
  30599. $globals.Compiler);
  30600. $core.addMethod(
  30601. $core.method({
  30602. selector: "currentClass",
  30603. protocol: 'accessing',
  30604. fn: function (){
  30605. var self=this;
  30606. var $1;
  30607. $1=self["@currentClass"];
  30608. return $1;
  30609. },
  30610. args: [],
  30611. source: "currentClass\x0a\x09^ currentClass",
  30612. referencedClasses: [],
  30613. messageSends: []
  30614. }),
  30615. $globals.Compiler);
  30616. $core.addMethod(
  30617. $core.method({
  30618. selector: "currentClass:",
  30619. protocol: 'accessing',
  30620. fn: function (aClass){
  30621. var self=this;
  30622. self["@currentClass"]=aClass;
  30623. return self;
  30624. },
  30625. args: ["aClass"],
  30626. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30627. referencedClasses: [],
  30628. messageSends: []
  30629. }),
  30630. $globals.Compiler);
  30631. $core.addMethod(
  30632. $core.method({
  30633. selector: "currentPackage",
  30634. protocol: 'accessing',
  30635. fn: function (){
  30636. var self=this;
  30637. var $1;
  30638. $1=self["@currentPackage"];
  30639. return $1;
  30640. },
  30641. args: [],
  30642. source: "currentPackage\x0a\x09^ currentPackage",
  30643. referencedClasses: [],
  30644. messageSends: []
  30645. }),
  30646. $globals.Compiler);
  30647. $core.addMethod(
  30648. $core.method({
  30649. selector: "currentPackage:",
  30650. protocol: 'accessing',
  30651. fn: function (anObject){
  30652. var self=this;
  30653. self["@currentPackage"]=anObject;
  30654. return self;
  30655. },
  30656. args: ["anObject"],
  30657. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30658. referencedClasses: [],
  30659. messageSends: []
  30660. }),
  30661. $globals.Compiler);
  30662. $core.addMethod(
  30663. $core.method({
  30664. selector: "eval:",
  30665. protocol: 'compiling',
  30666. fn: function (aString){
  30667. var self=this;
  30668. return $core.withContext(function($ctx1) {
  30669. return eval(aString);
  30670. return self;
  30671. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  30672. },
  30673. args: ["aString"],
  30674. source: "eval: aString\x0a\x09<return eval(aString)>",
  30675. referencedClasses: [],
  30676. messageSends: []
  30677. }),
  30678. $globals.Compiler);
  30679. $core.addMethod(
  30680. $core.method({
  30681. selector: "eval:forPackage:",
  30682. protocol: 'compiling',
  30683. fn: function (aString,aPackage){
  30684. var self=this;
  30685. return $core.withContext(function($ctx1) {
  30686. return aPackage && aPackage.innerEval
  30687. ? aPackage.innerEval(aString)
  30688. : eval(aString);
  30689. return self;
  30690. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  30691. },
  30692. args: ["aString", "aPackage"],
  30693. source: "eval: aString forPackage: aPackage\x0a\x09<return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)>",
  30694. referencedClasses: [],
  30695. messageSends: []
  30696. }),
  30697. $globals.Compiler);
  30698. $core.addMethod(
  30699. $core.method({
  30700. selector: "evaluateExpression:",
  30701. protocol: 'compiling',
  30702. fn: function (aString){
  30703. var self=this;
  30704. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  30705. return $core.withContext(function($ctx1) {
  30706. var $1;
  30707. $1=self._evaluateExpression_on_(aString,$recv($DoIt())._new());
  30708. return $1;
  30709. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  30710. },
  30711. args: ["aString"],
  30712. 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",
  30713. referencedClasses: ["DoIt"],
  30714. messageSends: ["evaluateExpression:on:", "new"]
  30715. }),
  30716. $globals.Compiler);
  30717. $core.addMethod(
  30718. $core.method({
  30719. selector: "evaluateExpression:on:",
  30720. protocol: 'compiling',
  30721. fn: function (aString,anObject){
  30722. var self=this;
  30723. var result,method;
  30724. return $core.withContext(function($ctx1) {
  30725. var $1,$2;
  30726. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30727. $recv(method)._protocol_("**xxxDoIt");
  30728. $1=$recv(anObject)._class();
  30729. $ctx1.sendIdx["class"]=1;
  30730. $recv($1)._addCompiledMethod_(method);
  30731. result=$recv(anObject)._xxxDoIt();
  30732. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  30733. $2=result;
  30734. return $2;
  30735. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  30736. },
  30737. args: ["aString", "anObject"],
  30738. 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",
  30739. referencedClasses: [],
  30740. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30741. }),
  30742. $globals.Compiler);
  30743. $core.addMethod(
  30744. $core.method({
  30745. selector: "install:forClass:protocol:",
  30746. protocol: 'compiling',
  30747. fn: function (aString,aBehavior,anotherString){
  30748. var self=this;
  30749. var compiledMethod;
  30750. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  30751. return $core.withContext(function($ctx1) {
  30752. var $1;
  30753. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  30754. $1=$recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  30755. return $1;
  30756. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  30757. },
  30758. args: ["aString", "aBehavior", "anotherString"],
  30759. 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",
  30760. referencedClasses: ["ClassBuilder"],
  30761. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  30762. }),
  30763. $globals.Compiler);
  30764. $core.addMethod(
  30765. $core.method({
  30766. selector: "parse:",
  30767. protocol: 'compiling',
  30768. fn: function (aString){
  30769. var self=this;
  30770. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30771. return $core.withContext(function($ctx1) {
  30772. var $1;
  30773. $1=$recv($Smalltalk())._parse_(aString);
  30774. return $1;
  30775. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  30776. },
  30777. args: ["aString"],
  30778. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30779. referencedClasses: ["Smalltalk"],
  30780. messageSends: ["parse:"]
  30781. }),
  30782. $globals.Compiler);
  30783. $core.addMethod(
  30784. $core.method({
  30785. selector: "parseExpression:",
  30786. protocol: 'compiling',
  30787. fn: function (aString){
  30788. var self=this;
  30789. return $core.withContext(function($ctx1) {
  30790. var $2,$1;
  30791. $2=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30792. $ctx1.sendIdx[","]=1;
  30793. $1=self._parse_($2);
  30794. return $1;
  30795. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  30796. },
  30797. args: ["aString"],
  30798. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30799. referencedClasses: [],
  30800. messageSends: ["parse:", ","]
  30801. }),
  30802. $globals.Compiler);
  30803. $core.addMethod(
  30804. $core.method({
  30805. selector: "recompile:",
  30806. protocol: 'compiling',
  30807. fn: function (aClass){
  30808. var self=this;
  30809. return $core.withContext(function($ctx1) {
  30810. var $1;
  30811. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30812. return $core.withContext(function($ctx2) {
  30813. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  30814. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30815. }),"Recompiling ".__comma($recv(aClass)._name()));
  30816. $1=$recv(aClass)._isMetaclass();
  30817. if(!$core.assert($1)){
  30818. self._recompile_($recv(aClass)._class());
  30819. };
  30820. return self;
  30821. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  30822. },
  30823. args: ["aClass"],
  30824. 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 ]",
  30825. referencedClasses: [],
  30826. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30827. }),
  30828. $globals.Compiler);
  30829. $core.addMethod(
  30830. $core.method({
  30831. selector: "recompileAll",
  30832. protocol: 'compiling',
  30833. fn: function (){
  30834. var self=this;
  30835. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30836. return $core.withContext(function($ctx1) {
  30837. $recv($recv($Smalltalk())._classes())._do_displayingProgress_((function(each){
  30838. return $core.withContext(function($ctx2) {
  30839. return self._recompile_(each);
  30840. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30841. }),"Compiling all classes...");
  30842. return self;
  30843. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  30844. },
  30845. args: [],
  30846. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30847. referencedClasses: ["Smalltalk"],
  30848. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30849. }),
  30850. $globals.Compiler);
  30851. $core.addMethod(
  30852. $core.method({
  30853. selector: "source",
  30854. protocol: 'accessing',
  30855. fn: function (){
  30856. var self=this;
  30857. return $core.withContext(function($ctx1) {
  30858. var $2,$1,$receiver;
  30859. $2=self["@source"];
  30860. if(($receiver = $2) == null || $receiver.isNil){
  30861. $1="";
  30862. } else {
  30863. $1=$2;
  30864. };
  30865. return $1;
  30866. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  30867. },
  30868. args: [],
  30869. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30870. referencedClasses: [],
  30871. messageSends: ["ifNil:"]
  30872. }),
  30873. $globals.Compiler);
  30874. $core.addMethod(
  30875. $core.method({
  30876. selector: "source:",
  30877. protocol: 'accessing',
  30878. fn: function (aString){
  30879. var self=this;
  30880. self["@source"]=aString;
  30881. return self;
  30882. },
  30883. args: ["aString"],
  30884. source: "source: aString\x0a\x09source := aString",
  30885. referencedClasses: [],
  30886. messageSends: []
  30887. }),
  30888. $globals.Compiler);
  30889. $core.addMethod(
  30890. $core.method({
  30891. selector: "unknownVariables",
  30892. protocol: 'accessing',
  30893. fn: function (){
  30894. var self=this;
  30895. var $1;
  30896. $1=self["@unknownVariables"];
  30897. return $1;
  30898. },
  30899. args: [],
  30900. source: "unknownVariables\x0a\x09^ unknownVariables",
  30901. referencedClasses: [],
  30902. messageSends: []
  30903. }),
  30904. $globals.Compiler);
  30905. $core.addMethod(
  30906. $core.method({
  30907. selector: "unknownVariables:",
  30908. protocol: 'accessing',
  30909. fn: function (aCollection){
  30910. var self=this;
  30911. self["@unknownVariables"]=aCollection;
  30912. return self;
  30913. },
  30914. args: ["aCollection"],
  30915. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  30916. referencedClasses: [],
  30917. messageSends: []
  30918. }),
  30919. $globals.Compiler);
  30920. $core.addMethod(
  30921. $core.method({
  30922. selector: "recompile:",
  30923. protocol: 'compiling',
  30924. fn: function (aClass){
  30925. var self=this;
  30926. return $core.withContext(function($ctx1) {
  30927. $recv(self._new())._recompile_(aClass);
  30928. return self;
  30929. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  30930. },
  30931. args: ["aClass"],
  30932. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  30933. referencedClasses: [],
  30934. messageSends: ["recompile:", "new"]
  30935. }),
  30936. $globals.Compiler.klass);
  30937. $core.addMethod(
  30938. $core.method({
  30939. selector: "recompileAll",
  30940. protocol: 'compiling',
  30941. fn: function (){
  30942. var self=this;
  30943. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30944. return $core.withContext(function($ctx1) {
  30945. $recv($recv($Smalltalk())._classes())._do_((function(each){
  30946. return $core.withContext(function($ctx2) {
  30947. return self._recompile_(each);
  30948. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30949. }));
  30950. return self;
  30951. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  30952. },
  30953. args: [],
  30954. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  30955. referencedClasses: ["Smalltalk"],
  30956. messageSends: ["do:", "classes", "recompile:"]
  30957. }),
  30958. $globals.Compiler.klass);
  30959. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  30960. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  30961. $core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core');
  30962. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  30963. $core.addMethod(
  30964. $core.method({
  30965. selector: "evaluate:context:",
  30966. protocol: 'evaluating',
  30967. fn: function (aString,aContext){
  30968. var self=this;
  30969. var compiler,ast;
  30970. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  30971. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  30972. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  30973. return $core.withContext(function($ctx1) {
  30974. var $1,$2,$3,$4;
  30975. var $early={};
  30976. try {
  30977. compiler=$recv($Compiler())._new();
  30978. $recv((function(){
  30979. return $core.withContext(function($ctx2) {
  30980. ast=$recv(compiler)._parseExpression_(aString);
  30981. return ast;
  30982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30983. }))._on_do_($Error(),(function(ex){
  30984. return $core.withContext(function($ctx2) {
  30985. $1=self._alert_($recv(ex)._messageText());
  30986. throw $early=[$1];
  30987. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30988. }));
  30989. $2=$recv($AISemanticAnalyzer())._on_($recv($recv(aContext)._receiver())._class());
  30990. $recv($2)._context_(aContext);
  30991. $3=$recv($2)._visit_(ast);
  30992. $4=$recv(aContext)._evaluateNode_(ast);
  30993. return $4;
  30994. }
  30995. catch(e) {if(e===$early)return e[0]; throw e}
  30996. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  30997. },
  30998. args: ["aString", "aContext"],
  30999. 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",
  31000. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
  31001. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  31002. }),
  31003. $globals.Evaluator);
  31004. $core.addMethod(
  31005. $core.method({
  31006. selector: "evaluate:for:",
  31007. protocol: 'evaluating',
  31008. fn: function (aString,anObject){
  31009. var self=this;
  31010. return $core.withContext(function($ctx1) {
  31011. var $1;
  31012. $1=$recv(anObject)._evaluate_on_(aString,self);
  31013. return $1;
  31014. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  31015. },
  31016. args: ["aString", "anObject"],
  31017. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  31018. referencedClasses: [],
  31019. messageSends: ["evaluate:on:"]
  31020. }),
  31021. $globals.Evaluator);
  31022. $core.addMethod(
  31023. $core.method({
  31024. selector: "evaluate:receiver:",
  31025. protocol: 'evaluating',
  31026. fn: function (aString,anObject){
  31027. var self=this;
  31028. var compiler;
  31029. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  31030. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  31031. return $core.withContext(function($ctx1) {
  31032. var $1,$2;
  31033. var $early={};
  31034. try {
  31035. compiler=$recv($Compiler())._new();
  31036. $recv((function(){
  31037. return $core.withContext(function($ctx2) {
  31038. return $recv(compiler)._parseExpression_(aString);
  31039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31040. }))._on_do_($Error(),(function(ex){
  31041. return $core.withContext(function($ctx2) {
  31042. $1=self._alert_($recv(ex)._messageText());
  31043. throw $early=[$1];
  31044. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  31045. }));
  31046. $2=$recv(compiler)._evaluateExpression_on_(aString,anObject);
  31047. return $2;
  31048. }
  31049. catch(e) {if(e===$early)return e[0]; throw e}
  31050. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  31051. },
  31052. args: ["aString", "anObject"],
  31053. 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",
  31054. referencedClasses: ["Compiler", "Error"],
  31055. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  31056. }),
  31057. $globals.Evaluator);
  31058. $core.addMethod(
  31059. $core.method({
  31060. selector: "evaluate:for:",
  31061. protocol: 'instance creation',
  31062. fn: function (aString,anObject){
  31063. var self=this;
  31064. return $core.withContext(function($ctx1) {
  31065. var $1;
  31066. $1=$recv(self._new())._evaluate_for_(aString,anObject);
  31067. return $1;
  31068. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  31069. },
  31070. args: ["aString", "anObject"],
  31071. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  31072. referencedClasses: [],
  31073. messageSends: ["evaluate:for:", "new"]
  31074. }),
  31075. $globals.Evaluator.klass);
  31076. $core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-Core');
  31077. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  31078. $core.addMethod(
  31079. $core.method({
  31080. selector: "visit:",
  31081. protocol: 'visiting',
  31082. fn: function (aNode){
  31083. var self=this;
  31084. return $core.withContext(function($ctx1) {
  31085. var $1;
  31086. $1=$recv(aNode)._accept_(self);
  31087. return $1;
  31088. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
  31089. },
  31090. args: ["aNode"],
  31091. source: "visit: aNode\x0a\x09^ aNode accept: self",
  31092. referencedClasses: [],
  31093. messageSends: ["accept:"]
  31094. }),
  31095. $globals.NodeVisitor);
  31096. $core.addMethod(
  31097. $core.method({
  31098. selector: "visitAll:",
  31099. protocol: 'visiting',
  31100. fn: function (aCollection){
  31101. var self=this;
  31102. return $core.withContext(function($ctx1) {
  31103. var $1;
  31104. $1=$recv(aCollection)._collect_((function(each){
  31105. return $core.withContext(function($ctx2) {
  31106. return self._visit_(each);
  31107. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31108. }));
  31109. return $1;
  31110. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
  31111. },
  31112. args: ["aCollection"],
  31113. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  31114. referencedClasses: [],
  31115. messageSends: ["collect:", "visit:"]
  31116. }),
  31117. $globals.NodeVisitor);
  31118. $core.addMethod(
  31119. $core.method({
  31120. selector: "visitAssignmentNode:",
  31121. protocol: 'visiting',
  31122. fn: function (aNode){
  31123. var self=this;
  31124. return $core.withContext(function($ctx1) {
  31125. var $1;
  31126. $1=self._visitNode_(aNode);
  31127. return $1;
  31128. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  31129. },
  31130. args: ["aNode"],
  31131. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  31132. referencedClasses: [],
  31133. messageSends: ["visitNode:"]
  31134. }),
  31135. $globals.NodeVisitor);
  31136. $core.addMethod(
  31137. $core.method({
  31138. selector: "visitBlockNode:",
  31139. protocol: 'visiting',
  31140. fn: function (aNode){
  31141. var self=this;
  31142. return $core.withContext(function($ctx1) {
  31143. var $1;
  31144. $1=self._visitNode_(aNode);
  31145. return $1;
  31146. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  31147. },
  31148. args: ["aNode"],
  31149. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  31150. referencedClasses: [],
  31151. messageSends: ["visitNode:"]
  31152. }),
  31153. $globals.NodeVisitor);
  31154. $core.addMethod(
  31155. $core.method({
  31156. selector: "visitBlockSequenceNode:",
  31157. protocol: 'visiting',
  31158. fn: function (aNode){
  31159. var self=this;
  31160. return $core.withContext(function($ctx1) {
  31161. var $1;
  31162. $1=self._visitSequenceNode_(aNode);
  31163. return $1;
  31164. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  31165. },
  31166. args: ["aNode"],
  31167. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  31168. referencedClasses: [],
  31169. messageSends: ["visitSequenceNode:"]
  31170. }),
  31171. $globals.NodeVisitor);
  31172. $core.addMethod(
  31173. $core.method({
  31174. selector: "visitCascadeNode:",
  31175. protocol: 'visiting',
  31176. fn: function (aNode){
  31177. var self=this;
  31178. return $core.withContext(function($ctx1) {
  31179. var $1;
  31180. $1=self._visitNode_(aNode);
  31181. return $1;
  31182. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  31183. },
  31184. args: ["aNode"],
  31185. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  31186. referencedClasses: [],
  31187. messageSends: ["visitNode:"]
  31188. }),
  31189. $globals.NodeVisitor);
  31190. $core.addMethod(
  31191. $core.method({
  31192. selector: "visitDynamicArrayNode:",
  31193. protocol: 'visiting',
  31194. fn: function (aNode){
  31195. var self=this;
  31196. return $core.withContext(function($ctx1) {
  31197. var $1;
  31198. $1=self._visitNode_(aNode);
  31199. return $1;
  31200. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  31201. },
  31202. args: ["aNode"],
  31203. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  31204. referencedClasses: [],
  31205. messageSends: ["visitNode:"]
  31206. }),
  31207. $globals.NodeVisitor);
  31208. $core.addMethod(
  31209. $core.method({
  31210. selector: "visitDynamicDictionaryNode:",
  31211. protocol: 'visiting',
  31212. fn: function (aNode){
  31213. var self=this;
  31214. return $core.withContext(function($ctx1) {
  31215. var $1;
  31216. $1=self._visitNode_(aNode);
  31217. return $1;
  31218. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  31219. },
  31220. args: ["aNode"],
  31221. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  31222. referencedClasses: [],
  31223. messageSends: ["visitNode:"]
  31224. }),
  31225. $globals.NodeVisitor);
  31226. $core.addMethod(
  31227. $core.method({
  31228. selector: "visitJSStatementNode:",
  31229. protocol: 'visiting',
  31230. fn: function (aNode){
  31231. var self=this;
  31232. return $core.withContext(function($ctx1) {
  31233. var $1;
  31234. $1=self._visitNode_(aNode);
  31235. return $1;
  31236. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  31237. },
  31238. args: ["aNode"],
  31239. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  31240. referencedClasses: [],
  31241. messageSends: ["visitNode:"]
  31242. }),
  31243. $globals.NodeVisitor);
  31244. $core.addMethod(
  31245. $core.method({
  31246. selector: "visitMethodNode:",
  31247. protocol: 'visiting',
  31248. fn: function (aNode){
  31249. var self=this;
  31250. return $core.withContext(function($ctx1) {
  31251. var $1;
  31252. $1=self._visitNode_(aNode);
  31253. return $1;
  31254. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  31255. },
  31256. args: ["aNode"],
  31257. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  31258. referencedClasses: [],
  31259. messageSends: ["visitNode:"]
  31260. }),
  31261. $globals.NodeVisitor);
  31262. $core.addMethod(
  31263. $core.method({
  31264. selector: "visitNode:",
  31265. protocol: 'visiting',
  31266. fn: function (aNode){
  31267. var self=this;
  31268. return $core.withContext(function($ctx1) {
  31269. var $1;
  31270. $1=self._visitAll_($recv(aNode)._nodes());
  31271. return $1;
  31272. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
  31273. },
  31274. args: ["aNode"],
  31275. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  31276. referencedClasses: [],
  31277. messageSends: ["visitAll:", "nodes"]
  31278. }),
  31279. $globals.NodeVisitor);
  31280. $core.addMethod(
  31281. $core.method({
  31282. selector: "visitReturnNode:",
  31283. protocol: 'visiting',
  31284. fn: function (aNode){
  31285. var self=this;
  31286. return $core.withContext(function($ctx1) {
  31287. var $1;
  31288. $1=self._visitNode_(aNode);
  31289. return $1;
  31290. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  31291. },
  31292. args: ["aNode"],
  31293. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  31294. referencedClasses: [],
  31295. messageSends: ["visitNode:"]
  31296. }),
  31297. $globals.NodeVisitor);
  31298. $core.addMethod(
  31299. $core.method({
  31300. selector: "visitSendNode:",
  31301. protocol: 'visiting',
  31302. fn: function (aNode){
  31303. var self=this;
  31304. return $core.withContext(function($ctx1) {
  31305. var $1;
  31306. $1=self._visitNode_(aNode);
  31307. return $1;
  31308. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  31309. },
  31310. args: ["aNode"],
  31311. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  31312. referencedClasses: [],
  31313. messageSends: ["visitNode:"]
  31314. }),
  31315. $globals.NodeVisitor);
  31316. $core.addMethod(
  31317. $core.method({
  31318. selector: "visitSequenceNode:",
  31319. protocol: 'visiting',
  31320. fn: function (aNode){
  31321. var self=this;
  31322. return $core.withContext(function($ctx1) {
  31323. var $1;
  31324. $1=self._visitNode_(aNode);
  31325. return $1;
  31326. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  31327. },
  31328. args: ["aNode"],
  31329. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  31330. referencedClasses: [],
  31331. messageSends: ["visitNode:"]
  31332. }),
  31333. $globals.NodeVisitor);
  31334. $core.addMethod(
  31335. $core.method({
  31336. selector: "visitValueNode:",
  31337. protocol: 'visiting',
  31338. fn: function (aNode){
  31339. var self=this;
  31340. return $core.withContext(function($ctx1) {
  31341. var $1;
  31342. $1=self._visitNode_(aNode);
  31343. return $1;
  31344. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  31345. },
  31346. args: ["aNode"],
  31347. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  31348. referencedClasses: [],
  31349. messageSends: ["visitNode:"]
  31350. }),
  31351. $globals.NodeVisitor);
  31352. $core.addMethod(
  31353. $core.method({
  31354. selector: "visitVariableNode:",
  31355. protocol: 'visiting',
  31356. fn: function (aNode){
  31357. var self=this;
  31358. return $core.withContext(function($ctx1) {
  31359. var $1;
  31360. $1=self._visitNode_(aNode);
  31361. return $1;
  31362. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  31363. },
  31364. args: ["aNode"],
  31365. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  31366. referencedClasses: [],
  31367. messageSends: ["visitNode:"]
  31368. }),
  31369. $globals.NodeVisitor);
  31370. $core.addMethod(
  31371. $core.method({
  31372. selector: "asVariableName",
  31373. protocol: '*Compiler-Core',
  31374. fn: function (){
  31375. var self=this;
  31376. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  31377. return $core.withContext(function($ctx1) {
  31378. var $2,$1;
  31379. $2=$recv($recv($Smalltalk())._reservedWords())._includes_(self);
  31380. if($core.assert($2)){
  31381. $1=self.__comma("_");
  31382. } else {
  31383. $1=self;
  31384. };
  31385. return $1;
  31386. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  31387. },
  31388. args: [],
  31389. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  31390. referencedClasses: ["Smalltalk"],
  31391. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  31392. }),
  31393. $globals.String);
  31394. });
  31395. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  31396. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  31397. $core.addPackage('Compiler-AST');
  31398. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  31399. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  31400. $core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  31401. $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.";
  31402. $core.addMethod(
  31403. $core.method({
  31404. selector: "accept:",
  31405. protocol: 'visiting',
  31406. fn: function (aVisitor){
  31407. var self=this;
  31408. return $core.withContext(function($ctx1) {
  31409. var $1;
  31410. $1=$recv(aVisitor)._visitNode_(self);
  31411. return $1;
  31412. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)});
  31413. },
  31414. args: ["aVisitor"],
  31415. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  31416. referencedClasses: [],
  31417. messageSends: ["visitNode:"]
  31418. }),
  31419. $globals.Node);
  31420. $core.addMethod(
  31421. $core.method({
  31422. selector: "addNode:",
  31423. protocol: 'accessing',
  31424. fn: function (aNode){
  31425. var self=this;
  31426. return $core.withContext(function($ctx1) {
  31427. $recv(self._nodes())._add_(aNode);
  31428. $recv(aNode)._parent_(self);
  31429. return self;
  31430. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)});
  31431. },
  31432. args: ["aNode"],
  31433. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  31434. referencedClasses: [],
  31435. messageSends: ["add:", "nodes", "parent:"]
  31436. }),
  31437. $globals.Node);
  31438. $core.addMethod(
  31439. $core.method({
  31440. selector: "allNodes",
  31441. protocol: 'accessing',
  31442. fn: function (){
  31443. var self=this;
  31444. var allNodes;
  31445. return $core.withContext(function($ctx1) {
  31446. var $1,$2;
  31447. $1=self._nodes();
  31448. $ctx1.sendIdx["nodes"]=1;
  31449. allNodes=$recv($1)._asSet();
  31450. $recv(self._nodes())._do_((function(each){
  31451. return $core.withContext(function($ctx2) {
  31452. return $recv(allNodes)._addAll_($recv(each)._allNodes());
  31453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31454. }));
  31455. $2=allNodes;
  31456. return $2;
  31457. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)});
  31458. },
  31459. args: [],
  31460. 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",
  31461. referencedClasses: [],
  31462. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  31463. }),
  31464. $globals.Node);
  31465. $core.addMethod(
  31466. $core.method({
  31467. selector: "inPosition:",
  31468. protocol: 'testing',
  31469. fn: function (aPoint){
  31470. var self=this;
  31471. return $core.withContext(function($ctx1) {
  31472. var $1;
  31473. $1=$recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  31474. return $core.withContext(function($ctx2) {
  31475. return $recv(self._positionEnd()).__gt_eq(aPoint);
  31476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31477. }));
  31478. return $1;
  31479. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)});
  31480. },
  31481. args: ["aPoint"],
  31482. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  31483. referencedClasses: [],
  31484. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  31485. }),
  31486. $globals.Node);
  31487. $core.addMethod(
  31488. $core.method({
  31489. selector: "isAssignmentNode",
  31490. protocol: 'testing',
  31491. fn: function (){
  31492. var self=this;
  31493. return false;
  31494. },
  31495. args: [],
  31496. source: "isAssignmentNode\x0a\x09^ false",
  31497. referencedClasses: [],
  31498. messageSends: []
  31499. }),
  31500. $globals.Node);
  31501. $core.addMethod(
  31502. $core.method({
  31503. selector: "isBlockNode",
  31504. protocol: 'testing',
  31505. fn: function (){
  31506. var self=this;
  31507. return false;
  31508. },
  31509. args: [],
  31510. source: "isBlockNode\x0a\x09^ false",
  31511. referencedClasses: [],
  31512. messageSends: []
  31513. }),
  31514. $globals.Node);
  31515. $core.addMethod(
  31516. $core.method({
  31517. selector: "isBlockSequenceNode",
  31518. protocol: 'testing',
  31519. fn: function (){
  31520. var self=this;
  31521. return false;
  31522. },
  31523. args: [],
  31524. source: "isBlockSequenceNode\x0a\x09^ false",
  31525. referencedClasses: [],
  31526. messageSends: []
  31527. }),
  31528. $globals.Node);
  31529. $core.addMethod(
  31530. $core.method({
  31531. selector: "isCascadeNode",
  31532. protocol: 'testing',
  31533. fn: function (){
  31534. var self=this;
  31535. return false;
  31536. },
  31537. args: [],
  31538. source: "isCascadeNode\x0a\x09^ false",
  31539. referencedClasses: [],
  31540. messageSends: []
  31541. }),
  31542. $globals.Node);
  31543. $core.addMethod(
  31544. $core.method({
  31545. selector: "isImmutable",
  31546. protocol: 'testing',
  31547. fn: function (){
  31548. var self=this;
  31549. return false;
  31550. },
  31551. args: [],
  31552. source: "isImmutable\x0a\x09^ false",
  31553. referencedClasses: [],
  31554. messageSends: []
  31555. }),
  31556. $globals.Node);
  31557. $core.addMethod(
  31558. $core.method({
  31559. selector: "isJSStatementNode",
  31560. protocol: 'testing',
  31561. fn: function (){
  31562. var self=this;
  31563. return false;
  31564. },
  31565. args: [],
  31566. source: "isJSStatementNode\x0a\x09^ false",
  31567. referencedClasses: [],
  31568. messageSends: []
  31569. }),
  31570. $globals.Node);
  31571. $core.addMethod(
  31572. $core.method({
  31573. selector: "isLastChild",
  31574. protocol: 'testing',
  31575. fn: function (){
  31576. var self=this;
  31577. return $core.withContext(function($ctx1) {
  31578. var $1;
  31579. $1=$recv($recv($recv(self._parent())._nodes())._last()).__eq(self);
  31580. return $1;
  31581. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)});
  31582. },
  31583. args: [],
  31584. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  31585. referencedClasses: [],
  31586. messageSends: ["=", "last", "nodes", "parent"]
  31587. }),
  31588. $globals.Node);
  31589. $core.addMethod(
  31590. $core.method({
  31591. selector: "isNavigationNode",
  31592. protocol: 'testing',
  31593. fn: function (){
  31594. var self=this;
  31595. return false;
  31596. },
  31597. args: [],
  31598. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  31599. referencedClasses: [],
  31600. messageSends: []
  31601. }),
  31602. $globals.Node);
  31603. $core.addMethod(
  31604. $core.method({
  31605. selector: "isNode",
  31606. protocol: 'testing',
  31607. fn: function (){
  31608. var self=this;
  31609. return true;
  31610. },
  31611. args: [],
  31612. source: "isNode\x0a\x09^ true",
  31613. referencedClasses: [],
  31614. messageSends: []
  31615. }),
  31616. $globals.Node);
  31617. $core.addMethod(
  31618. $core.method({
  31619. selector: "isReferenced",
  31620. protocol: 'testing',
  31621. fn: function (){
  31622. var self=this;
  31623. return $core.withContext(function($ctx1) {
  31624. var $4,$3,$2,$1;
  31625. $4=self._parent();
  31626. $ctx1.sendIdx["parent"]=1;
  31627. $3=$recv($4)._isSequenceNode();
  31628. $2=$recv($3)._or_((function(){
  31629. return $core.withContext(function($ctx2) {
  31630. return $recv(self._parent())._isAssignmentNode();
  31631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31632. }));
  31633. $1=$recv($2)._not();
  31634. return $1;
  31635. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)});
  31636. },
  31637. args: [],
  31638. 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",
  31639. referencedClasses: [],
  31640. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  31641. }),
  31642. $globals.Node);
  31643. $core.addMethod(
  31644. $core.method({
  31645. selector: "isReturnNode",
  31646. protocol: 'testing',
  31647. fn: function (){
  31648. var self=this;
  31649. return false;
  31650. },
  31651. args: [],
  31652. source: "isReturnNode\x0a\x09^ false",
  31653. referencedClasses: [],
  31654. messageSends: []
  31655. }),
  31656. $globals.Node);
  31657. $core.addMethod(
  31658. $core.method({
  31659. selector: "isSendNode",
  31660. protocol: 'testing',
  31661. fn: function (){
  31662. var self=this;
  31663. return false;
  31664. },
  31665. args: [],
  31666. source: "isSendNode\x0a\x09^ false",
  31667. referencedClasses: [],
  31668. messageSends: []
  31669. }),
  31670. $globals.Node);
  31671. $core.addMethod(
  31672. $core.method({
  31673. selector: "isSequenceNode",
  31674. protocol: 'testing',
  31675. fn: function (){
  31676. var self=this;
  31677. return false;
  31678. },
  31679. args: [],
  31680. source: "isSequenceNode\x0a\x09^ false",
  31681. referencedClasses: [],
  31682. messageSends: []
  31683. }),
  31684. $globals.Node);
  31685. $core.addMethod(
  31686. $core.method({
  31687. selector: "isValueNode",
  31688. protocol: 'testing',
  31689. fn: function (){
  31690. var self=this;
  31691. return false;
  31692. },
  31693. args: [],
  31694. source: "isValueNode\x0a\x09^ false",
  31695. referencedClasses: [],
  31696. messageSends: []
  31697. }),
  31698. $globals.Node);
  31699. $core.addMethod(
  31700. $core.method({
  31701. selector: "isVariableNode",
  31702. protocol: 'testing',
  31703. fn: function (){
  31704. var self=this;
  31705. return false;
  31706. },
  31707. args: [],
  31708. source: "isVariableNode\x0a\x09^ false",
  31709. referencedClasses: [],
  31710. messageSends: []
  31711. }),
  31712. $globals.Node);
  31713. $core.addMethod(
  31714. $core.method({
  31715. selector: "method",
  31716. protocol: 'accessing',
  31717. fn: function (){
  31718. var self=this;
  31719. return $core.withContext(function($ctx1) {
  31720. var $2,$1,$receiver;
  31721. $2=self._parent();
  31722. if(($receiver = $2) == null || $receiver.isNil){
  31723. $1=$2;
  31724. } else {
  31725. var node;
  31726. node=$receiver;
  31727. $1=$recv(node)._method();
  31728. };
  31729. return $1;
  31730. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)});
  31731. },
  31732. args: [],
  31733. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  31734. referencedClasses: [],
  31735. messageSends: ["ifNotNil:", "parent", "method"]
  31736. }),
  31737. $globals.Node);
  31738. $core.addMethod(
  31739. $core.method({
  31740. selector: "navigationNodeAt:ifAbsent:",
  31741. protocol: 'accessing',
  31742. fn: function (aPoint,aBlock){
  31743. var self=this;
  31744. var children;
  31745. return $core.withContext(function($ctx1) {
  31746. var $1,$4,$3,$2;
  31747. var $early={};
  31748. try {
  31749. children=$recv(self._allNodes())._select_((function(each){
  31750. return $core.withContext(function($ctx2) {
  31751. return $recv($recv(each)._isNavigationNode())._and_((function(){
  31752. return $core.withContext(function($ctx3) {
  31753. return $recv(each)._inPosition_(aPoint);
  31754. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31755. }));
  31756. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31757. }));
  31758. $recv(children)._ifEmpty_((function(){
  31759. return $core.withContext(function($ctx2) {
  31760. $1=$recv(aBlock)._value();
  31761. throw $early=[$1];
  31762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31763. }));
  31764. $2=$recv($recv($recv(children)._asArray())._sort_((function(a,b){
  31765. return $core.withContext(function($ctx2) {
  31766. $4=$recv(a)._positionStart();
  31767. $ctx2.sendIdx["positionStart"]=1;
  31768. $3=$recv($4)._dist_(aPoint);
  31769. $ctx2.sendIdx["dist:"]=1;
  31770. return $recv($3).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  31771. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  31772. })))._first();
  31773. return $2;
  31774. }
  31775. catch(e) {if(e===$early)return e[0]; throw e}
  31776. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)});
  31777. },
  31778. args: ["aPoint", "aBlock"],
  31779. 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",
  31780. referencedClasses: [],
  31781. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  31782. }),
  31783. $globals.Node);
  31784. $core.addMethod(
  31785. $core.method({
  31786. selector: "nextChild",
  31787. protocol: 'accessing',
  31788. fn: function (){
  31789. var self=this;
  31790. return $core.withContext(function($ctx1) {
  31791. var $3,$2,$1;
  31792. $3=self._nodes();
  31793. $ctx1.sendIdx["nodes"]=1;
  31794. $2=$recv($3)._isEmpty();
  31795. if($core.assert($2)){
  31796. $1=self;
  31797. } else {
  31798. $1=$recv($recv(self._nodes())._first())._nextChild();
  31799. };
  31800. return $1;
  31801. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},$globals.Node)});
  31802. },
  31803. args: [],
  31804. 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 ]",
  31805. referencedClasses: [],
  31806. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"]
  31807. }),
  31808. $globals.Node);
  31809. $core.addMethod(
  31810. $core.method({
  31811. selector: "nextNode",
  31812. protocol: 'accessing',
  31813. fn: function (){
  31814. var self=this;
  31815. return $core.withContext(function($ctx1) {
  31816. var $2,$1,$receiver;
  31817. $2=self._parent();
  31818. if(($receiver = $2) == null || $receiver.isNil){
  31819. $1=$2;
  31820. } else {
  31821. var node;
  31822. node=$receiver;
  31823. $1=$recv(node)._nextNode_(self);
  31824. };
  31825. return $1;
  31826. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},$globals.Node)});
  31827. },
  31828. args: [],
  31829. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  31830. referencedClasses: [],
  31831. messageSends: ["ifNotNil:", "parent", "nextNode:"]
  31832. }),
  31833. $globals.Node);
  31834. $core.addMethod(
  31835. $core.method({
  31836. selector: "nextNode:",
  31837. protocol: 'accessing',
  31838. fn: function (aNode){
  31839. var self=this;
  31840. var next;
  31841. return $core.withContext(function($ctx1) {
  31842. var $1,$2;
  31843. var $early={};
  31844. try {
  31845. $1=self._nodes();
  31846. $ctx1.sendIdx["nodes"]=1;
  31847. next=$recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  31848. throw $early=[self];
  31849. }));
  31850. $2=$recv(next)._nextChild();
  31851. return $2;
  31852. }
  31853. catch(e) {if(e===$early)return e[0]; throw e}
  31854. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},$globals.Node)});
  31855. },
  31856. args: ["aNode"],
  31857. 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",
  31858. referencedClasses: [],
  31859. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"]
  31860. }),
  31861. $globals.Node);
  31862. $core.addMethod(
  31863. $core.method({
  31864. selector: "nodes",
  31865. protocol: 'accessing',
  31866. fn: function (){
  31867. var self=this;
  31868. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  31869. return $core.withContext(function($ctx1) {
  31870. var $2,$1,$receiver;
  31871. $2=self["@nodes"];
  31872. if(($receiver = $2) == null || $receiver.isNil){
  31873. self["@nodes"]=$recv($Array())._new();
  31874. $1=self["@nodes"];
  31875. } else {
  31876. $1=$2;
  31877. };
  31878. return $1;
  31879. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)});
  31880. },
  31881. args: [],
  31882. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  31883. referencedClasses: ["Array"],
  31884. messageSends: ["ifNil:", "new"]
  31885. }),
  31886. $globals.Node);
  31887. $core.addMethod(
  31888. $core.method({
  31889. selector: "nodes:",
  31890. protocol: 'building',
  31891. fn: function (aCollection){
  31892. var self=this;
  31893. return $core.withContext(function($ctx1) {
  31894. self["@nodes"]=aCollection;
  31895. $recv(aCollection)._do_((function(each){
  31896. return $core.withContext(function($ctx2) {
  31897. return $recv(each)._parent_(self);
  31898. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31899. }));
  31900. return self;
  31901. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)});
  31902. },
  31903. args: ["aCollection"],
  31904. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  31905. referencedClasses: [],
  31906. messageSends: ["do:", "parent:"]
  31907. }),
  31908. $globals.Node);
  31909. $core.addMethod(
  31910. $core.method({
  31911. selector: "parent",
  31912. protocol: 'accessing',
  31913. fn: function (){
  31914. var self=this;
  31915. var $1;
  31916. $1=self["@parent"];
  31917. return $1;
  31918. },
  31919. args: [],
  31920. source: "parent\x0a\x09^ parent",
  31921. referencedClasses: [],
  31922. messageSends: []
  31923. }),
  31924. $globals.Node);
  31925. $core.addMethod(
  31926. $core.method({
  31927. selector: "parent:",
  31928. protocol: 'accessing',
  31929. fn: function (aNode){
  31930. var self=this;
  31931. self["@parent"]=aNode;
  31932. return self;
  31933. },
  31934. args: ["aNode"],
  31935. source: "parent: aNode\x0a\x09parent := aNode",
  31936. referencedClasses: [],
  31937. messageSends: []
  31938. }),
  31939. $globals.Node);
  31940. $core.addMethod(
  31941. $core.method({
  31942. selector: "position",
  31943. protocol: 'accessing',
  31944. fn: function (){
  31945. var self=this;
  31946. return $core.withContext(function($ctx1) {
  31947. var $2,$3,$1,$receiver;
  31948. $2=self["@position"];
  31949. if(($receiver = $2) == null || $receiver.isNil){
  31950. $3=self._parent();
  31951. if(($receiver = $3) == null || $receiver.isNil){
  31952. $1=$3;
  31953. } else {
  31954. var node;
  31955. node=$receiver;
  31956. $1=$recv(node)._position();
  31957. };
  31958. } else {
  31959. $1=$2;
  31960. };
  31961. return $1;
  31962. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)});
  31963. },
  31964. args: [],
  31965. 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 ] ]",
  31966. referencedClasses: [],
  31967. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  31968. }),
  31969. $globals.Node);
  31970. $core.addMethod(
  31971. $core.method({
  31972. selector: "position:",
  31973. protocol: 'accessing',
  31974. fn: function (aPosition){
  31975. var self=this;
  31976. self["@position"]=aPosition;
  31977. return self;
  31978. },
  31979. args: ["aPosition"],
  31980. source: "position: aPosition\x0a\x09position := aPosition",
  31981. referencedClasses: [],
  31982. messageSends: []
  31983. }),
  31984. $globals.Node);
  31985. $core.addMethod(
  31986. $core.method({
  31987. selector: "positionEnd",
  31988. protocol: 'accessing',
  31989. fn: function (){
  31990. var self=this;
  31991. return $core.withContext(function($ctx1) {
  31992. var $2,$7,$6,$5,$4,$3,$1;
  31993. $2=self._positionStart();
  31994. $7=self._source();
  31995. $ctx1.sendIdx["source"]=1;
  31996. $6=$recv($7)._lines();
  31997. $ctx1.sendIdx["lines"]=1;
  31998. $5=$recv($6)._size();
  31999. $ctx1.sendIdx["size"]=1;
  32000. $4=$recv($5).__minus((1));
  32001. $ctx1.sendIdx["-"]=1;
  32002. $3=$recv($4).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  32003. $1=$recv($2).__plus($3);
  32004. return $1;
  32005. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)});
  32006. },
  32007. args: [],
  32008. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  32009. referencedClasses: [],
  32010. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  32011. }),
  32012. $globals.Node);
  32013. $core.addMethod(
  32014. $core.method({
  32015. selector: "positionStart",
  32016. protocol: 'accessing',
  32017. fn: function (){
  32018. var self=this;
  32019. return $core.withContext(function($ctx1) {
  32020. var $1;
  32021. $1=self._position();
  32022. return $1;
  32023. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)});
  32024. },
  32025. args: [],
  32026. source: "positionStart\x0a\x09^ self position",
  32027. referencedClasses: [],
  32028. messageSends: ["position"]
  32029. }),
  32030. $globals.Node);
  32031. $core.addMethod(
  32032. $core.method({
  32033. selector: "postCopy",
  32034. protocol: 'copying',
  32035. fn: function (){
  32036. var self=this;
  32037. return $core.withContext(function($ctx1) {
  32038. (
  32039. $ctx1.supercall = true,
  32040. $globals.Node.superclass.fn.prototype._postCopy.apply($recv(self), []));
  32041. $ctx1.supercall = false;
  32042. $recv(self._nodes())._do_((function(each){
  32043. return $core.withContext(function($ctx2) {
  32044. return $recv(each)._parent_(self);
  32045. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32046. }));
  32047. return self;
  32048. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)});
  32049. },
  32050. args: [],
  32051. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  32052. referencedClasses: [],
  32053. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  32054. }),
  32055. $globals.Node);
  32056. $core.addMethod(
  32057. $core.method({
  32058. selector: "requiresSmalltalkContext",
  32059. protocol: 'testing',
  32060. fn: function (){
  32061. var self=this;
  32062. return $core.withContext(function($ctx1) {
  32063. var $1;
  32064. $1=$recv($recv(self._nodes())._detect_ifNone_((function(each){
  32065. return $core.withContext(function($ctx2) {
  32066. return $recv(each)._requiresSmalltalkContext();
  32067. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32068. }),(function(){
  32069. return nil;
  32070. })))._notNil();
  32071. return $1;
  32072. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)});
  32073. },
  32074. args: [],
  32075. 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",
  32076. referencedClasses: [],
  32077. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  32078. }),
  32079. $globals.Node);
  32080. $core.addMethod(
  32081. $core.method({
  32082. selector: "shouldBeAliased",
  32083. protocol: 'accessing',
  32084. fn: function (){
  32085. var self=this;
  32086. return $core.withContext(function($ctx1) {
  32087. var $2,$1,$receiver;
  32088. $2=self["@shouldBeAliased"];
  32089. if(($receiver = $2) == null || $receiver.isNil){
  32090. $1=false;
  32091. } else {
  32092. $1=$2;
  32093. };
  32094. return $1;
  32095. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)});
  32096. },
  32097. args: [],
  32098. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  32099. referencedClasses: [],
  32100. messageSends: ["ifNil:"]
  32101. }),
  32102. $globals.Node);
  32103. $core.addMethod(
  32104. $core.method({
  32105. selector: "shouldBeAliased:",
  32106. protocol: 'accessing',
  32107. fn: function (aBoolean){
  32108. var self=this;
  32109. self["@shouldBeAliased"]=aBoolean;
  32110. return self;
  32111. },
  32112. args: ["aBoolean"],
  32113. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  32114. referencedClasses: [],
  32115. messageSends: []
  32116. }),
  32117. $globals.Node);
  32118. $core.addMethod(
  32119. $core.method({
  32120. selector: "shouldBeInlined",
  32121. protocol: 'accessing',
  32122. fn: function (){
  32123. var self=this;
  32124. return $core.withContext(function($ctx1) {
  32125. var $2,$1,$receiver;
  32126. $2=self["@shouldBeInlined"];
  32127. if(($receiver = $2) == null || $receiver.isNil){
  32128. $1=false;
  32129. } else {
  32130. $1=$2;
  32131. };
  32132. return $1;
  32133. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)});
  32134. },
  32135. args: [],
  32136. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  32137. referencedClasses: [],
  32138. messageSends: ["ifNil:"]
  32139. }),
  32140. $globals.Node);
  32141. $core.addMethod(
  32142. $core.method({
  32143. selector: "shouldBeInlined:",
  32144. protocol: 'accessing',
  32145. fn: function (aBoolean){
  32146. var self=this;
  32147. self["@shouldBeInlined"]=aBoolean;
  32148. return self;
  32149. },
  32150. args: ["aBoolean"],
  32151. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  32152. referencedClasses: [],
  32153. messageSends: []
  32154. }),
  32155. $globals.Node);
  32156. $core.addMethod(
  32157. $core.method({
  32158. selector: "size",
  32159. protocol: 'accessing',
  32160. fn: function (){
  32161. var self=this;
  32162. return $core.withContext(function($ctx1) {
  32163. var $1;
  32164. $1=$recv(self._source())._size();
  32165. return $1;
  32166. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)});
  32167. },
  32168. args: [],
  32169. source: "size\x0a\x09^ self source size",
  32170. referencedClasses: [],
  32171. messageSends: ["size", "source"]
  32172. }),
  32173. $globals.Node);
  32174. $core.addMethod(
  32175. $core.method({
  32176. selector: "source",
  32177. protocol: 'accessing',
  32178. fn: function (){
  32179. var self=this;
  32180. return $core.withContext(function($ctx1) {
  32181. var $2,$1,$receiver;
  32182. $2=self["@source"];
  32183. if(($receiver = $2) == null || $receiver.isNil){
  32184. $1="";
  32185. } else {
  32186. $1=$2;
  32187. };
  32188. return $1;
  32189. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)});
  32190. },
  32191. args: [],
  32192. source: "source\x0a\x09^ source ifNil: [ '' ]",
  32193. referencedClasses: [],
  32194. messageSends: ["ifNil:"]
  32195. }),
  32196. $globals.Node);
  32197. $core.addMethod(
  32198. $core.method({
  32199. selector: "source:",
  32200. protocol: 'accessing',
  32201. fn: function (aString){
  32202. var self=this;
  32203. self["@source"]=aString;
  32204. return self;
  32205. },
  32206. args: ["aString"],
  32207. source: "source: aString\x0a\x09source := aString",
  32208. referencedClasses: [],
  32209. messageSends: []
  32210. }),
  32211. $globals.Node);
  32212. $core.addMethod(
  32213. $core.method({
  32214. selector: "stopOnStepping",
  32215. protocol: 'testing',
  32216. fn: function (){
  32217. var self=this;
  32218. return false;
  32219. },
  32220. args: [],
  32221. source: "stopOnStepping\x0a\x09^ false",
  32222. referencedClasses: [],
  32223. messageSends: []
  32224. }),
  32225. $globals.Node);
  32226. $core.addMethod(
  32227. $core.method({
  32228. selector: "subtreeNeedsAliasing",
  32229. protocol: 'testing',
  32230. fn: function (){
  32231. var self=this;
  32232. return $core.withContext(function($ctx1) {
  32233. var $1;
  32234. $1=$recv($recv(self._shouldBeAliased())._or_((function(){
  32235. return $core.withContext(function($ctx2) {
  32236. return self._shouldBeInlined();
  32237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32238. })))._or_((function(){
  32239. return $core.withContext(function($ctx2) {
  32240. return $recv(self._nodes())._anySatisfy_((function(each){
  32241. return $core.withContext(function($ctx3) {
  32242. return $recv(each)._subtreeNeedsAliasing();
  32243. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  32244. }));
  32245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  32246. }));
  32247. $ctx1.sendIdx["or:"]=1;
  32248. return $1;
  32249. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)});
  32250. },
  32251. args: [],
  32252. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  32253. referencedClasses: [],
  32254. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  32255. }),
  32256. $globals.Node);
  32257. $core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST');
  32258. $globals.AssignmentNode.comment="I represent an assignment node.";
  32259. $core.addMethod(
  32260. $core.method({
  32261. selector: "accept:",
  32262. protocol: 'visiting',
  32263. fn: function (aVisitor){
  32264. var self=this;
  32265. return $core.withContext(function($ctx1) {
  32266. var $1;
  32267. $1=$recv(aVisitor)._visitAssignmentNode_(self);
  32268. return $1;
  32269. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  32270. },
  32271. args: ["aVisitor"],
  32272. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  32273. referencedClasses: [],
  32274. messageSends: ["visitAssignmentNode:"]
  32275. }),
  32276. $globals.AssignmentNode);
  32277. $core.addMethod(
  32278. $core.method({
  32279. selector: "isAssignmentNode",
  32280. protocol: 'testing',
  32281. fn: function (){
  32282. var self=this;
  32283. return true;
  32284. },
  32285. args: [],
  32286. source: "isAssignmentNode\x0a\x09^ true",
  32287. referencedClasses: [],
  32288. messageSends: []
  32289. }),
  32290. $globals.AssignmentNode);
  32291. $core.addMethod(
  32292. $core.method({
  32293. selector: "left",
  32294. protocol: 'accessing',
  32295. fn: function (){
  32296. var self=this;
  32297. var $1;
  32298. $1=self["@left"];
  32299. return $1;
  32300. },
  32301. args: [],
  32302. source: "left\x0a\x09^ left",
  32303. referencedClasses: [],
  32304. messageSends: []
  32305. }),
  32306. $globals.AssignmentNode);
  32307. $core.addMethod(
  32308. $core.method({
  32309. selector: "left:",
  32310. protocol: 'accessing',
  32311. fn: function (aNode){
  32312. var self=this;
  32313. return $core.withContext(function($ctx1) {
  32314. self["@left"]=aNode;
  32315. $recv(aNode)._parent_(self);
  32316. return self;
  32317. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)});
  32318. },
  32319. args: ["aNode"],
  32320. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  32321. referencedClasses: [],
  32322. messageSends: ["parent:"]
  32323. }),
  32324. $globals.AssignmentNode);
  32325. $core.addMethod(
  32326. $core.method({
  32327. selector: "nodes",
  32328. protocol: 'accessing',
  32329. fn: function (){
  32330. var self=this;
  32331. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  32332. return $core.withContext(function($ctx1) {
  32333. var $1;
  32334. $1=$recv($Array())._with_with_(self._left(),self._right());
  32335. return $1;
  32336. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)});
  32337. },
  32338. args: [],
  32339. source: "nodes\x0a\x09^ Array with: self left with: self right",
  32340. referencedClasses: ["Array"],
  32341. messageSends: ["with:with:", "left", "right"]
  32342. }),
  32343. $globals.AssignmentNode);
  32344. $core.addMethod(
  32345. $core.method({
  32346. selector: "right",
  32347. protocol: 'accessing',
  32348. fn: function (){
  32349. var self=this;
  32350. var $1;
  32351. $1=self["@right"];
  32352. return $1;
  32353. },
  32354. args: [],
  32355. source: "right\x0a\x09^ right",
  32356. referencedClasses: [],
  32357. messageSends: []
  32358. }),
  32359. $globals.AssignmentNode);
  32360. $core.addMethod(
  32361. $core.method({
  32362. selector: "right:",
  32363. protocol: 'accessing',
  32364. fn: function (aNode){
  32365. var self=this;
  32366. return $core.withContext(function($ctx1) {
  32367. self["@right"]=aNode;
  32368. $recv(aNode)._parent_(self);
  32369. return self;
  32370. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)});
  32371. },
  32372. args: ["aNode"],
  32373. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  32374. referencedClasses: [],
  32375. messageSends: ["parent:"]
  32376. }),
  32377. $globals.AssignmentNode);
  32378. $core.addMethod(
  32379. $core.method({
  32380. selector: "shouldBeAliased",
  32381. protocol: 'testing',
  32382. fn: function (){
  32383. var self=this;
  32384. return $core.withContext(function($ctx1) {
  32385. var $2,$1;
  32386. $2=(
  32387. $ctx1.supercall = true,
  32388. $globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
  32389. $ctx1.supercall = false;
  32390. $1=$recv($2)._or_((function(){
  32391. return $core.withContext(function($ctx2) {
  32392. return self._isReferenced();
  32393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32394. }));
  32395. return $1;
  32396. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  32397. },
  32398. args: [],
  32399. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  32400. referencedClasses: [],
  32401. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  32402. }),
  32403. $globals.AssignmentNode);
  32404. $core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  32405. $globals.BlockNode.comment="I represent an block closure node.";
  32406. $core.addMethod(
  32407. $core.method({
  32408. selector: "accept:",
  32409. protocol: 'visiting',
  32410. fn: function (aVisitor){
  32411. var self=this;
  32412. return $core.withContext(function($ctx1) {
  32413. var $1;
  32414. $1=$recv(aVisitor)._visitBlockNode_(self);
  32415. return $1;
  32416. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)});
  32417. },
  32418. args: ["aVisitor"],
  32419. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  32420. referencedClasses: [],
  32421. messageSends: ["visitBlockNode:"]
  32422. }),
  32423. $globals.BlockNode);
  32424. $core.addMethod(
  32425. $core.method({
  32426. selector: "isBlockNode",
  32427. protocol: 'testing',
  32428. fn: function (){
  32429. var self=this;
  32430. return true;
  32431. },
  32432. args: [],
  32433. source: "isBlockNode\x0a\x09^ true",
  32434. referencedClasses: [],
  32435. messageSends: []
  32436. }),
  32437. $globals.BlockNode);
  32438. $core.addMethod(
  32439. $core.method({
  32440. selector: "nextChild",
  32441. protocol: 'accessing',
  32442. fn: function (){
  32443. var self=this;
  32444. return self;
  32445. },
  32446. args: [],
  32447. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  32448. referencedClasses: [],
  32449. messageSends: []
  32450. }),
  32451. $globals.BlockNode);
  32452. $core.addMethod(
  32453. $core.method({
  32454. selector: "nextNode:",
  32455. protocol: 'accessing',
  32456. fn: function (aNode){
  32457. var self=this;
  32458. return self;
  32459. },
  32460. args: ["aNode"],
  32461. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  32462. referencedClasses: [],
  32463. messageSends: []
  32464. }),
  32465. $globals.BlockNode);
  32466. $core.addMethod(
  32467. $core.method({
  32468. selector: "parameters",
  32469. protocol: 'accessing',
  32470. fn: function (){
  32471. var self=this;
  32472. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  32473. return $core.withContext(function($ctx1) {
  32474. var $2,$1,$receiver;
  32475. $2=self["@parameters"];
  32476. if(($receiver = $2) == null || $receiver.isNil){
  32477. self["@parameters"]=$recv($Array())._new();
  32478. $1=self["@parameters"];
  32479. } else {
  32480. $1=$2;
  32481. };
  32482. return $1;
  32483. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  32484. },
  32485. args: [],
  32486. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  32487. referencedClasses: ["Array"],
  32488. messageSends: ["ifNil:", "new"]
  32489. }),
  32490. $globals.BlockNode);
  32491. $core.addMethod(
  32492. $core.method({
  32493. selector: "parameters:",
  32494. protocol: 'accessing',
  32495. fn: function (aCollection){
  32496. var self=this;
  32497. self["@parameters"]=aCollection;
  32498. return self;
  32499. },
  32500. args: ["aCollection"],
  32501. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  32502. referencedClasses: [],
  32503. messageSends: []
  32504. }),
  32505. $globals.BlockNode);
  32506. $core.addMethod(
  32507. $core.method({
  32508. selector: "scope",
  32509. protocol: 'accessing',
  32510. fn: function (){
  32511. var self=this;
  32512. var $1;
  32513. $1=self["@scope"];
  32514. return $1;
  32515. },
  32516. args: [],
  32517. source: "scope\x0a\x09^ scope",
  32518. referencedClasses: [],
  32519. messageSends: []
  32520. }),
  32521. $globals.BlockNode);
  32522. $core.addMethod(
  32523. $core.method({
  32524. selector: "scope:",
  32525. protocol: 'accessing',
  32526. fn: function (aLexicalScope){
  32527. var self=this;
  32528. self["@scope"]=aLexicalScope;
  32529. return self;
  32530. },
  32531. args: ["aLexicalScope"],
  32532. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32533. referencedClasses: [],
  32534. messageSends: []
  32535. }),
  32536. $globals.BlockNode);
  32537. $core.addMethod(
  32538. $core.method({
  32539. selector: "subtreeNeedsAliasing",
  32540. protocol: 'testing',
  32541. fn: function (){
  32542. var self=this;
  32543. return $core.withContext(function($ctx1) {
  32544. var $1;
  32545. $1=$recv(self._shouldBeAliased())._or_((function(){
  32546. return $core.withContext(function($ctx2) {
  32547. return self._shouldBeInlined();
  32548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32549. }));
  32550. return $1;
  32551. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  32552. },
  32553. args: [],
  32554. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  32555. referencedClasses: [],
  32556. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  32557. }),
  32558. $globals.BlockNode);
  32559. $core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST');
  32560. $globals.CascadeNode.comment="I represent an cascade node.";
  32561. $core.addMethod(
  32562. $core.method({
  32563. selector: "accept:",
  32564. protocol: 'visiting',
  32565. fn: function (aVisitor){
  32566. var self=this;
  32567. return $core.withContext(function($ctx1) {
  32568. var $1;
  32569. $1=$recv(aVisitor)._visitCascadeNode_(self);
  32570. return $1;
  32571. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)});
  32572. },
  32573. args: ["aVisitor"],
  32574. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  32575. referencedClasses: [],
  32576. messageSends: ["visitCascadeNode:"]
  32577. }),
  32578. $globals.CascadeNode);
  32579. $core.addMethod(
  32580. $core.method({
  32581. selector: "isCascadeNode",
  32582. protocol: 'testing',
  32583. fn: function (){
  32584. var self=this;
  32585. return true;
  32586. },
  32587. args: [],
  32588. source: "isCascadeNode\x0a\x09^ true",
  32589. referencedClasses: [],
  32590. messageSends: []
  32591. }),
  32592. $globals.CascadeNode);
  32593. $core.addMethod(
  32594. $core.method({
  32595. selector: "receiver",
  32596. protocol: 'accessing',
  32597. fn: function (){
  32598. var self=this;
  32599. var $1;
  32600. $1=self["@receiver"];
  32601. return $1;
  32602. },
  32603. args: [],
  32604. source: "receiver\x0a\x09^ receiver",
  32605. referencedClasses: [],
  32606. messageSends: []
  32607. }),
  32608. $globals.CascadeNode);
  32609. $core.addMethod(
  32610. $core.method({
  32611. selector: "receiver:",
  32612. protocol: 'accessing',
  32613. fn: function (aNode){
  32614. var self=this;
  32615. self["@receiver"]=aNode;
  32616. return self;
  32617. },
  32618. args: ["aNode"],
  32619. source: "receiver: aNode\x0a\x09receiver := aNode",
  32620. referencedClasses: [],
  32621. messageSends: []
  32622. }),
  32623. $globals.CascadeNode);
  32624. $core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST');
  32625. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  32626. $core.addMethod(
  32627. $core.method({
  32628. selector: "accept:",
  32629. protocol: 'visiting',
  32630. fn: function (aVisitor){
  32631. var self=this;
  32632. return $core.withContext(function($ctx1) {
  32633. var $1;
  32634. $1=$recv(aVisitor)._visitDynamicArrayNode_(self);
  32635. return $1;
  32636. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  32637. },
  32638. args: ["aVisitor"],
  32639. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  32640. referencedClasses: [],
  32641. messageSends: ["visitDynamicArrayNode:"]
  32642. }),
  32643. $globals.DynamicArrayNode);
  32644. $core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST');
  32645. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  32646. $core.addMethod(
  32647. $core.method({
  32648. selector: "accept:",
  32649. protocol: 'visiting',
  32650. fn: function (aVisitor){
  32651. var self=this;
  32652. return $core.withContext(function($ctx1) {
  32653. var $1;
  32654. $1=$recv(aVisitor)._visitDynamicDictionaryNode_(self);
  32655. return $1;
  32656. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  32657. },
  32658. args: ["aVisitor"],
  32659. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  32660. referencedClasses: [],
  32661. messageSends: ["visitDynamicDictionaryNode:"]
  32662. }),
  32663. $globals.DynamicDictionaryNode);
  32664. $core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST');
  32665. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  32666. $core.addMethod(
  32667. $core.method({
  32668. selector: "accept:",
  32669. protocol: 'visiting',
  32670. fn: function (aVisitor){
  32671. var self=this;
  32672. return $core.withContext(function($ctx1) {
  32673. var $1;
  32674. $1=$recv(aVisitor)._visitJSStatementNode_(self);
  32675. return $1;
  32676. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  32677. },
  32678. args: ["aVisitor"],
  32679. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  32680. referencedClasses: [],
  32681. messageSends: ["visitJSStatementNode:"]
  32682. }),
  32683. $globals.JSStatementNode);
  32684. $core.addMethod(
  32685. $core.method({
  32686. selector: "isJSStatementNode",
  32687. protocol: 'testing',
  32688. fn: function (){
  32689. var self=this;
  32690. return true;
  32691. },
  32692. args: [],
  32693. source: "isJSStatementNode\x0a\x09^ true",
  32694. referencedClasses: [],
  32695. messageSends: []
  32696. }),
  32697. $globals.JSStatementNode);
  32698. $core.addMethod(
  32699. $core.method({
  32700. selector: "requiresSmalltalkContext",
  32701. protocol: 'testing',
  32702. fn: function (){
  32703. var self=this;
  32704. return true;
  32705. },
  32706. args: [],
  32707. source: "requiresSmalltalkContext\x0a\x09^ true",
  32708. referencedClasses: [],
  32709. messageSends: []
  32710. }),
  32711. $globals.JSStatementNode);
  32712. $core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
  32713. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  32714. $core.addMethod(
  32715. $core.method({
  32716. selector: "accept:",
  32717. protocol: 'visiting',
  32718. fn: function (aVisitor){
  32719. var self=this;
  32720. return $core.withContext(function($ctx1) {
  32721. var $1;
  32722. $1=$recv(aVisitor)._visitMethodNode_(self);
  32723. return $1;
  32724. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)});
  32725. },
  32726. args: ["aVisitor"],
  32727. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  32728. referencedClasses: [],
  32729. messageSends: ["visitMethodNode:"]
  32730. }),
  32731. $globals.MethodNode);
  32732. $core.addMethod(
  32733. $core.method({
  32734. selector: "arguments",
  32735. protocol: 'accessing',
  32736. fn: function (){
  32737. var self=this;
  32738. return $core.withContext(function($ctx1) {
  32739. var $2,$1,$receiver;
  32740. $2=self["@arguments"];
  32741. if(($receiver = $2) == null || $receiver.isNil){
  32742. $1=[];
  32743. } else {
  32744. $1=$2;
  32745. };
  32746. return $1;
  32747. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  32748. },
  32749. args: [],
  32750. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  32751. referencedClasses: [],
  32752. messageSends: ["ifNil:"]
  32753. }),
  32754. $globals.MethodNode);
  32755. $core.addMethod(
  32756. $core.method({
  32757. selector: "arguments:",
  32758. protocol: 'accessing',
  32759. fn: function (aCollection){
  32760. var self=this;
  32761. self["@arguments"]=aCollection;
  32762. return self;
  32763. },
  32764. args: ["aCollection"],
  32765. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  32766. referencedClasses: [],
  32767. messageSends: []
  32768. }),
  32769. $globals.MethodNode);
  32770. $core.addMethod(
  32771. $core.method({
  32772. selector: "classReferences",
  32773. protocol: 'accessing',
  32774. fn: function (){
  32775. var self=this;
  32776. var $1;
  32777. $1=self["@classReferences"];
  32778. return $1;
  32779. },
  32780. args: [],
  32781. source: "classReferences\x0a\x09^ classReferences",
  32782. referencedClasses: [],
  32783. messageSends: []
  32784. }),
  32785. $globals.MethodNode);
  32786. $core.addMethod(
  32787. $core.method({
  32788. selector: "classReferences:",
  32789. protocol: 'accessing',
  32790. fn: function (aCollection){
  32791. var self=this;
  32792. self["@classReferences"]=aCollection;
  32793. return self;
  32794. },
  32795. args: ["aCollection"],
  32796. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  32797. referencedClasses: [],
  32798. messageSends: []
  32799. }),
  32800. $globals.MethodNode);
  32801. $core.addMethod(
  32802. $core.method({
  32803. selector: "messageSends",
  32804. protocol: 'accessing',
  32805. fn: function (){
  32806. var self=this;
  32807. return $core.withContext(function($ctx1) {
  32808. var $1;
  32809. $1=$recv(self._sendIndexes())._keys();
  32810. return $1;
  32811. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  32812. },
  32813. args: [],
  32814. source: "messageSends\x0a\x09^ self sendIndexes keys",
  32815. referencedClasses: [],
  32816. messageSends: ["keys", "sendIndexes"]
  32817. }),
  32818. $globals.MethodNode);
  32819. $core.addMethod(
  32820. $core.method({
  32821. selector: "method",
  32822. protocol: 'accessing',
  32823. fn: function (){
  32824. var self=this;
  32825. return self;
  32826. },
  32827. args: [],
  32828. source: "method\x0a\x09^ self",
  32829. referencedClasses: [],
  32830. messageSends: []
  32831. }),
  32832. $globals.MethodNode);
  32833. $core.addMethod(
  32834. $core.method({
  32835. selector: "scope",
  32836. protocol: 'accessing',
  32837. fn: function (){
  32838. var self=this;
  32839. var $1;
  32840. $1=self["@scope"];
  32841. return $1;
  32842. },
  32843. args: [],
  32844. source: "scope\x0a\x09^ scope",
  32845. referencedClasses: [],
  32846. messageSends: []
  32847. }),
  32848. $globals.MethodNode);
  32849. $core.addMethod(
  32850. $core.method({
  32851. selector: "scope:",
  32852. protocol: 'accessing',
  32853. fn: function (aMethodScope){
  32854. var self=this;
  32855. self["@scope"]=aMethodScope;
  32856. return self;
  32857. },
  32858. args: ["aMethodScope"],
  32859. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  32860. referencedClasses: [],
  32861. messageSends: []
  32862. }),
  32863. $globals.MethodNode);
  32864. $core.addMethod(
  32865. $core.method({
  32866. selector: "selector",
  32867. protocol: 'accessing',
  32868. fn: function (){
  32869. var self=this;
  32870. var $1;
  32871. $1=self["@selector"];
  32872. return $1;
  32873. },
  32874. args: [],
  32875. source: "selector\x0a\x09^ selector",
  32876. referencedClasses: [],
  32877. messageSends: []
  32878. }),
  32879. $globals.MethodNode);
  32880. $core.addMethod(
  32881. $core.method({
  32882. selector: "selector:",
  32883. protocol: 'accessing',
  32884. fn: function (aString){
  32885. var self=this;
  32886. self["@selector"]=aString;
  32887. return self;
  32888. },
  32889. args: ["aString"],
  32890. source: "selector: aString\x0a\x09selector := aString",
  32891. referencedClasses: [],
  32892. messageSends: []
  32893. }),
  32894. $globals.MethodNode);
  32895. $core.addMethod(
  32896. $core.method({
  32897. selector: "sendIndexes",
  32898. protocol: 'accessing',
  32899. fn: function (){
  32900. var self=this;
  32901. var $1;
  32902. $1=self["@sendIndexes"];
  32903. return $1;
  32904. },
  32905. args: [],
  32906. source: "sendIndexes\x0a\x09^ sendIndexes",
  32907. referencedClasses: [],
  32908. messageSends: []
  32909. }),
  32910. $globals.MethodNode);
  32911. $core.addMethod(
  32912. $core.method({
  32913. selector: "sendIndexes:",
  32914. protocol: 'accessing',
  32915. fn: function (aDictionary){
  32916. var self=this;
  32917. self["@sendIndexes"]=aDictionary;
  32918. return self;
  32919. },
  32920. args: ["aDictionary"],
  32921. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  32922. referencedClasses: [],
  32923. messageSends: []
  32924. }),
  32925. $globals.MethodNode);
  32926. $core.addMethod(
  32927. $core.method({
  32928. selector: "sequenceNode",
  32929. protocol: 'accessing',
  32930. fn: function (){
  32931. var self=this;
  32932. return $core.withContext(function($ctx1) {
  32933. var $1;
  32934. var $early={};
  32935. try {
  32936. $recv(self._nodes())._do_((function(each){
  32937. return $core.withContext(function($ctx2) {
  32938. $1=$recv(each)._isSequenceNode();
  32939. if($core.assert($1)){
  32940. throw $early=[each];
  32941. };
  32942. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32943. }));
  32944. return nil;
  32945. }
  32946. catch(e) {if(e===$early)return e[0]; throw e}
  32947. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  32948. },
  32949. args: [],
  32950. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  32951. referencedClasses: [],
  32952. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  32953. }),
  32954. $globals.MethodNode);
  32955. $core.addMethod(
  32956. $core.method({
  32957. selector: "source",
  32958. protocol: 'accessing',
  32959. fn: function (){
  32960. var self=this;
  32961. var $1;
  32962. $1=self["@source"];
  32963. return $1;
  32964. },
  32965. args: [],
  32966. source: "source\x0a\x09^ source",
  32967. referencedClasses: [],
  32968. messageSends: []
  32969. }),
  32970. $globals.MethodNode);
  32971. $core.addMethod(
  32972. $core.method({
  32973. selector: "source:",
  32974. protocol: 'accessing',
  32975. fn: function (aString){
  32976. var self=this;
  32977. self["@source"]=aString;
  32978. return self;
  32979. },
  32980. args: ["aString"],
  32981. source: "source: aString\x0a\x09source := aString",
  32982. referencedClasses: [],
  32983. messageSends: []
  32984. }),
  32985. $globals.MethodNode);
  32986. $core.addMethod(
  32987. $core.method({
  32988. selector: "superSends",
  32989. protocol: 'accessing',
  32990. fn: function (){
  32991. var self=this;
  32992. var $1;
  32993. $1=self["@superSends"];
  32994. return $1;
  32995. },
  32996. args: [],
  32997. source: "superSends\x0a\x09^ superSends",
  32998. referencedClasses: [],
  32999. messageSends: []
  33000. }),
  33001. $globals.MethodNode);
  33002. $core.addMethod(
  33003. $core.method({
  33004. selector: "superSends:",
  33005. protocol: 'accessing',
  33006. fn: function (aCollection){
  33007. var self=this;
  33008. self["@superSends"]=aCollection;
  33009. return self;
  33010. },
  33011. args: ["aCollection"],
  33012. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  33013. referencedClasses: [],
  33014. messageSends: []
  33015. }),
  33016. $globals.MethodNode);
  33017. $core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST');
  33018. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  33019. $core.addMethod(
  33020. $core.method({
  33021. selector: "accept:",
  33022. protocol: 'visiting',
  33023. fn: function (aVisitor){
  33024. var self=this;
  33025. return $core.withContext(function($ctx1) {
  33026. var $1;
  33027. $1=$recv(aVisitor)._visitReturnNode_(self);
  33028. return $1;
  33029. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)});
  33030. },
  33031. args: ["aVisitor"],
  33032. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  33033. referencedClasses: [],
  33034. messageSends: ["visitReturnNode:"]
  33035. }),
  33036. $globals.ReturnNode);
  33037. $core.addMethod(
  33038. $core.method({
  33039. selector: "isReturnNode",
  33040. protocol: 'testing',
  33041. fn: function (){
  33042. var self=this;
  33043. return true;
  33044. },
  33045. args: [],
  33046. source: "isReturnNode\x0a\x09^ true",
  33047. referencedClasses: [],
  33048. messageSends: []
  33049. }),
  33050. $globals.ReturnNode);
  33051. $core.addMethod(
  33052. $core.method({
  33053. selector: "nonLocalReturn",
  33054. protocol: 'testing',
  33055. fn: function (){
  33056. var self=this;
  33057. return $core.withContext(function($ctx1) {
  33058. var $1;
  33059. $1=$recv($recv(self._scope())._isMethodScope())._not();
  33060. return $1;
  33061. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  33062. },
  33063. args: [],
  33064. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  33065. referencedClasses: [],
  33066. messageSends: ["not", "isMethodScope", "scope"]
  33067. }),
  33068. $globals.ReturnNode);
  33069. $core.addMethod(
  33070. $core.method({
  33071. selector: "scope",
  33072. protocol: 'accessing',
  33073. fn: function (){
  33074. var self=this;
  33075. var $1;
  33076. $1=self["@scope"];
  33077. return $1;
  33078. },
  33079. args: [],
  33080. source: "scope\x0a\x09^ scope",
  33081. referencedClasses: [],
  33082. messageSends: []
  33083. }),
  33084. $globals.ReturnNode);
  33085. $core.addMethod(
  33086. $core.method({
  33087. selector: "scope:",
  33088. protocol: 'accessing',
  33089. fn: function (aLexicalScope){
  33090. var self=this;
  33091. self["@scope"]=aLexicalScope;
  33092. return self;
  33093. },
  33094. args: ["aLexicalScope"],
  33095. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33096. referencedClasses: [],
  33097. messageSends: []
  33098. }),
  33099. $globals.ReturnNode);
  33100. $core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  33101. $globals.SendNode.comment="I represent an message send node.";
  33102. $core.addMethod(
  33103. $core.method({
  33104. selector: "accept:",
  33105. protocol: 'visiting',
  33106. fn: function (aVisitor){
  33107. var self=this;
  33108. return $core.withContext(function($ctx1) {
  33109. var $1;
  33110. $1=$recv(aVisitor)._visitSendNode_(self);
  33111. return $1;
  33112. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)});
  33113. },
  33114. args: ["aVisitor"],
  33115. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  33116. referencedClasses: [],
  33117. messageSends: ["visitSendNode:"]
  33118. }),
  33119. $globals.SendNode);
  33120. $core.addMethod(
  33121. $core.method({
  33122. selector: "arguments",
  33123. protocol: 'accessing',
  33124. fn: function (){
  33125. var self=this;
  33126. return $core.withContext(function($ctx1) {
  33127. var $2,$1,$receiver;
  33128. $2=self["@arguments"];
  33129. if(($receiver = $2) == null || $receiver.isNil){
  33130. self["@arguments"]=[];
  33131. $1=self["@arguments"];
  33132. } else {
  33133. $1=$2;
  33134. };
  33135. return $1;
  33136. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  33137. },
  33138. args: [],
  33139. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  33140. referencedClasses: [],
  33141. messageSends: ["ifNil:"]
  33142. }),
  33143. $globals.SendNode);
  33144. $core.addMethod(
  33145. $core.method({
  33146. selector: "arguments:",
  33147. protocol: 'accessing',
  33148. fn: function (aCollection){
  33149. var self=this;
  33150. return $core.withContext(function($ctx1) {
  33151. self["@arguments"]=aCollection;
  33152. $recv(aCollection)._do_((function(each){
  33153. return $core.withContext(function($ctx2) {
  33154. return $recv(each)._parent_(self);
  33155. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33156. }));
  33157. return self;
  33158. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)});
  33159. },
  33160. args: ["aCollection"],
  33161. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  33162. referencedClasses: [],
  33163. messageSends: ["do:", "parent:"]
  33164. }),
  33165. $globals.SendNode);
  33166. $core.addMethod(
  33167. $core.method({
  33168. selector: "cascadeNodeWithMessages:",
  33169. protocol: 'accessing',
  33170. fn: function (aCollection){
  33171. var self=this;
  33172. var first;
  33173. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  33174. function $CascadeNode(){return $globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  33175. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  33176. return $core.withContext(function($ctx1) {
  33177. var $1,$2,$4,$5,$3;
  33178. $1=$recv($SendNode())._new();
  33179. $ctx1.sendIdx["new"]=1;
  33180. $recv($1)._selector_(self._selector());
  33181. $recv($1)._arguments_(self._arguments());
  33182. $2=$recv($1)._yourself();
  33183. $ctx1.sendIdx["yourself"]=1;
  33184. first=$2;
  33185. $4=$recv($CascadeNode())._new();
  33186. $recv($4)._receiver_(self._receiver());
  33187. $recv($4)._nodes_($recv($recv($Array())._with_(first)).__comma(aCollection));
  33188. $5=$recv($4)._yourself();
  33189. $3=$5;
  33190. return $3;
  33191. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)});
  33192. },
  33193. args: ["aCollection"],
  33194. 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",
  33195. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  33196. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  33197. }),
  33198. $globals.SendNode);
  33199. $core.addMethod(
  33200. $core.method({
  33201. selector: "index",
  33202. protocol: 'accessing',
  33203. fn: function (){
  33204. var self=this;
  33205. var $1;
  33206. $1=self["@index"];
  33207. return $1;
  33208. },
  33209. args: [],
  33210. source: "index\x0a\x09^ index",
  33211. referencedClasses: [],
  33212. messageSends: []
  33213. }),
  33214. $globals.SendNode);
  33215. $core.addMethod(
  33216. $core.method({
  33217. selector: "index:",
  33218. protocol: 'accessing',
  33219. fn: function (anInteger){
  33220. var self=this;
  33221. self["@index"]=anInteger;
  33222. return self;
  33223. },
  33224. args: ["anInteger"],
  33225. source: "index: anInteger\x0a\x09index := anInteger",
  33226. referencedClasses: [],
  33227. messageSends: []
  33228. }),
  33229. $globals.SendNode);
  33230. $core.addMethod(
  33231. $core.method({
  33232. selector: "isCascadeSendNode",
  33233. protocol: 'testing',
  33234. fn: function (){
  33235. var self=this;
  33236. return $core.withContext(function($ctx1) {
  33237. var $1;
  33238. $1=$recv(self._parent())._isCascadeNode();
  33239. return $1;
  33240. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  33241. },
  33242. args: [],
  33243. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  33244. referencedClasses: [],
  33245. messageSends: ["isCascadeNode", "parent"]
  33246. }),
  33247. $globals.SendNode);
  33248. $core.addMethod(
  33249. $core.method({
  33250. selector: "isNavigationNode",
  33251. protocol: 'testing',
  33252. fn: function (){
  33253. var self=this;
  33254. return true;
  33255. },
  33256. args: [],
  33257. source: "isNavigationNode\x0a\x09^ true",
  33258. referencedClasses: [],
  33259. messageSends: []
  33260. }),
  33261. $globals.SendNode);
  33262. $core.addMethod(
  33263. $core.method({
  33264. selector: "isSendNode",
  33265. protocol: 'testing',
  33266. fn: function (){
  33267. var self=this;
  33268. return true;
  33269. },
  33270. args: [],
  33271. source: "isSendNode\x0a\x09^ true",
  33272. referencedClasses: [],
  33273. messageSends: []
  33274. }),
  33275. $globals.SendNode);
  33276. $core.addMethod(
  33277. $core.method({
  33278. selector: "navigationLink",
  33279. protocol: 'accessing',
  33280. fn: function (){
  33281. var self=this;
  33282. return $core.withContext(function($ctx1) {
  33283. var $1;
  33284. $1=self._selector();
  33285. return $1;
  33286. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  33287. },
  33288. args: [],
  33289. source: "navigationLink\x0a\x09^ self selector",
  33290. referencedClasses: [],
  33291. messageSends: ["selector"]
  33292. }),
  33293. $globals.SendNode);
  33294. $core.addMethod(
  33295. $core.method({
  33296. selector: "nodes",
  33297. protocol: 'accessing',
  33298. fn: function (){
  33299. var self=this;
  33300. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  33301. return $core.withContext(function($ctx1) {
  33302. var $1,$3,$2,$5,$6,$4,$receiver;
  33303. $1=self._receiver();
  33304. $ctx1.sendIdx["receiver"]=1;
  33305. if(($receiver = $1) == null || $receiver.isNil){
  33306. $3=self._arguments();
  33307. $ctx1.sendIdx["arguments"]=1;
  33308. $2=$recv($3)._copy();
  33309. return $2;
  33310. } else {
  33311. $1;
  33312. };
  33313. $5=$recv($Array())._with_(self._receiver());
  33314. $recv($5)._addAll_(self._arguments());
  33315. $6=$recv($5)._yourself();
  33316. $4=$6;
  33317. return $4;
  33318. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)});
  33319. },
  33320. args: [],
  33321. 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",
  33322. referencedClasses: ["Array"],
  33323. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  33324. }),
  33325. $globals.SendNode);
  33326. $core.addMethod(
  33327. $core.method({
  33328. selector: "receiver",
  33329. protocol: 'accessing',
  33330. fn: function (){
  33331. var self=this;
  33332. var $1;
  33333. $1=self["@receiver"];
  33334. return $1;
  33335. },
  33336. args: [],
  33337. source: "receiver\x0a\x09^ receiver",
  33338. referencedClasses: [],
  33339. messageSends: []
  33340. }),
  33341. $globals.SendNode);
  33342. $core.addMethod(
  33343. $core.method({
  33344. selector: "receiver:",
  33345. protocol: 'accessing',
  33346. fn: function (aNode){
  33347. var self=this;
  33348. return $core.withContext(function($ctx1) {
  33349. var $1;
  33350. self["@receiver"]=aNode;
  33351. $1=$recv(aNode)._isNode();
  33352. if($core.assert($1)){
  33353. $recv(aNode)._parent_(self);
  33354. };
  33355. return self;
  33356. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)});
  33357. },
  33358. args: ["aNode"],
  33359. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  33360. referencedClasses: [],
  33361. messageSends: ["ifTrue:", "isNode", "parent:"]
  33362. }),
  33363. $globals.SendNode);
  33364. $core.addMethod(
  33365. $core.method({
  33366. selector: "requiresSmalltalkContext",
  33367. protocol: 'testing',
  33368. fn: function (){
  33369. var self=this;
  33370. return true;
  33371. },
  33372. args: [],
  33373. source: "requiresSmalltalkContext\x0a\x09^ true",
  33374. referencedClasses: [],
  33375. messageSends: []
  33376. }),
  33377. $globals.SendNode);
  33378. $core.addMethod(
  33379. $core.method({
  33380. selector: "selector",
  33381. protocol: 'accessing',
  33382. fn: function (){
  33383. var self=this;
  33384. var $1;
  33385. $1=self["@selector"];
  33386. return $1;
  33387. },
  33388. args: [],
  33389. source: "selector\x0a\x09^ selector",
  33390. referencedClasses: [],
  33391. messageSends: []
  33392. }),
  33393. $globals.SendNode);
  33394. $core.addMethod(
  33395. $core.method({
  33396. selector: "selector:",
  33397. protocol: 'accessing',
  33398. fn: function (aString){
  33399. var self=this;
  33400. self["@selector"]=aString;
  33401. return self;
  33402. },
  33403. args: ["aString"],
  33404. source: "selector: aString\x0a\x09selector := aString",
  33405. referencedClasses: [],
  33406. messageSends: []
  33407. }),
  33408. $globals.SendNode);
  33409. $core.addMethod(
  33410. $core.method({
  33411. selector: "shouldBeAliased",
  33412. protocol: 'testing',
  33413. fn: function (){
  33414. var self=this;
  33415. var sends;
  33416. return $core.withContext(function($ctx1) {
  33417. var $2,$1;
  33418. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  33419. $2=(
  33420. $ctx1.supercall = true,
  33421. $globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
  33422. $ctx1.supercall = false;
  33423. $1=$recv($2)._or_((function(){
  33424. return $core.withContext(function($ctx2) {
  33425. return $recv(self._isReferenced())._and_((function(){
  33426. return $core.withContext(function($ctx3) {
  33427. return $recv($recv($recv(sends).__gt((1)))._and_((function(){
  33428. return $core.withContext(function($ctx4) {
  33429. return $recv(self._index()).__lt(sends);
  33430. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  33431. })))._or_((function(){
  33432. return $core.withContext(function($ctx4) {
  33433. return self._superSend();
  33434. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  33435. }));
  33436. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33437. }));
  33438. $ctx2.sendIdx["and:"]=1;
  33439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33440. }));
  33441. $ctx1.sendIdx["or:"]=1;
  33442. return $1;
  33443. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  33444. },
  33445. args: [],
  33446. 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 ] ] ])",
  33447. referencedClasses: [],
  33448. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
  33449. }),
  33450. $globals.SendNode);
  33451. $core.addMethod(
  33452. $core.method({
  33453. selector: "stopOnStepping",
  33454. protocol: 'testing',
  33455. fn: function (){
  33456. var self=this;
  33457. return true;
  33458. },
  33459. args: [],
  33460. source: "stopOnStepping\x0a\x09^ true",
  33461. referencedClasses: [],
  33462. messageSends: []
  33463. }),
  33464. $globals.SendNode);
  33465. $core.addMethod(
  33466. $core.method({
  33467. selector: "superSend",
  33468. protocol: 'accessing',
  33469. fn: function (){
  33470. var self=this;
  33471. return $core.withContext(function($ctx1) {
  33472. var $2,$1,$receiver;
  33473. $2=self["@superSend"];
  33474. if(($receiver = $2) == null || $receiver.isNil){
  33475. $1=false;
  33476. } else {
  33477. $1=$2;
  33478. };
  33479. return $1;
  33480. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  33481. },
  33482. args: [],
  33483. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  33484. referencedClasses: [],
  33485. messageSends: ["ifNil:"]
  33486. }),
  33487. $globals.SendNode);
  33488. $core.addMethod(
  33489. $core.method({
  33490. selector: "superSend:",
  33491. protocol: 'accessing',
  33492. fn: function (aBoolean){
  33493. var self=this;
  33494. self["@superSend"]=aBoolean;
  33495. return self;
  33496. },
  33497. args: ["aBoolean"],
  33498. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  33499. referencedClasses: [],
  33500. messageSends: []
  33501. }),
  33502. $globals.SendNode);
  33503. $core.addMethod(
  33504. $core.method({
  33505. selector: "valueForReceiver:",
  33506. protocol: 'accessing',
  33507. fn: function (anObject){
  33508. var self=this;
  33509. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  33510. return $core.withContext(function($ctx1) {
  33511. var $2,$3,$5,$4,$6,$1,$receiver;
  33512. $2=$recv($SendNode())._new();
  33513. $recv($2)._position_(self._position());
  33514. $recv($2)._source_(self._source());
  33515. $3=$2;
  33516. $5=self._receiver();
  33517. $ctx1.sendIdx["receiver"]=1;
  33518. if(($receiver = $5) == null || $receiver.isNil){
  33519. $4=anObject;
  33520. } else {
  33521. $4=$recv(self._receiver())._valueForReceiver_(anObject);
  33522. };
  33523. $recv($3)._receiver_($4);
  33524. $recv($2)._selector_(self._selector());
  33525. $recv($2)._arguments_(self._arguments());
  33526. $6=$recv($2)._yourself();
  33527. $1=$6;
  33528. return $1;
  33529. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
  33530. },
  33531. args: ["anObject"],
  33532. 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",
  33533. referencedClasses: ["SendNode"],
  33534. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33535. }),
  33536. $globals.SendNode);
  33537. $core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST');
  33538. $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).";
  33539. $core.addMethod(
  33540. $core.method({
  33541. selector: "accept:",
  33542. protocol: 'visiting',
  33543. fn: function (aVisitor){
  33544. var self=this;
  33545. return $core.withContext(function($ctx1) {
  33546. var $1;
  33547. $1=$recv(aVisitor)._visitSequenceNode_(self);
  33548. return $1;
  33549. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)});
  33550. },
  33551. args: ["aVisitor"],
  33552. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  33553. referencedClasses: [],
  33554. messageSends: ["visitSequenceNode:"]
  33555. }),
  33556. $globals.SequenceNode);
  33557. $core.addMethod(
  33558. $core.method({
  33559. selector: "asBlockSequenceNode",
  33560. protocol: 'converting',
  33561. fn: function (){
  33562. var self=this;
  33563. function $BlockSequenceNode(){return $globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  33564. return $core.withContext(function($ctx1) {
  33565. var $2,$3,$1;
  33566. $2=$recv($BlockSequenceNode())._new();
  33567. $recv($2)._position_(self._position());
  33568. $recv($2)._source_(self._source());
  33569. $recv($2)._nodes_(self._nodes());
  33570. $recv($2)._temps_(self._temps());
  33571. $3=$recv($2)._yourself();
  33572. $1=$3;
  33573. return $1;
  33574. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  33575. },
  33576. args: [],
  33577. 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",
  33578. referencedClasses: ["BlockSequenceNode"],
  33579. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  33580. }),
  33581. $globals.SequenceNode);
  33582. $core.addMethod(
  33583. $core.method({
  33584. selector: "isSequenceNode",
  33585. protocol: 'testing',
  33586. fn: function (){
  33587. var self=this;
  33588. return true;
  33589. },
  33590. args: [],
  33591. source: "isSequenceNode\x0a\x09^ true",
  33592. referencedClasses: [],
  33593. messageSends: []
  33594. }),
  33595. $globals.SequenceNode);
  33596. $core.addMethod(
  33597. $core.method({
  33598. selector: "scope",
  33599. protocol: 'accessing',
  33600. fn: function (){
  33601. var self=this;
  33602. var $1;
  33603. $1=self["@scope"];
  33604. return $1;
  33605. },
  33606. args: [],
  33607. source: "scope\x0a\x09^ scope",
  33608. referencedClasses: [],
  33609. messageSends: []
  33610. }),
  33611. $globals.SequenceNode);
  33612. $core.addMethod(
  33613. $core.method({
  33614. selector: "scope:",
  33615. protocol: 'accessing',
  33616. fn: function (aLexicalScope){
  33617. var self=this;
  33618. self["@scope"]=aLexicalScope;
  33619. return self;
  33620. },
  33621. args: ["aLexicalScope"],
  33622. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33623. referencedClasses: [],
  33624. messageSends: []
  33625. }),
  33626. $globals.SequenceNode);
  33627. $core.addMethod(
  33628. $core.method({
  33629. selector: "temps",
  33630. protocol: 'accessing',
  33631. fn: function (){
  33632. var self=this;
  33633. return $core.withContext(function($ctx1) {
  33634. var $2,$1,$receiver;
  33635. $2=self["@temps"];
  33636. if(($receiver = $2) == null || $receiver.isNil){
  33637. $1=[];
  33638. } else {
  33639. $1=$2;
  33640. };
  33641. return $1;
  33642. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  33643. },
  33644. args: [],
  33645. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  33646. referencedClasses: [],
  33647. messageSends: ["ifNil:"]
  33648. }),
  33649. $globals.SequenceNode);
  33650. $core.addMethod(
  33651. $core.method({
  33652. selector: "temps:",
  33653. protocol: 'accessing',
  33654. fn: function (aCollection){
  33655. var self=this;
  33656. self["@temps"]=aCollection;
  33657. return self;
  33658. },
  33659. args: ["aCollection"],
  33660. source: "temps: aCollection\x0a\x09temps := aCollection",
  33661. referencedClasses: [],
  33662. messageSends: []
  33663. }),
  33664. $globals.SequenceNode);
  33665. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  33666. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  33667. $core.addMethod(
  33668. $core.method({
  33669. selector: "accept:",
  33670. protocol: 'visiting',
  33671. fn: function (aVisitor){
  33672. var self=this;
  33673. return $core.withContext(function($ctx1) {
  33674. var $1;
  33675. $1=$recv(aVisitor)._visitBlockSequenceNode_(self);
  33676. return $1;
  33677. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  33678. },
  33679. args: ["aVisitor"],
  33680. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  33681. referencedClasses: [],
  33682. messageSends: ["visitBlockSequenceNode:"]
  33683. }),
  33684. $globals.BlockSequenceNode);
  33685. $core.addMethod(
  33686. $core.method({
  33687. selector: "isBlockSequenceNode",
  33688. protocol: 'testing',
  33689. fn: function (){
  33690. var self=this;
  33691. return true;
  33692. },
  33693. args: [],
  33694. source: "isBlockSequenceNode\x0a\x09^ true",
  33695. referencedClasses: [],
  33696. messageSends: []
  33697. }),
  33698. $globals.BlockSequenceNode);
  33699. $core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST');
  33700. $globals.ValueNode.comment="I represent a value node.";
  33701. $core.addMethod(
  33702. $core.method({
  33703. selector: "accept:",
  33704. protocol: 'visiting',
  33705. fn: function (aVisitor){
  33706. var self=this;
  33707. return $core.withContext(function($ctx1) {
  33708. var $1;
  33709. $1=$recv(aVisitor)._visitValueNode_(self);
  33710. return $1;
  33711. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)});
  33712. },
  33713. args: ["aVisitor"],
  33714. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  33715. referencedClasses: [],
  33716. messageSends: ["visitValueNode:"]
  33717. }),
  33718. $globals.ValueNode);
  33719. $core.addMethod(
  33720. $core.method({
  33721. selector: "isImmutable",
  33722. protocol: 'testing',
  33723. fn: function (){
  33724. var self=this;
  33725. return $core.withContext(function($ctx1) {
  33726. var $1;
  33727. $1=$recv(self._value())._isImmutable();
  33728. return $1;
  33729. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  33730. },
  33731. args: [],
  33732. source: "isImmutable\x0a\x09^ self value isImmutable",
  33733. referencedClasses: [],
  33734. messageSends: ["isImmutable", "value"]
  33735. }),
  33736. $globals.ValueNode);
  33737. $core.addMethod(
  33738. $core.method({
  33739. selector: "isValueNode",
  33740. protocol: 'testing',
  33741. fn: function (){
  33742. var self=this;
  33743. return true;
  33744. },
  33745. args: [],
  33746. source: "isValueNode\x0a\x09^ true",
  33747. referencedClasses: [],
  33748. messageSends: []
  33749. }),
  33750. $globals.ValueNode);
  33751. $core.addMethod(
  33752. $core.method({
  33753. selector: "value",
  33754. protocol: 'accessing',
  33755. fn: function (){
  33756. var self=this;
  33757. var $1;
  33758. $1=self["@value"];
  33759. return $1;
  33760. },
  33761. args: [],
  33762. source: "value\x0a\x09^ value",
  33763. referencedClasses: [],
  33764. messageSends: []
  33765. }),
  33766. $globals.ValueNode);
  33767. $core.addMethod(
  33768. $core.method({
  33769. selector: "value:",
  33770. protocol: 'accessing',
  33771. fn: function (anObject){
  33772. var self=this;
  33773. self["@value"]=anObject;
  33774. return self;
  33775. },
  33776. args: ["anObject"],
  33777. source: "value: anObject\x0a\x09value := anObject",
  33778. referencedClasses: [],
  33779. messageSends: []
  33780. }),
  33781. $globals.ValueNode);
  33782. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  33783. $globals.VariableNode.comment="I represent an variable node.";
  33784. $core.addMethod(
  33785. $core.method({
  33786. selector: "accept:",
  33787. protocol: 'visiting',
  33788. fn: function (aVisitor){
  33789. var self=this;
  33790. return $core.withContext(function($ctx1) {
  33791. var $1;
  33792. $1=$recv(aVisitor)._visitVariableNode_(self);
  33793. return $1;
  33794. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)});
  33795. },
  33796. args: ["aVisitor"],
  33797. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  33798. referencedClasses: [],
  33799. messageSends: ["visitVariableNode:"]
  33800. }),
  33801. $globals.VariableNode);
  33802. $core.addMethod(
  33803. $core.method({
  33804. selector: "alias",
  33805. protocol: 'accessing',
  33806. fn: function (){
  33807. var self=this;
  33808. return $core.withContext(function($ctx1) {
  33809. var $1;
  33810. $1=$recv(self._binding())._alias();
  33811. return $1;
  33812. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  33813. },
  33814. args: [],
  33815. source: "alias\x0a\x09^ self binding alias",
  33816. referencedClasses: [],
  33817. messageSends: ["alias", "binding"]
  33818. }),
  33819. $globals.VariableNode);
  33820. $core.addMethod(
  33821. $core.method({
  33822. selector: "assigned",
  33823. protocol: 'accessing',
  33824. fn: function (){
  33825. var self=this;
  33826. return $core.withContext(function($ctx1) {
  33827. var $2,$1,$receiver;
  33828. $2=self["@assigned"];
  33829. if(($receiver = $2) == null || $receiver.isNil){
  33830. $1=false;
  33831. } else {
  33832. $1=$2;
  33833. };
  33834. return $1;
  33835. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  33836. },
  33837. args: [],
  33838. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  33839. referencedClasses: [],
  33840. messageSends: ["ifNil:"]
  33841. }),
  33842. $globals.VariableNode);
  33843. $core.addMethod(
  33844. $core.method({
  33845. selector: "assigned:",
  33846. protocol: 'accessing',
  33847. fn: function (aBoolean){
  33848. var self=this;
  33849. self["@assigned"]=aBoolean;
  33850. return self;
  33851. },
  33852. args: ["aBoolean"],
  33853. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  33854. referencedClasses: [],
  33855. messageSends: []
  33856. }),
  33857. $globals.VariableNode);
  33858. $core.addMethod(
  33859. $core.method({
  33860. selector: "beAssigned",
  33861. protocol: 'accessing',
  33862. fn: function (){
  33863. var self=this;
  33864. return $core.withContext(function($ctx1) {
  33865. $recv(self._binding())._validateAssignment();
  33866. self["@assigned"]=true;
  33867. return self;
  33868. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  33869. },
  33870. args: [],
  33871. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  33872. referencedClasses: [],
  33873. messageSends: ["validateAssignment", "binding"]
  33874. }),
  33875. $globals.VariableNode);
  33876. $core.addMethod(
  33877. $core.method({
  33878. selector: "binding",
  33879. protocol: 'accessing',
  33880. fn: function (){
  33881. var self=this;
  33882. var $1;
  33883. $1=self["@binding"];
  33884. return $1;
  33885. },
  33886. args: [],
  33887. source: "binding\x0a\x09^ binding",
  33888. referencedClasses: [],
  33889. messageSends: []
  33890. }),
  33891. $globals.VariableNode);
  33892. $core.addMethod(
  33893. $core.method({
  33894. selector: "binding:",
  33895. protocol: 'accessing',
  33896. fn: function (aScopeVar){
  33897. var self=this;
  33898. self["@binding"]=aScopeVar;
  33899. return self;
  33900. },
  33901. args: ["aScopeVar"],
  33902. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  33903. referencedClasses: [],
  33904. messageSends: []
  33905. }),
  33906. $globals.VariableNode);
  33907. $core.addMethod(
  33908. $core.method({
  33909. selector: "isArgument",
  33910. protocol: 'testing',
  33911. fn: function (){
  33912. var self=this;
  33913. return $core.withContext(function($ctx1) {
  33914. var $1;
  33915. $1=$recv(self._binding())._isArgVar();
  33916. return $1;
  33917. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  33918. },
  33919. args: [],
  33920. source: "isArgument\x0a\x09^ self binding isArgVar",
  33921. referencedClasses: [],
  33922. messageSends: ["isArgVar", "binding"]
  33923. }),
  33924. $globals.VariableNode);
  33925. $core.addMethod(
  33926. $core.method({
  33927. selector: "isImmutable",
  33928. protocol: 'testing',
  33929. fn: function (){
  33930. var self=this;
  33931. return $core.withContext(function($ctx1) {
  33932. var $1;
  33933. $1=$recv(self._binding())._isImmutable();
  33934. return $1;
  33935. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  33936. },
  33937. args: [],
  33938. source: "isImmutable\x0a\x09^ self binding isImmutable",
  33939. referencedClasses: [],
  33940. messageSends: ["isImmutable", "binding"]
  33941. }),
  33942. $globals.VariableNode);
  33943. $core.addMethod(
  33944. $core.method({
  33945. selector: "isNavigationNode",
  33946. protocol: 'testing',
  33947. fn: function (){
  33948. var self=this;
  33949. return true;
  33950. },
  33951. args: [],
  33952. source: "isNavigationNode\x0a\x09^ true",
  33953. referencedClasses: [],
  33954. messageSends: []
  33955. }),
  33956. $globals.VariableNode);
  33957. $core.addMethod(
  33958. $core.method({
  33959. selector: "isVariableNode",
  33960. protocol: 'testing',
  33961. fn: function (){
  33962. var self=this;
  33963. return true;
  33964. },
  33965. args: [],
  33966. source: "isVariableNode\x0a\x09^ true",
  33967. referencedClasses: [],
  33968. messageSends: []
  33969. }),
  33970. $globals.VariableNode);
  33971. $core.addMethod(
  33972. $core.method({
  33973. selector: "navigationLink",
  33974. protocol: 'accessing',
  33975. fn: function (){
  33976. var self=this;
  33977. return $core.withContext(function($ctx1) {
  33978. var $1;
  33979. $1=self._value();
  33980. return $1;
  33981. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  33982. },
  33983. args: [],
  33984. source: "navigationLink\x0a\x09^ self value",
  33985. referencedClasses: [],
  33986. messageSends: ["value"]
  33987. }),
  33988. $globals.VariableNode);
  33989. $core.addMethod(
  33990. $core.method({
  33991. selector: "ast",
  33992. protocol: '*Compiler-AST',
  33993. fn: function (){
  33994. var self=this;
  33995. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  33996. return $core.withContext(function($ctx1) {
  33997. var $1,$2;
  33998. $1=self._source();
  33999. $ctx1.sendIdx["source"]=1;
  34000. $recv($1)._ifEmpty_((function(){
  34001. return $core.withContext(function($ctx2) {
  34002. return self._error_("Method source is empty");
  34003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34004. }));
  34005. $2=$recv($Smalltalk())._parse_(self._source());
  34006. return $2;
  34007. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  34008. },
  34009. args: [],
  34010. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  34011. referencedClasses: ["Smalltalk"],
  34012. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  34013. }),
  34014. $globals.CompiledMethod);
  34015. $core.addMethod(
  34016. $core.method({
  34017. selector: "isNode",
  34018. protocol: '*Compiler-AST',
  34019. fn: function (){
  34020. var self=this;
  34021. return false;
  34022. },
  34023. args: [],
  34024. source: "isNode\x0a\x09^ false",
  34025. referencedClasses: [],
  34026. messageSends: []
  34027. }),
  34028. $globals.Object);
  34029. });
  34030. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){"use strict";
  34031. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  34032. $core.addPackage('Compiler-Semantic');
  34033. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  34034. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  34035. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  34036. $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.";
  34037. $core.addMethod(
  34038. $core.method({
  34039. selector: "addArg:",
  34040. protocol: 'adding',
  34041. fn: function (aString){
  34042. var self=this;
  34043. function $ArgVar(){return $globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  34044. return $core.withContext(function($ctx1) {
  34045. var $1;
  34046. $1=self._args();
  34047. $ctx1.sendIdx["args"]=1;
  34048. $recv($1)._at_put_(aString,$recv($ArgVar())._on_(aString));
  34049. $recv($recv(self._args())._at_(aString))._scope_(self);
  34050. return self;
  34051. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  34052. },
  34053. args: ["aString"],
  34054. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  34055. referencedClasses: ["ArgVar"],
  34056. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  34057. }),
  34058. $globals.LexicalScope);
  34059. $core.addMethod(
  34060. $core.method({
  34061. selector: "addTemp:",
  34062. protocol: 'adding',
  34063. fn: function (aString){
  34064. var self=this;
  34065. function $TempVar(){return $globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  34066. return $core.withContext(function($ctx1) {
  34067. var $1;
  34068. $1=self._temps();
  34069. $ctx1.sendIdx["temps"]=1;
  34070. $recv($1)._at_put_(aString,$recv($TempVar())._on_(aString));
  34071. $recv($recv(self._temps())._at_(aString))._scope_(self);
  34072. return self;
  34073. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  34074. },
  34075. args: ["aString"],
  34076. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  34077. referencedClasses: ["TempVar"],
  34078. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  34079. }),
  34080. $globals.LexicalScope);
  34081. $core.addMethod(
  34082. $core.method({
  34083. selector: "alias",
  34084. protocol: 'accessing',
  34085. fn: function (){
  34086. var self=this;
  34087. return $core.withContext(function($ctx1) {
  34088. var $1;
  34089. $1="$ctx".__comma($recv(self._scopeLevel())._asString());
  34090. return $1;
  34091. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  34092. },
  34093. args: [],
  34094. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  34095. referencedClasses: [],
  34096. messageSends: [",", "asString", "scopeLevel"]
  34097. }),
  34098. $globals.LexicalScope);
  34099. $core.addMethod(
  34100. $core.method({
  34101. selector: "allVariableNames",
  34102. protocol: 'accessing',
  34103. fn: function (){
  34104. var self=this;
  34105. return $core.withContext(function($ctx1) {
  34106. var $2,$1;
  34107. $2=$recv(self._args())._keys();
  34108. $ctx1.sendIdx["keys"]=1;
  34109. $1=$recv($2).__comma($recv(self._temps())._keys());
  34110. return $1;
  34111. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  34112. },
  34113. args: [],
  34114. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  34115. referencedClasses: [],
  34116. messageSends: [",", "keys", "args", "temps"]
  34117. }),
  34118. $globals.LexicalScope);
  34119. $core.addMethod(
  34120. $core.method({
  34121. selector: "args",
  34122. protocol: 'accessing',
  34123. fn: function (){
  34124. var self=this;
  34125. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34126. return $core.withContext(function($ctx1) {
  34127. var $2,$1,$receiver;
  34128. $2=self["@args"];
  34129. if(($receiver = $2) == null || $receiver.isNil){
  34130. self["@args"]=$recv($Dictionary())._new();
  34131. $1=self["@args"];
  34132. } else {
  34133. $1=$2;
  34134. };
  34135. return $1;
  34136. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  34137. },
  34138. args: [],
  34139. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  34140. referencedClasses: ["Dictionary"],
  34141. messageSends: ["ifNil:", "new"]
  34142. }),
  34143. $globals.LexicalScope);
  34144. $core.addMethod(
  34145. $core.method({
  34146. selector: "bindingFor:",
  34147. protocol: 'accessing',
  34148. fn: function (aStringOrNode){
  34149. var self=this;
  34150. return $core.withContext(function($ctx1) {
  34151. var $2,$3,$4,$5,$1;
  34152. $2=self._pseudoVars();
  34153. $3=$recv(aStringOrNode)._value();
  34154. $ctx1.sendIdx["value"]=1;
  34155. $1=$recv($2)._at_ifAbsent_($3,(function(){
  34156. return $core.withContext(function($ctx2) {
  34157. $4=self._args();
  34158. $5=$recv(aStringOrNode)._value();
  34159. $ctx2.sendIdx["value"]=2;
  34160. return $recv($4)._at_ifAbsent_($5,(function(){
  34161. return $core.withContext(function($ctx3) {
  34162. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  34163. return nil;
  34164. }));
  34165. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  34166. }));
  34167. $ctx2.sendIdx["at:ifAbsent:"]=2;
  34168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34169. }));
  34170. $ctx1.sendIdx["at:ifAbsent:"]=1;
  34171. return $1;
  34172. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  34173. },
  34174. args: ["aStringOrNode"],
  34175. 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 ]]]",
  34176. referencedClasses: [],
  34177. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  34178. }),
  34179. $globals.LexicalScope);
  34180. $core.addMethod(
  34181. $core.method({
  34182. selector: "blockIndex",
  34183. protocol: 'accessing',
  34184. fn: function (){
  34185. var self=this;
  34186. return $core.withContext(function($ctx1) {
  34187. var $2,$1,$receiver;
  34188. $2=self["@blockIndex"];
  34189. if(($receiver = $2) == null || $receiver.isNil){
  34190. $1=(0);
  34191. } else {
  34192. $1=$2;
  34193. };
  34194. return $1;
  34195. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  34196. },
  34197. args: [],
  34198. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  34199. referencedClasses: [],
  34200. messageSends: ["ifNil:"]
  34201. }),
  34202. $globals.LexicalScope);
  34203. $core.addMethod(
  34204. $core.method({
  34205. selector: "blockIndex:",
  34206. protocol: 'accessing',
  34207. fn: function (anInteger){
  34208. var self=this;
  34209. self["@blockIndex"]=anInteger;
  34210. return self;
  34211. },
  34212. args: ["anInteger"],
  34213. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  34214. referencedClasses: [],
  34215. messageSends: []
  34216. }),
  34217. $globals.LexicalScope);
  34218. $core.addMethod(
  34219. $core.method({
  34220. selector: "canInlineNonLocalReturns",
  34221. protocol: 'testing',
  34222. fn: function (){
  34223. var self=this;
  34224. return $core.withContext(function($ctx1) {
  34225. var $1;
  34226. $1=$recv(self._isInlined())._and_((function(){
  34227. return $core.withContext(function($ctx2) {
  34228. return $recv(self._outerScope())._canInlineNonLocalReturns();
  34229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34230. }));
  34231. return $1;
  34232. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  34233. },
  34234. args: [],
  34235. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  34236. referencedClasses: [],
  34237. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  34238. }),
  34239. $globals.LexicalScope);
  34240. $core.addMethod(
  34241. $core.method({
  34242. selector: "instruction",
  34243. protocol: 'accessing',
  34244. fn: function (){
  34245. var self=this;
  34246. var $1;
  34247. $1=self["@instruction"];
  34248. return $1;
  34249. },
  34250. args: [],
  34251. source: "instruction\x0a\x09^ instruction",
  34252. referencedClasses: [],
  34253. messageSends: []
  34254. }),
  34255. $globals.LexicalScope);
  34256. $core.addMethod(
  34257. $core.method({
  34258. selector: "instruction:",
  34259. protocol: 'accessing',
  34260. fn: function (anIRInstruction){
  34261. var self=this;
  34262. self["@instruction"]=anIRInstruction;
  34263. return self;
  34264. },
  34265. args: ["anIRInstruction"],
  34266. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  34267. referencedClasses: [],
  34268. messageSends: []
  34269. }),
  34270. $globals.LexicalScope);
  34271. $core.addMethod(
  34272. $core.method({
  34273. selector: "isBlockScope",
  34274. protocol: 'testing',
  34275. fn: function (){
  34276. var self=this;
  34277. return $core.withContext(function($ctx1) {
  34278. var $1;
  34279. $1=$recv(self._isMethodScope())._not();
  34280. return $1;
  34281. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  34282. },
  34283. args: [],
  34284. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  34285. referencedClasses: [],
  34286. messageSends: ["not", "isMethodScope"]
  34287. }),
  34288. $globals.LexicalScope);
  34289. $core.addMethod(
  34290. $core.method({
  34291. selector: "isInlined",
  34292. protocol: 'testing',
  34293. fn: function (){
  34294. var self=this;
  34295. return $core.withContext(function($ctx1) {
  34296. var $3,$2,$1;
  34297. $3=self._instruction();
  34298. $ctx1.sendIdx["instruction"]=1;
  34299. $2=$recv($3)._notNil();
  34300. $1=$recv($2)._and_((function(){
  34301. return $core.withContext(function($ctx2) {
  34302. return $recv(self._instruction())._isInlined();
  34303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34304. }));
  34305. return $1;
  34306. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  34307. },
  34308. args: [],
  34309. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  34310. referencedClasses: [],
  34311. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  34312. }),
  34313. $globals.LexicalScope);
  34314. $core.addMethod(
  34315. $core.method({
  34316. selector: "isMethodScope",
  34317. protocol: 'testing',
  34318. fn: function (){
  34319. var self=this;
  34320. return false;
  34321. },
  34322. args: [],
  34323. source: "isMethodScope\x0a\x09^ false",
  34324. referencedClasses: [],
  34325. messageSends: []
  34326. }),
  34327. $globals.LexicalScope);
  34328. $core.addMethod(
  34329. $core.method({
  34330. selector: "lookupVariable:",
  34331. protocol: 'accessing',
  34332. fn: function (aNode){
  34333. var self=this;
  34334. var lookup;
  34335. return $core.withContext(function($ctx1) {
  34336. var $1,$2,$3,$receiver;
  34337. lookup=self._bindingFor_(aNode);
  34338. $1=lookup;
  34339. if(($receiver = $1) == null || $receiver.isNil){
  34340. $2=self._outerScope();
  34341. $ctx1.sendIdx["outerScope"]=1;
  34342. if(($receiver = $2) == null || $receiver.isNil){
  34343. lookup=$2;
  34344. } else {
  34345. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  34346. };
  34347. lookup;
  34348. } else {
  34349. $1;
  34350. };
  34351. $3=lookup;
  34352. return $3;
  34353. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  34354. },
  34355. args: ["aNode"],
  34356. 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",
  34357. referencedClasses: [],
  34358. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  34359. }),
  34360. $globals.LexicalScope);
  34361. $core.addMethod(
  34362. $core.method({
  34363. selector: "methodScope",
  34364. protocol: 'accessing',
  34365. fn: function (){
  34366. var self=this;
  34367. return $core.withContext(function($ctx1) {
  34368. var $2,$1,$receiver;
  34369. $2=self._outerScope();
  34370. $ctx1.sendIdx["outerScope"]=1;
  34371. if(($receiver = $2) == null || $receiver.isNil){
  34372. $1=$2;
  34373. } else {
  34374. $1=$recv(self._outerScope())._methodScope();
  34375. };
  34376. return $1;
  34377. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  34378. },
  34379. args: [],
  34380. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  34381. referencedClasses: [],
  34382. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  34383. }),
  34384. $globals.LexicalScope);
  34385. $core.addMethod(
  34386. $core.method({
  34387. selector: "node",
  34388. protocol: 'accessing',
  34389. fn: function (){
  34390. var self=this;
  34391. var $1;
  34392. $1=self["@node"];
  34393. return $1;
  34394. },
  34395. args: [],
  34396. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  34397. referencedClasses: [],
  34398. messageSends: []
  34399. }),
  34400. $globals.LexicalScope);
  34401. $core.addMethod(
  34402. $core.method({
  34403. selector: "node:",
  34404. protocol: 'accessing',
  34405. fn: function (aNode){
  34406. var self=this;
  34407. self["@node"]=aNode;
  34408. return self;
  34409. },
  34410. args: ["aNode"],
  34411. source: "node: aNode\x0a\x09node := aNode",
  34412. referencedClasses: [],
  34413. messageSends: []
  34414. }),
  34415. $globals.LexicalScope);
  34416. $core.addMethod(
  34417. $core.method({
  34418. selector: "outerScope",
  34419. protocol: 'accessing',
  34420. fn: function (){
  34421. var self=this;
  34422. var $1;
  34423. $1=self["@outerScope"];
  34424. return $1;
  34425. },
  34426. args: [],
  34427. source: "outerScope\x0a\x09^ outerScope",
  34428. referencedClasses: [],
  34429. messageSends: []
  34430. }),
  34431. $globals.LexicalScope);
  34432. $core.addMethod(
  34433. $core.method({
  34434. selector: "outerScope:",
  34435. protocol: 'accessing',
  34436. fn: function (aLexicalScope){
  34437. var self=this;
  34438. self["@outerScope"]=aLexicalScope;
  34439. return self;
  34440. },
  34441. args: ["aLexicalScope"],
  34442. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  34443. referencedClasses: [],
  34444. messageSends: []
  34445. }),
  34446. $globals.LexicalScope);
  34447. $core.addMethod(
  34448. $core.method({
  34449. selector: "pseudoVars",
  34450. protocol: 'accessing',
  34451. fn: function (){
  34452. var self=this;
  34453. return $core.withContext(function($ctx1) {
  34454. var $1;
  34455. $1=$recv(self._methodScope())._pseudoVars();
  34456. return $1;
  34457. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  34458. },
  34459. args: [],
  34460. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  34461. referencedClasses: [],
  34462. messageSends: ["pseudoVars", "methodScope"]
  34463. }),
  34464. $globals.LexicalScope);
  34465. $core.addMethod(
  34466. $core.method({
  34467. selector: "scopeLevel",
  34468. protocol: 'accessing',
  34469. fn: function (){
  34470. var self=this;
  34471. return $core.withContext(function($ctx1) {
  34472. var $1,$2,$4,$3,$5,$receiver;
  34473. $1=self._outerScope();
  34474. $ctx1.sendIdx["outerScope"]=1;
  34475. if(($receiver = $1) == null || $receiver.isNil){
  34476. return (1);
  34477. } else {
  34478. $1;
  34479. };
  34480. $2=self._isInlined();
  34481. if($core.assert($2)){
  34482. $4=self._outerScope();
  34483. $ctx1.sendIdx["outerScope"]=2;
  34484. $3=$recv($4)._scopeLevel();
  34485. $ctx1.sendIdx["scopeLevel"]=1;
  34486. return $3;
  34487. };
  34488. $5=$recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  34489. return $5;
  34490. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  34491. },
  34492. args: [],
  34493. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  34494. referencedClasses: [],
  34495. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  34496. }),
  34497. $globals.LexicalScope);
  34498. $core.addMethod(
  34499. $core.method({
  34500. selector: "temps",
  34501. protocol: 'accessing',
  34502. fn: function (){
  34503. var self=this;
  34504. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34505. return $core.withContext(function($ctx1) {
  34506. var $2,$1,$receiver;
  34507. $2=self["@temps"];
  34508. if(($receiver = $2) == null || $receiver.isNil){
  34509. self["@temps"]=$recv($Dictionary())._new();
  34510. $1=self["@temps"];
  34511. } else {
  34512. $1=$2;
  34513. };
  34514. return $1;
  34515. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  34516. },
  34517. args: [],
  34518. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  34519. referencedClasses: ["Dictionary"],
  34520. messageSends: ["ifNil:", "new"]
  34521. }),
  34522. $globals.LexicalScope);
  34523. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  34524. $globals.MethodLexicalScope.comment="I represent a method scope.";
  34525. $core.addMethod(
  34526. $core.method({
  34527. selector: "addIVar:",
  34528. protocol: 'adding',
  34529. fn: function (aString){
  34530. var self=this;
  34531. function $InstanceVar(){return $globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  34532. return $core.withContext(function($ctx1) {
  34533. var $1;
  34534. $1=self._iVars();
  34535. $ctx1.sendIdx["iVars"]=1;
  34536. $recv($1)._at_put_(aString,$recv($InstanceVar())._on_(aString));
  34537. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  34538. return self;
  34539. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  34540. },
  34541. args: ["aString"],
  34542. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  34543. referencedClasses: ["InstanceVar"],
  34544. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  34545. }),
  34546. $globals.MethodLexicalScope);
  34547. $core.addMethod(
  34548. $core.method({
  34549. selector: "addNonLocalReturn:",
  34550. protocol: 'adding',
  34551. fn: function (aScope){
  34552. var self=this;
  34553. return $core.withContext(function($ctx1) {
  34554. $recv(self._nonLocalReturns())._add_(aScope);
  34555. return self;
  34556. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34557. },
  34558. args: ["aScope"],
  34559. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  34560. referencedClasses: [],
  34561. messageSends: ["add:", "nonLocalReturns"]
  34562. }),
  34563. $globals.MethodLexicalScope);
  34564. $core.addMethod(
  34565. $core.method({
  34566. selector: "allVariableNames",
  34567. protocol: 'accessing',
  34568. fn: function (){
  34569. var self=this;
  34570. return $core.withContext(function($ctx1) {
  34571. var $2,$1;
  34572. $2=(
  34573. $ctx1.supercall = true,
  34574. $globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply($recv(self), []));
  34575. $ctx1.supercall = false;
  34576. $1=$recv($2).__comma($recv(self._iVars())._keys());
  34577. return $1;
  34578. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  34579. },
  34580. args: [],
  34581. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  34582. referencedClasses: [],
  34583. messageSends: [",", "allVariableNames", "keys", "iVars"]
  34584. }),
  34585. $globals.MethodLexicalScope);
  34586. $core.addMethod(
  34587. $core.method({
  34588. selector: "bindingFor:",
  34589. protocol: 'accessing',
  34590. fn: function (aNode){
  34591. var self=this;
  34592. return $core.withContext(function($ctx1) {
  34593. var $2,$1,$receiver;
  34594. $2=(
  34595. $ctx1.supercall = true,
  34596. $globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  34597. $ctx1.supercall = false;
  34598. if(($receiver = $2) == null || $receiver.isNil){
  34599. $1=$recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  34600. return nil;
  34601. }));
  34602. } else {
  34603. $1=$2;
  34604. };
  34605. return $1;
  34606. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  34607. },
  34608. args: ["aNode"],
  34609. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  34610. referencedClasses: [],
  34611. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  34612. }),
  34613. $globals.MethodLexicalScope);
  34614. $core.addMethod(
  34615. $core.method({
  34616. selector: "canInlineNonLocalReturns",
  34617. protocol: 'testing',
  34618. fn: function (){
  34619. var self=this;
  34620. return true;
  34621. },
  34622. args: [],
  34623. source: "canInlineNonLocalReturns\x0a\x09^ true",
  34624. referencedClasses: [],
  34625. messageSends: []
  34626. }),
  34627. $globals.MethodLexicalScope);
  34628. $core.addMethod(
  34629. $core.method({
  34630. selector: "hasLocalReturn",
  34631. protocol: 'testing',
  34632. fn: function (){
  34633. var self=this;
  34634. return $core.withContext(function($ctx1) {
  34635. var $1;
  34636. $1=self._localReturn();
  34637. return $1;
  34638. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  34639. },
  34640. args: [],
  34641. source: "hasLocalReturn\x0a\x09^ self localReturn",
  34642. referencedClasses: [],
  34643. messageSends: ["localReturn"]
  34644. }),
  34645. $globals.MethodLexicalScope);
  34646. $core.addMethod(
  34647. $core.method({
  34648. selector: "hasNonLocalReturn",
  34649. protocol: 'testing',
  34650. fn: function (){
  34651. var self=this;
  34652. return $core.withContext(function($ctx1) {
  34653. var $1;
  34654. $1=$recv(self._nonLocalReturns())._notEmpty();
  34655. return $1;
  34656. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  34657. },
  34658. args: [],
  34659. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  34660. referencedClasses: [],
  34661. messageSends: ["notEmpty", "nonLocalReturns"]
  34662. }),
  34663. $globals.MethodLexicalScope);
  34664. $core.addMethod(
  34665. $core.method({
  34666. selector: "iVars",
  34667. protocol: 'accessing',
  34668. fn: function (){
  34669. var self=this;
  34670. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34671. return $core.withContext(function($ctx1) {
  34672. var $2,$1,$receiver;
  34673. $2=self["@iVars"];
  34674. if(($receiver = $2) == null || $receiver.isNil){
  34675. self["@iVars"]=$recv($Dictionary())._new();
  34676. $1=self["@iVars"];
  34677. } else {
  34678. $1=$2;
  34679. };
  34680. return $1;
  34681. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  34682. },
  34683. args: [],
  34684. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  34685. referencedClasses: ["Dictionary"],
  34686. messageSends: ["ifNil:", "new"]
  34687. }),
  34688. $globals.MethodLexicalScope);
  34689. $core.addMethod(
  34690. $core.method({
  34691. selector: "isMethodScope",
  34692. protocol: 'testing',
  34693. fn: function (){
  34694. var self=this;
  34695. return true;
  34696. },
  34697. args: [],
  34698. source: "isMethodScope\x0a\x09^ true",
  34699. referencedClasses: [],
  34700. messageSends: []
  34701. }),
  34702. $globals.MethodLexicalScope);
  34703. $core.addMethod(
  34704. $core.method({
  34705. selector: "localReturn",
  34706. protocol: 'accessing',
  34707. fn: function (){
  34708. var self=this;
  34709. return $core.withContext(function($ctx1) {
  34710. var $2,$1,$receiver;
  34711. $2=self["@localReturn"];
  34712. if(($receiver = $2) == null || $receiver.isNil){
  34713. $1=false;
  34714. } else {
  34715. $1=$2;
  34716. };
  34717. return $1;
  34718. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  34719. },
  34720. args: [],
  34721. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  34722. referencedClasses: [],
  34723. messageSends: ["ifNil:"]
  34724. }),
  34725. $globals.MethodLexicalScope);
  34726. $core.addMethod(
  34727. $core.method({
  34728. selector: "localReturn:",
  34729. protocol: 'accessing',
  34730. fn: function (aBoolean){
  34731. var self=this;
  34732. self["@localReturn"]=aBoolean;
  34733. return self;
  34734. },
  34735. args: ["aBoolean"],
  34736. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  34737. referencedClasses: [],
  34738. messageSends: []
  34739. }),
  34740. $globals.MethodLexicalScope);
  34741. $core.addMethod(
  34742. $core.method({
  34743. selector: "methodScope",
  34744. protocol: 'accessing',
  34745. fn: function (){
  34746. var self=this;
  34747. return self;
  34748. },
  34749. args: [],
  34750. source: "methodScope\x0a\x09^ self",
  34751. referencedClasses: [],
  34752. messageSends: []
  34753. }),
  34754. $globals.MethodLexicalScope);
  34755. $core.addMethod(
  34756. $core.method({
  34757. selector: "nonLocalReturns",
  34758. protocol: 'accessing',
  34759. fn: function (){
  34760. var self=this;
  34761. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34762. return $core.withContext(function($ctx1) {
  34763. var $2,$1,$receiver;
  34764. $2=self["@nonLocalReturns"];
  34765. if(($receiver = $2) == null || $receiver.isNil){
  34766. self["@nonLocalReturns"]=$recv($OrderedCollection())._new();
  34767. $1=self["@nonLocalReturns"];
  34768. } else {
  34769. $1=$2;
  34770. };
  34771. return $1;
  34772. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  34773. },
  34774. args: [],
  34775. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  34776. referencedClasses: ["OrderedCollection"],
  34777. messageSends: ["ifNil:", "new"]
  34778. }),
  34779. $globals.MethodLexicalScope);
  34780. $core.addMethod(
  34781. $core.method({
  34782. selector: "pseudoVars",
  34783. protocol: 'accessing',
  34784. fn: function (){
  34785. var self=this;
  34786. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34787. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  34788. function $PseudoVar(){return $globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  34789. return $core.withContext(function($ctx1) {
  34790. var $1,$2,$3,$4,$receiver;
  34791. $1=self["@pseudoVars"];
  34792. if(($receiver = $1) == null || $receiver.isNil){
  34793. self["@pseudoVars"]=$recv($Dictionary())._new();
  34794. self["@pseudoVars"];
  34795. $recv($recv($Smalltalk())._pseudoVariableNames())._do_((function(each){
  34796. return $core.withContext(function($ctx2) {
  34797. $2=$recv($PseudoVar())._on_(each);
  34798. $recv($2)._scope_(self._methodScope());
  34799. $3=$recv($2)._yourself();
  34800. return $recv(self["@pseudoVars"])._at_put_(each,$3);
  34801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34802. }));
  34803. } else {
  34804. $1;
  34805. };
  34806. $4=self["@pseudoVars"];
  34807. return $4;
  34808. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  34809. },
  34810. args: [],
  34811. 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",
  34812. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  34813. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  34814. }),
  34815. $globals.MethodLexicalScope);
  34816. $core.addMethod(
  34817. $core.method({
  34818. selector: "removeNonLocalReturn:",
  34819. protocol: 'adding',
  34820. fn: function (aScope){
  34821. var self=this;
  34822. return $core.withContext(function($ctx1) {
  34823. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  34824. }));
  34825. return self;
  34826. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34827. },
  34828. args: ["aScope"],
  34829. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  34830. referencedClasses: [],
  34831. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  34832. }),
  34833. $globals.MethodLexicalScope);
  34834. $core.addMethod(
  34835. $core.method({
  34836. selector: "unknownVariables",
  34837. protocol: 'accessing',
  34838. fn: function (){
  34839. var self=this;
  34840. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34841. return $core.withContext(function($ctx1) {
  34842. var $2,$1,$receiver;
  34843. $2=self["@unknownVariables"];
  34844. if(($receiver = $2) == null || $receiver.isNil){
  34845. self["@unknownVariables"]=$recv($OrderedCollection())._new();
  34846. $1=self["@unknownVariables"];
  34847. } else {
  34848. $1=$2;
  34849. };
  34850. return $1;
  34851. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  34852. },
  34853. args: [],
  34854. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  34855. referencedClasses: ["OrderedCollection"],
  34856. messageSends: ["ifNil:", "new"]
  34857. }),
  34858. $globals.MethodLexicalScope);
  34859. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  34860. $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.";
  34861. $core.addMethod(
  34862. $core.method({
  34863. selector: "alias",
  34864. protocol: 'accessing',
  34865. fn: function (){
  34866. var self=this;
  34867. return $core.withContext(function($ctx1) {
  34868. var $1;
  34869. $1=$recv(self._name())._asVariableName();
  34870. return $1;
  34871. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  34872. },
  34873. args: [],
  34874. source: "alias\x0a\x09^ self name asVariableName",
  34875. referencedClasses: [],
  34876. messageSends: ["asVariableName", "name"]
  34877. }),
  34878. $globals.ScopeVar);
  34879. $core.addMethod(
  34880. $core.method({
  34881. selector: "isArgVar",
  34882. protocol: 'testing',
  34883. fn: function (){
  34884. var self=this;
  34885. return false;
  34886. },
  34887. args: [],
  34888. source: "isArgVar\x0a\x09^ false",
  34889. referencedClasses: [],
  34890. messageSends: []
  34891. }),
  34892. $globals.ScopeVar);
  34893. $core.addMethod(
  34894. $core.method({
  34895. selector: "isClassRefVar",
  34896. protocol: 'testing',
  34897. fn: function (){
  34898. var self=this;
  34899. return false;
  34900. },
  34901. args: [],
  34902. source: "isClassRefVar\x0a\x09^ false",
  34903. referencedClasses: [],
  34904. messageSends: []
  34905. }),
  34906. $globals.ScopeVar);
  34907. $core.addMethod(
  34908. $core.method({
  34909. selector: "isImmutable",
  34910. protocol: 'testing',
  34911. fn: function (){
  34912. var self=this;
  34913. return false;
  34914. },
  34915. args: [],
  34916. source: "isImmutable\x0a\x09^ false",
  34917. referencedClasses: [],
  34918. messageSends: []
  34919. }),
  34920. $globals.ScopeVar);
  34921. $core.addMethod(
  34922. $core.method({
  34923. selector: "isInstanceVar",
  34924. protocol: 'testing',
  34925. fn: function (){
  34926. var self=this;
  34927. return false;
  34928. },
  34929. args: [],
  34930. source: "isInstanceVar\x0a\x09^ false",
  34931. referencedClasses: [],
  34932. messageSends: []
  34933. }),
  34934. $globals.ScopeVar);
  34935. $core.addMethod(
  34936. $core.method({
  34937. selector: "isPseudoVar",
  34938. protocol: 'testing',
  34939. fn: function (){
  34940. var self=this;
  34941. return false;
  34942. },
  34943. args: [],
  34944. source: "isPseudoVar\x0a\x09^ false",
  34945. referencedClasses: [],
  34946. messageSends: []
  34947. }),
  34948. $globals.ScopeVar);
  34949. $core.addMethod(
  34950. $core.method({
  34951. selector: "isTempVar",
  34952. protocol: 'testing',
  34953. fn: function (){
  34954. var self=this;
  34955. return false;
  34956. },
  34957. args: [],
  34958. source: "isTempVar\x0a\x09^ false",
  34959. referencedClasses: [],
  34960. messageSends: []
  34961. }),
  34962. $globals.ScopeVar);
  34963. $core.addMethod(
  34964. $core.method({
  34965. selector: "isUnknownVar",
  34966. protocol: 'testing',
  34967. fn: function (){
  34968. var self=this;
  34969. return false;
  34970. },
  34971. args: [],
  34972. source: "isUnknownVar\x0a\x09^ false",
  34973. referencedClasses: [],
  34974. messageSends: []
  34975. }),
  34976. $globals.ScopeVar);
  34977. $core.addMethod(
  34978. $core.method({
  34979. selector: "name",
  34980. protocol: 'accessing',
  34981. fn: function (){
  34982. var self=this;
  34983. var $1;
  34984. $1=self["@name"];
  34985. return $1;
  34986. },
  34987. args: [],
  34988. source: "name\x0a\x09^ name",
  34989. referencedClasses: [],
  34990. messageSends: []
  34991. }),
  34992. $globals.ScopeVar);
  34993. $core.addMethod(
  34994. $core.method({
  34995. selector: "name:",
  34996. protocol: 'accessing',
  34997. fn: function (aString){
  34998. var self=this;
  34999. self["@name"]=aString;
  35000. return self;
  35001. },
  35002. args: ["aString"],
  35003. source: "name: aString\x0a\x09name := aString",
  35004. referencedClasses: [],
  35005. messageSends: []
  35006. }),
  35007. $globals.ScopeVar);
  35008. $core.addMethod(
  35009. $core.method({
  35010. selector: "scope",
  35011. protocol: 'accessing',
  35012. fn: function (){
  35013. var self=this;
  35014. var $1;
  35015. $1=self["@scope"];
  35016. return $1;
  35017. },
  35018. args: [],
  35019. source: "scope\x0a\x09^ scope",
  35020. referencedClasses: [],
  35021. messageSends: []
  35022. }),
  35023. $globals.ScopeVar);
  35024. $core.addMethod(
  35025. $core.method({
  35026. selector: "scope:",
  35027. protocol: 'accessing',
  35028. fn: function (aScope){
  35029. var self=this;
  35030. self["@scope"]=aScope;
  35031. return self;
  35032. },
  35033. args: ["aScope"],
  35034. source: "scope: aScope\x0a\x09scope := aScope",
  35035. referencedClasses: [],
  35036. messageSends: []
  35037. }),
  35038. $globals.ScopeVar);
  35039. $core.addMethod(
  35040. $core.method({
  35041. selector: "validateAssignment",
  35042. protocol: 'testing',
  35043. fn: function (){
  35044. var self=this;
  35045. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  35046. return $core.withContext(function($ctx1) {
  35047. var $1,$2,$3;
  35048. $1=$recv(self._isArgVar())._or_((function(){
  35049. return $core.withContext(function($ctx2) {
  35050. return self._isPseudoVar();
  35051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35052. }));
  35053. if($core.assert($1)){
  35054. $2=$recv($InvalidAssignmentError())._new();
  35055. $recv($2)._variableName_(self._name());
  35056. $3=$recv($2)._signal();
  35057. $3;
  35058. };
  35059. return self;
  35060. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  35061. },
  35062. args: [],
  35063. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  35064. referencedClasses: ["InvalidAssignmentError"],
  35065. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  35066. }),
  35067. $globals.ScopeVar);
  35068. $core.addMethod(
  35069. $core.method({
  35070. selector: "on:",
  35071. protocol: 'instance creation',
  35072. fn: function (aString){
  35073. var self=this;
  35074. return $core.withContext(function($ctx1) {
  35075. var $2,$3,$1;
  35076. $2=self._new();
  35077. $recv($2)._name_(aString);
  35078. $3=$recv($2)._yourself();
  35079. $1=$3;
  35080. return $1;
  35081. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  35082. },
  35083. args: ["aString"],
  35084. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  35085. referencedClasses: [],
  35086. messageSends: ["name:", "new", "yourself"]
  35087. }),
  35088. $globals.ScopeVar.klass);
  35089. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  35090. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  35091. $core.addMethod(
  35092. $core.method({
  35093. selector: "node",
  35094. protocol: 'accessing',
  35095. fn: function (){
  35096. var self=this;
  35097. var $1;
  35098. $1=self["@node"];
  35099. return $1;
  35100. },
  35101. args: [],
  35102. source: "node\x0a\x09^ node",
  35103. referencedClasses: [],
  35104. messageSends: []
  35105. }),
  35106. $globals.AliasVar);
  35107. $core.addMethod(
  35108. $core.method({
  35109. selector: "node:",
  35110. protocol: 'accessing',
  35111. fn: function (aNode){
  35112. var self=this;
  35113. self["@node"]=aNode;
  35114. return self;
  35115. },
  35116. args: ["aNode"],
  35117. source: "node: aNode\x0a\x09node := aNode",
  35118. referencedClasses: [],
  35119. messageSends: []
  35120. }),
  35121. $globals.AliasVar);
  35122. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35123. $globals.ArgVar.comment="I am an argument of a method or block.";
  35124. $core.addMethod(
  35125. $core.method({
  35126. selector: "isArgVar",
  35127. protocol: 'testing',
  35128. fn: function (){
  35129. var self=this;
  35130. return true;
  35131. },
  35132. args: [],
  35133. source: "isArgVar\x0a\x09^ true",
  35134. referencedClasses: [],
  35135. messageSends: []
  35136. }),
  35137. $globals.ArgVar);
  35138. $core.addMethod(
  35139. $core.method({
  35140. selector: "isImmutable",
  35141. protocol: 'testing',
  35142. fn: function (){
  35143. var self=this;
  35144. return true;
  35145. },
  35146. args: [],
  35147. source: "isImmutable\x0a\x09^ true",
  35148. referencedClasses: [],
  35149. messageSends: []
  35150. }),
  35151. $globals.ArgVar);
  35152. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35153. $globals.ClassRefVar.comment="I am an class reference variable";
  35154. $core.addMethod(
  35155. $core.method({
  35156. selector: "alias",
  35157. protocol: 'accessing',
  35158. fn: function (){
  35159. var self=this;
  35160. return $core.withContext(function($ctx1) {
  35161. var $1;
  35162. $1=$recv("$".__comma(self._name())).__comma("()");
  35163. $ctx1.sendIdx[","]=1;
  35164. return $1;
  35165. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  35166. },
  35167. args: [],
  35168. 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, '()'",
  35169. referencedClasses: [],
  35170. messageSends: [",", "name"]
  35171. }),
  35172. $globals.ClassRefVar);
  35173. $core.addMethod(
  35174. $core.method({
  35175. selector: "isClassRefVar",
  35176. protocol: 'testing',
  35177. fn: function (){
  35178. var self=this;
  35179. return true;
  35180. },
  35181. args: [],
  35182. source: "isClassRefVar\x0a\x09^ true",
  35183. referencedClasses: [],
  35184. messageSends: []
  35185. }),
  35186. $globals.ClassRefVar);
  35187. $core.addMethod(
  35188. $core.method({
  35189. selector: "isImmutable",
  35190. protocol: 'testing',
  35191. fn: function (){
  35192. var self=this;
  35193. return true;
  35194. },
  35195. args: [],
  35196. source: "isImmutable\x0a\x09^ true",
  35197. referencedClasses: [],
  35198. messageSends: []
  35199. }),
  35200. $globals.ClassRefVar);
  35201. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35202. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  35203. $core.addMethod(
  35204. $core.method({
  35205. selector: "alias",
  35206. protocol: 'testing',
  35207. fn: function (){
  35208. var self=this;
  35209. return $core.withContext(function($ctx1) {
  35210. var $1;
  35211. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  35212. $ctx1.sendIdx[","]=1;
  35213. return $1;
  35214. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  35215. },
  35216. args: [],
  35217. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  35218. referencedClasses: [],
  35219. messageSends: [",", "name"]
  35220. }),
  35221. $globals.InstanceVar);
  35222. $core.addMethod(
  35223. $core.method({
  35224. selector: "isInstanceVar",
  35225. protocol: 'testing',
  35226. fn: function (){
  35227. var self=this;
  35228. return true;
  35229. },
  35230. args: [],
  35231. source: "isInstanceVar\x0a\x09^ true",
  35232. referencedClasses: [],
  35233. messageSends: []
  35234. }),
  35235. $globals.InstanceVar);
  35236. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35237. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  35238. $core.addMethod(
  35239. $core.method({
  35240. selector: "alias",
  35241. protocol: 'accessing',
  35242. fn: function (){
  35243. var self=this;
  35244. return $core.withContext(function($ctx1) {
  35245. var $1;
  35246. $1=self._name();
  35247. return $1;
  35248. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  35249. },
  35250. args: [],
  35251. source: "alias\x0a\x09^ self name",
  35252. referencedClasses: [],
  35253. messageSends: ["name"]
  35254. }),
  35255. $globals.PseudoVar);
  35256. $core.addMethod(
  35257. $core.method({
  35258. selector: "isImmutable",
  35259. protocol: 'testing',
  35260. fn: function (){
  35261. var self=this;
  35262. return true;
  35263. },
  35264. args: [],
  35265. source: "isImmutable\x0a\x09^ true",
  35266. referencedClasses: [],
  35267. messageSends: []
  35268. }),
  35269. $globals.PseudoVar);
  35270. $core.addMethod(
  35271. $core.method({
  35272. selector: "isPseudoVar",
  35273. protocol: 'testing',
  35274. fn: function (){
  35275. var self=this;
  35276. return true;
  35277. },
  35278. args: [],
  35279. source: "isPseudoVar\x0a\x09^ true",
  35280. referencedClasses: [],
  35281. messageSends: []
  35282. }),
  35283. $globals.PseudoVar);
  35284. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35285. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  35286. $core.addMethod(
  35287. $core.method({
  35288. selector: "isTempVar",
  35289. protocol: 'testing',
  35290. fn: function (){
  35291. var self=this;
  35292. return true;
  35293. },
  35294. args: [],
  35295. source: "isTempVar\x0a\x09^ true",
  35296. referencedClasses: [],
  35297. messageSends: []
  35298. }),
  35299. $globals.TempVar);
  35300. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35301. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  35302. $core.addMethod(
  35303. $core.method({
  35304. selector: "isUnknownVar",
  35305. protocol: 'testing',
  35306. fn: function (){
  35307. var self=this;
  35308. return true;
  35309. },
  35310. args: [],
  35311. source: "isUnknownVar\x0a\x09^ true",
  35312. referencedClasses: [],
  35313. messageSends: []
  35314. }),
  35315. $globals.UnknownVar);
  35316. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  35317. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  35318. $core.addMethod(
  35319. $core.method({
  35320. selector: "classReferences",
  35321. protocol: 'accessing',
  35322. fn: function (){
  35323. var self=this;
  35324. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  35325. return $core.withContext(function($ctx1) {
  35326. var $2,$1,$receiver;
  35327. $2=self["@classReferences"];
  35328. if(($receiver = $2) == null || $receiver.isNil){
  35329. self["@classReferences"]=$recv($Set())._new();
  35330. $1=self["@classReferences"];
  35331. } else {
  35332. $1=$2;
  35333. };
  35334. return $1;
  35335. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  35336. },
  35337. args: [],
  35338. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  35339. referencedClasses: ["Set"],
  35340. messageSends: ["ifNil:", "new"]
  35341. }),
  35342. $globals.SemanticAnalyzer);
  35343. $core.addMethod(
  35344. $core.method({
  35345. selector: "errorShadowingVariable:",
  35346. protocol: 'error handling',
  35347. fn: function (aString){
  35348. var self=this;
  35349. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  35350. return $core.withContext(function($ctx1) {
  35351. var $1,$2;
  35352. $1=$recv($ShadowingVariableError())._new();
  35353. $recv($1)._variableName_(aString);
  35354. $2=$recv($1)._signal();
  35355. return self;
  35356. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  35357. },
  35358. args: ["aString"],
  35359. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  35360. referencedClasses: ["ShadowingVariableError"],
  35361. messageSends: ["variableName:", "new", "signal"]
  35362. }),
  35363. $globals.SemanticAnalyzer);
  35364. $core.addMethod(
  35365. $core.method({
  35366. selector: "errorUnknownVariable:",
  35367. protocol: 'error handling',
  35368. fn: function (aNode){
  35369. var self=this;
  35370. var identifier;
  35371. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  35372. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  35373. return $core.withContext(function($ctx1) {
  35374. var $1,$2,$3,$4,$5;
  35375. identifier=$recv(aNode)._value();
  35376. $ctx1.sendIdx["value"]=1;
  35377. $1=$recv($recv($recv($recv($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  35378. return $core.withContext(function($ctx2) {
  35379. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  35380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35381. }));
  35382. if($core.assert($1)){
  35383. $2=$recv($UnknownVariableError())._new();
  35384. $3=$2;
  35385. $4=$recv(aNode)._value();
  35386. $ctx1.sendIdx["value"]=2;
  35387. $recv($3)._variableName_($4);
  35388. $5=$recv($2)._signal();
  35389. $5;
  35390. } else {
  35391. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  35392. };
  35393. return self;
  35394. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  35395. },
  35396. args: ["aNode"],
  35397. 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 ]",
  35398. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  35399. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  35400. }),
  35401. $globals.SemanticAnalyzer);
  35402. $core.addMethod(
  35403. $core.method({
  35404. selector: "isVariableUndefined:inPackage:",
  35405. protocol: 'testing',
  35406. fn: function (aString,aPackage){
  35407. var self=this;
  35408. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  35409. return $core.withContext(function($ctx1) {
  35410. var $1,$3,$4,$2,$receiver;
  35411. if(($receiver = aPackage) == null || $receiver.isNil){
  35412. aPackage;
  35413. } else {
  35414. var packageKnownVars;
  35415. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  35416. packageKnownVars;
  35417. $1=$recv(packageKnownVars)._includes_(aString);
  35418. if($core.assert($1)){
  35419. return false;
  35420. };
  35421. };
  35422. $3=$recv($Compiler())._new();
  35423. $4=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  35424. $ctx1.sendIdx[","]=1;
  35425. $2=$recv($3)._eval_($4);
  35426. return $2;
  35427. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  35428. },
  35429. args: ["aString", "aPackage"],
  35430. 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'",
  35431. referencedClasses: ["Compiler"],
  35432. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  35433. }),
  35434. $globals.SemanticAnalyzer);
  35435. $core.addMethod(
  35436. $core.method({
  35437. selector: "messageSends",
  35438. protocol: 'accessing',
  35439. fn: function (){
  35440. var self=this;
  35441. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  35442. return $core.withContext(function($ctx1) {
  35443. var $2,$1,$receiver;
  35444. $2=self["@messageSends"];
  35445. if(($receiver = $2) == null || $receiver.isNil){
  35446. self["@messageSends"]=$recv($Dictionary())._new();
  35447. $1=self["@messageSends"];
  35448. } else {
  35449. $1=$2;
  35450. };
  35451. return $1;
  35452. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  35453. },
  35454. args: [],
  35455. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  35456. referencedClasses: ["Dictionary"],
  35457. messageSends: ["ifNil:", "new"]
  35458. }),
  35459. $globals.SemanticAnalyzer);
  35460. $core.addMethod(
  35461. $core.method({
  35462. selector: "newBlockScope",
  35463. protocol: 'factory',
  35464. fn: function (){
  35465. var self=this;
  35466. function $LexicalScope(){return $globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  35467. return $core.withContext(function($ctx1) {
  35468. var $1;
  35469. $1=self._newScopeOfClass_($LexicalScope());
  35470. return $1;
  35471. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  35472. },
  35473. args: [],
  35474. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  35475. referencedClasses: ["LexicalScope"],
  35476. messageSends: ["newScopeOfClass:"]
  35477. }),
  35478. $globals.SemanticAnalyzer);
  35479. $core.addMethod(
  35480. $core.method({
  35481. selector: "newMethodScope",
  35482. protocol: 'factory',
  35483. fn: function (){
  35484. var self=this;
  35485. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  35486. return $core.withContext(function($ctx1) {
  35487. var $1;
  35488. $1=self._newScopeOfClass_($MethodLexicalScope());
  35489. return $1;
  35490. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  35491. },
  35492. args: [],
  35493. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  35494. referencedClasses: ["MethodLexicalScope"],
  35495. messageSends: ["newScopeOfClass:"]
  35496. }),
  35497. $globals.SemanticAnalyzer);
  35498. $core.addMethod(
  35499. $core.method({
  35500. selector: "newScopeOfClass:",
  35501. protocol: 'factory',
  35502. fn: function (aLexicalScopeClass){
  35503. var self=this;
  35504. return $core.withContext(function($ctx1) {
  35505. var $2,$3,$1;
  35506. $2=$recv(aLexicalScopeClass)._new();
  35507. $recv($2)._outerScope_(self["@currentScope"]);
  35508. $3=$recv($2)._yourself();
  35509. $1=$3;
  35510. return $1;
  35511. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  35512. },
  35513. args: ["aLexicalScopeClass"],
  35514. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  35515. referencedClasses: [],
  35516. messageSends: ["outerScope:", "new", "yourself"]
  35517. }),
  35518. $globals.SemanticAnalyzer);
  35519. $core.addMethod(
  35520. $core.method({
  35521. selector: "nextBlockIndex",
  35522. protocol: 'private',
  35523. fn: function (){
  35524. var self=this;
  35525. return $core.withContext(function($ctx1) {
  35526. var $1,$2,$receiver;
  35527. $1=self["@blockIndex"];
  35528. if(($receiver = $1) == null || $receiver.isNil){
  35529. self["@blockIndex"]=(0);
  35530. self["@blockIndex"];
  35531. } else {
  35532. $1;
  35533. };
  35534. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  35535. $2=self["@blockIndex"];
  35536. return $2;
  35537. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  35538. },
  35539. args: [],
  35540. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  35541. referencedClasses: [],
  35542. messageSends: ["ifNil:", "+"]
  35543. }),
  35544. $globals.SemanticAnalyzer);
  35545. $core.addMethod(
  35546. $core.method({
  35547. selector: "popScope",
  35548. protocol: 'scope',
  35549. fn: function (){
  35550. var self=this;
  35551. return $core.withContext(function($ctx1) {
  35552. var $1,$receiver;
  35553. $1=self["@currentScope"];
  35554. if(($receiver = $1) == null || $receiver.isNil){
  35555. $1;
  35556. } else {
  35557. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  35558. self["@currentScope"];
  35559. };
  35560. return self;
  35561. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  35562. },
  35563. args: [],
  35564. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  35565. referencedClasses: [],
  35566. messageSends: ["ifNotNil:", "outerScope"]
  35567. }),
  35568. $globals.SemanticAnalyzer);
  35569. $core.addMethod(
  35570. $core.method({
  35571. selector: "pushScope:",
  35572. protocol: 'scope',
  35573. fn: function (aScope){
  35574. var self=this;
  35575. return $core.withContext(function($ctx1) {
  35576. $recv(aScope)._outerScope_(self["@currentScope"]);
  35577. self["@currentScope"]=aScope;
  35578. return self;
  35579. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  35580. },
  35581. args: ["aScope"],
  35582. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  35583. referencedClasses: [],
  35584. messageSends: ["outerScope:"]
  35585. }),
  35586. $globals.SemanticAnalyzer);
  35587. $core.addMethod(
  35588. $core.method({
  35589. selector: "superSends",
  35590. protocol: 'accessing',
  35591. fn: function (){
  35592. var self=this;
  35593. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  35594. return $core.withContext(function($ctx1) {
  35595. var $2,$1,$receiver;
  35596. $2=self["@superSends"];
  35597. if(($receiver = $2) == null || $receiver.isNil){
  35598. self["@superSends"]=$recv($Dictionary())._new();
  35599. $1=self["@superSends"];
  35600. } else {
  35601. $1=$2;
  35602. };
  35603. return $1;
  35604. }, function($ctx1) {$ctx1.fill(self,"superSends",{},$globals.SemanticAnalyzer)});
  35605. },
  35606. args: [],
  35607. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  35608. referencedClasses: ["Dictionary"],
  35609. messageSends: ["ifNil:", "new"]
  35610. }),
  35611. $globals.SemanticAnalyzer);
  35612. $core.addMethod(
  35613. $core.method({
  35614. selector: "theClass",
  35615. protocol: 'accessing',
  35616. fn: function (){
  35617. var self=this;
  35618. var $1;
  35619. $1=self["@theClass"];
  35620. return $1;
  35621. },
  35622. args: [],
  35623. source: "theClass\x0a\x09^ theClass",
  35624. referencedClasses: [],
  35625. messageSends: []
  35626. }),
  35627. $globals.SemanticAnalyzer);
  35628. $core.addMethod(
  35629. $core.method({
  35630. selector: "theClass:",
  35631. protocol: 'accessing',
  35632. fn: function (aClass){
  35633. var self=this;
  35634. self["@theClass"]=aClass;
  35635. return self;
  35636. },
  35637. args: ["aClass"],
  35638. source: "theClass: aClass\x0a\x09theClass := aClass",
  35639. referencedClasses: [],
  35640. messageSends: []
  35641. }),
  35642. $globals.SemanticAnalyzer);
  35643. $core.addMethod(
  35644. $core.method({
  35645. selector: "thePackage",
  35646. protocol: 'accessing',
  35647. fn: function (){
  35648. var self=this;
  35649. var $1;
  35650. $1=self["@thePackage"];
  35651. return $1;
  35652. },
  35653. args: [],
  35654. source: "thePackage\x0a\x09^ thePackage",
  35655. referencedClasses: [],
  35656. messageSends: []
  35657. }),
  35658. $globals.SemanticAnalyzer);
  35659. $core.addMethod(
  35660. $core.method({
  35661. selector: "thePackage:",
  35662. protocol: 'accessing',
  35663. fn: function (aPackage){
  35664. var self=this;
  35665. self["@thePackage"]=aPackage;
  35666. return self;
  35667. },
  35668. args: ["aPackage"],
  35669. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  35670. referencedClasses: [],
  35671. messageSends: []
  35672. }),
  35673. $globals.SemanticAnalyzer);
  35674. $core.addMethod(
  35675. $core.method({
  35676. selector: "validateVariableScope:",
  35677. protocol: 'scope',
  35678. fn: function (aString){
  35679. var self=this;
  35680. return $core.withContext(function($ctx1) {
  35681. var $1,$receiver;
  35682. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  35683. if(($receiver = $1) == null || $receiver.isNil){
  35684. $1;
  35685. } else {
  35686. self._errorShadowingVariable_(aString);
  35687. };
  35688. return self;
  35689. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  35690. },
  35691. args: ["aString"],
  35692. 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 ]",
  35693. referencedClasses: [],
  35694. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  35695. }),
  35696. $globals.SemanticAnalyzer);
  35697. $core.addMethod(
  35698. $core.method({
  35699. selector: "visitAssignmentNode:",
  35700. protocol: 'visiting',
  35701. fn: function (aNode){
  35702. var self=this;
  35703. return $core.withContext(function($ctx1) {
  35704. (
  35705. $ctx1.supercall = true,
  35706. $globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  35707. $ctx1.supercall = false;
  35708. $recv($recv(aNode)._left())._beAssigned();
  35709. return self;
  35710. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35711. },
  35712. args: ["aNode"],
  35713. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  35714. referencedClasses: [],
  35715. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  35716. }),
  35717. $globals.SemanticAnalyzer);
  35718. $core.addMethod(
  35719. $core.method({
  35720. selector: "visitBlockNode:",
  35721. protocol: 'visiting',
  35722. fn: function (aNode){
  35723. var self=this;
  35724. return $core.withContext(function($ctx1) {
  35725. self._pushScope_(self._newBlockScope());
  35726. $recv(aNode)._scope_(self["@currentScope"]);
  35727. $recv(self["@currentScope"])._node_(aNode);
  35728. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  35729. $recv($recv(aNode)._parameters())._do_((function(each){
  35730. return $core.withContext(function($ctx2) {
  35731. self._validateVariableScope_(each);
  35732. return $recv(self["@currentScope"])._addArg_(each);
  35733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35734. }));
  35735. (
  35736. $ctx1.supercall = true,
  35737. $globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  35738. $ctx1.supercall = false;
  35739. self._popScope();
  35740. return self;
  35741. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35742. },
  35743. args: ["aNode"],
  35744. 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",
  35745. referencedClasses: [],
  35746. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  35747. }),
  35748. $globals.SemanticAnalyzer);
  35749. $core.addMethod(
  35750. $core.method({
  35751. selector: "visitCascadeNode:",
  35752. protocol: 'visiting',
  35753. fn: function (aNode){
  35754. var self=this;
  35755. return $core.withContext(function($ctx1) {
  35756. var $3,$2,$1;
  35757. (
  35758. $ctx1.supercall = true,
  35759. $globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  35760. $ctx1.supercall = false;
  35761. $3=$recv(aNode)._nodes();
  35762. $ctx1.sendIdx["nodes"]=1;
  35763. $2=$recv($3)._first();
  35764. $1=$recv($2)._superSend();
  35765. if($core.assert($1)){
  35766. $recv($recv(aNode)._nodes())._do_((function(each){
  35767. return $core.withContext(function($ctx2) {
  35768. return $recv(each)._superSend_(true);
  35769. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35770. }));
  35771. };
  35772. return self;
  35773. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35774. },
  35775. args: ["aNode"],
  35776. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  35777. referencedClasses: [],
  35778. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"]
  35779. }),
  35780. $globals.SemanticAnalyzer);
  35781. $core.addMethod(
  35782. $core.method({
  35783. selector: "visitMethodNode:",
  35784. protocol: 'visiting',
  35785. fn: function (aNode){
  35786. var self=this;
  35787. return $core.withContext(function($ctx1) {
  35788. var $1;
  35789. self._pushScope_(self._newMethodScope());
  35790. $recv(aNode)._scope_(self["@currentScope"]);
  35791. $recv(self["@currentScope"])._node_(aNode);
  35792. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  35793. return $core.withContext(function($ctx2) {
  35794. return $recv(self["@currentScope"])._addIVar_(each);
  35795. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35796. }));
  35797. $ctx1.sendIdx["do:"]=1;
  35798. $recv($recv(aNode)._arguments())._do_((function(each){
  35799. return $core.withContext(function($ctx2) {
  35800. self._validateVariableScope_(each);
  35801. return $recv(self["@currentScope"])._addArg_(each);
  35802. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35803. }));
  35804. (
  35805. $ctx1.supercall = true,
  35806. $globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  35807. $ctx1.supercall = false;
  35808. $recv(aNode)._classReferences_(self._classReferences());
  35809. $recv(aNode)._sendIndexes_(self._messageSends());
  35810. $1=$recv(aNode)._superSends_($recv(self._superSends())._keys());
  35811. self._popScope();
  35812. return self;
  35813. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35814. },
  35815. args: ["aNode"],
  35816. 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",
  35817. referencedClasses: [],
  35818. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"]
  35819. }),
  35820. $globals.SemanticAnalyzer);
  35821. $core.addMethod(
  35822. $core.method({
  35823. selector: "visitReturnNode:",
  35824. protocol: 'visiting',
  35825. fn: function (aNode){
  35826. var self=this;
  35827. return $core.withContext(function($ctx1) {
  35828. var $1;
  35829. $recv(aNode)._scope_(self["@currentScope"]);
  35830. $1=$recv(self["@currentScope"])._isMethodScope();
  35831. if($core.assert($1)){
  35832. $recv(self["@currentScope"])._localReturn_(true);
  35833. } else {
  35834. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  35835. };
  35836. (
  35837. $ctx1.supercall = true,
  35838. $globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  35839. $ctx1.supercall = false;
  35840. return self;
  35841. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35842. },
  35843. args: ["aNode"],
  35844. 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",
  35845. referencedClasses: [],
  35846. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  35847. }),
  35848. $globals.SemanticAnalyzer);
  35849. $core.addMethod(
  35850. $core.method({
  35851. selector: "visitSendNode:",
  35852. protocol: 'visiting',
  35853. fn: function (aNode){
  35854. var self=this;
  35855. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  35856. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  35857. return $core.withContext(function($ctx1) {
  35858. var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
  35859. $3=$recv(aNode)._receiver();
  35860. $ctx1.sendIdx["receiver"]=1;
  35861. $2=$recv($3)._value();
  35862. $1=$recv($2).__eq("super");
  35863. if($core.assert($1)){
  35864. $recv(aNode)._superSend_(true);
  35865. $4=$recv(aNode)._receiver();
  35866. $ctx1.sendIdx["receiver"]=2;
  35867. $recv($4)._value_("self");
  35868. $5=self._superSends();
  35869. $ctx1.sendIdx["superSends"]=1;
  35870. $6=$recv(aNode)._selector();
  35871. $ctx1.sendIdx["selector"]=1;
  35872. $recv($5)._at_ifAbsentPut_($6,(function(){
  35873. return $core.withContext(function($ctx2) {
  35874. return $recv($Set())._new();
  35875. $ctx2.sendIdx["new"]=1;
  35876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  35877. }));
  35878. $ctx1.sendIdx["at:ifAbsentPut:"]=1;
  35879. $8=self._superSends();
  35880. $9=$recv(aNode)._selector();
  35881. $ctx1.sendIdx["selector"]=2;
  35882. $7=$recv($8)._at_($9);
  35883. $ctx1.sendIdx["at:"]=1;
  35884. $recv($7)._add_(aNode);
  35885. $ctx1.sendIdx["add:"]=1;
  35886. } else {
  35887. $11=$recv($IRSendInliner())._inlinedSelectors();
  35888. $12=$recv(aNode)._selector();
  35889. $ctx1.sendIdx["selector"]=3;
  35890. $10=$recv($11)._includes_($12);
  35891. if($core.assert($10)){
  35892. $recv(aNode)._shouldBeInlined_(true);
  35893. $13=$recv(aNode)._receiver();
  35894. if(($receiver = $13) == null || $receiver.isNil){
  35895. $13;
  35896. } else {
  35897. var receiver;
  35898. receiver=$receiver;
  35899. $recv(receiver)._shouldBeAliased_(true);
  35900. };
  35901. };
  35902. };
  35903. $14=self._messageSends();
  35904. $ctx1.sendIdx["messageSends"]=1;
  35905. $15=$recv(aNode)._selector();
  35906. $ctx1.sendIdx["selector"]=4;
  35907. $recv($14)._at_ifAbsentPut_($15,(function(){
  35908. return $core.withContext(function($ctx2) {
  35909. return $recv($Set())._new();
  35910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  35911. }));
  35912. $17=self._messageSends();
  35913. $ctx1.sendIdx["messageSends"]=2;
  35914. $18=$recv(aNode)._selector();
  35915. $ctx1.sendIdx["selector"]=5;
  35916. $16=$recv($17)._at_($18);
  35917. $ctx1.sendIdx["at:"]=2;
  35918. $recv($16)._add_(aNode);
  35919. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  35920. (
  35921. $ctx1.supercall = true,
  35922. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  35923. $ctx1.supercall = false;
  35924. return self;
  35925. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35926. },
  35927. args: ["aNode"],
  35928. 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",
  35929. referencedClasses: ["Set", "IRSendInliner"],
  35930. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"]
  35931. }),
  35932. $globals.SemanticAnalyzer);
  35933. $core.addMethod(
  35934. $core.method({
  35935. selector: "visitSequenceNode:",
  35936. protocol: 'visiting',
  35937. fn: function (aNode){
  35938. var self=this;
  35939. return $core.withContext(function($ctx1) {
  35940. $recv($recv(aNode)._temps())._do_((function(each){
  35941. return $core.withContext(function($ctx2) {
  35942. self._validateVariableScope_(each);
  35943. return $recv(self["@currentScope"])._addTemp_(each);
  35944. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35945. }));
  35946. (
  35947. $ctx1.supercall = true,
  35948. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  35949. $ctx1.supercall = false;
  35950. return self;
  35951. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35952. },
  35953. args: ["aNode"],
  35954. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  35955. referencedClasses: [],
  35956. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  35957. }),
  35958. $globals.SemanticAnalyzer);
  35959. $core.addMethod(
  35960. $core.method({
  35961. selector: "visitVariableNode:",
  35962. protocol: 'visiting',
  35963. fn: function (aNode){
  35964. var self=this;
  35965. var binding;
  35966. function $ClassRefVar(){return $globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  35967. function $UnknownVar(){return $globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  35968. return $core.withContext(function($ctx1) {
  35969. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  35970. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  35971. $1=binding;
  35972. if(($receiver = $1) == null || $receiver.isNil){
  35973. $3=$recv(aNode)._value();
  35974. $ctx1.sendIdx["value"]=1;
  35975. $2=$recv($3)._isCapitalized();
  35976. if($core.assert($2)){
  35977. $4=$recv($ClassRefVar())._new();
  35978. $ctx1.sendIdx["new"]=1;
  35979. $5=$4;
  35980. $6=$recv(aNode)._value();
  35981. $ctx1.sendIdx["value"]=2;
  35982. $recv($5)._name_($6);
  35983. $ctx1.sendIdx["name:"]=1;
  35984. $7=$recv($4)._yourself();
  35985. $ctx1.sendIdx["yourself"]=1;
  35986. binding=$7;
  35987. binding;
  35988. $8=self._classReferences();
  35989. $9=$recv(aNode)._value();
  35990. $ctx1.sendIdx["value"]=3;
  35991. $recv($8)._add_($9);
  35992. } else {
  35993. self._errorUnknownVariable_(aNode);
  35994. $10=$recv($UnknownVar())._new();
  35995. $recv($10)._name_($recv(aNode)._value());
  35996. $11=$recv($10)._yourself();
  35997. binding=$11;
  35998. binding;
  35999. };
  36000. } else {
  36001. $1;
  36002. };
  36003. $recv(aNode)._binding_(binding);
  36004. return self;
  36005. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  36006. },
  36007. args: ["aNode"],
  36008. 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.",
  36009. referencedClasses: ["ClassRefVar", "UnknownVar"],
  36010. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  36011. }),
  36012. $globals.SemanticAnalyzer);
  36013. $core.addMethod(
  36014. $core.method({
  36015. selector: "on:",
  36016. protocol: 'instance creation',
  36017. fn: function (aClass){
  36018. var self=this;
  36019. return $core.withContext(function($ctx1) {
  36020. var $2,$3,$1;
  36021. $2=self._new();
  36022. $recv($2)._theClass_(aClass);
  36023. $3=$recv($2)._yourself();
  36024. $1=$3;
  36025. return $1;
  36026. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  36027. },
  36028. args: ["aClass"],
  36029. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  36030. referencedClasses: [],
  36031. messageSends: ["theClass:", "new", "yourself"]
  36032. }),
  36033. $globals.SemanticAnalyzer.klass);
  36034. });
  36035. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  36036. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  36037. $core.addPackage('Compiler-IR');
  36038. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  36039. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36040. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  36041. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  36042. $core.addMethod(
  36043. $core.method({
  36044. selector: "alias:",
  36045. protocol: 'visiting',
  36046. fn: function (aNode){
  36047. var self=this;
  36048. var variable;
  36049. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36050. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  36051. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  36052. return $core.withContext(function($ctx1) {
  36053. var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
  36054. $1=$recv(aNode)._isImmutable();
  36055. if($core.assert($1)){
  36056. $2=self._visit_(aNode);
  36057. $ctx1.sendIdx["visit:"]=1;
  36058. return $2;
  36059. };
  36060. $3=$recv($IRVariable())._new();
  36061. $ctx1.sendIdx["new"]=1;
  36062. $4=$3;
  36063. $6=$recv($AliasVar())._new();
  36064. $ctx1.sendIdx["new"]=2;
  36065. $5=$recv($6)._name_("$".__comma(self._nextAlias()));
  36066. $recv($4)._variable_($5);
  36067. $7=$recv($3)._yourself();
  36068. $ctx1.sendIdx["yourself"]=1;
  36069. variable=$7;
  36070. $8=self._sequence();
  36071. $10=$recv($IRAssignment())._new();
  36072. $recv($10)._add_(variable);
  36073. $ctx1.sendIdx["add:"]=2;
  36074. $recv($10)._add_(self._visit_(aNode));
  36075. $ctx1.sendIdx["add:"]=3;
  36076. $11=$recv($10)._yourself();
  36077. $9=$11;
  36078. $recv($8)._add_($9);
  36079. $ctx1.sendIdx["add:"]=1;
  36080. $recv($recv(self._method())._internalVariables())._add_(variable);
  36081. $12=variable;
  36082. return $12;
  36083. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  36084. },
  36085. args: ["aNode"],
  36086. 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",
  36087. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  36088. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  36089. }),
  36090. $globals.IRASTTranslator);
  36091. $core.addMethod(
  36092. $core.method({
  36093. selector: "aliasTemporally:",
  36094. protocol: 'visiting',
  36095. fn: function (aCollection){
  36096. var self=this;
  36097. var threshold,result;
  36098. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  36099. return $core.withContext(function($ctx1) {
  36100. var $1,$2,$4,$3,$5;
  36101. threshold=(0);
  36102. $recv(aCollection)._withIndexDo_((function(each,i){
  36103. return $core.withContext(function($ctx2) {
  36104. $1=$recv(each)._subtreeNeedsAliasing();
  36105. if($core.assert($1)){
  36106. threshold=i;
  36107. return threshold;
  36108. };
  36109. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  36110. }));
  36111. $ctx1.sendIdx["withIndexDo:"]=1;
  36112. result=$recv($OrderedCollection())._new();
  36113. $recv(aCollection)._withIndexDo_((function(each,i){
  36114. return $core.withContext(function($ctx2) {
  36115. $2=result;
  36116. $4=$recv(i).__lt_eq(threshold);
  36117. if($core.assert($4)){
  36118. $3=self._alias_(each);
  36119. } else {
  36120. $3=self._visit_(each);
  36121. };
  36122. return $recv($2)._add_($3);
  36123. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  36124. }));
  36125. $5=result;
  36126. return $5;
  36127. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  36128. },
  36129. args: ["aCollection"],
  36130. 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",
  36131. referencedClasses: ["OrderedCollection"],
  36132. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  36133. }),
  36134. $globals.IRASTTranslator);
  36135. $core.addMethod(
  36136. $core.method({
  36137. selector: "method",
  36138. protocol: 'accessing',
  36139. fn: function (){
  36140. var self=this;
  36141. var $1;
  36142. $1=self["@method"];
  36143. return $1;
  36144. },
  36145. args: [],
  36146. source: "method\x0a\x09^ method",
  36147. referencedClasses: [],
  36148. messageSends: []
  36149. }),
  36150. $globals.IRASTTranslator);
  36151. $core.addMethod(
  36152. $core.method({
  36153. selector: "method:",
  36154. protocol: 'accessing',
  36155. fn: function (anIRMethod){
  36156. var self=this;
  36157. self["@method"]=anIRMethod;
  36158. return self;
  36159. },
  36160. args: ["anIRMethod"],
  36161. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  36162. referencedClasses: [],
  36163. messageSends: []
  36164. }),
  36165. $globals.IRASTTranslator);
  36166. $core.addMethod(
  36167. $core.method({
  36168. selector: "nextAlias",
  36169. protocol: 'accessing',
  36170. fn: function (){
  36171. var self=this;
  36172. return $core.withContext(function($ctx1) {
  36173. var $1,$2,$receiver;
  36174. $1=self["@nextAlias"];
  36175. if(($receiver = $1) == null || $receiver.isNil){
  36176. self["@nextAlias"]=(0);
  36177. self["@nextAlias"];
  36178. } else {
  36179. $1;
  36180. };
  36181. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  36182. $2=$recv(self["@nextAlias"])._asString();
  36183. return $2;
  36184. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  36185. },
  36186. args: [],
  36187. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  36188. referencedClasses: [],
  36189. messageSends: ["ifNil:", "+", "asString"]
  36190. }),
  36191. $globals.IRASTTranslator);
  36192. $core.addMethod(
  36193. $core.method({
  36194. selector: "sequence",
  36195. protocol: 'accessing',
  36196. fn: function (){
  36197. var self=this;
  36198. var $1;
  36199. $1=self["@sequence"];
  36200. return $1;
  36201. },
  36202. args: [],
  36203. source: "sequence\x0a\x09^ sequence",
  36204. referencedClasses: [],
  36205. messageSends: []
  36206. }),
  36207. $globals.IRASTTranslator);
  36208. $core.addMethod(
  36209. $core.method({
  36210. selector: "sequence:",
  36211. protocol: 'accessing',
  36212. fn: function (anIRSequence){
  36213. var self=this;
  36214. self["@sequence"]=anIRSequence;
  36215. return self;
  36216. },
  36217. args: ["anIRSequence"],
  36218. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  36219. referencedClasses: [],
  36220. messageSends: []
  36221. }),
  36222. $globals.IRASTTranslator);
  36223. $core.addMethod(
  36224. $core.method({
  36225. selector: "source",
  36226. protocol: 'accessing',
  36227. fn: function (){
  36228. var self=this;
  36229. var $1;
  36230. $1=self["@source"];
  36231. return $1;
  36232. },
  36233. args: [],
  36234. source: "source\x0a\x09^ source",
  36235. referencedClasses: [],
  36236. messageSends: []
  36237. }),
  36238. $globals.IRASTTranslator);
  36239. $core.addMethod(
  36240. $core.method({
  36241. selector: "source:",
  36242. protocol: 'accessing',
  36243. fn: function (aString){
  36244. var self=this;
  36245. self["@source"]=aString;
  36246. return self;
  36247. },
  36248. args: ["aString"],
  36249. source: "source: aString\x0a\x09source := aString",
  36250. referencedClasses: [],
  36251. messageSends: []
  36252. }),
  36253. $globals.IRASTTranslator);
  36254. $core.addMethod(
  36255. $core.method({
  36256. selector: "theClass",
  36257. protocol: 'accessing',
  36258. fn: function (){
  36259. var self=this;
  36260. var $1;
  36261. $1=self["@theClass"];
  36262. return $1;
  36263. },
  36264. args: [],
  36265. source: "theClass\x0a\x09^ theClass",
  36266. referencedClasses: [],
  36267. messageSends: []
  36268. }),
  36269. $globals.IRASTTranslator);
  36270. $core.addMethod(
  36271. $core.method({
  36272. selector: "theClass:",
  36273. protocol: 'accessing',
  36274. fn: function (aClass){
  36275. var self=this;
  36276. self["@theClass"]=aClass;
  36277. return self;
  36278. },
  36279. args: ["aClass"],
  36280. source: "theClass: aClass\x0a\x09theClass := aClass",
  36281. referencedClasses: [],
  36282. messageSends: []
  36283. }),
  36284. $globals.IRASTTranslator);
  36285. $core.addMethod(
  36286. $core.method({
  36287. selector: "visitAssignmentNode:",
  36288. protocol: 'visiting',
  36289. fn: function (aNode){
  36290. var self=this;
  36291. var left,right,assignment;
  36292. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  36293. return $core.withContext(function($ctx1) {
  36294. var $1,$3,$4,$2,$5;
  36295. right=self._visit_($recv(aNode)._right());
  36296. $ctx1.sendIdx["visit:"]=1;
  36297. left=self._visit_($recv(aNode)._left());
  36298. $1=self._sequence();
  36299. $3=$recv($IRAssignment())._new();
  36300. $recv($3)._add_(left);
  36301. $ctx1.sendIdx["add:"]=2;
  36302. $recv($3)._add_(right);
  36303. $4=$recv($3)._yourself();
  36304. $2=$4;
  36305. $recv($1)._add_($2);
  36306. $ctx1.sendIdx["add:"]=1;
  36307. $5=left;
  36308. return $5;
  36309. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  36310. },
  36311. args: ["aNode"],
  36312. 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",
  36313. referencedClasses: ["IRAssignment"],
  36314. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  36315. }),
  36316. $globals.IRASTTranslator);
  36317. $core.addMethod(
  36318. $core.method({
  36319. selector: "visitBlockNode:",
  36320. protocol: 'visiting',
  36321. fn: function (aNode){
  36322. var self=this;
  36323. var closure;
  36324. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  36325. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  36326. return $core.withContext(function($ctx1) {
  36327. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  36328. $1=$recv($IRClosure())._new();
  36329. $ctx1.sendIdx["new"]=1;
  36330. $recv($1)._arguments_($recv(aNode)._parameters());
  36331. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  36332. $2=$1;
  36333. $3=$recv(aNode)._scope();
  36334. $ctx1.sendIdx["scope"]=1;
  36335. $recv($2)._scope_($3);
  36336. $ctx1.sendIdx["scope:"]=1;
  36337. $4=$recv($1)._yourself();
  36338. $ctx1.sendIdx["yourself"]=1;
  36339. closure=$4;
  36340. $6=$recv(aNode)._scope();
  36341. $ctx1.sendIdx["scope"]=2;
  36342. $5=$recv($6)._temps();
  36343. $recv($5)._do_((function(each){
  36344. return $core.withContext(function($ctx2) {
  36345. $7=$recv($IRTempDeclaration())._new();
  36346. $recv($7)._name_($recv(each)._name());
  36347. $recv($7)._scope_($recv(aNode)._scope());
  36348. $8=$recv($7)._yourself();
  36349. return $recv(closure)._add_($8);
  36350. $ctx2.sendIdx["add:"]=1;
  36351. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36352. }));
  36353. $ctx1.sendIdx["do:"]=1;
  36354. $recv($recv(aNode)._nodes())._do_((function(each){
  36355. return $core.withContext(function($ctx2) {
  36356. return $recv(closure)._add_(self._visit_(each));
  36357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36358. }));
  36359. $9=closure;
  36360. return $9;
  36361. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  36362. },
  36363. args: ["aNode"],
  36364. 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",
  36365. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  36366. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  36367. }),
  36368. $globals.IRASTTranslator);
  36369. $core.addMethod(
  36370. $core.method({
  36371. selector: "visitBlockSequenceNode:",
  36372. protocol: 'visiting',
  36373. fn: function (aNode){
  36374. var self=this;
  36375. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  36376. function $IRBlockReturn(){return $globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  36377. return $core.withContext(function($ctx1) {
  36378. var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
  36379. $2=$recv($IRBlockSequence())._new();
  36380. $ctx1.sendIdx["new"]=1;
  36381. $1=self._withSequence_do_($2,(function(){
  36382. return $core.withContext(function($ctx2) {
  36383. $3=$recv(aNode)._nodes();
  36384. $ctx2.sendIdx["nodes"]=1;
  36385. return $recv($3)._ifNotEmpty_((function(){
  36386. return $core.withContext(function($ctx3) {
  36387. $5=$recv(aNode)._nodes();
  36388. $ctx3.sendIdx["nodes"]=2;
  36389. $4=$recv($5)._allButLast();
  36390. $recv($4)._do_((function(each){
  36391. return $core.withContext(function($ctx4) {
  36392. $6=self._sequence();
  36393. $ctx4.sendIdx["sequence"]=1;
  36394. $7=self._visitOrAlias_(each);
  36395. $ctx4.sendIdx["visitOrAlias:"]=1;
  36396. return $recv($6)._add_($7);
  36397. $ctx4.sendIdx["add:"]=1;
  36398. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  36399. }));
  36400. $10=$recv(aNode)._nodes();
  36401. $ctx3.sendIdx["nodes"]=3;
  36402. $9=$recv($10)._last();
  36403. $ctx3.sendIdx["last"]=1;
  36404. $8=$recv($9)._isReturnNode();
  36405. if($core.assert($8)){
  36406. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last()));
  36407. } else {
  36408. $11=self._sequence();
  36409. $ctx3.sendIdx["sequence"]=2;
  36410. $13=$recv($IRBlockReturn())._new();
  36411. $14=$13;
  36412. $17=$recv(aNode)._nodes();
  36413. $ctx3.sendIdx["nodes"]=4;
  36414. $16=$recv($17)._last();
  36415. $ctx3.sendIdx["last"]=2;
  36416. $15=self._visitOrAlias_($16);
  36417. $ctx3.sendIdx["visitOrAlias:"]=2;
  36418. $recv($14)._add_($15);
  36419. $ctx3.sendIdx["add:"]=3;
  36420. $18=$recv($13)._yourself();
  36421. $12=$18;
  36422. return $recv($11)._add_($12);
  36423. $ctx3.sendIdx["add:"]=2;
  36424. };
  36425. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36426. }));
  36427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36428. }));
  36429. return $1;
  36430. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36431. },
  36432. args: ["aNode"],
  36433. 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) ] ]]",
  36434. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  36435. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  36436. }),
  36437. $globals.IRASTTranslator);
  36438. $core.addMethod(
  36439. $core.method({
  36440. selector: "visitCascadeNode:",
  36441. protocol: 'visiting',
  36442. fn: function (aNode){
  36443. var self=this;
  36444. var alias,receiver;
  36445. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  36446. return $core.withContext(function($ctx1) {
  36447. var $2,$1,$3,$5,$4,$6;
  36448. $2=$recv(aNode)._receiver();
  36449. $ctx1.sendIdx["receiver"]=1;
  36450. $1=$recv($2)._isImmutable();
  36451. if($core.assert($1)){
  36452. receiver=$recv(aNode)._receiver();
  36453. $ctx1.sendIdx["receiver"]=2;
  36454. receiver;
  36455. } else {
  36456. alias=self._alias_($recv(aNode)._receiver());
  36457. $ctx1.sendIdx["alias:"]=1;
  36458. alias;
  36459. receiver=$recv($recv($VariableNode())._new())._binding_($recv(alias)._variable());
  36460. receiver;
  36461. };
  36462. $3=$recv(aNode)._nodes();
  36463. $ctx1.sendIdx["nodes"]=1;
  36464. $recv($3)._do_((function(each){
  36465. return $core.withContext(function($ctx2) {
  36466. return $recv(each)._receiver_(receiver);
  36467. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36468. }));
  36469. $ctx1.sendIdx["do:"]=1;
  36470. $5=$recv(aNode)._nodes();
  36471. $ctx1.sendIdx["nodes"]=2;
  36472. $4=$recv($5)._allButLast();
  36473. $recv($4)._do_((function(each){
  36474. return $core.withContext(function($ctx2) {
  36475. return $recv(self._sequence())._add_(self._visit_(each));
  36476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  36477. }));
  36478. $6=self._alias_($recv($recv(aNode)._nodes())._last());
  36479. return $6;
  36480. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},$globals.IRASTTranslator)});
  36481. },
  36482. args: ["aNode"],
  36483. 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",
  36484. referencedClasses: ["VariableNode"],
  36485. messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"]
  36486. }),
  36487. $globals.IRASTTranslator);
  36488. $core.addMethod(
  36489. $core.method({
  36490. selector: "visitDynamicArrayNode:",
  36491. protocol: 'visiting',
  36492. fn: function (aNode){
  36493. var self=this;
  36494. var array;
  36495. function $IRDynamicArray(){return $globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  36496. return $core.withContext(function($ctx1) {
  36497. var $1;
  36498. array=$recv($IRDynamicArray())._new();
  36499. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36500. return $core.withContext(function($ctx2) {
  36501. return $recv(array)._add_(each);
  36502. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36503. }));
  36504. $1=array;
  36505. return $1;
  36506. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  36507. },
  36508. args: ["aNode"],
  36509. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  36510. referencedClasses: ["IRDynamicArray"],
  36511. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  36512. }),
  36513. $globals.IRASTTranslator);
  36514. $core.addMethod(
  36515. $core.method({
  36516. selector: "visitDynamicDictionaryNode:",
  36517. protocol: 'visiting',
  36518. fn: function (aNode){
  36519. var self=this;
  36520. var dictionary;
  36521. function $IRDynamicDictionary(){return $globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  36522. return $core.withContext(function($ctx1) {
  36523. var $1;
  36524. dictionary=$recv($IRDynamicDictionary())._new();
  36525. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36526. return $core.withContext(function($ctx2) {
  36527. return $recv(dictionary)._add_(each);
  36528. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36529. }));
  36530. $1=dictionary;
  36531. return $1;
  36532. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  36533. },
  36534. args: ["aNode"],
  36535. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  36536. referencedClasses: ["IRDynamicDictionary"],
  36537. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  36538. }),
  36539. $globals.IRASTTranslator);
  36540. $core.addMethod(
  36541. $core.method({
  36542. selector: "visitJSStatementNode:",
  36543. protocol: 'visiting',
  36544. fn: function (aNode){
  36545. var self=this;
  36546. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  36547. return $core.withContext(function($ctx1) {
  36548. var $2,$3,$1;
  36549. $2=$recv($IRVerbatim())._new();
  36550. $recv($2)._source_($recv($recv(aNode)._source())._crlfSanitized());
  36551. $3=$recv($2)._yourself();
  36552. $1=$3;
  36553. return $1;
  36554. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36555. },
  36556. args: ["aNode"],
  36557. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  36558. referencedClasses: ["IRVerbatim"],
  36559. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  36560. }),
  36561. $globals.IRASTTranslator);
  36562. $core.addMethod(
  36563. $core.method({
  36564. selector: "visitMethodNode:",
  36565. protocol: 'visiting',
  36566. fn: function (aNode){
  36567. var self=this;
  36568. function $IRMethod(){return $globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  36569. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  36570. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  36571. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36572. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  36573. return $core.withContext(function($ctx1) {
  36574. 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;
  36575. $2=$recv($IRMethod())._new();
  36576. $ctx1.sendIdx["new"]=1;
  36577. $recv($2)._source_($recv(self._source())._crlfSanitized());
  36578. $ctx1.sendIdx["source:"]=1;
  36579. $recv($2)._theClass_(self._theClass());
  36580. $recv($2)._arguments_($recv(aNode)._arguments());
  36581. $recv($2)._selector_($recv(aNode)._selector());
  36582. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  36583. $recv($2)._superSends_($recv(aNode)._superSends());
  36584. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  36585. $recv($2)._classReferences_($recv(aNode)._classReferences());
  36586. $3=$2;
  36587. $4=$recv(aNode)._scope();
  36588. $ctx1.sendIdx["scope"]=1;
  36589. $recv($3)._scope_($4);
  36590. $ctx1.sendIdx["scope:"]=1;
  36591. $5=$recv($2)._yourself();
  36592. $ctx1.sendIdx["yourself"]=1;
  36593. $1=$5;
  36594. self._method_($1);
  36595. $7=$recv(aNode)._scope();
  36596. $ctx1.sendIdx["scope"]=2;
  36597. $6=$recv($7)._temps();
  36598. $recv($6)._do_((function(each){
  36599. return $core.withContext(function($ctx2) {
  36600. $8=self._method();
  36601. $ctx2.sendIdx["method"]=1;
  36602. $10=$recv($IRTempDeclaration())._new();
  36603. $ctx2.sendIdx["new"]=2;
  36604. $recv($10)._name_($recv(each)._name());
  36605. $11=$10;
  36606. $12=$recv(aNode)._scope();
  36607. $ctx2.sendIdx["scope"]=3;
  36608. $recv($11)._scope_($12);
  36609. $13=$recv($10)._yourself();
  36610. $ctx2.sendIdx["yourself"]=2;
  36611. $9=$13;
  36612. return $recv($8)._add_($9);
  36613. $ctx2.sendIdx["add:"]=1;
  36614. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36615. }));
  36616. $ctx1.sendIdx["do:"]=1;
  36617. $recv($recv(aNode)._nodes())._do_((function(each){
  36618. return $core.withContext(function($ctx2) {
  36619. $14=self._method();
  36620. $ctx2.sendIdx["method"]=2;
  36621. return $recv($14)._add_(self._visit_(each));
  36622. $ctx2.sendIdx["add:"]=2;
  36623. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36624. }));
  36625. $16=$recv(aNode)._scope();
  36626. $ctx1.sendIdx["scope"]=4;
  36627. $15=$recv($16)._hasLocalReturn();
  36628. if(!$core.assert($15)){
  36629. $17=self._method();
  36630. $ctx1.sendIdx["method"]=3;
  36631. $18=$17;
  36632. $20=$recv($IRReturn())._new();
  36633. $ctx1.sendIdx["new"]=3;
  36634. $21=$20;
  36635. $23=$recv($IRVariable())._new();
  36636. $ctx1.sendIdx["new"]=4;
  36637. $recv($23)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  36638. $24=$recv($23)._yourself();
  36639. $ctx1.sendIdx["yourself"]=3;
  36640. $22=$24;
  36641. $recv($21)._add_($22);
  36642. $ctx1.sendIdx["add:"]=4;
  36643. $25=$recv($20)._yourself();
  36644. $ctx1.sendIdx["yourself"]=4;
  36645. $19=$25;
  36646. $recv($18)._add_($19);
  36647. $ctx1.sendIdx["add:"]=3;
  36648. $27=$recv($IRVerbatim())._new();
  36649. $recv($27)._source_("");
  36650. $28=$recv($27)._yourself();
  36651. $26=$recv($17)._add_($28);
  36652. $26;
  36653. };
  36654. $29=self._method();
  36655. return $29;
  36656. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36657. },
  36658. args: ["aNode"],
  36659. 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",
  36660. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  36661. 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"]
  36662. }),
  36663. $globals.IRASTTranslator);
  36664. $core.addMethod(
  36665. $core.method({
  36666. selector: "visitOrAlias:",
  36667. protocol: 'visiting',
  36668. fn: function (aNode){
  36669. var self=this;
  36670. return $core.withContext(function($ctx1) {
  36671. var $2,$1;
  36672. $2=$recv(aNode)._shouldBeAliased();
  36673. if($core.assert($2)){
  36674. $1=self._alias_(aNode);
  36675. } else {
  36676. $1=self._visit_(aNode);
  36677. };
  36678. return $1;
  36679. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  36680. },
  36681. args: ["aNode"],
  36682. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  36683. referencedClasses: [],
  36684. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  36685. }),
  36686. $globals.IRASTTranslator);
  36687. $core.addMethod(
  36688. $core.method({
  36689. selector: "visitReturnNode:",
  36690. protocol: 'visiting',
  36691. fn: function (aNode){
  36692. var self=this;
  36693. var return_;
  36694. function $IRNonLocalReturn(){return $globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  36695. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  36696. return $core.withContext(function($ctx1) {
  36697. var $1,$2;
  36698. $1=$recv(aNode)._nonLocalReturn();
  36699. if($core.assert($1)){
  36700. return_=$recv($IRNonLocalReturn())._new();
  36701. $ctx1.sendIdx["new"]=1;
  36702. } else {
  36703. return_=$recv($IRReturn())._new();
  36704. };
  36705. $recv(return_)._scope_($recv(aNode)._scope());
  36706. $recv($recv(aNode)._nodes())._do_((function(each){
  36707. return $core.withContext(function($ctx2) {
  36708. return $recv(return_)._add_(self._alias_(each));
  36709. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36710. }));
  36711. $2=return_;
  36712. return $2;
  36713. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  36714. },
  36715. args: ["aNode"],
  36716. 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",
  36717. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  36718. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"]
  36719. }),
  36720. $globals.IRASTTranslator);
  36721. $core.addMethod(
  36722. $core.method({
  36723. selector: "visitSendNode:",
  36724. protocol: 'visiting',
  36725. fn: function (aNode){
  36726. var self=this;
  36727. var send,all,receiver,arguments_;
  36728. function $IRSend(){return $globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  36729. return $core.withContext(function($ctx1) {
  36730. var $1,$2,$3,$4;
  36731. send=$recv($IRSend())._new();
  36732. $1=send;
  36733. $recv($1)._selector_($recv(aNode)._selector());
  36734. $2=$recv($1)._index_($recv(aNode)._index());
  36735. $3=$recv(aNode)._superSend();
  36736. if($core.assert($3)){
  36737. $recv(send)._classSend_($recv(self._theClass())._superclass());
  36738. };
  36739. all=self._aliasTemporally_($recv([$recv(aNode)._receiver()]).__comma($recv(aNode)._arguments()));
  36740. receiver=$recv(all)._first();
  36741. arguments_=$recv(all)._allButFirst();
  36742. $recv(send)._add_(receiver);
  36743. $ctx1.sendIdx["add:"]=1;
  36744. $recv(arguments_)._do_((function(each){
  36745. return $core.withContext(function($ctx2) {
  36746. return $recv(send)._add_(each);
  36747. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36748. }));
  36749. $4=send;
  36750. return $4;
  36751. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments_:arguments_},$globals.IRASTTranslator)});
  36752. },
  36753. args: ["aNode"],
  36754. 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",
  36755. referencedClasses: ["IRSend"],
  36756. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"]
  36757. }),
  36758. $globals.IRASTTranslator);
  36759. $core.addMethod(
  36760. $core.method({
  36761. selector: "visitSequenceNode:",
  36762. protocol: 'visiting',
  36763. fn: function (aNode){
  36764. var self=this;
  36765. function $IRSequence(){return $globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  36766. return $core.withContext(function($ctx1) {
  36767. var $2,$1;
  36768. $1=self._withSequence_do_($recv($IRSequence())._new(),(function(){
  36769. return $core.withContext(function($ctx2) {
  36770. return $recv($recv(aNode)._nodes())._do_((function(each){
  36771. var instruction;
  36772. return $core.withContext(function($ctx3) {
  36773. instruction=self._visitOrAlias_(each);
  36774. instruction;
  36775. $2=$recv(instruction)._isVariable();
  36776. if(!$core.assert($2)){
  36777. return $recv(self._sequence())._add_(instruction);
  36778. };
  36779. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  36780. }));
  36781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36782. }));
  36783. return $1;
  36784. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36785. },
  36786. args: ["aNode"],
  36787. 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 ] ]]",
  36788. referencedClasses: ["IRSequence"],
  36789. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  36790. }),
  36791. $globals.IRASTTranslator);
  36792. $core.addMethod(
  36793. $core.method({
  36794. selector: "visitValueNode:",
  36795. protocol: 'visiting',
  36796. fn: function (aNode){
  36797. var self=this;
  36798. function $IRValue(){return $globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  36799. return $core.withContext(function($ctx1) {
  36800. var $2,$3,$1;
  36801. $2=$recv($IRValue())._new();
  36802. $recv($2)._value_($recv(aNode)._value());
  36803. $3=$recv($2)._yourself();
  36804. $1=$3;
  36805. return $1;
  36806. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36807. },
  36808. args: ["aNode"],
  36809. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  36810. referencedClasses: ["IRValue"],
  36811. messageSends: ["value:", "new", "value", "yourself"]
  36812. }),
  36813. $globals.IRASTTranslator);
  36814. $core.addMethod(
  36815. $core.method({
  36816. selector: "visitVariableNode:",
  36817. protocol: 'visiting',
  36818. fn: function (aNode){
  36819. var self=this;
  36820. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36821. return $core.withContext(function($ctx1) {
  36822. var $2,$3,$1;
  36823. $2=$recv($IRVariable())._new();
  36824. $recv($2)._variable_($recv(aNode)._binding());
  36825. $3=$recv($2)._yourself();
  36826. $1=$3;
  36827. return $1;
  36828. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36829. },
  36830. args: ["aNode"],
  36831. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  36832. referencedClasses: ["IRVariable"],
  36833. messageSends: ["variable:", "new", "binding", "yourself"]
  36834. }),
  36835. $globals.IRASTTranslator);
  36836. $core.addMethod(
  36837. $core.method({
  36838. selector: "withSequence:do:",
  36839. protocol: 'accessing',
  36840. fn: function (aSequence,aBlock){
  36841. var self=this;
  36842. var outerSequence;
  36843. return $core.withContext(function($ctx1) {
  36844. outerSequence=self._sequence();
  36845. self._sequence_(aSequence);
  36846. $ctx1.sendIdx["sequence:"]=1;
  36847. $recv(aBlock)._value();
  36848. self._sequence_(outerSequence);
  36849. return aSequence;
  36850. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  36851. },
  36852. args: ["aSequence", "aBlock"],
  36853. 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",
  36854. referencedClasses: [],
  36855. messageSends: ["sequence", "sequence:", "value"]
  36856. }),
  36857. $globals.IRASTTranslator);
  36858. $core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  36859. $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.";
  36860. $core.addMethod(
  36861. $core.method({
  36862. selector: "accept:",
  36863. protocol: 'visiting',
  36864. fn: function (aVisitor){
  36865. var self=this;
  36866. return $core.withContext(function($ctx1) {
  36867. var $1;
  36868. $1=$recv(aVisitor)._visitIRInstruction_(self);
  36869. return $1;
  36870. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)});
  36871. },
  36872. args: ["aVisitor"],
  36873. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  36874. referencedClasses: [],
  36875. messageSends: ["visitIRInstruction:"]
  36876. }),
  36877. $globals.IRInstruction);
  36878. $core.addMethod(
  36879. $core.method({
  36880. selector: "add:",
  36881. protocol: 'building',
  36882. fn: function (anObject){
  36883. var self=this;
  36884. return $core.withContext(function($ctx1) {
  36885. var $1;
  36886. $recv(anObject)._parent_(self);
  36887. $1=$recv(self._instructions())._add_(anObject);
  36888. return $1;
  36889. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  36890. },
  36891. args: ["anObject"],
  36892. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  36893. referencedClasses: [],
  36894. messageSends: ["parent:", "add:", "instructions"]
  36895. }),
  36896. $globals.IRInstruction);
  36897. $core.addMethod(
  36898. $core.method({
  36899. selector: "canBeAssigned",
  36900. protocol: 'testing',
  36901. fn: function (){
  36902. var self=this;
  36903. return true;
  36904. },
  36905. args: [],
  36906. source: "canBeAssigned\x0a\x09^ true",
  36907. referencedClasses: [],
  36908. messageSends: []
  36909. }),
  36910. $globals.IRInstruction);
  36911. $core.addMethod(
  36912. $core.method({
  36913. selector: "instructions",
  36914. protocol: 'accessing',
  36915. fn: function (){
  36916. var self=this;
  36917. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  36918. return $core.withContext(function($ctx1) {
  36919. var $2,$1,$receiver;
  36920. $2=self["@instructions"];
  36921. if(($receiver = $2) == null || $receiver.isNil){
  36922. self["@instructions"]=$recv($OrderedCollection())._new();
  36923. $1=self["@instructions"];
  36924. } else {
  36925. $1=$2;
  36926. };
  36927. return $1;
  36928. }, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)});
  36929. },
  36930. args: [],
  36931. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  36932. referencedClasses: ["OrderedCollection"],
  36933. messageSends: ["ifNil:", "new"]
  36934. }),
  36935. $globals.IRInstruction);
  36936. $core.addMethod(
  36937. $core.method({
  36938. selector: "isClosure",
  36939. protocol: 'testing',
  36940. fn: function (){
  36941. var self=this;
  36942. return false;
  36943. },
  36944. args: [],
  36945. source: "isClosure\x0a\x09^ false",
  36946. referencedClasses: [],
  36947. messageSends: []
  36948. }),
  36949. $globals.IRInstruction);
  36950. $core.addMethod(
  36951. $core.method({
  36952. selector: "isInlined",
  36953. protocol: 'testing',
  36954. fn: function (){
  36955. var self=this;
  36956. return false;
  36957. },
  36958. args: [],
  36959. source: "isInlined\x0a\x09^ false",
  36960. referencedClasses: [],
  36961. messageSends: []
  36962. }),
  36963. $globals.IRInstruction);
  36964. $core.addMethod(
  36965. $core.method({
  36966. selector: "isLocalReturn",
  36967. protocol: 'testing',
  36968. fn: function (){
  36969. var self=this;
  36970. return false;
  36971. },
  36972. args: [],
  36973. source: "isLocalReturn\x0a\x09^ false",
  36974. referencedClasses: [],
  36975. messageSends: []
  36976. }),
  36977. $globals.IRInstruction);
  36978. $core.addMethod(
  36979. $core.method({
  36980. selector: "isMethod",
  36981. protocol: 'testing',
  36982. fn: function (){
  36983. var self=this;
  36984. return false;
  36985. },
  36986. args: [],
  36987. source: "isMethod\x0a\x09^ false",
  36988. referencedClasses: [],
  36989. messageSends: []
  36990. }),
  36991. $globals.IRInstruction);
  36992. $core.addMethod(
  36993. $core.method({
  36994. selector: "isReturn",
  36995. protocol: 'testing',
  36996. fn: function (){
  36997. var self=this;
  36998. return false;
  36999. },
  37000. args: [],
  37001. source: "isReturn\x0a\x09^ false",
  37002. referencedClasses: [],
  37003. messageSends: []
  37004. }),
  37005. $globals.IRInstruction);
  37006. $core.addMethod(
  37007. $core.method({
  37008. selector: "isSend",
  37009. protocol: 'testing',
  37010. fn: function (){
  37011. var self=this;
  37012. return false;
  37013. },
  37014. args: [],
  37015. source: "isSend\x0a\x09^ false",
  37016. referencedClasses: [],
  37017. messageSends: []
  37018. }),
  37019. $globals.IRInstruction);
  37020. $core.addMethod(
  37021. $core.method({
  37022. selector: "isSequence",
  37023. protocol: 'testing',
  37024. fn: function (){
  37025. var self=this;
  37026. return false;
  37027. },
  37028. args: [],
  37029. source: "isSequence\x0a\x09^ false",
  37030. referencedClasses: [],
  37031. messageSends: []
  37032. }),
  37033. $globals.IRInstruction);
  37034. $core.addMethod(
  37035. $core.method({
  37036. selector: "isTempDeclaration",
  37037. protocol: 'testing',
  37038. fn: function (){
  37039. var self=this;
  37040. return false;
  37041. },
  37042. args: [],
  37043. source: "isTempDeclaration\x0a\x09^ false",
  37044. referencedClasses: [],
  37045. messageSends: []
  37046. }),
  37047. $globals.IRInstruction);
  37048. $core.addMethod(
  37049. $core.method({
  37050. selector: "isVariable",
  37051. protocol: 'testing',
  37052. fn: function (){
  37053. var self=this;
  37054. return false;
  37055. },
  37056. args: [],
  37057. source: "isVariable\x0a\x09^ false",
  37058. referencedClasses: [],
  37059. messageSends: []
  37060. }),
  37061. $globals.IRInstruction);
  37062. $core.addMethod(
  37063. $core.method({
  37064. selector: "method",
  37065. protocol: 'accessing',
  37066. fn: function (){
  37067. var self=this;
  37068. return $core.withContext(function($ctx1) {
  37069. var $1;
  37070. $1=$recv(self._parent())._method();
  37071. return $1;
  37072. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  37073. },
  37074. args: [],
  37075. source: "method\x0a\x09^ self parent method",
  37076. referencedClasses: [],
  37077. messageSends: ["method", "parent"]
  37078. }),
  37079. $globals.IRInstruction);
  37080. $core.addMethod(
  37081. $core.method({
  37082. selector: "needsBoxingAsReceiver",
  37083. protocol: 'testing',
  37084. fn: function (){
  37085. var self=this;
  37086. return true;
  37087. },
  37088. args: [],
  37089. source: "needsBoxingAsReceiver\x0a\x09^ true",
  37090. referencedClasses: [],
  37091. messageSends: []
  37092. }),
  37093. $globals.IRInstruction);
  37094. $core.addMethod(
  37095. $core.method({
  37096. selector: "parent",
  37097. protocol: 'accessing',
  37098. fn: function (){
  37099. var self=this;
  37100. var $1;
  37101. $1=self["@parent"];
  37102. return $1;
  37103. },
  37104. args: [],
  37105. source: "parent\x0a\x09^ parent",
  37106. referencedClasses: [],
  37107. messageSends: []
  37108. }),
  37109. $globals.IRInstruction);
  37110. $core.addMethod(
  37111. $core.method({
  37112. selector: "parent:",
  37113. protocol: 'accessing',
  37114. fn: function (anIRInstruction){
  37115. var self=this;
  37116. self["@parent"]=anIRInstruction;
  37117. return self;
  37118. },
  37119. args: ["anIRInstruction"],
  37120. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  37121. referencedClasses: [],
  37122. messageSends: []
  37123. }),
  37124. $globals.IRInstruction);
  37125. $core.addMethod(
  37126. $core.method({
  37127. selector: "remove",
  37128. protocol: 'building',
  37129. fn: function (){
  37130. var self=this;
  37131. return $core.withContext(function($ctx1) {
  37132. $recv(self._parent())._remove_(self);
  37133. return self;
  37134. }, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)});
  37135. },
  37136. args: [],
  37137. source: "remove\x0a\x09self parent remove: self",
  37138. referencedClasses: [],
  37139. messageSends: ["remove:", "parent"]
  37140. }),
  37141. $globals.IRInstruction);
  37142. $core.addMethod(
  37143. $core.method({
  37144. selector: "remove:",
  37145. protocol: 'building',
  37146. fn: function (anIRInstruction){
  37147. var self=this;
  37148. return $core.withContext(function($ctx1) {
  37149. $recv(self._instructions())._remove_(anIRInstruction);
  37150. return self;
  37151. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37152. },
  37153. args: ["anIRInstruction"],
  37154. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  37155. referencedClasses: [],
  37156. messageSends: ["remove:", "instructions"]
  37157. }),
  37158. $globals.IRInstruction);
  37159. $core.addMethod(
  37160. $core.method({
  37161. selector: "replace:with:",
  37162. protocol: 'building',
  37163. fn: function (anIRInstruction,anotherIRInstruction){
  37164. var self=this;
  37165. return $core.withContext(function($ctx1) {
  37166. var $1;
  37167. $recv(anotherIRInstruction)._parent_(self);
  37168. $1=self._instructions();
  37169. $ctx1.sendIdx["instructions"]=1;
  37170. $recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  37171. return self;
  37172. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  37173. },
  37174. args: ["anIRInstruction", "anotherIRInstruction"],
  37175. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  37176. referencedClasses: [],
  37177. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  37178. }),
  37179. $globals.IRInstruction);
  37180. $core.addMethod(
  37181. $core.method({
  37182. selector: "replaceWith:",
  37183. protocol: 'building',
  37184. fn: function (anIRInstruction){
  37185. var self=this;
  37186. return $core.withContext(function($ctx1) {
  37187. $recv(self._parent())._replace_with_(self,anIRInstruction);
  37188. return self;
  37189. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37190. },
  37191. args: ["anIRInstruction"],
  37192. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  37193. referencedClasses: [],
  37194. messageSends: ["replace:with:", "parent"]
  37195. }),
  37196. $globals.IRInstruction);
  37197. $core.addMethod(
  37198. $core.method({
  37199. selector: "scope",
  37200. protocol: 'accessing',
  37201. fn: function (){
  37202. var self=this;
  37203. return $core.withContext(function($ctx1) {
  37204. var $2,$1,$receiver;
  37205. $2=self._parent();
  37206. if(($receiver = $2) == null || $receiver.isNil){
  37207. $1=$2;
  37208. } else {
  37209. var node;
  37210. node=$receiver;
  37211. $1=$recv(node)._scope();
  37212. };
  37213. return $1;
  37214. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  37215. },
  37216. args: [],
  37217. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  37218. referencedClasses: [],
  37219. messageSends: ["ifNotNil:", "parent", "scope"]
  37220. }),
  37221. $globals.IRInstruction);
  37222. $core.addMethod(
  37223. $core.method({
  37224. selector: "on:",
  37225. protocol: 'instance creation',
  37226. fn: function (aBuilder){
  37227. var self=this;
  37228. return $core.withContext(function($ctx1) {
  37229. var $2,$3,$1;
  37230. $2=self._new();
  37231. $recv($2)._builder_(aBuilder);
  37232. $3=$recv($2)._yourself();
  37233. $1=$3;
  37234. return $1;
  37235. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  37236. },
  37237. args: ["aBuilder"],
  37238. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  37239. referencedClasses: [],
  37240. messageSends: ["builder:", "new", "yourself"]
  37241. }),
  37242. $globals.IRInstruction.klass);
  37243. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  37244. $core.addMethod(
  37245. $core.method({
  37246. selector: "accept:",
  37247. protocol: 'visiting',
  37248. fn: function (aVisitor){
  37249. var self=this;
  37250. return $core.withContext(function($ctx1) {
  37251. var $1;
  37252. $1=$recv(aVisitor)._visitIRAssignment_(self);
  37253. return $1;
  37254. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)});
  37255. },
  37256. args: ["aVisitor"],
  37257. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  37258. referencedClasses: [],
  37259. messageSends: ["visitIRAssignment:"]
  37260. }),
  37261. $globals.IRAssignment);
  37262. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  37263. $core.addMethod(
  37264. $core.method({
  37265. selector: "accept:",
  37266. protocol: 'visiting',
  37267. fn: function (aVisitor){
  37268. var self=this;
  37269. return $core.withContext(function($ctx1) {
  37270. var $1;
  37271. $1=$recv(aVisitor)._visitIRDynamicArray_(self);
  37272. return $1;
  37273. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  37274. },
  37275. args: ["aVisitor"],
  37276. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  37277. referencedClasses: [],
  37278. messageSends: ["visitIRDynamicArray:"]
  37279. }),
  37280. $globals.IRDynamicArray);
  37281. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  37282. $core.addMethod(
  37283. $core.method({
  37284. selector: "accept:",
  37285. protocol: 'visiting',
  37286. fn: function (aVisitor){
  37287. var self=this;
  37288. return $core.withContext(function($ctx1) {
  37289. var $1;
  37290. $1=$recv(aVisitor)._visitIRDynamicDictionary_(self);
  37291. return $1;
  37292. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  37293. },
  37294. args: ["aVisitor"],
  37295. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  37296. referencedClasses: [],
  37297. messageSends: ["visitIRDynamicDictionary:"]
  37298. }),
  37299. $globals.IRDynamicDictionary);
  37300. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  37301. $core.addMethod(
  37302. $core.method({
  37303. selector: "scope",
  37304. protocol: 'accessing',
  37305. fn: function (){
  37306. var self=this;
  37307. var $1;
  37308. $1=self["@scope"];
  37309. return $1;
  37310. },
  37311. args: [],
  37312. source: "scope\x0a\x09^ scope",
  37313. referencedClasses: [],
  37314. messageSends: []
  37315. }),
  37316. $globals.IRScopedInstruction);
  37317. $core.addMethod(
  37318. $core.method({
  37319. selector: "scope:",
  37320. protocol: 'accessing',
  37321. fn: function (aScope){
  37322. var self=this;
  37323. self["@scope"]=aScope;
  37324. return self;
  37325. },
  37326. args: ["aScope"],
  37327. source: "scope: aScope\x0a\x09scope := aScope",
  37328. referencedClasses: [],
  37329. messageSends: []
  37330. }),
  37331. $globals.IRScopedInstruction);
  37332. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  37333. $core.addMethod(
  37334. $core.method({
  37335. selector: "arguments",
  37336. protocol: 'accessing',
  37337. fn: function (){
  37338. var self=this;
  37339. return $core.withContext(function($ctx1) {
  37340. var $2,$1,$receiver;
  37341. $2=self["@arguments"];
  37342. if(($receiver = $2) == null || $receiver.isNil){
  37343. $1=[];
  37344. } else {
  37345. $1=$2;
  37346. };
  37347. return $1;
  37348. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  37349. },
  37350. args: [],
  37351. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  37352. referencedClasses: [],
  37353. messageSends: ["ifNil:"]
  37354. }),
  37355. $globals.IRClosureInstruction);
  37356. $core.addMethod(
  37357. $core.method({
  37358. selector: "arguments:",
  37359. protocol: 'accessing',
  37360. fn: function (aCollection){
  37361. var self=this;
  37362. self["@arguments"]=aCollection;
  37363. return self;
  37364. },
  37365. args: ["aCollection"],
  37366. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  37367. referencedClasses: [],
  37368. messageSends: []
  37369. }),
  37370. $globals.IRClosureInstruction);
  37371. $core.addMethod(
  37372. $core.method({
  37373. selector: "locals",
  37374. protocol: 'accessing',
  37375. fn: function (){
  37376. var self=this;
  37377. return $core.withContext(function($ctx1) {
  37378. var $2,$3,$1;
  37379. $2=$recv(self._arguments())._copy();
  37380. $recv($2)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  37381. return $core.withContext(function($ctx2) {
  37382. return $recv(each)._name();
  37383. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37384. })));
  37385. $3=$recv($2)._yourself();
  37386. $1=$3;
  37387. return $1;
  37388. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  37389. },
  37390. args: [],
  37391. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  37392. referencedClasses: [],
  37393. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  37394. }),
  37395. $globals.IRClosureInstruction);
  37396. $core.addMethod(
  37397. $core.method({
  37398. selector: "requiresSmalltalkContext",
  37399. protocol: 'accessing',
  37400. fn: function (){
  37401. var self=this;
  37402. return $core.withContext(function($ctx1) {
  37403. var $2,$1,$receiver;
  37404. $2=self["@requiresSmalltalkContext"];
  37405. if(($receiver = $2) == null || $receiver.isNil){
  37406. $1=false;
  37407. } else {
  37408. $1=$2;
  37409. };
  37410. return $1;
  37411. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  37412. },
  37413. args: [],
  37414. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  37415. referencedClasses: [],
  37416. messageSends: ["ifNil:"]
  37417. }),
  37418. $globals.IRClosureInstruction);
  37419. $core.addMethod(
  37420. $core.method({
  37421. selector: "requiresSmalltalkContext:",
  37422. protocol: 'accessing',
  37423. fn: function (anObject){
  37424. var self=this;
  37425. self["@requiresSmalltalkContext"]=anObject;
  37426. return self;
  37427. },
  37428. args: ["anObject"],
  37429. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  37430. referencedClasses: [],
  37431. messageSends: []
  37432. }),
  37433. $globals.IRClosureInstruction);
  37434. $core.addMethod(
  37435. $core.method({
  37436. selector: "scope:",
  37437. protocol: 'accessing',
  37438. fn: function (aScope){
  37439. var self=this;
  37440. return $core.withContext(function($ctx1) {
  37441. (
  37442. $ctx1.supercall = true,
  37443. $globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply($recv(self), [aScope]));
  37444. $ctx1.supercall = false;
  37445. $recv(aScope)._instruction_(self);
  37446. return self;
  37447. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  37448. },
  37449. args: ["aScope"],
  37450. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  37451. referencedClasses: [],
  37452. messageSends: ["scope:", "instruction:"]
  37453. }),
  37454. $globals.IRClosureInstruction);
  37455. $core.addMethod(
  37456. $core.method({
  37457. selector: "tempDeclarations",
  37458. protocol: 'accessing',
  37459. fn: function (){
  37460. var self=this;
  37461. return $core.withContext(function($ctx1) {
  37462. var $1;
  37463. $1=$recv(self._instructions())._select_((function(each){
  37464. return $core.withContext(function($ctx2) {
  37465. return $recv(each)._isTempDeclaration();
  37466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37467. }));
  37468. return $1;
  37469. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  37470. },
  37471. args: [],
  37472. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  37473. referencedClasses: [],
  37474. messageSends: ["select:", "instructions", "isTempDeclaration"]
  37475. }),
  37476. $globals.IRClosureInstruction);
  37477. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  37478. $core.addMethod(
  37479. $core.method({
  37480. selector: "accept:",
  37481. protocol: 'visiting',
  37482. fn: function (aVisitor){
  37483. var self=this;
  37484. return $core.withContext(function($ctx1) {
  37485. var $1;
  37486. $1=$recv(aVisitor)._visitIRClosure_(self);
  37487. return $1;
  37488. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)});
  37489. },
  37490. args: ["aVisitor"],
  37491. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  37492. referencedClasses: [],
  37493. messageSends: ["visitIRClosure:"]
  37494. }),
  37495. $globals.IRClosure);
  37496. $core.addMethod(
  37497. $core.method({
  37498. selector: "isClosure",
  37499. protocol: 'testing',
  37500. fn: function (){
  37501. var self=this;
  37502. return true;
  37503. },
  37504. args: [],
  37505. source: "isClosure\x0a\x09^ true",
  37506. referencedClasses: [],
  37507. messageSends: []
  37508. }),
  37509. $globals.IRClosure);
  37510. $core.addMethod(
  37511. $core.method({
  37512. selector: "sequence",
  37513. protocol: 'accessing',
  37514. fn: function (){
  37515. var self=this;
  37516. return $core.withContext(function($ctx1) {
  37517. var $1;
  37518. $1=$recv(self._instructions())._last();
  37519. return $1;
  37520. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  37521. },
  37522. args: [],
  37523. source: "sequence\x0a\x09^ self instructions last",
  37524. referencedClasses: [],
  37525. messageSends: ["last", "instructions"]
  37526. }),
  37527. $globals.IRClosure);
  37528. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  37529. $globals.IRMethod.comment="I am a method instruction";
  37530. $core.addMethod(
  37531. $core.method({
  37532. selector: "accept:",
  37533. protocol: 'visiting',
  37534. fn: function (aVisitor){
  37535. var self=this;
  37536. return $core.withContext(function($ctx1) {
  37537. var $1;
  37538. $1=$recv(aVisitor)._visitIRMethod_(self);
  37539. return $1;
  37540. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)});
  37541. },
  37542. args: ["aVisitor"],
  37543. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  37544. referencedClasses: [],
  37545. messageSends: ["visitIRMethod:"]
  37546. }),
  37547. $globals.IRMethod);
  37548. $core.addMethod(
  37549. $core.method({
  37550. selector: "classReferences",
  37551. protocol: 'accessing',
  37552. fn: function (){
  37553. var self=this;
  37554. var $1;
  37555. $1=self["@classReferences"];
  37556. return $1;
  37557. },
  37558. args: [],
  37559. source: "classReferences\x0a\x09^ classReferences",
  37560. referencedClasses: [],
  37561. messageSends: []
  37562. }),
  37563. $globals.IRMethod);
  37564. $core.addMethod(
  37565. $core.method({
  37566. selector: "classReferences:",
  37567. protocol: 'accessing',
  37568. fn: function (aCollection){
  37569. var self=this;
  37570. self["@classReferences"]=aCollection;
  37571. return self;
  37572. },
  37573. args: ["aCollection"],
  37574. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  37575. referencedClasses: [],
  37576. messageSends: []
  37577. }),
  37578. $globals.IRMethod);
  37579. $core.addMethod(
  37580. $core.method({
  37581. selector: "internalVariables",
  37582. protocol: 'accessing',
  37583. fn: function (){
  37584. var self=this;
  37585. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  37586. return $core.withContext(function($ctx1) {
  37587. var $2,$1,$receiver;
  37588. $2=self["@internalVariables"];
  37589. if(($receiver = $2) == null || $receiver.isNil){
  37590. self["@internalVariables"]=$recv($Set())._new();
  37591. $1=self["@internalVariables"];
  37592. } else {
  37593. $1=$2;
  37594. };
  37595. return $1;
  37596. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  37597. },
  37598. args: [],
  37599. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  37600. referencedClasses: ["Set"],
  37601. messageSends: ["ifNil:", "new"]
  37602. }),
  37603. $globals.IRMethod);
  37604. $core.addMethod(
  37605. $core.method({
  37606. selector: "isMethod",
  37607. protocol: 'accessing',
  37608. fn: function (){
  37609. var self=this;
  37610. return true;
  37611. },
  37612. args: [],
  37613. source: "isMethod\x0a\x09^ true",
  37614. referencedClasses: [],
  37615. messageSends: []
  37616. }),
  37617. $globals.IRMethod);
  37618. $core.addMethod(
  37619. $core.method({
  37620. selector: "messageSends",
  37621. protocol: 'accessing',
  37622. fn: function (){
  37623. var self=this;
  37624. return $core.withContext(function($ctx1) {
  37625. var $1;
  37626. $1=$recv(self._sendIndexes())._keys();
  37627. return $1;
  37628. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  37629. },
  37630. args: [],
  37631. source: "messageSends\x0a\x09^ self sendIndexes keys",
  37632. referencedClasses: [],
  37633. messageSends: ["keys", "sendIndexes"]
  37634. }),
  37635. $globals.IRMethod);
  37636. $core.addMethod(
  37637. $core.method({
  37638. selector: "method",
  37639. protocol: 'accessing',
  37640. fn: function (){
  37641. var self=this;
  37642. return self;
  37643. },
  37644. args: [],
  37645. source: "method\x0a\x09^ self",
  37646. referencedClasses: [],
  37647. messageSends: []
  37648. }),
  37649. $globals.IRMethod);
  37650. $core.addMethod(
  37651. $core.method({
  37652. selector: "selector",
  37653. protocol: 'accessing',
  37654. fn: function (){
  37655. var self=this;
  37656. var $1;
  37657. $1=self["@selector"];
  37658. return $1;
  37659. },
  37660. args: [],
  37661. source: "selector\x0a\x09^ selector",
  37662. referencedClasses: [],
  37663. messageSends: []
  37664. }),
  37665. $globals.IRMethod);
  37666. $core.addMethod(
  37667. $core.method({
  37668. selector: "selector:",
  37669. protocol: 'accessing',
  37670. fn: function (aString){
  37671. var self=this;
  37672. self["@selector"]=aString;
  37673. return self;
  37674. },
  37675. args: ["aString"],
  37676. source: "selector: aString\x0a\x09selector := aString",
  37677. referencedClasses: [],
  37678. messageSends: []
  37679. }),
  37680. $globals.IRMethod);
  37681. $core.addMethod(
  37682. $core.method({
  37683. selector: "sendIndexes",
  37684. protocol: 'accessing',
  37685. fn: function (){
  37686. var self=this;
  37687. var $1;
  37688. $1=self["@sendIndexes"];
  37689. return $1;
  37690. },
  37691. args: [],
  37692. source: "sendIndexes\x0a\x09^ sendIndexes",
  37693. referencedClasses: [],
  37694. messageSends: []
  37695. }),
  37696. $globals.IRMethod);
  37697. $core.addMethod(
  37698. $core.method({
  37699. selector: "sendIndexes:",
  37700. protocol: 'accessing',
  37701. fn: function (aDictionary){
  37702. var self=this;
  37703. self["@sendIndexes"]=aDictionary;
  37704. return self;
  37705. },
  37706. args: ["aDictionary"],
  37707. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  37708. referencedClasses: [],
  37709. messageSends: []
  37710. }),
  37711. $globals.IRMethod);
  37712. $core.addMethod(
  37713. $core.method({
  37714. selector: "source",
  37715. protocol: 'accessing',
  37716. fn: function (){
  37717. var self=this;
  37718. var $1;
  37719. $1=self["@source"];
  37720. return $1;
  37721. },
  37722. args: [],
  37723. source: "source\x0a\x09^ source",
  37724. referencedClasses: [],
  37725. messageSends: []
  37726. }),
  37727. $globals.IRMethod);
  37728. $core.addMethod(
  37729. $core.method({
  37730. selector: "source:",
  37731. protocol: 'accessing',
  37732. fn: function (aString){
  37733. var self=this;
  37734. self["@source"]=aString;
  37735. return self;
  37736. },
  37737. args: ["aString"],
  37738. source: "source: aString\x0a\x09source := aString",
  37739. referencedClasses: [],
  37740. messageSends: []
  37741. }),
  37742. $globals.IRMethod);
  37743. $core.addMethod(
  37744. $core.method({
  37745. selector: "superSends",
  37746. protocol: 'accessing',
  37747. fn: function (){
  37748. var self=this;
  37749. var $1;
  37750. $1=self["@superSends"];
  37751. return $1;
  37752. },
  37753. args: [],
  37754. source: "superSends\x0a\x09^ superSends",
  37755. referencedClasses: [],
  37756. messageSends: []
  37757. }),
  37758. $globals.IRMethod);
  37759. $core.addMethod(
  37760. $core.method({
  37761. selector: "superSends:",
  37762. protocol: 'accessing',
  37763. fn: function (aCollection){
  37764. var self=this;
  37765. self["@superSends"]=aCollection;
  37766. return self;
  37767. },
  37768. args: ["aCollection"],
  37769. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  37770. referencedClasses: [],
  37771. messageSends: []
  37772. }),
  37773. $globals.IRMethod);
  37774. $core.addMethod(
  37775. $core.method({
  37776. selector: "theClass",
  37777. protocol: 'accessing',
  37778. fn: function (){
  37779. var self=this;
  37780. var $1;
  37781. $1=self["@theClass"];
  37782. return $1;
  37783. },
  37784. args: [],
  37785. source: "theClass\x0a\x09^ theClass",
  37786. referencedClasses: [],
  37787. messageSends: []
  37788. }),
  37789. $globals.IRMethod);
  37790. $core.addMethod(
  37791. $core.method({
  37792. selector: "theClass:",
  37793. protocol: 'accessing',
  37794. fn: function (aClass){
  37795. var self=this;
  37796. self["@theClass"]=aClass;
  37797. return self;
  37798. },
  37799. args: ["aClass"],
  37800. source: "theClass: aClass\x0a\x09theClass := aClass",
  37801. referencedClasses: [],
  37802. messageSends: []
  37803. }),
  37804. $globals.IRMethod);
  37805. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  37806. $globals.IRReturn.comment="I am a local return instruction.";
  37807. $core.addMethod(
  37808. $core.method({
  37809. selector: "accept:",
  37810. protocol: 'visiting',
  37811. fn: function (aVisitor){
  37812. var self=this;
  37813. return $core.withContext(function($ctx1) {
  37814. var $1;
  37815. $1=$recv(aVisitor)._visitIRReturn_(self);
  37816. return $1;
  37817. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)});
  37818. },
  37819. args: ["aVisitor"],
  37820. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  37821. referencedClasses: [],
  37822. messageSends: ["visitIRReturn:"]
  37823. }),
  37824. $globals.IRReturn);
  37825. $core.addMethod(
  37826. $core.method({
  37827. selector: "canBeAssigned",
  37828. protocol: 'testing',
  37829. fn: function (){
  37830. var self=this;
  37831. return false;
  37832. },
  37833. args: [],
  37834. source: "canBeAssigned\x0a\x09^ false",
  37835. referencedClasses: [],
  37836. messageSends: []
  37837. }),
  37838. $globals.IRReturn);
  37839. $core.addMethod(
  37840. $core.method({
  37841. selector: "isBlockReturn",
  37842. protocol: 'testing',
  37843. fn: function (){
  37844. var self=this;
  37845. return false;
  37846. },
  37847. args: [],
  37848. source: "isBlockReturn\x0a\x09^ false",
  37849. referencedClasses: [],
  37850. messageSends: []
  37851. }),
  37852. $globals.IRReturn);
  37853. $core.addMethod(
  37854. $core.method({
  37855. selector: "isLocalReturn",
  37856. protocol: 'testing',
  37857. fn: function (){
  37858. var self=this;
  37859. return true;
  37860. },
  37861. args: [],
  37862. source: "isLocalReturn\x0a\x09^ true",
  37863. referencedClasses: [],
  37864. messageSends: []
  37865. }),
  37866. $globals.IRReturn);
  37867. $core.addMethod(
  37868. $core.method({
  37869. selector: "isNonLocalReturn",
  37870. protocol: 'testing',
  37871. fn: function (){
  37872. var self=this;
  37873. return $core.withContext(function($ctx1) {
  37874. var $1;
  37875. $1=$recv(self._isLocalReturn())._not();
  37876. return $1;
  37877. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)});
  37878. },
  37879. args: [],
  37880. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  37881. referencedClasses: [],
  37882. messageSends: ["not", "isLocalReturn"]
  37883. }),
  37884. $globals.IRReturn);
  37885. $core.addMethod(
  37886. $core.method({
  37887. selector: "isReturn",
  37888. protocol: 'testing',
  37889. fn: function (){
  37890. var self=this;
  37891. return true;
  37892. },
  37893. args: [],
  37894. source: "isReturn\x0a\x09^ true",
  37895. referencedClasses: [],
  37896. messageSends: []
  37897. }),
  37898. $globals.IRReturn);
  37899. $core.addMethod(
  37900. $core.method({
  37901. selector: "scope",
  37902. protocol: 'accessing',
  37903. fn: function (){
  37904. var self=this;
  37905. return $core.withContext(function($ctx1) {
  37906. var $2,$1,$receiver;
  37907. $2=self["@scope"];
  37908. if(($receiver = $2) == null || $receiver.isNil){
  37909. $1=$recv(self._parent())._scope();
  37910. } else {
  37911. $1=$2;
  37912. };
  37913. return $1;
  37914. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  37915. },
  37916. args: [],
  37917. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  37918. referencedClasses: [],
  37919. messageSends: ["ifNil:", "scope", "parent"]
  37920. }),
  37921. $globals.IRReturn);
  37922. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  37923. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  37924. $core.addMethod(
  37925. $core.method({
  37926. selector: "accept:",
  37927. protocol: 'visiting',
  37928. fn: function (aVisitor){
  37929. var self=this;
  37930. return $core.withContext(function($ctx1) {
  37931. var $1;
  37932. $1=$recv(aVisitor)._visitIRBlockReturn_(self);
  37933. return $1;
  37934. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  37935. },
  37936. args: ["aVisitor"],
  37937. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  37938. referencedClasses: [],
  37939. messageSends: ["visitIRBlockReturn:"]
  37940. }),
  37941. $globals.IRBlockReturn);
  37942. $core.addMethod(
  37943. $core.method({
  37944. selector: "isBlockReturn",
  37945. protocol: 'testing',
  37946. fn: function (){
  37947. var self=this;
  37948. return true;
  37949. },
  37950. args: [],
  37951. source: "isBlockReturn\x0a\x09^ true",
  37952. referencedClasses: [],
  37953. messageSends: []
  37954. }),
  37955. $globals.IRBlockReturn);
  37956. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  37957. $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.";
  37958. $core.addMethod(
  37959. $core.method({
  37960. selector: "accept:",
  37961. protocol: 'visiting',
  37962. fn: function (aVisitor){
  37963. var self=this;
  37964. return $core.withContext(function($ctx1) {
  37965. var $1;
  37966. $1=$recv(aVisitor)._visitIRNonLocalReturn_(self);
  37967. return $1;
  37968. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  37969. },
  37970. args: ["aVisitor"],
  37971. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  37972. referencedClasses: [],
  37973. messageSends: ["visitIRNonLocalReturn:"]
  37974. }),
  37975. $globals.IRNonLocalReturn);
  37976. $core.addMethod(
  37977. $core.method({
  37978. selector: "isLocalReturn",
  37979. protocol: 'testing',
  37980. fn: function (){
  37981. var self=this;
  37982. return false;
  37983. },
  37984. args: [],
  37985. source: "isLocalReturn\x0a\x09^ false",
  37986. referencedClasses: [],
  37987. messageSends: []
  37988. }),
  37989. $globals.IRNonLocalReturn);
  37990. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  37991. $core.addMethod(
  37992. $core.method({
  37993. selector: "accept:",
  37994. protocol: 'visiting',
  37995. fn: function (aVisitor){
  37996. var self=this;
  37997. return $core.withContext(function($ctx1) {
  37998. var $1;
  37999. $1=$recv(aVisitor)._visitIRTempDeclaration_(self);
  38000. return $1;
  38001. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  38002. },
  38003. args: ["aVisitor"],
  38004. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  38005. referencedClasses: [],
  38006. messageSends: ["visitIRTempDeclaration:"]
  38007. }),
  38008. $globals.IRTempDeclaration);
  38009. $core.addMethod(
  38010. $core.method({
  38011. selector: "isTempDeclaration",
  38012. protocol: 'testing',
  38013. fn: function (){
  38014. var self=this;
  38015. return true;
  38016. },
  38017. args: [],
  38018. source: "isTempDeclaration\x0a\x09^ true",
  38019. referencedClasses: [],
  38020. messageSends: []
  38021. }),
  38022. $globals.IRTempDeclaration);
  38023. $core.addMethod(
  38024. $core.method({
  38025. selector: "name",
  38026. protocol: 'accessing',
  38027. fn: function (){
  38028. var self=this;
  38029. var $1;
  38030. $1=self["@name"];
  38031. return $1;
  38032. },
  38033. args: [],
  38034. source: "name\x0a\x09^ name",
  38035. referencedClasses: [],
  38036. messageSends: []
  38037. }),
  38038. $globals.IRTempDeclaration);
  38039. $core.addMethod(
  38040. $core.method({
  38041. selector: "name:",
  38042. protocol: 'accessing',
  38043. fn: function (aString){
  38044. var self=this;
  38045. self["@name"]=aString;
  38046. return self;
  38047. },
  38048. args: ["aString"],
  38049. source: "name: aString\x0a\x09name := aString",
  38050. referencedClasses: [],
  38051. messageSends: []
  38052. }),
  38053. $globals.IRTempDeclaration);
  38054. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  38055. $globals.IRSend.comment="I am a message send instruction.";
  38056. $core.addMethod(
  38057. $core.method({
  38058. selector: "accept:",
  38059. protocol: 'visiting',
  38060. fn: function (aVisitor){
  38061. var self=this;
  38062. return $core.withContext(function($ctx1) {
  38063. var $1;
  38064. $1=$recv(aVisitor)._visitIRSend_(self);
  38065. return $1;
  38066. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)});
  38067. },
  38068. args: ["aVisitor"],
  38069. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  38070. referencedClasses: [],
  38071. messageSends: ["visitIRSend:"]
  38072. }),
  38073. $globals.IRSend);
  38074. $core.addMethod(
  38075. $core.method({
  38076. selector: "classSend",
  38077. protocol: 'accessing',
  38078. fn: function (){
  38079. var self=this;
  38080. var $1;
  38081. $1=self["@classSend"];
  38082. return $1;
  38083. },
  38084. args: [],
  38085. source: "classSend\x0a\x09^ classSend",
  38086. referencedClasses: [],
  38087. messageSends: []
  38088. }),
  38089. $globals.IRSend);
  38090. $core.addMethod(
  38091. $core.method({
  38092. selector: "classSend:",
  38093. protocol: 'accessing',
  38094. fn: function (aClass){
  38095. var self=this;
  38096. self["@classSend"]=aClass;
  38097. return self;
  38098. },
  38099. args: ["aClass"],
  38100. source: "classSend: aClass\x0a\x09classSend := aClass",
  38101. referencedClasses: [],
  38102. messageSends: []
  38103. }),
  38104. $globals.IRSend);
  38105. $core.addMethod(
  38106. $core.method({
  38107. selector: "index",
  38108. protocol: 'accessing',
  38109. fn: function (){
  38110. var self=this;
  38111. var $1;
  38112. $1=self["@index"];
  38113. return $1;
  38114. },
  38115. args: [],
  38116. source: "index\x0a\x09^ index",
  38117. referencedClasses: [],
  38118. messageSends: []
  38119. }),
  38120. $globals.IRSend);
  38121. $core.addMethod(
  38122. $core.method({
  38123. selector: "index:",
  38124. protocol: 'accessing',
  38125. fn: function (anInteger){
  38126. var self=this;
  38127. self["@index"]=anInteger;
  38128. return self;
  38129. },
  38130. args: ["anInteger"],
  38131. source: "index: anInteger\x0a\x09index := anInteger",
  38132. referencedClasses: [],
  38133. messageSends: []
  38134. }),
  38135. $globals.IRSend);
  38136. $core.addMethod(
  38137. $core.method({
  38138. selector: "isSend",
  38139. protocol: 'testing',
  38140. fn: function (){
  38141. var self=this;
  38142. return true;
  38143. },
  38144. args: [],
  38145. source: "isSend\x0a\x09^ true",
  38146. referencedClasses: [],
  38147. messageSends: []
  38148. }),
  38149. $globals.IRSend);
  38150. $core.addMethod(
  38151. $core.method({
  38152. selector: "selector",
  38153. protocol: 'accessing',
  38154. fn: function (){
  38155. var self=this;
  38156. var $1;
  38157. $1=self["@selector"];
  38158. return $1;
  38159. },
  38160. args: [],
  38161. source: "selector\x0a\x09^ selector",
  38162. referencedClasses: [],
  38163. messageSends: []
  38164. }),
  38165. $globals.IRSend);
  38166. $core.addMethod(
  38167. $core.method({
  38168. selector: "selector:",
  38169. protocol: 'accessing',
  38170. fn: function (aString){
  38171. var self=this;
  38172. self["@selector"]=aString;
  38173. return self;
  38174. },
  38175. args: ["aString"],
  38176. source: "selector: aString\x0a\x09selector := aString",
  38177. referencedClasses: [],
  38178. messageSends: []
  38179. }),
  38180. $globals.IRSend);
  38181. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  38182. $core.addMethod(
  38183. $core.method({
  38184. selector: "accept:",
  38185. protocol: 'visiting',
  38186. fn: function (aVisitor){
  38187. var self=this;
  38188. return $core.withContext(function($ctx1) {
  38189. var $1;
  38190. $1=$recv(aVisitor)._visitIRSequence_(self);
  38191. return $1;
  38192. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)});
  38193. },
  38194. args: ["aVisitor"],
  38195. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  38196. referencedClasses: [],
  38197. messageSends: ["visitIRSequence:"]
  38198. }),
  38199. $globals.IRSequence);
  38200. $core.addMethod(
  38201. $core.method({
  38202. selector: "isSequence",
  38203. protocol: 'testing',
  38204. fn: function (){
  38205. var self=this;
  38206. return true;
  38207. },
  38208. args: [],
  38209. source: "isSequence\x0a\x09^ true",
  38210. referencedClasses: [],
  38211. messageSends: []
  38212. }),
  38213. $globals.IRSequence);
  38214. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  38215. $core.addMethod(
  38216. $core.method({
  38217. selector: "accept:",
  38218. protocol: 'visiting',
  38219. fn: function (aVisitor){
  38220. var self=this;
  38221. return $core.withContext(function($ctx1) {
  38222. var $1;
  38223. $1=$recv(aVisitor)._visitIRBlockSequence_(self);
  38224. return $1;
  38225. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  38226. },
  38227. args: ["aVisitor"],
  38228. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  38229. referencedClasses: [],
  38230. messageSends: ["visitIRBlockSequence:"]
  38231. }),
  38232. $globals.IRBlockSequence);
  38233. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  38234. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  38235. $core.addMethod(
  38236. $core.method({
  38237. selector: "accept:",
  38238. protocol: 'visiting',
  38239. fn: function (aVisitor){
  38240. var self=this;
  38241. return $core.withContext(function($ctx1) {
  38242. var $1;
  38243. $1=$recv(aVisitor)._visitIRValue_(self);
  38244. return $1;
  38245. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)});
  38246. },
  38247. args: ["aVisitor"],
  38248. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  38249. referencedClasses: [],
  38250. messageSends: ["visitIRValue:"]
  38251. }),
  38252. $globals.IRValue);
  38253. $core.addMethod(
  38254. $core.method({
  38255. selector: "needsBoxingAsReceiver",
  38256. protocol: 'testing',
  38257. fn: function (){
  38258. var self=this;
  38259. return false;
  38260. },
  38261. args: [],
  38262. source: "needsBoxingAsReceiver\x0a\x09^ false",
  38263. referencedClasses: [],
  38264. messageSends: []
  38265. }),
  38266. $globals.IRValue);
  38267. $core.addMethod(
  38268. $core.method({
  38269. selector: "value",
  38270. protocol: 'accessing',
  38271. fn: function (){
  38272. var self=this;
  38273. var $1;
  38274. $1=self["@value"];
  38275. return $1;
  38276. },
  38277. args: [],
  38278. source: "value\x0a\x09^ value",
  38279. referencedClasses: [],
  38280. messageSends: []
  38281. }),
  38282. $globals.IRValue);
  38283. $core.addMethod(
  38284. $core.method({
  38285. selector: "value:",
  38286. protocol: 'accessing',
  38287. fn: function (aString){
  38288. var self=this;
  38289. self["@value"]=aString;
  38290. return self;
  38291. },
  38292. args: ["aString"],
  38293. source: "value: aString\x0a\x09value := aString",
  38294. referencedClasses: [],
  38295. messageSends: []
  38296. }),
  38297. $globals.IRValue);
  38298. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  38299. $globals.IRVariable.comment="I am a variable instruction.";
  38300. $core.addMethod(
  38301. $core.method({
  38302. selector: "accept:",
  38303. protocol: 'visiting',
  38304. fn: function (aVisitor){
  38305. var self=this;
  38306. return $core.withContext(function($ctx1) {
  38307. var $1;
  38308. $1=$recv(aVisitor)._visitIRVariable_(self);
  38309. return $1;
  38310. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)});
  38311. },
  38312. args: ["aVisitor"],
  38313. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  38314. referencedClasses: [],
  38315. messageSends: ["visitIRVariable:"]
  38316. }),
  38317. $globals.IRVariable);
  38318. $core.addMethod(
  38319. $core.method({
  38320. selector: "isVariable",
  38321. protocol: 'testing',
  38322. fn: function (){
  38323. var self=this;
  38324. return true;
  38325. },
  38326. args: [],
  38327. source: "isVariable\x0a\x09^ true",
  38328. referencedClasses: [],
  38329. messageSends: []
  38330. }),
  38331. $globals.IRVariable);
  38332. $core.addMethod(
  38333. $core.method({
  38334. selector: "needsBoxingAsReceiver",
  38335. protocol: 'testing',
  38336. fn: function (){
  38337. var self=this;
  38338. return $core.withContext(function($ctx1) {
  38339. var $1;
  38340. $1=$recv($recv(self._variable())._isPseudoVar())._not();
  38341. return $1;
  38342. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  38343. },
  38344. args: [],
  38345. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  38346. referencedClasses: [],
  38347. messageSends: ["not", "isPseudoVar", "variable"]
  38348. }),
  38349. $globals.IRVariable);
  38350. $core.addMethod(
  38351. $core.method({
  38352. selector: "variable",
  38353. protocol: 'accessing',
  38354. fn: function (){
  38355. var self=this;
  38356. var $1;
  38357. $1=self["@variable"];
  38358. return $1;
  38359. },
  38360. args: [],
  38361. source: "variable\x0a\x09^ variable",
  38362. referencedClasses: [],
  38363. messageSends: []
  38364. }),
  38365. $globals.IRVariable);
  38366. $core.addMethod(
  38367. $core.method({
  38368. selector: "variable:",
  38369. protocol: 'accessing',
  38370. fn: function (aScopeVariable){
  38371. var self=this;
  38372. self["@variable"]=aScopeVariable;
  38373. return self;
  38374. },
  38375. args: ["aScopeVariable"],
  38376. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  38377. referencedClasses: [],
  38378. messageSends: []
  38379. }),
  38380. $globals.IRVariable);
  38381. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  38382. $core.addMethod(
  38383. $core.method({
  38384. selector: "accept:",
  38385. protocol: 'visiting',
  38386. fn: function (aVisitor){
  38387. var self=this;
  38388. return $core.withContext(function($ctx1) {
  38389. var $1;
  38390. $1=$recv(aVisitor)._visitIRVerbatim_(self);
  38391. return $1;
  38392. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  38393. },
  38394. args: ["aVisitor"],
  38395. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  38396. referencedClasses: [],
  38397. messageSends: ["visitIRVerbatim:"]
  38398. }),
  38399. $globals.IRVerbatim);
  38400. $core.addMethod(
  38401. $core.method({
  38402. selector: "source",
  38403. protocol: 'accessing',
  38404. fn: function (){
  38405. var self=this;
  38406. var $1;
  38407. $1=self["@source"];
  38408. return $1;
  38409. },
  38410. args: [],
  38411. source: "source\x0a\x09^ source",
  38412. referencedClasses: [],
  38413. messageSends: []
  38414. }),
  38415. $globals.IRVerbatim);
  38416. $core.addMethod(
  38417. $core.method({
  38418. selector: "source:",
  38419. protocol: 'accessing',
  38420. fn: function (aString){
  38421. var self=this;
  38422. self["@source"]=aString;
  38423. return self;
  38424. },
  38425. args: ["aString"],
  38426. source: "source: aString\x0a\x09source := aString",
  38427. referencedClasses: [],
  38428. messageSends: []
  38429. }),
  38430. $globals.IRVerbatim);
  38431. $core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR');
  38432. $core.addMethod(
  38433. $core.method({
  38434. selector: "visit:",
  38435. protocol: 'visiting',
  38436. fn: function (anIRInstruction){
  38437. var self=this;
  38438. return $core.withContext(function($ctx1) {
  38439. var $1;
  38440. $1=$recv(anIRInstruction)._accept_(self);
  38441. return $1;
  38442. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  38443. },
  38444. args: ["anIRInstruction"],
  38445. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  38446. referencedClasses: [],
  38447. messageSends: ["accept:"]
  38448. }),
  38449. $globals.IRVisitor);
  38450. $core.addMethod(
  38451. $core.method({
  38452. selector: "visitIRAssignment:",
  38453. protocol: 'visiting',
  38454. fn: function (anIRAssignment){
  38455. var self=this;
  38456. return $core.withContext(function($ctx1) {
  38457. var $1;
  38458. $1=self._visitIRInstruction_(anIRAssignment);
  38459. return $1;
  38460. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  38461. },
  38462. args: ["anIRAssignment"],
  38463. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  38464. referencedClasses: [],
  38465. messageSends: ["visitIRInstruction:"]
  38466. }),
  38467. $globals.IRVisitor);
  38468. $core.addMethod(
  38469. $core.method({
  38470. selector: "visitIRBlockReturn:",
  38471. protocol: 'visiting',
  38472. fn: function (anIRBlockReturn){
  38473. var self=this;
  38474. return $core.withContext(function($ctx1) {
  38475. var $1;
  38476. $1=self._visitIRReturn_(anIRBlockReturn);
  38477. return $1;
  38478. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  38479. },
  38480. args: ["anIRBlockReturn"],
  38481. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  38482. referencedClasses: [],
  38483. messageSends: ["visitIRReturn:"]
  38484. }),
  38485. $globals.IRVisitor);
  38486. $core.addMethod(
  38487. $core.method({
  38488. selector: "visitIRBlockSequence:",
  38489. protocol: 'visiting',
  38490. fn: function (anIRBlockSequence){
  38491. var self=this;
  38492. return $core.withContext(function($ctx1) {
  38493. var $1;
  38494. $1=self._visitIRSequence_(anIRBlockSequence);
  38495. return $1;
  38496. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  38497. },
  38498. args: ["anIRBlockSequence"],
  38499. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  38500. referencedClasses: [],
  38501. messageSends: ["visitIRSequence:"]
  38502. }),
  38503. $globals.IRVisitor);
  38504. $core.addMethod(
  38505. $core.method({
  38506. selector: "visitIRClosure:",
  38507. protocol: 'visiting',
  38508. fn: function (anIRClosure){
  38509. var self=this;
  38510. return $core.withContext(function($ctx1) {
  38511. var $1;
  38512. $1=self._visitIRInstruction_(anIRClosure);
  38513. return $1;
  38514. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  38515. },
  38516. args: ["anIRClosure"],
  38517. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  38518. referencedClasses: [],
  38519. messageSends: ["visitIRInstruction:"]
  38520. }),
  38521. $globals.IRVisitor);
  38522. $core.addMethod(
  38523. $core.method({
  38524. selector: "visitIRDynamicArray:",
  38525. protocol: 'visiting',
  38526. fn: function (anIRDynamicArray){
  38527. var self=this;
  38528. return $core.withContext(function($ctx1) {
  38529. var $1;
  38530. $1=self._visitIRInstruction_(anIRDynamicArray);
  38531. return $1;
  38532. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  38533. },
  38534. args: ["anIRDynamicArray"],
  38535. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  38536. referencedClasses: [],
  38537. messageSends: ["visitIRInstruction:"]
  38538. }),
  38539. $globals.IRVisitor);
  38540. $core.addMethod(
  38541. $core.method({
  38542. selector: "visitIRDynamicDictionary:",
  38543. protocol: 'visiting',
  38544. fn: function (anIRDynamicDictionary){
  38545. var self=this;
  38546. return $core.withContext(function($ctx1) {
  38547. var $1;
  38548. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  38549. return $1;
  38550. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  38551. },
  38552. args: ["anIRDynamicDictionary"],
  38553. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  38554. referencedClasses: [],
  38555. messageSends: ["visitIRInstruction:"]
  38556. }),
  38557. $globals.IRVisitor);
  38558. $core.addMethod(
  38559. $core.method({
  38560. selector: "visitIRInlinedClosure:",
  38561. protocol: 'visiting',
  38562. fn: function (anIRInlinedClosure){
  38563. var self=this;
  38564. return $core.withContext(function($ctx1) {
  38565. var $1;
  38566. $1=self._visitIRClosure_(anIRInlinedClosure);
  38567. return $1;
  38568. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  38569. },
  38570. args: ["anIRInlinedClosure"],
  38571. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  38572. referencedClasses: [],
  38573. messageSends: ["visitIRClosure:"]
  38574. }),
  38575. $globals.IRVisitor);
  38576. $core.addMethod(
  38577. $core.method({
  38578. selector: "visitIRInlinedSequence:",
  38579. protocol: 'visiting',
  38580. fn: function (anIRInlinedSequence){
  38581. var self=this;
  38582. return $core.withContext(function($ctx1) {
  38583. var $1;
  38584. $1=self._visitIRSequence_(anIRInlinedSequence);
  38585. return $1;
  38586. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  38587. },
  38588. args: ["anIRInlinedSequence"],
  38589. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  38590. referencedClasses: [],
  38591. messageSends: ["visitIRSequence:"]
  38592. }),
  38593. $globals.IRVisitor);
  38594. $core.addMethod(
  38595. $core.method({
  38596. selector: "visitIRInstruction:",
  38597. protocol: 'visiting',
  38598. fn: function (anIRInstruction){
  38599. var self=this;
  38600. return $core.withContext(function($ctx1) {
  38601. $recv($recv(anIRInstruction)._instructions())._do_((function(each){
  38602. return $core.withContext(function($ctx2) {
  38603. return self._visit_(each);
  38604. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38605. }));
  38606. return anIRInstruction;
  38607. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  38608. },
  38609. args: ["anIRInstruction"],
  38610. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  38611. referencedClasses: [],
  38612. messageSends: ["do:", "instructions", "visit:"]
  38613. }),
  38614. $globals.IRVisitor);
  38615. $core.addMethod(
  38616. $core.method({
  38617. selector: "visitIRMethod:",
  38618. protocol: 'visiting',
  38619. fn: function (anIRMethod){
  38620. var self=this;
  38621. return $core.withContext(function($ctx1) {
  38622. var $1;
  38623. $1=self._visitIRInstruction_(anIRMethod);
  38624. return $1;
  38625. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  38626. },
  38627. args: ["anIRMethod"],
  38628. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  38629. referencedClasses: [],
  38630. messageSends: ["visitIRInstruction:"]
  38631. }),
  38632. $globals.IRVisitor);
  38633. $core.addMethod(
  38634. $core.method({
  38635. selector: "visitIRNonLocalReturn:",
  38636. protocol: 'visiting',
  38637. fn: function (anIRNonLocalReturn){
  38638. var self=this;
  38639. return $core.withContext(function($ctx1) {
  38640. var $1;
  38641. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  38642. return $1;
  38643. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  38644. },
  38645. args: ["anIRNonLocalReturn"],
  38646. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  38647. referencedClasses: [],
  38648. messageSends: ["visitIRInstruction:"]
  38649. }),
  38650. $globals.IRVisitor);
  38651. $core.addMethod(
  38652. $core.method({
  38653. selector: "visitIRNonLocalReturnHandling:",
  38654. protocol: 'visiting',
  38655. fn: function (anIRNonLocalReturnHandling){
  38656. var self=this;
  38657. return $core.withContext(function($ctx1) {
  38658. var $1;
  38659. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  38660. return $1;
  38661. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  38662. },
  38663. args: ["anIRNonLocalReturnHandling"],
  38664. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  38665. referencedClasses: [],
  38666. messageSends: ["visitIRInstruction:"]
  38667. }),
  38668. $globals.IRVisitor);
  38669. $core.addMethod(
  38670. $core.method({
  38671. selector: "visitIRReturn:",
  38672. protocol: 'visiting',
  38673. fn: function (anIRReturn){
  38674. var self=this;
  38675. return $core.withContext(function($ctx1) {
  38676. var $1;
  38677. $1=self._visitIRInstruction_(anIRReturn);
  38678. return $1;
  38679. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  38680. },
  38681. args: ["anIRReturn"],
  38682. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  38683. referencedClasses: [],
  38684. messageSends: ["visitIRInstruction:"]
  38685. }),
  38686. $globals.IRVisitor);
  38687. $core.addMethod(
  38688. $core.method({
  38689. selector: "visitIRSend:",
  38690. protocol: 'visiting',
  38691. fn: function (anIRSend){
  38692. var self=this;
  38693. return $core.withContext(function($ctx1) {
  38694. var $1;
  38695. $1=self._visitIRInstruction_(anIRSend);
  38696. return $1;
  38697. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  38698. },
  38699. args: ["anIRSend"],
  38700. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  38701. referencedClasses: [],
  38702. messageSends: ["visitIRInstruction:"]
  38703. }),
  38704. $globals.IRVisitor);
  38705. $core.addMethod(
  38706. $core.method({
  38707. selector: "visitIRSequence:",
  38708. protocol: 'visiting',
  38709. fn: function (anIRSequence){
  38710. var self=this;
  38711. return $core.withContext(function($ctx1) {
  38712. var $1;
  38713. $1=self._visitIRInstruction_(anIRSequence);
  38714. return $1;
  38715. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  38716. },
  38717. args: ["anIRSequence"],
  38718. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  38719. referencedClasses: [],
  38720. messageSends: ["visitIRInstruction:"]
  38721. }),
  38722. $globals.IRVisitor);
  38723. $core.addMethod(
  38724. $core.method({
  38725. selector: "visitIRTempDeclaration:",
  38726. protocol: 'visiting',
  38727. fn: function (anIRTempDeclaration){
  38728. var self=this;
  38729. return $core.withContext(function($ctx1) {
  38730. var $1;
  38731. $1=self._visitIRInstruction_(anIRTempDeclaration);
  38732. return $1;
  38733. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  38734. },
  38735. args: ["anIRTempDeclaration"],
  38736. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  38737. referencedClasses: [],
  38738. messageSends: ["visitIRInstruction:"]
  38739. }),
  38740. $globals.IRVisitor);
  38741. $core.addMethod(
  38742. $core.method({
  38743. selector: "visitIRValue:",
  38744. protocol: 'visiting',
  38745. fn: function (anIRValue){
  38746. var self=this;
  38747. return $core.withContext(function($ctx1) {
  38748. var $1;
  38749. $1=self._visitIRInstruction_(anIRValue);
  38750. return $1;
  38751. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  38752. },
  38753. args: ["anIRValue"],
  38754. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  38755. referencedClasses: [],
  38756. messageSends: ["visitIRInstruction:"]
  38757. }),
  38758. $globals.IRVisitor);
  38759. $core.addMethod(
  38760. $core.method({
  38761. selector: "visitIRVariable:",
  38762. protocol: 'visiting',
  38763. fn: function (anIRVariable){
  38764. var self=this;
  38765. return $core.withContext(function($ctx1) {
  38766. var $1;
  38767. $1=self._visitIRInstruction_(anIRVariable);
  38768. return $1;
  38769. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  38770. },
  38771. args: ["anIRVariable"],
  38772. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  38773. referencedClasses: [],
  38774. messageSends: ["visitIRInstruction:"]
  38775. }),
  38776. $globals.IRVisitor);
  38777. $core.addMethod(
  38778. $core.method({
  38779. selector: "visitIRVerbatim:",
  38780. protocol: 'visiting',
  38781. fn: function (anIRVerbatim){
  38782. var self=this;
  38783. return $core.withContext(function($ctx1) {
  38784. var $1;
  38785. $1=self._visitIRInstruction_(anIRVerbatim);
  38786. return $1;
  38787. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  38788. },
  38789. args: ["anIRVerbatim"],
  38790. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  38791. referencedClasses: [],
  38792. messageSends: ["visitIRInstruction:"]
  38793. }),
  38794. $globals.IRVisitor);
  38795. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  38796. $core.addMethod(
  38797. $core.method({
  38798. selector: "contents",
  38799. protocol: 'accessing',
  38800. fn: function (){
  38801. var self=this;
  38802. return $core.withContext(function($ctx1) {
  38803. var $1;
  38804. $1=$recv(self._stream())._contents();
  38805. return $1;
  38806. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  38807. },
  38808. args: [],
  38809. source: "contents\x0a\x09^ self stream contents",
  38810. referencedClasses: [],
  38811. messageSends: ["contents", "stream"]
  38812. }),
  38813. $globals.IRJSTranslator);
  38814. $core.addMethod(
  38815. $core.method({
  38816. selector: "currentClass",
  38817. protocol: 'accessing',
  38818. fn: function (){
  38819. var self=this;
  38820. var $1;
  38821. $1=self["@currentClass"];
  38822. return $1;
  38823. },
  38824. args: [],
  38825. source: "currentClass\x0a\x09^ currentClass",
  38826. referencedClasses: [],
  38827. messageSends: []
  38828. }),
  38829. $globals.IRJSTranslator);
  38830. $core.addMethod(
  38831. $core.method({
  38832. selector: "currentClass:",
  38833. protocol: 'accessing',
  38834. fn: function (aClass){
  38835. var self=this;
  38836. self["@currentClass"]=aClass;
  38837. return self;
  38838. },
  38839. args: ["aClass"],
  38840. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  38841. referencedClasses: [],
  38842. messageSends: []
  38843. }),
  38844. $globals.IRJSTranslator);
  38845. $core.addMethod(
  38846. $core.method({
  38847. selector: "initialize",
  38848. protocol: 'initialization',
  38849. fn: function (){
  38850. var self=this;
  38851. function $JSStream(){return $globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  38852. return $core.withContext(function($ctx1) {
  38853. (
  38854. $ctx1.supercall = true,
  38855. $globals.IRJSTranslator.superclass.fn.prototype._initialize.apply($recv(self), []));
  38856. $ctx1.supercall = false;
  38857. self["@stream"]=$recv($JSStream())._new();
  38858. return self;
  38859. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  38860. },
  38861. args: [],
  38862. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  38863. referencedClasses: ["JSStream"],
  38864. messageSends: ["initialize", "new"]
  38865. }),
  38866. $globals.IRJSTranslator);
  38867. $core.addMethod(
  38868. $core.method({
  38869. selector: "stream",
  38870. protocol: 'accessing',
  38871. fn: function (){
  38872. var self=this;
  38873. var $1;
  38874. $1=self["@stream"];
  38875. return $1;
  38876. },
  38877. args: [],
  38878. source: "stream\x0a\x09^ stream",
  38879. referencedClasses: [],
  38880. messageSends: []
  38881. }),
  38882. $globals.IRJSTranslator);
  38883. $core.addMethod(
  38884. $core.method({
  38885. selector: "stream:",
  38886. protocol: 'accessing',
  38887. fn: function (aStream){
  38888. var self=this;
  38889. self["@stream"]=aStream;
  38890. return self;
  38891. },
  38892. args: ["aStream"],
  38893. source: "stream: aStream\x0a\x09stream := aStream",
  38894. referencedClasses: [],
  38895. messageSends: []
  38896. }),
  38897. $globals.IRJSTranslator);
  38898. $core.addMethod(
  38899. $core.method({
  38900. selector: "visitIRAssignment:",
  38901. protocol: 'visiting',
  38902. fn: function (anIRAssignment){
  38903. var self=this;
  38904. return $core.withContext(function($ctx1) {
  38905. var $2,$1;
  38906. $2=$recv(anIRAssignment)._instructions();
  38907. $ctx1.sendIdx["instructions"]=1;
  38908. $1=$recv($2)._first();
  38909. self._visit_($1);
  38910. $ctx1.sendIdx["visit:"]=1;
  38911. $recv(self._stream())._nextPutAssignment();
  38912. self._visit_($recv($recv(anIRAssignment)._instructions())._last());
  38913. return self;
  38914. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  38915. },
  38916. args: ["anIRAssignment"],
  38917. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  38918. referencedClasses: [],
  38919. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"]
  38920. }),
  38921. $globals.IRJSTranslator);
  38922. $core.addMethod(
  38923. $core.method({
  38924. selector: "visitIRClosure:",
  38925. protocol: 'visiting',
  38926. fn: function (anIRClosure){
  38927. var self=this;
  38928. return $core.withContext(function($ctx1) {
  38929. var $1,$2;
  38930. $1=self._stream();
  38931. $ctx1.sendIdx["stream"]=1;
  38932. $recv($1)._nextPutClosureWith_arguments_((function(){
  38933. return $core.withContext(function($ctx2) {
  38934. $2=self._stream();
  38935. $ctx2.sendIdx["stream"]=2;
  38936. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  38937. return $core.withContext(function($ctx3) {
  38938. return $recv($recv(each)._name())._asVariableName();
  38939. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38940. })));
  38941. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  38942. return $core.withContext(function($ctx3) {
  38943. return (
  38944. $ctx3.supercall = true,
  38945. $globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  38946. $ctx3.supercall = false;
  38947. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38948. }));
  38949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38950. }),$recv(anIRClosure)._arguments());
  38951. return self;
  38952. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  38953. },
  38954. args: ["anIRClosure"],
  38955. 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",
  38956. referencedClasses: [],
  38957. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  38958. }),
  38959. $globals.IRJSTranslator);
  38960. $core.addMethod(
  38961. $core.method({
  38962. selector: "visitIRDynamicArray:",
  38963. protocol: 'visiting',
  38964. fn: function (anIRDynamicArray){
  38965. var self=this;
  38966. return $core.withContext(function($ctx1) {
  38967. var $1;
  38968. $1=self._stream();
  38969. $ctx1.sendIdx["stream"]=1;
  38970. $recv($1)._nextPutAll_("[");
  38971. $ctx1.sendIdx["nextPutAll:"]=1;
  38972. $recv($recv(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  38973. return $core.withContext(function($ctx2) {
  38974. return self._visit_(each);
  38975. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38976. }),(function(){
  38977. return $core.withContext(function($ctx2) {
  38978. return $recv(self._stream())._nextPutAll_(",");
  38979. $ctx2.sendIdx["nextPutAll:"]=2;
  38980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38981. }));
  38982. $recv(self["@stream"])._nextPutAll_("]");
  38983. return self;
  38984. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  38985. },
  38986. args: ["anIRDynamicArray"],
  38987. 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: ']'",
  38988. referencedClasses: [],
  38989. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  38990. }),
  38991. $globals.IRJSTranslator);
  38992. $core.addMethod(
  38993. $core.method({
  38994. selector: "visitIRDynamicDictionary:",
  38995. protocol: 'visiting',
  38996. fn: function (anIRDynamicDictionary){
  38997. var self=this;
  38998. return $core.withContext(function($ctx1) {
  38999. var $1,$2;
  39000. $1=self._stream();
  39001. $ctx1.sendIdx["stream"]=1;
  39002. $recv($1)._nextPutAll_("$globals.HashedCollection._newFromPairs_([");
  39003. $ctx1.sendIdx["nextPutAll:"]=1;
  39004. $recv($recv(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  39005. return $core.withContext(function($ctx2) {
  39006. return self._visit_(each);
  39007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39008. }),(function(){
  39009. return $core.withContext(function($ctx2) {
  39010. $2=self._stream();
  39011. $ctx2.sendIdx["stream"]=2;
  39012. return $recv($2)._nextPutAll_(",");
  39013. $ctx2.sendIdx["nextPutAll:"]=2;
  39014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39015. }));
  39016. $recv(self._stream())._nextPutAll_("])");
  39017. return self;
  39018. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  39019. },
  39020. args: ["anIRDynamicDictionary"],
  39021. 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: '])'",
  39022. referencedClasses: [],
  39023. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  39024. }),
  39025. $globals.IRJSTranslator);
  39026. $core.addMethod(
  39027. $core.method({
  39028. selector: "visitIRMethod:",
  39029. protocol: 'visiting',
  39030. fn: function (anIRMethod){
  39031. var self=this;
  39032. return $core.withContext(function($ctx1) {
  39033. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  39034. $1=self._stream();
  39035. $ctx1.sendIdx["stream"]=1;
  39036. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  39037. return $core.withContext(function($ctx2) {
  39038. $2=self._stream();
  39039. $ctx2.sendIdx["stream"]=2;
  39040. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  39041. return $core.withContext(function($ctx3) {
  39042. $3=self._stream();
  39043. $ctx3.sendIdx["stream"]=3;
  39044. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  39045. return $core.withContext(function($ctx4) {
  39046. return $recv($recv(each)._name())._asVariableName();
  39047. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39048. }));
  39049. $ctx3.sendIdx["collect:"]=1;
  39050. $recv($3)._nextPutVars_($4);
  39051. $ctx3.sendIdx["nextPutVars:"]=1;
  39052. $recv($recv(anIRMethod)._classReferences())._do_((function(each){
  39053. return $core.withContext(function($ctx4) {
  39054. $5=self._stream();
  39055. $ctx4.sendIdx["stream"]=4;
  39056. return $recv($5)._nextPutClassRefFunction_(each);
  39057. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)});
  39058. }));
  39059. $6=self._stream();
  39060. $ctx3.sendIdx["stream"]=5;
  39061. return $recv($6)._nextPutContextFor_during_(anIRMethod,(function(){
  39062. return $core.withContext(function($ctx4) {
  39063. $8=$recv(anIRMethod)._internalVariables();
  39064. $ctx4.sendIdx["internalVariables"]=1;
  39065. $7=$recv($8)._notEmpty();
  39066. if($core.assert($7)){
  39067. $9=self._stream();
  39068. $ctx4.sendIdx["stream"]=6;
  39069. $recv($9)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  39070. return $core.withContext(function($ctx5) {
  39071. return $recv($recv(each)._variable())._alias();
  39072. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)});
  39073. })));
  39074. };
  39075. $10=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  39076. if($core.assert($10)){
  39077. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  39078. return $core.withContext(function($ctx5) {
  39079. return (
  39080. $ctx5.supercall = true,
  39081. $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39082. $ctx5.supercall = false;
  39083. $ctx5.sendIdx["visitIRMethod:"]=1;
  39084. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)});
  39085. }));
  39086. } else {
  39087. return (
  39088. $ctx4.supercall = true,
  39089. $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39090. $ctx4.supercall = false;
  39091. };
  39092. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  39093. }));
  39094. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39095. }),$recv(anIRMethod)._arguments());
  39096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39097. }));
  39098. return self;
  39099. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  39100. },
  39101. args: ["anIRMethod"],
  39102. 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 ]",
  39103. referencedClasses: [],
  39104. 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"]
  39105. }),
  39106. $globals.IRJSTranslator);
  39107. $core.addMethod(
  39108. $core.method({
  39109. selector: "visitIRNonLocalReturn:",
  39110. protocol: 'visiting',
  39111. fn: function (anIRNonLocalReturn){
  39112. var self=this;
  39113. return $core.withContext(function($ctx1) {
  39114. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  39115. return $core.withContext(function($ctx2) {
  39116. return (
  39117. $ctx2.supercall = true,
  39118. $globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39119. $ctx2.supercall = false;
  39120. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39121. }));
  39122. return self;
  39123. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  39124. },
  39125. args: ["anIRNonLocalReturn"],
  39126. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  39127. referencedClasses: [],
  39128. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  39129. }),
  39130. $globals.IRJSTranslator);
  39131. $core.addMethod(
  39132. $core.method({
  39133. selector: "visitIRReturn:",
  39134. protocol: 'visiting',
  39135. fn: function (anIRReturn){
  39136. var self=this;
  39137. return $core.withContext(function($ctx1) {
  39138. $recv(self._stream())._nextPutReturnWith_((function(){
  39139. return $core.withContext(function($ctx2) {
  39140. return (
  39141. $ctx2.supercall = true,
  39142. $globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39143. $ctx2.supercall = false;
  39144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39145. }));
  39146. return self;
  39147. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  39148. },
  39149. args: ["anIRReturn"],
  39150. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  39151. referencedClasses: [],
  39152. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  39153. }),
  39154. $globals.IRJSTranslator);
  39155. $core.addMethod(
  39156. $core.method({
  39157. selector: "visitIRSend:",
  39158. protocol: 'visiting',
  39159. fn: function (anIRSend){
  39160. var self=this;
  39161. var sends;
  39162. return $core.withContext(function($ctx1) {
  39163. var $1,$2,$receiver;
  39164. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  39165. $1=$recv(anIRSend)._classSend();
  39166. if(($receiver = $1) == null || $receiver.isNil){
  39167. self._visitSend_(anIRSend);
  39168. } else {
  39169. self._visitSuperSend_(anIRSend);
  39170. };
  39171. $2=$recv($recv(sends).__gt((1)))._and_((function(){
  39172. return $core.withContext(function($ctx2) {
  39173. return $recv($recv(anIRSend)._index()).__lt(sends);
  39174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39175. }));
  39176. if($core.assert($2)){
  39177. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  39178. };
  39179. return self;
  39180. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},$globals.IRJSTranslator)});
  39181. },
  39182. args: ["anIRSend"],
  39183. 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 ]",
  39184. referencedClasses: [],
  39185. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  39186. }),
  39187. $globals.IRJSTranslator);
  39188. $core.addMethod(
  39189. $core.method({
  39190. selector: "visitIRSequence:",
  39191. protocol: 'visiting',
  39192. fn: function (anIRSequence){
  39193. var self=this;
  39194. return $core.withContext(function($ctx1) {
  39195. var $1;
  39196. $1=self._stream();
  39197. $ctx1.sendIdx["stream"]=1;
  39198. $recv($1)._nextPutSequenceWith_((function(){
  39199. return $core.withContext(function($ctx2) {
  39200. return $recv($recv(anIRSequence)._instructions())._do_((function(each){
  39201. return $core.withContext(function($ctx3) {
  39202. return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
  39203. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39204. }));
  39205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39206. }));
  39207. return self;
  39208. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  39209. },
  39210. args: ["anIRSequence"],
  39211. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  39212. referencedClasses: [],
  39213. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  39214. }),
  39215. $globals.IRJSTranslator);
  39216. $core.addMethod(
  39217. $core.method({
  39218. selector: "visitIRTempDeclaration:",
  39219. protocol: 'visiting',
  39220. fn: function (anIRTempDeclaration){
  39221. var self=this;
  39222. return self;
  39223. },
  39224. args: ["anIRTempDeclaration"],
  39225. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  39226. referencedClasses: [],
  39227. messageSends: []
  39228. }),
  39229. $globals.IRJSTranslator);
  39230. $core.addMethod(
  39231. $core.method({
  39232. selector: "visitIRValue:",
  39233. protocol: 'visiting',
  39234. fn: function (anIRValue){
  39235. var self=this;
  39236. return $core.withContext(function($ctx1) {
  39237. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  39238. return self;
  39239. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  39240. },
  39241. args: ["anIRValue"],
  39242. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  39243. referencedClasses: [],
  39244. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  39245. }),
  39246. $globals.IRJSTranslator);
  39247. $core.addMethod(
  39248. $core.method({
  39249. selector: "visitIRVariable:",
  39250. protocol: 'visiting',
  39251. fn: function (anIRVariable){
  39252. var self=this;
  39253. return $core.withContext(function($ctx1) {
  39254. var $3,$2,$1,$4;
  39255. $3=$recv(anIRVariable)._variable();
  39256. $ctx1.sendIdx["variable"]=1;
  39257. $2=$recv($3)._name();
  39258. $1=$recv($2).__eq("thisContext");
  39259. if($core.assert($1)){
  39260. $4=self._stream();
  39261. $ctx1.sendIdx["stream"]=1;
  39262. $recv($4)._nextPutAll_("$core.getThisContext()");
  39263. $ctx1.sendIdx["nextPutAll:"]=1;
  39264. } else {
  39265. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  39266. };
  39267. return self;
  39268. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  39269. },
  39270. args: ["anIRVariable"],
  39271. 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 ]",
  39272. referencedClasses: [],
  39273. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  39274. }),
  39275. $globals.IRJSTranslator);
  39276. $core.addMethod(
  39277. $core.method({
  39278. selector: "visitIRVerbatim:",
  39279. protocol: 'visiting',
  39280. fn: function (anIRVerbatim){
  39281. var self=this;
  39282. return $core.withContext(function($ctx1) {
  39283. var $1;
  39284. $1=self._stream();
  39285. $ctx1.sendIdx["stream"]=1;
  39286. $recv($1)._nextPutStatementWith_((function(){
  39287. return $core.withContext(function($ctx2) {
  39288. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  39289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39290. }));
  39291. return self;
  39292. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  39293. },
  39294. args: ["anIRVerbatim"],
  39295. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  39296. referencedClasses: [],
  39297. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  39298. }),
  39299. $globals.IRJSTranslator);
  39300. $core.addMethod(
  39301. $core.method({
  39302. selector: "visitReceiver:",
  39303. protocol: 'visiting',
  39304. fn: function (anIRInstruction){
  39305. var self=this;
  39306. return $core.withContext(function($ctx1) {
  39307. var $1,$2,$3;
  39308. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  39309. if(!$core.assert($1)){
  39310. $2=self._visit_(anIRInstruction);
  39311. $ctx1.sendIdx["visit:"]=1;
  39312. return $2;
  39313. };
  39314. $3=self._stream();
  39315. $ctx1.sendIdx["stream"]=1;
  39316. $recv($3)._nextPutAll_("$recv(");
  39317. $ctx1.sendIdx["nextPutAll:"]=1;
  39318. self._visit_(anIRInstruction);
  39319. $recv(self._stream())._nextPutAll_(")");
  39320. return self;
  39321. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  39322. },
  39323. args: ["anIRInstruction"],
  39324. 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: ')'",
  39325. referencedClasses: [],
  39326. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  39327. }),
  39328. $globals.IRJSTranslator);
  39329. $core.addMethod(
  39330. $core.method({
  39331. selector: "visitSend:",
  39332. protocol: 'visiting',
  39333. fn: function (anIRSend){
  39334. var self=this;
  39335. return $core.withContext(function($ctx1) {
  39336. var $2,$1,$3,$4,$5;
  39337. $2=$recv(anIRSend)._instructions();
  39338. $ctx1.sendIdx["instructions"]=1;
  39339. $1=$recv($2)._first();
  39340. self._visitReceiver_($1);
  39341. $3=self._stream();
  39342. $ctx1.sendIdx["stream"]=1;
  39343. $4=$recv(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName())).__comma("(");
  39344. $ctx1.sendIdx[","]=1;
  39345. $recv($3)._nextPutAll_($4);
  39346. $ctx1.sendIdx["nextPutAll:"]=1;
  39347. $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39348. return $core.withContext(function($ctx2) {
  39349. return self._visit_(each);
  39350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39351. }),(function(){
  39352. return $core.withContext(function($ctx2) {
  39353. $5=self._stream();
  39354. $ctx2.sendIdx["stream"]=2;
  39355. return $recv($5)._nextPutAll_(",");
  39356. $ctx2.sendIdx["nextPutAll:"]=2;
  39357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39358. }));
  39359. $recv(self._stream())._nextPutAll_(")");
  39360. return self;
  39361. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39362. },
  39363. args: ["anIRSend"],
  39364. 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: ')'",
  39365. referencedClasses: [],
  39366. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"]
  39367. }),
  39368. $globals.IRJSTranslator);
  39369. $core.addMethod(
  39370. $core.method({
  39371. selector: "visitSuperSend:",
  39372. protocol: 'visiting',
  39373. fn: function (anIRSend){
  39374. var self=this;
  39375. return $core.withContext(function($ctx1) {
  39376. var $1,$2,$5,$4,$3,$6,$7,$8,$10,$9,$11,$12,$13,$14;
  39377. $1=self._stream();
  39378. $ctx1.sendIdx["stream"]=1;
  39379. $recv($1)._nextPutAll_("(");
  39380. $ctx1.sendIdx["nextPutAll:"]=1;
  39381. $recv($1)._lf();
  39382. $ctx1.sendIdx["lf"]=1;
  39383. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39384. $ctx1.sendIdx["nextPutAll:"]=2;
  39385. $recv($1)._lf();
  39386. $ctx1.sendIdx["lf"]=2;
  39387. $2=$1;
  39388. $5=$recv(anIRSend)._scope();
  39389. $ctx1.sendIdx["scope"]=1;
  39390. $4=$recv($5)._alias();
  39391. $ctx1.sendIdx["alias"]=1;
  39392. $3=$recv($4).__comma(".supercall = true, ");
  39393. $ctx1.sendIdx[","]=1;
  39394. $recv($2)._nextPutAll_($3);
  39395. $ctx1.sendIdx["nextPutAll:"]=3;
  39396. $recv($1)._lf();
  39397. $ctx1.sendIdx["lf"]=3;
  39398. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39399. $ctx1.sendIdx["nextPutAll:"]=4;
  39400. $recv($1)._lf();
  39401. $ctx1.sendIdx["lf"]=4;
  39402. $recv($1)._nextPutAll_($recv(self._currentClass())._asJavascript());
  39403. $ctx1.sendIdx["nextPutAll:"]=5;
  39404. $recv($1)._nextPutAll_(".superclass.fn.prototype.");
  39405. $ctx1.sendIdx["nextPutAll:"]=6;
  39406. $6=$1;
  39407. $7=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  39408. $ctx1.sendIdx[","]=2;
  39409. $recv($6)._nextPutAll_($7);
  39410. $ctx1.sendIdx["nextPutAll:"]=7;
  39411. $8=$recv($1)._nextPutAll_("$recv(");
  39412. $ctx1.sendIdx["nextPutAll:"]=8;
  39413. $10=$recv(anIRSend)._instructions();
  39414. $ctx1.sendIdx["instructions"]=1;
  39415. $9=$recv($10)._first();
  39416. self._visit_($9);
  39417. $ctx1.sendIdx["visit:"]=1;
  39418. $11=self._stream();
  39419. $ctx1.sendIdx["stream"]=2;
  39420. $recv($11)._nextPutAll_("), [");
  39421. $ctx1.sendIdx["nextPutAll:"]=9;
  39422. $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39423. return $core.withContext(function($ctx2) {
  39424. return self._visit_(each);
  39425. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39426. }),(function(){
  39427. return $core.withContext(function($ctx2) {
  39428. $12=self._stream();
  39429. $ctx2.sendIdx["stream"]=3;
  39430. return $recv($12)._nextPutAll_(",");
  39431. $ctx2.sendIdx["nextPutAll:"]=10;
  39432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39433. }));
  39434. $13=self._stream();
  39435. $recv($13)._nextPutAll_("]));");
  39436. $ctx1.sendIdx["nextPutAll:"]=11;
  39437. $recv($13)._lf();
  39438. $ctx1.sendIdx["lf"]=5;
  39439. $recv($13)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39440. $ctx1.sendIdx["nextPutAll:"]=12;
  39441. $recv($13)._lf();
  39442. $ctx1.sendIdx["lf"]=6;
  39443. $recv($13)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  39444. $ctx1.sendIdx["nextPutAll:"]=13;
  39445. $recv($13)._lf();
  39446. $14=$recv($13)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39447. return self;
  39448. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39449. },
  39450. args: ["anIRSend"],
  39451. 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);'",
  39452. referencedClasses: [],
  39453. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"]
  39454. }),
  39455. $globals.IRJSTranslator);
  39456. $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
  39457. $core.addMethod(
  39458. $core.method({
  39459. selector: "contents",
  39460. protocol: 'accessing',
  39461. fn: function (){
  39462. var self=this;
  39463. return $core.withContext(function($ctx1) {
  39464. var $1;
  39465. $1=$recv(self["@stream"])._contents();
  39466. return $1;
  39467. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  39468. },
  39469. args: [],
  39470. source: "contents\x0a\x09^ stream contents",
  39471. referencedClasses: [],
  39472. messageSends: ["contents"]
  39473. }),
  39474. $globals.JSStream);
  39475. $core.addMethod(
  39476. $core.method({
  39477. selector: "initialize",
  39478. protocol: 'initialization',
  39479. fn: function (){
  39480. var self=this;
  39481. return $core.withContext(function($ctx1) {
  39482. (
  39483. $ctx1.supercall = true,
  39484. $globals.JSStream.superclass.fn.prototype._initialize.apply($recv(self), []));
  39485. $ctx1.supercall = false;
  39486. self["@stream"]=""._writeStream();
  39487. return self;
  39488. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  39489. },
  39490. args: [],
  39491. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  39492. referencedClasses: [],
  39493. messageSends: ["initialize", "writeStream"]
  39494. }),
  39495. $globals.JSStream);
  39496. $core.addMethod(
  39497. $core.method({
  39498. selector: "lf",
  39499. protocol: 'streaming',
  39500. fn: function (){
  39501. var self=this;
  39502. return $core.withContext(function($ctx1) {
  39503. $recv(self["@stream"])._lf();
  39504. return self;
  39505. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  39506. },
  39507. args: [],
  39508. source: "lf\x0a\x09stream lf",
  39509. referencedClasses: [],
  39510. messageSends: ["lf"]
  39511. }),
  39512. $globals.JSStream);
  39513. $core.addMethod(
  39514. $core.method({
  39515. selector: "nextPut:",
  39516. protocol: 'streaming',
  39517. fn: function (aString){
  39518. var self=this;
  39519. return $core.withContext(function($ctx1) {
  39520. $recv(self["@stream"])._nextPut_(aString);
  39521. return self;
  39522. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  39523. },
  39524. args: ["aString"],
  39525. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  39526. referencedClasses: [],
  39527. messageSends: ["nextPut:"]
  39528. }),
  39529. $globals.JSStream);
  39530. $core.addMethod(
  39531. $core.method({
  39532. selector: "nextPutAll:",
  39533. protocol: 'streaming',
  39534. fn: function (aString){
  39535. var self=this;
  39536. return $core.withContext(function($ctx1) {
  39537. $recv(self["@stream"])._nextPutAll_(aString);
  39538. return self;
  39539. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  39540. },
  39541. args: ["aString"],
  39542. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  39543. referencedClasses: [],
  39544. messageSends: ["nextPutAll:"]
  39545. }),
  39546. $globals.JSStream);
  39547. $core.addMethod(
  39548. $core.method({
  39549. selector: "nextPutAssignment",
  39550. protocol: 'streaming',
  39551. fn: function (){
  39552. var self=this;
  39553. return $core.withContext(function($ctx1) {
  39554. $recv(self["@stream"])._nextPutAll_("=");
  39555. return self;
  39556. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},$globals.JSStream)});
  39557. },
  39558. args: [],
  39559. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  39560. referencedClasses: [],
  39561. messageSends: ["nextPutAll:"]
  39562. }),
  39563. $globals.JSStream);
  39564. $core.addMethod(
  39565. $core.method({
  39566. selector: "nextPutBlockContextFor:during:",
  39567. protocol: 'streaming',
  39568. fn: function (anIRClosure,aBlock){
  39569. var self=this;
  39570. return $core.withContext(function($ctx1) {
  39571. 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;
  39572. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  39573. if(!$core.assert($1)){
  39574. $2=$recv(aBlock)._value();
  39575. $ctx1.sendIdx["value"]=1;
  39576. return $2;
  39577. };
  39578. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39579. $ctx1.sendIdx["nextPutAll:"]=1;
  39580. self._lf();
  39581. $ctx1.sendIdx["lf"]=1;
  39582. $6=$recv(anIRClosure)._scope();
  39583. $ctx1.sendIdx["scope"]=1;
  39584. $5=$recv($6)._alias();
  39585. $ctx1.sendIdx["alias"]=1;
  39586. $4="return $core.withContext(function(".__comma($5);
  39587. $ctx1.sendIdx[","]=2;
  39588. $3=$recv($4).__comma(") {");
  39589. $ctx1.sendIdx[","]=1;
  39590. self._nextPutAll_($3);
  39591. $ctx1.sendIdx["nextPutAll:"]=2;
  39592. self._lf();
  39593. $ctx1.sendIdx["lf"]=2;
  39594. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39595. $ctx1.sendIdx["nextPutAll:"]=3;
  39596. $7=self._lf();
  39597. $ctx1.sendIdx["lf"]=3;
  39598. $recv(aBlock)._value();
  39599. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39600. $ctx1.sendIdx["nextPutAll:"]=4;
  39601. self._lf();
  39602. $ctx1.sendIdx["lf"]=4;
  39603. $11=$recv(anIRClosure)._scope();
  39604. $ctx1.sendIdx["scope"]=2;
  39605. $10=$recv($11)._alias();
  39606. $ctx1.sendIdx["alias"]=2;
  39607. $9="}, function(".__comma($10);
  39608. $ctx1.sendIdx[","]=4;
  39609. $8=$recv($9).__comma(") {");
  39610. $ctx1.sendIdx[","]=3;
  39611. self._nextPutAll_($8);
  39612. $ctx1.sendIdx["nextPutAll:"]=5;
  39613. $15=$recv(anIRClosure)._scope();
  39614. $ctx1.sendIdx["scope"]=3;
  39615. $14=$recv($15)._alias();
  39616. $ctx1.sendIdx["alias"]=3;
  39617. $13=$recv($14).__comma(".fillBlock({");
  39618. $ctx1.sendIdx[","]=5;
  39619. $12=self._nextPutAll_($13);
  39620. $ctx1.sendIdx["nextPutAll:"]=6;
  39621. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  39622. return $core.withContext(function($ctx2) {
  39623. $16=$recv(each)._asVariableName();
  39624. $ctx2.sendIdx["asVariableName"]=1;
  39625. self._nextPutAll_($16);
  39626. $ctx2.sendIdx["nextPutAll:"]=7;
  39627. self._nextPutAll_(":");
  39628. $ctx2.sendIdx["nextPutAll:"]=8;
  39629. $17=self._nextPutAll_($recv(each)._asVariableName());
  39630. $ctx2.sendIdx["nextPutAll:"]=9;
  39631. return $17;
  39632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39633. }),(function(){
  39634. return $core.withContext(function($ctx2) {
  39635. return self._nextPutAll_(",");
  39636. $ctx2.sendIdx["nextPutAll:"]=10;
  39637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39638. }));
  39639. self._nextPutAll_("},");
  39640. $ctx1.sendIdx["nextPutAll:"]=11;
  39641. $23=$recv(anIRClosure)._scope();
  39642. $ctx1.sendIdx["scope"]=4;
  39643. $22=$recv($23)._outerScope();
  39644. $21=$recv($22)._alias();
  39645. $20=$recv($21).__comma(",");
  39646. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  39647. $ctx1.sendIdx[","]=7;
  39648. $18=$recv($19).__comma(")});");
  39649. $ctx1.sendIdx[","]=6;
  39650. self._nextPutAll_($18);
  39651. $ctx1.sendIdx["nextPutAll:"]=12;
  39652. self._lf();
  39653. $24=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39654. return self;
  39655. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  39656. },
  39657. args: ["anIRClosure", "aBlock"],
  39658. 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);'",
  39659. referencedClasses: [],
  39660. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  39661. }),
  39662. $globals.JSStream);
  39663. $core.addMethod(
  39664. $core.method({
  39665. selector: "nextPutClassRefFunction:",
  39666. protocol: 'streaming',
  39667. fn: function (aString){
  39668. var self=this;
  39669. return $core.withContext(function($ctx1) {
  39670. var $1,$2;
  39671. $1=self["@stream"];
  39672. $recv($1)._nextPutAll_("function $");
  39673. $ctx1.sendIdx["nextPutAll:"]=1;
  39674. $recv($1)._nextPutAll_(aString);
  39675. $ctx1.sendIdx["nextPutAll:"]=2;
  39676. $recv($1)._nextPutAll_("(){return $globals.");
  39677. $ctx1.sendIdx["nextPutAll:"]=3;
  39678. $recv($1)._nextPutAll_(aString);
  39679. $ctx1.sendIdx["nextPutAll:"]=4;
  39680. $recv($1)._nextPutAll_("||(typeof ");
  39681. $ctx1.sendIdx["nextPutAll:"]=5;
  39682. $recv($1)._nextPutAll_(aString);
  39683. $ctx1.sendIdx["nextPutAll:"]=6;
  39684. $recv($1)._nextPutAll_("==\x22undefined\x22?nil:");
  39685. $ctx1.sendIdx["nextPutAll:"]=7;
  39686. $recv($1)._nextPutAll_(aString);
  39687. $ctx1.sendIdx["nextPutAll:"]=8;
  39688. $recv($1)._nextPutAll_(")}");
  39689. $2=$recv($1)._lf();
  39690. return self;
  39691. }, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},$globals.JSStream)});
  39692. },
  39693. args: ["aString"],
  39694. 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",
  39695. referencedClasses: [],
  39696. messageSends: ["nextPutAll:", "lf"]
  39697. }),
  39698. $globals.JSStream);
  39699. $core.addMethod(
  39700. $core.method({
  39701. selector: "nextPutClosureWith:arguments:",
  39702. protocol: 'streaming',
  39703. fn: function (aBlock,anArray){
  39704. var self=this;
  39705. return $core.withContext(function($ctx1) {
  39706. var $1,$2,$3,$4;
  39707. $recv(self["@stream"])._nextPutAll_("(function(");
  39708. $ctx1.sendIdx["nextPutAll:"]=1;
  39709. $recv(anArray)._do_separatedBy_((function(each){
  39710. return $core.withContext(function($ctx2) {
  39711. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  39712. $ctx2.sendIdx["nextPutAll:"]=2;
  39713. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39714. }),(function(){
  39715. return $core.withContext(function($ctx2) {
  39716. return $recv(self["@stream"])._nextPut_(",");
  39717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39718. }));
  39719. $1=self["@stream"];
  39720. $recv($1)._nextPutAll_("){");
  39721. $ctx1.sendIdx["nextPutAll:"]=3;
  39722. $2=$recv($1)._lf();
  39723. $ctx1.sendIdx["lf"]=1;
  39724. $recv(aBlock)._value();
  39725. $3=self["@stream"];
  39726. $recv($3)._lf();
  39727. $4=$recv($3)._nextPutAll_("})");
  39728. return self;
  39729. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  39730. },
  39731. args: ["aBlock", "anArray"],
  39732. 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: '})'",
  39733. referencedClasses: [],
  39734. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  39735. }),
  39736. $globals.JSStream);
  39737. $core.addMethod(
  39738. $core.method({
  39739. selector: "nextPutContextFor:during:",
  39740. protocol: 'streaming',
  39741. fn: function (aMethod,aBlock){
  39742. var self=this;
  39743. return $core.withContext(function($ctx1) {
  39744. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
  39745. $1=$recv(aMethod)._requiresSmalltalkContext();
  39746. if(!$core.assert($1)){
  39747. $2=$recv(aBlock)._value();
  39748. $ctx1.sendIdx["value"]=1;
  39749. return $2;
  39750. };
  39751. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39752. $ctx1.sendIdx["nextPutAll:"]=1;
  39753. self._lf();
  39754. $ctx1.sendIdx["lf"]=1;
  39755. $6=$recv(aMethod)._scope();
  39756. $ctx1.sendIdx["scope"]=1;
  39757. $5=$recv($6)._alias();
  39758. $ctx1.sendIdx["alias"]=1;
  39759. $4="return $core.withContext(function(".__comma($5);
  39760. $ctx1.sendIdx[","]=2;
  39761. $3=$recv($4).__comma(") {");
  39762. $ctx1.sendIdx[","]=1;
  39763. self._nextPutAll_($3);
  39764. $ctx1.sendIdx["nextPutAll:"]=2;
  39765. self._lf();
  39766. $ctx1.sendIdx["lf"]=2;
  39767. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39768. $ctx1.sendIdx["nextPutAll:"]=3;
  39769. $7=self._lf();
  39770. $ctx1.sendIdx["lf"]=3;
  39771. $recv(aBlock)._value();
  39772. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39773. $ctx1.sendIdx["nextPutAll:"]=4;
  39774. self._lf();
  39775. $ctx1.sendIdx["lf"]=4;
  39776. $12=$recv(aMethod)._scope();
  39777. $ctx1.sendIdx["scope"]=2;
  39778. $11=$recv($12)._alias();
  39779. $ctx1.sendIdx["alias"]=2;
  39780. $10="}, function(".__comma($11);
  39781. $ctx1.sendIdx[","]=5;
  39782. $9=$recv($10).__comma(") {");
  39783. $ctx1.sendIdx[","]=4;
  39784. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  39785. $ctx1.sendIdx[","]=3;
  39786. self._nextPutAll_($8);
  39787. $ctx1.sendIdx["nextPutAll:"]=5;
  39788. $16=$recv($recv(aMethod)._selector())._asJavascript();
  39789. $ctx1.sendIdx["asJavascript"]=1;
  39790. $15=".fill(self,".__comma($16);
  39791. $14=$recv($15).__comma(",{");
  39792. $ctx1.sendIdx[","]=6;
  39793. $13=self._nextPutAll_($14);
  39794. $ctx1.sendIdx["nextPutAll:"]=6;
  39795. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  39796. return $core.withContext(function($ctx2) {
  39797. $17=$recv(each)._asVariableName();
  39798. $ctx2.sendIdx["asVariableName"]=1;
  39799. self._nextPutAll_($17);
  39800. $ctx2.sendIdx["nextPutAll:"]=7;
  39801. self._nextPutAll_(":");
  39802. $ctx2.sendIdx["nextPutAll:"]=8;
  39803. $18=self._nextPutAll_($recv(each)._asVariableName());
  39804. $ctx2.sendIdx["nextPutAll:"]=9;
  39805. return $18;
  39806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39807. }),(function(){
  39808. return $core.withContext(function($ctx2) {
  39809. return self._nextPutAll_(",");
  39810. $ctx2.sendIdx["nextPutAll:"]=10;
  39811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39812. }));
  39813. self._nextPutAll_("},");
  39814. $ctx1.sendIdx["nextPutAll:"]=11;
  39815. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  39816. $ctx1.sendIdx["nextPutAll:"]=12;
  39817. self._nextPutAll_(")});");
  39818. $ctx1.sendIdx["nextPutAll:"]=13;
  39819. self._lf();
  39820. $19=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39821. return self;
  39822. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  39823. },
  39824. args: ["aMethod", "aBlock"],
  39825. 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);'",
  39826. referencedClasses: [],
  39827. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  39828. }),
  39829. $globals.JSStream);
  39830. $core.addMethod(
  39831. $core.method({
  39832. selector: "nextPutFunctionWith:arguments:",
  39833. protocol: 'streaming',
  39834. fn: function (aBlock,anArray){
  39835. var self=this;
  39836. return $core.withContext(function($ctx1) {
  39837. var $1,$2,$3,$4,$5,$6;
  39838. $recv(self["@stream"])._nextPutAll_("fn: function(");
  39839. $ctx1.sendIdx["nextPutAll:"]=1;
  39840. $recv(anArray)._do_separatedBy_((function(each){
  39841. return $core.withContext(function($ctx2) {
  39842. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  39843. $ctx2.sendIdx["nextPutAll:"]=2;
  39844. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39845. }),(function(){
  39846. return $core.withContext(function($ctx2) {
  39847. return $recv(self["@stream"])._nextPut_(",");
  39848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39849. }));
  39850. $1=self["@stream"];
  39851. $recv($1)._nextPutAll_("){");
  39852. $ctx1.sendIdx["nextPutAll:"]=3;
  39853. $2=$recv($1)._lf();
  39854. $ctx1.sendIdx["lf"]=1;
  39855. $3=self["@stream"];
  39856. $recv($3)._nextPutAll_("var self=this;");
  39857. $ctx1.sendIdx["nextPutAll:"]=4;
  39858. $4=$recv($3)._lf();
  39859. $ctx1.sendIdx["lf"]=2;
  39860. $recv(aBlock)._value();
  39861. $5=self["@stream"];
  39862. $recv($5)._lf();
  39863. $6=$recv($5)._nextPutAll_("}");
  39864. return self;
  39865. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  39866. },
  39867. args: ["aBlock", "anArray"],
  39868. 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: '}'",
  39869. referencedClasses: [],
  39870. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  39871. }),
  39872. $globals.JSStream);
  39873. $core.addMethod(
  39874. $core.method({
  39875. selector: "nextPutIf:with:",
  39876. protocol: 'streaming',
  39877. fn: function (aBlock,anotherBlock){
  39878. var self=this;
  39879. return $core.withContext(function($ctx1) {
  39880. var $1,$2;
  39881. $recv(self["@stream"])._nextPutAll_("if(");
  39882. $ctx1.sendIdx["nextPutAll:"]=1;
  39883. $recv(aBlock)._value();
  39884. $ctx1.sendIdx["value"]=1;
  39885. $1=self["@stream"];
  39886. $recv($1)._nextPutAll_("){");
  39887. $ctx1.sendIdx["nextPutAll:"]=2;
  39888. $2=$recv($1)._lf();
  39889. $recv(anotherBlock)._value();
  39890. $recv(self["@stream"])._nextPutAll_("}");
  39891. return self;
  39892. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  39893. },
  39894. args: ["aBlock", "anotherBlock"],
  39895. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  39896. referencedClasses: [],
  39897. messageSends: ["nextPutAll:", "value", "lf"]
  39898. }),
  39899. $globals.JSStream);
  39900. $core.addMethod(
  39901. $core.method({
  39902. selector: "nextPutIfElse:with:with:",
  39903. protocol: 'streaming',
  39904. fn: function (aBlock,ifBlock,elseBlock){
  39905. var self=this;
  39906. return $core.withContext(function($ctx1) {
  39907. var $1,$2,$3,$4;
  39908. $recv(self["@stream"])._nextPutAll_("if(");
  39909. $ctx1.sendIdx["nextPutAll:"]=1;
  39910. $recv(aBlock)._value();
  39911. $ctx1.sendIdx["value"]=1;
  39912. $1=self["@stream"];
  39913. $recv($1)._nextPutAll_("){");
  39914. $ctx1.sendIdx["nextPutAll:"]=2;
  39915. $2=$recv($1)._lf();
  39916. $ctx1.sendIdx["lf"]=1;
  39917. $recv(ifBlock)._value();
  39918. $ctx1.sendIdx["value"]=2;
  39919. $3=self["@stream"];
  39920. $recv($3)._nextPutAll_("} else {");
  39921. $ctx1.sendIdx["nextPutAll:"]=3;
  39922. $4=$recv($3)._lf();
  39923. $recv(elseBlock)._value();
  39924. $recv(self["@stream"])._nextPutAll_("}");
  39925. return self;
  39926. }, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  39927. },
  39928. args: ["aBlock", "ifBlock", "elseBlock"],
  39929. 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: '}'",
  39930. referencedClasses: [],
  39931. messageSends: ["nextPutAll:", "value", "lf"]
  39932. }),
  39933. $globals.JSStream);
  39934. $core.addMethod(
  39935. $core.method({
  39936. selector: "nextPutMethodDeclaration:with:",
  39937. protocol: 'streaming',
  39938. fn: function (aMethod,aBlock){
  39939. var self=this;
  39940. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  39941. return $core.withContext(function($ctx1) {
  39942. 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;
  39943. $1=self["@stream"];
  39944. $recv($1)._nextPutAll_("$core.method({");
  39945. $ctx1.sendIdx["nextPutAll:"]=1;
  39946. $recv($1)._lf();
  39947. $ctx1.sendIdx["lf"]=1;
  39948. $2=$1;
  39949. $5=$recv($recv(aMethod)._selector())._asJavascript();
  39950. $ctx1.sendIdx["asJavascript"]=1;
  39951. $4="selector: ".__comma($5);
  39952. $ctx1.sendIdx[","]=2;
  39953. $3=$recv($4).__comma(",");
  39954. $ctx1.sendIdx[","]=1;
  39955. $recv($2)._nextPutAll_($3);
  39956. $ctx1.sendIdx["nextPutAll:"]=2;
  39957. $recv($1)._lf();
  39958. $ctx1.sendIdx["lf"]=2;
  39959. $6=$1;
  39960. $9=$recv($recv(aMethod)._source())._asJavascript();
  39961. $ctx1.sendIdx["asJavascript"]=2;
  39962. $8="source: ".__comma($9);
  39963. $ctx1.sendIdx[","]=4;
  39964. $7=$recv($8).__comma(",");
  39965. $ctx1.sendIdx[","]=3;
  39966. $recv($6)._nextPutAll_($7);
  39967. $ctx1.sendIdx["nextPutAll:"]=3;
  39968. $10=$recv($1)._lf();
  39969. $ctx1.sendIdx["lf"]=3;
  39970. $recv(aBlock)._value();
  39971. $ctx1.sendIdx["value"]=1;
  39972. $11=self["@stream"];
  39973. $12=$11;
  39974. $15=$recv($String())._lf();
  39975. $ctx1.sendIdx["lf"]=4;
  39976. $14=",".__comma($15);
  39977. $ctx1.sendIdx[","]=6;
  39978. $13=$recv($14).__comma("messageSends: ");
  39979. $ctx1.sendIdx[","]=5;
  39980. $recv($12)._nextPutAll_($13);
  39981. $ctx1.sendIdx["nextPutAll:"]=4;
  39982. $16=$11;
  39983. $19=$recv($recv(aMethod)._messageSends())._asArray();
  39984. $ctx1.sendIdx["asArray"]=1;
  39985. $18=$recv($19)._asJavascript();
  39986. $ctx1.sendIdx["asJavascript"]=3;
  39987. $17=$recv($18).__comma(",");
  39988. $ctx1.sendIdx[","]=7;
  39989. $recv($16)._nextPutAll_($17);
  39990. $ctx1.sendIdx["nextPutAll:"]=5;
  39991. $recv($11)._lf();
  39992. $ctx1.sendIdx["lf"]=5;
  39993. $20=$11;
  39994. $23=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  39995. return $core.withContext(function($ctx2) {
  39996. return $recv(each)._value();
  39997. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39998. })))._asArray())._asJavascript();
  39999. $ctx1.sendIdx["asJavascript"]=4;
  40000. $22="args: ".__comma($23);
  40001. $21=$recv($22).__comma(",");
  40002. $ctx1.sendIdx[","]=8;
  40003. $recv($20)._nextPutAll_($21);
  40004. $ctx1.sendIdx["nextPutAll:"]=6;
  40005. $recv($11)._lf();
  40006. $24=$recv($11)._nextPutAll_("referencedClasses: [");
  40007. $ctx1.sendIdx["nextPutAll:"]=7;
  40008. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  40009. return $core.withContext(function($ctx2) {
  40010. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  40011. $ctx2.sendIdx["nextPutAll:"]=8;
  40012. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40013. }),(function(){
  40014. return $core.withContext(function($ctx2) {
  40015. return $recv(self["@stream"])._nextPutAll_(",");
  40016. $ctx2.sendIdx["nextPutAll:"]=9;
  40017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40018. }));
  40019. $25=self["@stream"];
  40020. $recv($25)._nextPutAll_("]");
  40021. $ctx1.sendIdx["nextPutAll:"]=10;
  40022. $26=$recv($25)._nextPutAll_("})");
  40023. return self;
  40024. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  40025. },
  40026. args: ["aMethod", "aBlock"],
  40027. 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: '})'",
  40028. referencedClasses: ["String"],
  40029. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  40030. }),
  40031. $globals.JSStream);
  40032. $core.addMethod(
  40033. $core.method({
  40034. selector: "nextPutNonLocalReturnHandlingWith:",
  40035. protocol: 'streaming',
  40036. fn: function (aBlock){
  40037. var self=this;
  40038. return $core.withContext(function($ctx1) {
  40039. var $1,$2,$3,$4;
  40040. $1=self["@stream"];
  40041. $recv($1)._nextPutAll_("var $early={};");
  40042. $ctx1.sendIdx["nextPutAll:"]=1;
  40043. $recv($1)._lf();
  40044. $ctx1.sendIdx["lf"]=1;
  40045. $recv($1)._nextPutAll_("try {");
  40046. $ctx1.sendIdx["nextPutAll:"]=2;
  40047. $2=$recv($1)._lf();
  40048. $ctx1.sendIdx["lf"]=2;
  40049. $recv(aBlock)._value();
  40050. $3=self["@stream"];
  40051. $recv($3)._nextPutAll_("}");
  40052. $ctx1.sendIdx["nextPutAll:"]=3;
  40053. $recv($3)._lf();
  40054. $ctx1.sendIdx["lf"]=3;
  40055. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  40056. $4=$recv($3)._lf();
  40057. return self;
  40058. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  40059. },
  40060. args: ["aBlock"],
  40061. 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",
  40062. referencedClasses: [],
  40063. messageSends: ["nextPutAll:", "lf", "value"]
  40064. }),
  40065. $globals.JSStream);
  40066. $core.addMethod(
  40067. $core.method({
  40068. selector: "nextPutNonLocalReturnWith:",
  40069. protocol: 'streaming',
  40070. fn: function (aBlock){
  40071. var self=this;
  40072. return $core.withContext(function($ctx1) {
  40073. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  40074. $ctx1.sendIdx["nextPutAll:"]=1;
  40075. $recv(aBlock)._value();
  40076. $recv(self["@stream"])._nextPutAll_("]");
  40077. return self;
  40078. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40079. },
  40080. args: ["aBlock"],
  40081. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  40082. referencedClasses: [],
  40083. messageSends: ["nextPutAll:", "value"]
  40084. }),
  40085. $globals.JSStream);
  40086. $core.addMethod(
  40087. $core.method({
  40088. selector: "nextPutReturn",
  40089. protocol: 'streaming',
  40090. fn: function (){
  40091. var self=this;
  40092. return $core.withContext(function($ctx1) {
  40093. $recv(self["@stream"])._nextPutAll_("return ");
  40094. return self;
  40095. }, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},$globals.JSStream)});
  40096. },
  40097. args: [],
  40098. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  40099. referencedClasses: [],
  40100. messageSends: ["nextPutAll:"]
  40101. }),
  40102. $globals.JSStream);
  40103. $core.addMethod(
  40104. $core.method({
  40105. selector: "nextPutReturnWith:",
  40106. protocol: 'streaming',
  40107. fn: function (aBlock){
  40108. var self=this;
  40109. return $core.withContext(function($ctx1) {
  40110. self._nextPutReturn();
  40111. $recv(aBlock)._value();
  40112. return self;
  40113. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40114. },
  40115. args: ["aBlock"],
  40116. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  40117. referencedClasses: [],
  40118. messageSends: ["nextPutReturn", "value"]
  40119. }),
  40120. $globals.JSStream);
  40121. $core.addMethod(
  40122. $core.method({
  40123. selector: "nextPutSendIndexFor:",
  40124. protocol: 'streaming',
  40125. fn: function (anIRSend){
  40126. var self=this;
  40127. return $core.withContext(function($ctx1) {
  40128. var $1;
  40129. self._nextPutAll_(";");
  40130. $ctx1.sendIdx["nextPutAll:"]=1;
  40131. self._lf();
  40132. $ctx1.sendIdx["lf"]=1;
  40133. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40134. $ctx1.sendIdx["nextPutAll:"]=2;
  40135. self._lf();
  40136. $ctx1.sendIdx["lf"]=2;
  40137. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  40138. $ctx1.sendIdx["nextPutAll:"]=3;
  40139. self._nextPutAll_(".sendIdx[");
  40140. $ctx1.sendIdx["nextPutAll:"]=4;
  40141. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  40142. $ctx1.sendIdx["nextPutAll:"]=5;
  40143. self._nextPutAll_("]=");
  40144. $ctx1.sendIdx["nextPutAll:"]=6;
  40145. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  40146. $ctx1.sendIdx["nextPutAll:"]=7;
  40147. self._nextPutAll_(";");
  40148. $ctx1.sendIdx["nextPutAll:"]=8;
  40149. self._lf();
  40150. $1=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  40151. return self;
  40152. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  40153. },
  40154. args: ["anIRSend"],
  40155. 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)'",
  40156. referencedClasses: [],
  40157. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  40158. }),
  40159. $globals.JSStream);
  40160. $core.addMethod(
  40161. $core.method({
  40162. selector: "nextPutSequenceWith:",
  40163. protocol: 'streaming',
  40164. fn: function (aBlock){
  40165. var self=this;
  40166. return $core.withContext(function($ctx1) {
  40167. $recv(aBlock)._value();
  40168. return self;
  40169. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
  40170. },
  40171. args: ["aBlock"],
  40172. 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",
  40173. referencedClasses: [],
  40174. messageSends: ["value"]
  40175. }),
  40176. $globals.JSStream);
  40177. $core.addMethod(
  40178. $core.method({
  40179. selector: "nextPutStatementWith:",
  40180. protocol: 'streaming',
  40181. fn: function (aBlock){
  40182. var self=this;
  40183. return $core.withContext(function($ctx1) {
  40184. var $1,$2;
  40185. $recv(aBlock)._value();
  40186. $1=self["@stream"];
  40187. $recv($1)._nextPutAll_(";");
  40188. $2=$recv($1)._lf();
  40189. return self;
  40190. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  40191. },
  40192. args: ["aBlock"],
  40193. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  40194. referencedClasses: [],
  40195. messageSends: ["value", "nextPutAll:", "lf"]
  40196. }),
  40197. $globals.JSStream);
  40198. $core.addMethod(
  40199. $core.method({
  40200. selector: "nextPutVars:",
  40201. protocol: 'streaming',
  40202. fn: function (aCollection){
  40203. var self=this;
  40204. return $core.withContext(function($ctx1) {
  40205. var $1,$2;
  40206. var $early={};
  40207. try {
  40208. $recv(aCollection)._ifEmpty_((function(){
  40209. throw $early=[self];
  40210. }));
  40211. $recv(self["@stream"])._nextPutAll_("var ");
  40212. $ctx1.sendIdx["nextPutAll:"]=1;
  40213. $recv(aCollection)._do_separatedBy_((function(each){
  40214. return $core.withContext(function($ctx2) {
  40215. return $recv(self["@stream"])._nextPutAll_(each);
  40216. $ctx2.sendIdx["nextPutAll:"]=2;
  40217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40218. }),(function(){
  40219. return $core.withContext(function($ctx2) {
  40220. return $recv(self["@stream"])._nextPutAll_(",");
  40221. $ctx2.sendIdx["nextPutAll:"]=3;
  40222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40223. }));
  40224. $1=self["@stream"];
  40225. $recv($1)._nextPutAll_(";");
  40226. $2=$recv($1)._lf();
  40227. return self;
  40228. }
  40229. catch(e) {if(e===$early)return e[0]; throw e}
  40230. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  40231. },
  40232. args: ["aCollection"],
  40233. 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",
  40234. referencedClasses: [],
  40235. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  40236. }),
  40237. $globals.JSStream);
  40238. $core.addMethod(
  40239. $core.method({
  40240. selector: "appendToInstruction:",
  40241. protocol: '*Compiler-IR',
  40242. fn: function (anIRInstruction){
  40243. var self=this;
  40244. return $core.withContext(function($ctx1) {
  40245. $recv(anIRInstruction)._appendBlock_(self);
  40246. return self;
  40247. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  40248. },
  40249. args: ["anIRInstruction"],
  40250. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  40251. referencedClasses: [],
  40252. messageSends: ["appendBlock:"]
  40253. }),
  40254. $globals.BlockClosure);
  40255. });
  40256. define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){"use strict";
  40257. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  40258. $core.addPackage('Compiler-Inlining');
  40259. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  40260. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40261. $core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
  40262. $globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  40263. $core.addMethod(
  40264. $core.method({
  40265. selector: "accept:",
  40266. protocol: 'visiting',
  40267. fn: function (aVisitor){
  40268. var self=this;
  40269. return $core.withContext(function($ctx1) {
  40270. var $1;
  40271. $1=$recv(aVisitor)._visitIRInlinedAssignment_(self);
  40272. return $1;
  40273. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
  40274. },
  40275. args: ["aVisitor"],
  40276. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  40277. referencedClasses: [],
  40278. messageSends: ["visitIRInlinedAssignment:"]
  40279. }),
  40280. $globals.IRInlinedAssignment);
  40281. $core.addMethod(
  40282. $core.method({
  40283. selector: "isInlined",
  40284. protocol: 'testing',
  40285. fn: function (){
  40286. var self=this;
  40287. return true;
  40288. },
  40289. args: [],
  40290. source: "isInlined\x0a\x09^ true",
  40291. referencedClasses: [],
  40292. messageSends: []
  40293. }),
  40294. $globals.IRInlinedAssignment);
  40295. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  40296. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  40297. $core.addMethod(
  40298. $core.method({
  40299. selector: "accept:",
  40300. protocol: 'visiting',
  40301. fn: function (aVisitor){
  40302. var self=this;
  40303. return $core.withContext(function($ctx1) {
  40304. $recv(aVisitor)._visitIRInlinedClosure_(self);
  40305. return self;
  40306. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  40307. },
  40308. args: ["aVisitor"],
  40309. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  40310. referencedClasses: [],
  40311. messageSends: ["visitIRInlinedClosure:"]
  40312. }),
  40313. $globals.IRInlinedClosure);
  40314. $core.addMethod(
  40315. $core.method({
  40316. selector: "isInlined",
  40317. protocol: 'testing',
  40318. fn: function (){
  40319. var self=this;
  40320. return true;
  40321. },
  40322. args: [],
  40323. source: "isInlined\x0a\x09^ true",
  40324. referencedClasses: [],
  40325. messageSends: []
  40326. }),
  40327. $globals.IRInlinedClosure);
  40328. $core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
  40329. $globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  40330. $core.addMethod(
  40331. $core.method({
  40332. selector: "accept:",
  40333. protocol: 'visiting',
  40334. fn: function (aVisitor){
  40335. var self=this;
  40336. return $core.withContext(function($ctx1) {
  40337. var $1;
  40338. $1=$recv(aVisitor)._visitIRInlinedReturn_(self);
  40339. return $1;
  40340. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
  40341. },
  40342. args: ["aVisitor"],
  40343. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  40344. referencedClasses: [],
  40345. messageSends: ["visitIRInlinedReturn:"]
  40346. }),
  40347. $globals.IRInlinedReturn);
  40348. $core.addMethod(
  40349. $core.method({
  40350. selector: "isInlined",
  40351. protocol: 'testing',
  40352. fn: function (){
  40353. var self=this;
  40354. return true;
  40355. },
  40356. args: [],
  40357. source: "isInlined\x0a\x09^ true",
  40358. referencedClasses: [],
  40359. messageSends: []
  40360. }),
  40361. $globals.IRInlinedReturn);
  40362. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  40363. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  40364. $core.addMethod(
  40365. $core.method({
  40366. selector: "accept:",
  40367. protocol: 'visiting',
  40368. fn: function (aVisitor){
  40369. var self=this;
  40370. return $core.withContext(function($ctx1) {
  40371. $recv(aVisitor)._visitInlinedSend_(self);
  40372. return self;
  40373. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  40374. },
  40375. args: ["aVisitor"],
  40376. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  40377. referencedClasses: [],
  40378. messageSends: ["visitInlinedSend:"]
  40379. }),
  40380. $globals.IRInlinedSend);
  40381. $core.addMethod(
  40382. $core.method({
  40383. selector: "internalVariables",
  40384. protocol: 'accessing',
  40385. fn: function (){
  40386. var self=this;
  40387. var $1;
  40388. $1=[];
  40389. return $1;
  40390. },
  40391. args: [],
  40392. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  40393. referencedClasses: [],
  40394. messageSends: []
  40395. }),
  40396. $globals.IRInlinedSend);
  40397. $core.addMethod(
  40398. $core.method({
  40399. selector: "isInlined",
  40400. protocol: 'testing',
  40401. fn: function (){
  40402. var self=this;
  40403. return true;
  40404. },
  40405. args: [],
  40406. source: "isInlined\x0a\x09^ true",
  40407. referencedClasses: [],
  40408. messageSends: []
  40409. }),
  40410. $globals.IRInlinedSend);
  40411. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40412. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  40413. $core.addMethod(
  40414. $core.method({
  40415. selector: "accept:",
  40416. protocol: 'visiting',
  40417. fn: function (aVisitor){
  40418. var self=this;
  40419. return $core.withContext(function($ctx1) {
  40420. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  40421. return self;
  40422. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  40423. },
  40424. args: ["aVisitor"],
  40425. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  40426. referencedClasses: [],
  40427. messageSends: ["visitIRInlinedIfFalse:"]
  40428. }),
  40429. $globals.IRInlinedIfFalse);
  40430. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40431. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  40432. $core.addMethod(
  40433. $core.method({
  40434. selector: "accept:",
  40435. protocol: 'visiting',
  40436. fn: function (aVisitor){
  40437. var self=this;
  40438. return $core.withContext(function($ctx1) {
  40439. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  40440. return self;
  40441. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  40442. },
  40443. args: ["aVisitor"],
  40444. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  40445. referencedClasses: [],
  40446. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  40447. }),
  40448. $globals.IRInlinedIfNilIfNotNil);
  40449. $core.addMethod(
  40450. $core.method({
  40451. selector: "internalVariables",
  40452. protocol: 'accessing',
  40453. fn: function (){
  40454. var self=this;
  40455. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  40456. return $core.withContext(function($ctx1) {
  40457. var $1;
  40458. $1=$recv($Array())._with_(self._receiverInternalVariable());
  40459. return $1;
  40460. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  40461. },
  40462. args: [],
  40463. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  40464. referencedClasses: ["Array"],
  40465. messageSends: ["with:", "receiverInternalVariable"]
  40466. }),
  40467. $globals.IRInlinedIfNilIfNotNil);
  40468. $core.addMethod(
  40469. $core.method({
  40470. selector: "receiverInternalVariable",
  40471. protocol: 'accessing',
  40472. fn: function (){
  40473. var self=this;
  40474. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  40475. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  40476. return $core.withContext(function($ctx1) {
  40477. var $2,$3,$1;
  40478. $2=$recv($IRVariable())._new();
  40479. $ctx1.sendIdx["new"]=1;
  40480. $recv($2)._variable_($recv($recv($AliasVar())._new())._name_(self._receiverInternalVariableName()));
  40481. $3=$recv($2)._yourself();
  40482. $1=$3;
  40483. return $1;
  40484. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  40485. },
  40486. args: [],
  40487. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  40488. referencedClasses: ["IRVariable", "AliasVar"],
  40489. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  40490. }),
  40491. $globals.IRInlinedIfNilIfNotNil);
  40492. $core.addMethod(
  40493. $core.method({
  40494. selector: "receiverInternalVariableName",
  40495. protocol: 'accessing',
  40496. fn: function (){
  40497. var self=this;
  40498. return "$receiver";
  40499. },
  40500. args: [],
  40501. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  40502. referencedClasses: [],
  40503. messageSends: []
  40504. }),
  40505. $globals.IRInlinedIfNilIfNotNil);
  40506. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40507. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  40508. $core.addMethod(
  40509. $core.method({
  40510. selector: "accept:",
  40511. protocol: 'visiting',
  40512. fn: function (aVisitor){
  40513. var self=this;
  40514. return $core.withContext(function($ctx1) {
  40515. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  40516. return self;
  40517. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  40518. },
  40519. args: ["aVisitor"],
  40520. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  40521. referencedClasses: [],
  40522. messageSends: ["visitIRInlinedIfTrue:"]
  40523. }),
  40524. $globals.IRInlinedIfTrue);
  40525. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40526. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  40527. $core.addMethod(
  40528. $core.method({
  40529. selector: "accept:",
  40530. protocol: 'visiting',
  40531. fn: function (aVisitor){
  40532. var self=this;
  40533. return $core.withContext(function($ctx1) {
  40534. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  40535. return self;
  40536. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  40537. },
  40538. args: ["aVisitor"],
  40539. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  40540. referencedClasses: [],
  40541. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  40542. }),
  40543. $globals.IRInlinedIfTrueIfFalse);
  40544. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  40545. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  40546. $core.addMethod(
  40547. $core.method({
  40548. selector: "accept:",
  40549. protocol: 'visiting',
  40550. fn: function (aVisitor){
  40551. var self=this;
  40552. return $core.withContext(function($ctx1) {
  40553. $recv(aVisitor)._visitIRInlinedSequence_(self);
  40554. return self;
  40555. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  40556. },
  40557. args: ["aVisitor"],
  40558. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  40559. referencedClasses: [],
  40560. messageSends: ["visitIRInlinedSequence:"]
  40561. }),
  40562. $globals.IRInlinedSequence);
  40563. $core.addMethod(
  40564. $core.method({
  40565. selector: "isInlined",
  40566. protocol: 'testing',
  40567. fn: function (){
  40568. var self=this;
  40569. return true;
  40570. },
  40571. args: [],
  40572. source: "isInlined\x0a\x09^ true",
  40573. referencedClasses: [],
  40574. messageSends: []
  40575. }),
  40576. $globals.IRInlinedSequence);
  40577. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  40578. $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`";
  40579. $core.addMethod(
  40580. $core.method({
  40581. selector: "assignmentInliner",
  40582. protocol: 'factory',
  40583. fn: function (){
  40584. var self=this;
  40585. function $IRAssignmentInliner(){return $globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  40586. return $core.withContext(function($ctx1) {
  40587. var $2,$3,$1;
  40588. $2=$recv($IRAssignmentInliner())._new();
  40589. $recv($2)._translator_(self);
  40590. $3=$recv($2)._yourself();
  40591. $1=$3;
  40592. return $1;
  40593. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  40594. },
  40595. args: [],
  40596. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40597. referencedClasses: ["IRAssignmentInliner"],
  40598. messageSends: ["translator:", "new", "yourself"]
  40599. }),
  40600. $globals.IRInliner);
  40601. $core.addMethod(
  40602. $core.method({
  40603. selector: "returnInliner",
  40604. protocol: 'factory',
  40605. fn: function (){
  40606. var self=this;
  40607. function $IRReturnInliner(){return $globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  40608. return $core.withContext(function($ctx1) {
  40609. var $2,$3,$1;
  40610. $2=$recv($IRReturnInliner())._new();
  40611. $recv($2)._translator_(self);
  40612. $3=$recv($2)._yourself();
  40613. $1=$3;
  40614. return $1;
  40615. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  40616. },
  40617. args: [],
  40618. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40619. referencedClasses: ["IRReturnInliner"],
  40620. messageSends: ["translator:", "new", "yourself"]
  40621. }),
  40622. $globals.IRInliner);
  40623. $core.addMethod(
  40624. $core.method({
  40625. selector: "sendInliner",
  40626. protocol: 'factory',
  40627. fn: function (){
  40628. var self=this;
  40629. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  40630. return $core.withContext(function($ctx1) {
  40631. var $2,$3,$1;
  40632. $2=$recv($IRSendInliner())._new();
  40633. $recv($2)._translator_(self);
  40634. $3=$recv($2)._yourself();
  40635. $1=$3;
  40636. return $1;
  40637. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  40638. },
  40639. args: [],
  40640. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40641. referencedClasses: ["IRSendInliner"],
  40642. messageSends: ["translator:", "new", "yourself"]
  40643. }),
  40644. $globals.IRInliner);
  40645. $core.addMethod(
  40646. $core.method({
  40647. selector: "shouldInlineAssignment:",
  40648. protocol: 'testing',
  40649. fn: function (anIRAssignment){
  40650. var self=this;
  40651. return $core.withContext(function($ctx1) {
  40652. var $4,$3,$2,$1;
  40653. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  40654. return $core.withContext(function($ctx2) {
  40655. $4=$recv(anIRAssignment)._instructions();
  40656. $ctx2.sendIdx["instructions"]=1;
  40657. $3=$recv($4)._last();
  40658. $ctx2.sendIdx["last"]=1;
  40659. $2=$recv($3)._isSend();
  40660. return $recv($2)._and_((function(){
  40661. return $core.withContext(function($ctx3) {
  40662. return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last());
  40663. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40664. }));
  40665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40666. }));
  40667. $ctx1.sendIdx["and:"]=1;
  40668. return $1;
  40669. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  40670. },
  40671. args: ["anIRAssignment"],
  40672. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  40673. referencedClasses: [],
  40674. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
  40675. }),
  40676. $globals.IRInliner);
  40677. $core.addMethod(
  40678. $core.method({
  40679. selector: "shouldInlineReturn:",
  40680. protocol: 'testing',
  40681. fn: function (anIRReturn){
  40682. var self=this;
  40683. return $core.withContext(function($ctx1) {
  40684. var $4,$3,$2,$1;
  40685. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  40686. return $core.withContext(function($ctx2) {
  40687. $4=$recv(anIRReturn)._instructions();
  40688. $ctx2.sendIdx["instructions"]=1;
  40689. $3=$recv($4)._first();
  40690. $ctx2.sendIdx["first"]=1;
  40691. $2=$recv($3)._isSend();
  40692. return $recv($2)._and_((function(){
  40693. return $core.withContext(function($ctx3) {
  40694. return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first());
  40695. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40696. }));
  40697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40698. }));
  40699. $ctx1.sendIdx["and:"]=1;
  40700. return $1;
  40701. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  40702. },
  40703. args: ["anIRReturn"],
  40704. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  40705. referencedClasses: [],
  40706. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
  40707. }),
  40708. $globals.IRInliner);
  40709. $core.addMethod(
  40710. $core.method({
  40711. selector: "shouldInlineSend:",
  40712. protocol: 'testing',
  40713. fn: function (anIRSend){
  40714. var self=this;
  40715. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  40716. return $core.withContext(function($ctx1) {
  40717. var $1;
  40718. $1=$recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  40719. return $core.withContext(function($ctx2) {
  40720. return $recv($IRSendInliner())._shouldInline_(anIRSend);
  40721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40722. }));
  40723. return $1;
  40724. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  40725. },
  40726. args: ["anIRSend"],
  40727. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  40728. referencedClasses: ["IRSendInliner"],
  40729. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  40730. }),
  40731. $globals.IRInliner);
  40732. $core.addMethod(
  40733. $core.method({
  40734. selector: "transformNonLocalReturn:",
  40735. protocol: 'visiting',
  40736. fn: function (anIRNonLocalReturn){
  40737. var self=this;
  40738. var localReturn;
  40739. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  40740. return $core.withContext(function($ctx1) {
  40741. var $2,$1,$4,$3,$5,$6,$7,$8,$9;
  40742. $2=$recv(anIRNonLocalReturn)._scope();
  40743. $ctx1.sendIdx["scope"]=1;
  40744. $1=$recv($2)._canInlineNonLocalReturns();
  40745. if($core.assert($1)){
  40746. $4=$recv(anIRNonLocalReturn)._scope();
  40747. $ctx1.sendIdx["scope"]=2;
  40748. $3=$recv($4)._methodScope();
  40749. $5=$recv(anIRNonLocalReturn)._scope();
  40750. $ctx1.sendIdx["scope"]=3;
  40751. $recv($3)._removeNonLocalReturn_($5);
  40752. $6=$recv($IRReturn())._new();
  40753. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  40754. $7=$recv($6)._yourself();
  40755. localReturn=$7;
  40756. localReturn;
  40757. $recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){
  40758. return $core.withContext(function($ctx2) {
  40759. return $recv(localReturn)._add_(each);
  40760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40761. }));
  40762. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  40763. $8=localReturn;
  40764. return $8;
  40765. };
  40766. $9=(
  40767. $ctx1.supercall = true,
  40768. $globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  40769. $ctx1.supercall = false;
  40770. return $9;
  40771. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  40772. },
  40773. args: ["anIRNonLocalReturn"],
  40774. 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",
  40775. referencedClasses: ["IRReturn"],
  40776. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  40777. }),
  40778. $globals.IRInliner);
  40779. $core.addMethod(
  40780. $core.method({
  40781. selector: "visitIRAssignment:",
  40782. protocol: 'visiting',
  40783. fn: function (anIRAssignment){
  40784. var self=this;
  40785. return $core.withContext(function($ctx1) {
  40786. var $2,$1;
  40787. $2=self._shouldInlineAssignment_(anIRAssignment);
  40788. if($core.assert($2)){
  40789. $1=$recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  40790. } else {
  40791. $1=(
  40792. $ctx1.supercall = true,
  40793. $globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  40794. $ctx1.supercall = false;
  40795. };
  40796. return $1;
  40797. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  40798. },
  40799. args: ["anIRAssignment"],
  40800. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  40801. referencedClasses: [],
  40802. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  40803. }),
  40804. $globals.IRInliner);
  40805. $core.addMethod(
  40806. $core.method({
  40807. selector: "visitIRNonLocalReturn:",
  40808. protocol: 'visiting',
  40809. fn: function (anIRNonLocalReturn){
  40810. var self=this;
  40811. return $core.withContext(function($ctx1) {
  40812. var $1;
  40813. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  40814. return $1;
  40815. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)});
  40816. },
  40817. args: ["anIRNonLocalReturn"],
  40818. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  40819. referencedClasses: [],
  40820. messageSends: ["transformNonLocalReturn:"]
  40821. }),
  40822. $globals.IRInliner);
  40823. $core.addMethod(
  40824. $core.method({
  40825. selector: "visitIRReturn:",
  40826. protocol: 'visiting',
  40827. fn: function (anIRReturn){
  40828. var self=this;
  40829. return $core.withContext(function($ctx1) {
  40830. var $2,$1;
  40831. $2=self._shouldInlineReturn_(anIRReturn);
  40832. if($core.assert($2)){
  40833. $1=$recv(self._returnInliner())._inlineReturn_(anIRReturn);
  40834. } else {
  40835. $1=(
  40836. $ctx1.supercall = true,
  40837. $globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  40838. $ctx1.supercall = false;
  40839. };
  40840. return $1;
  40841. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  40842. },
  40843. args: ["anIRReturn"],
  40844. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  40845. referencedClasses: [],
  40846. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  40847. }),
  40848. $globals.IRInliner);
  40849. $core.addMethod(
  40850. $core.method({
  40851. selector: "visitIRSend:",
  40852. protocol: 'visiting',
  40853. fn: function (anIRSend){
  40854. var self=this;
  40855. return $core.withContext(function($ctx1) {
  40856. var $2,$1;
  40857. $2=self._shouldInlineSend_(anIRSend);
  40858. if($core.assert($2)){
  40859. $1=$recv(self._sendInliner())._inlineSend_(anIRSend);
  40860. } else {
  40861. $1=(
  40862. $ctx1.supercall = true,
  40863. $globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  40864. $ctx1.supercall = false;
  40865. };
  40866. return $1;
  40867. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  40868. },
  40869. args: ["anIRSend"],
  40870. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  40871. referencedClasses: [],
  40872. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  40873. }),
  40874. $globals.IRInliner);
  40875. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  40876. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  40877. $core.addMethod(
  40878. $core.method({
  40879. selector: "visitIRInlinedAssignment:",
  40880. protocol: 'visiting',
  40881. fn: function (anIRInlinedAssignment){
  40882. var self=this;
  40883. return $core.withContext(function($ctx1) {
  40884. self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last());
  40885. return self;
  40886. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
  40887. },
  40888. args: ["anIRInlinedAssignment"],
  40889. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  40890. referencedClasses: [],
  40891. messageSends: ["visit:", "last", "instructions"]
  40892. }),
  40893. $globals.IRInliningJSTranslator);
  40894. $core.addMethod(
  40895. $core.method({
  40896. selector: "visitIRInlinedClosure:",
  40897. protocol: 'visiting',
  40898. fn: function (anIRInlinedClosure){
  40899. var self=this;
  40900. return $core.withContext(function($ctx1) {
  40901. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  40902. return $core.withContext(function($ctx2) {
  40903. return $recv($recv(each)._name())._asVariableName();
  40904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40905. })));
  40906. $recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){
  40907. return $core.withContext(function($ctx2) {
  40908. return self._visit_(each);
  40909. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40910. }));
  40911. return self;
  40912. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  40913. },
  40914. args: ["anIRInlinedClosure"],
  40915. 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 ]",
  40916. referencedClasses: [],
  40917. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  40918. }),
  40919. $globals.IRInliningJSTranslator);
  40920. $core.addMethod(
  40921. $core.method({
  40922. selector: "visitIRInlinedIfFalse:",
  40923. protocol: 'visiting',
  40924. fn: function (anIRInlinedIfFalse){
  40925. var self=this;
  40926. return $core.withContext(function($ctx1) {
  40927. var $1,$2,$4,$3;
  40928. $1=self._stream();
  40929. $ctx1.sendIdx["stream"]=1;
  40930. $recv($1)._nextPutIf_with_((function(){
  40931. return $core.withContext(function($ctx2) {
  40932. $2=self._stream();
  40933. $ctx2.sendIdx["stream"]=2;
  40934. $recv($2)._nextPutAll_("!$core.assert(");
  40935. $ctx2.sendIdx["nextPutAll:"]=1;
  40936. $4=$recv(anIRInlinedIfFalse)._instructions();
  40937. $ctx2.sendIdx["instructions"]=1;
  40938. $3=$recv($4)._first();
  40939. self._visit_($3);
  40940. $ctx2.sendIdx["visit:"]=1;
  40941. return $recv(self._stream())._nextPutAll_(")");
  40942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40943. }),(function(){
  40944. return $core.withContext(function($ctx2) {
  40945. return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last());
  40946. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40947. }));
  40948. return self;
  40949. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  40950. },
  40951. args: ["anIRInlinedIfFalse"],
  40952. 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 ]",
  40953. referencedClasses: [],
  40954. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  40955. }),
  40956. $globals.IRInliningJSTranslator);
  40957. $core.addMethod(
  40958. $core.method({
  40959. selector: "visitIRInlinedIfNilIfNotNil:",
  40960. protocol: 'visiting',
  40961. fn: function (anIRInlinedIfNilIfNotNil){
  40962. var self=this;
  40963. return $core.withContext(function($ctx1) {
  40964. var $1,$2,$3,$5,$4,$7,$6;
  40965. $1=self._stream();
  40966. $ctx1.sendIdx["stream"]=1;
  40967. $recv($1)._nextPutIfElse_with_with_((function(){
  40968. return $core.withContext(function($ctx2) {
  40969. $2=self._stream();
  40970. $ctx2.sendIdx["stream"]=2;
  40971. $3=$recv("(".__comma($recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = ");
  40972. $ctx2.sendIdx[","]=1;
  40973. $recv($2)._nextPutAll_($3);
  40974. $ctx2.sendIdx["nextPutAll:"]=1;
  40975. $5=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  40976. $ctx2.sendIdx["instructions"]=1;
  40977. $4=$recv($5)._first();
  40978. self._visit_($4);
  40979. $ctx2.sendIdx["visit:"]=1;
  40980. return $recv(self._stream())._nextPutAll_(") == null || $receiver.isNil");
  40981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40982. }),(function(){
  40983. return $core.withContext(function($ctx2) {
  40984. $7=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  40985. $ctx2.sendIdx["instructions"]=2;
  40986. $6=$recv($7)._second();
  40987. return self._visit_($6);
  40988. $ctx2.sendIdx["visit:"]=2;
  40989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40990. }),(function(){
  40991. return $core.withContext(function($ctx2) {
  40992. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third());
  40993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40994. }));
  40995. return self;
  40996. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  40997. },
  40998. args: ["anIRInlinedIfNilIfNotNil"],
  40999. 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 ]",
  41000. referencedClasses: [],
  41001. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"]
  41002. }),
  41003. $globals.IRInliningJSTranslator);
  41004. $core.addMethod(
  41005. $core.method({
  41006. selector: "visitIRInlinedIfTrue:",
  41007. protocol: 'visiting',
  41008. fn: function (anIRInlinedIfTrue){
  41009. var self=this;
  41010. return $core.withContext(function($ctx1) {
  41011. var $1,$2,$4,$3;
  41012. $1=self._stream();
  41013. $ctx1.sendIdx["stream"]=1;
  41014. $recv($1)._nextPutIf_with_((function(){
  41015. return $core.withContext(function($ctx2) {
  41016. $2=self._stream();
  41017. $ctx2.sendIdx["stream"]=2;
  41018. $recv($2)._nextPutAll_("$core.assert(");
  41019. $ctx2.sendIdx["nextPutAll:"]=1;
  41020. $4=$recv(anIRInlinedIfTrue)._instructions();
  41021. $ctx2.sendIdx["instructions"]=1;
  41022. $3=$recv($4)._first();
  41023. self._visit_($3);
  41024. $ctx2.sendIdx["visit:"]=1;
  41025. return $recv(self._stream())._nextPutAll_(")");
  41026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41027. }),(function(){
  41028. return $core.withContext(function($ctx2) {
  41029. return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last());
  41030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41031. }));
  41032. return self;
  41033. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  41034. },
  41035. args: ["anIRInlinedIfTrue"],
  41036. 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 ]",
  41037. referencedClasses: [],
  41038. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  41039. }),
  41040. $globals.IRInliningJSTranslator);
  41041. $core.addMethod(
  41042. $core.method({
  41043. selector: "visitIRInlinedIfTrueIfFalse:",
  41044. protocol: 'visiting',
  41045. fn: function (anIRInlinedIfTrueIfFalse){
  41046. var self=this;
  41047. return $core.withContext(function($ctx1) {
  41048. var $1,$2,$4,$3,$6,$5;
  41049. $1=self._stream();
  41050. $ctx1.sendIdx["stream"]=1;
  41051. $recv($1)._nextPutIfElse_with_with_((function(){
  41052. return $core.withContext(function($ctx2) {
  41053. $2=self._stream();
  41054. $ctx2.sendIdx["stream"]=2;
  41055. $recv($2)._nextPutAll_("$core.assert(");
  41056. $ctx2.sendIdx["nextPutAll:"]=1;
  41057. $4=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  41058. $ctx2.sendIdx["instructions"]=1;
  41059. $3=$recv($4)._first();
  41060. self._visit_($3);
  41061. $ctx2.sendIdx["visit:"]=1;
  41062. return $recv(self._stream())._nextPutAll_(")");
  41063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41064. }),(function(){
  41065. return $core.withContext(function($ctx2) {
  41066. $6=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  41067. $ctx2.sendIdx["instructions"]=2;
  41068. $5=$recv($6)._second();
  41069. return self._visit_($5);
  41070. $ctx2.sendIdx["visit:"]=2;
  41071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41072. }),(function(){
  41073. return $core.withContext(function($ctx2) {
  41074. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third());
  41075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41076. }));
  41077. return self;
  41078. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  41079. },
  41080. args: ["anIRInlinedIfTrueIfFalse"],
  41081. 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 ]",
  41082. referencedClasses: [],
  41083. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  41084. }),
  41085. $globals.IRInliningJSTranslator);
  41086. $core.addMethod(
  41087. $core.method({
  41088. selector: "visitIRInlinedNonLocalReturn:",
  41089. protocol: 'visiting',
  41090. fn: function (anIRInlinedReturn){
  41091. var self=this;
  41092. return $core.withContext(function($ctx1) {
  41093. var $1;
  41094. $1=self._stream();
  41095. $ctx1.sendIdx["stream"]=1;
  41096. $recv($1)._nextPutStatementWith_((function(){
  41097. return $core.withContext(function($ctx2) {
  41098. return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  41099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41100. }));
  41101. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  41102. }));
  41103. return self;
  41104. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  41105. },
  41106. args: ["anIRInlinedReturn"],
  41107. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  41108. referencedClasses: [],
  41109. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
  41110. }),
  41111. $globals.IRInliningJSTranslator);
  41112. $core.addMethod(
  41113. $core.method({
  41114. selector: "visitIRInlinedReturn:",
  41115. protocol: 'visiting',
  41116. fn: function (anIRInlinedReturn){
  41117. var self=this;
  41118. return $core.withContext(function($ctx1) {
  41119. self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  41120. return self;
  41121. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  41122. },
  41123. args: ["anIRInlinedReturn"],
  41124. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  41125. referencedClasses: [],
  41126. messageSends: ["visit:", "last", "instructions"]
  41127. }),
  41128. $globals.IRInliningJSTranslator);
  41129. $core.addMethod(
  41130. $core.method({
  41131. selector: "visitIRInlinedSequence:",
  41132. protocol: 'visiting',
  41133. fn: function (anIRInlinedSequence){
  41134. var self=this;
  41135. return $core.withContext(function($ctx1) {
  41136. $recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){
  41137. return $core.withContext(function($ctx2) {
  41138. return $recv(self._stream())._nextPutStatementWith_((function(){
  41139. return $core.withContext(function($ctx3) {
  41140. return self._visit_(each);
  41141. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41142. }));
  41143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41144. }));
  41145. return self;
  41146. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
  41147. },
  41148. args: ["anIRInlinedSequence"],
  41149. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  41150. referencedClasses: [],
  41151. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  41152. }),
  41153. $globals.IRInliningJSTranslator);
  41154. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  41155. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  41156. $core.addMethod(
  41157. $core.method({
  41158. selector: "ifFalse:",
  41159. protocol: 'inlining',
  41160. fn: function (anIRInstruction){
  41161. var self=this;
  41162. function $IRInlinedIfFalse(){return $globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  41163. return $core.withContext(function($ctx1) {
  41164. var $1;
  41165. $1=self._inlinedSend_with_($recv($IRInlinedIfFalse())._new(),anIRInstruction);
  41166. return $1;
  41167. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41168. },
  41169. args: ["anIRInstruction"],
  41170. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  41171. referencedClasses: ["IRInlinedIfFalse"],
  41172. messageSends: ["inlinedSend:with:", "new"]
  41173. }),
  41174. $globals.IRSendInliner);
  41175. $core.addMethod(
  41176. $core.method({
  41177. selector: "ifFalse:ifTrue:",
  41178. protocol: 'inlining',
  41179. fn: function (anIRInstruction,anotherIRInstruction){
  41180. var self=this;
  41181. return $core.withContext(function($ctx1) {
  41182. var $1;
  41183. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  41184. return $1;
  41185. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41186. },
  41187. args: ["anIRInstruction", "anotherIRInstruction"],
  41188. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  41189. referencedClasses: [],
  41190. messageSends: ["perform:withArguments:"]
  41191. }),
  41192. $globals.IRSendInliner);
  41193. $core.addMethod(
  41194. $core.method({
  41195. selector: "ifNil:",
  41196. protocol: 'inlining',
  41197. fn: function (anIRInstruction){
  41198. var self=this;
  41199. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41200. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  41201. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  41202. return $core.withContext(function($ctx1) {
  41203. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  41204. $2=$recv($IRInlinedIfNilIfNotNil())._new();
  41205. $ctx1.sendIdx["new"]=1;
  41206. $4=$recv($IRClosure())._new();
  41207. $ctx1.sendIdx["new"]=2;
  41208. $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41209. $5=$4;
  41210. $7=$recv($IRBlockSequence())._new();
  41211. $recv($7)._add_($recv($recv(self._send())._instructions())._first());
  41212. $8=$recv($7)._yourself();
  41213. $ctx1.sendIdx["yourself"]=1;
  41214. $6=$8;
  41215. $recv($5)._add_($6);
  41216. $ctx1.sendIdx["add:"]=1;
  41217. $9=$recv($4)._yourself();
  41218. $3=$9;
  41219. $1=self._inlinedSend_with_with_($2,anIRInstruction,$3);
  41220. return $1;
  41221. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41222. },
  41223. args: ["anIRInstruction"],
  41224. 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)",
  41225. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41226. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  41227. }),
  41228. $globals.IRSendInliner);
  41229. $core.addMethod(
  41230. $core.method({
  41231. selector: "ifNil:ifNotNil:",
  41232. protocol: 'inlining',
  41233. fn: function (anIRInstruction,anotherIRInstruction){
  41234. var self=this;
  41235. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41236. return $core.withContext(function($ctx1) {
  41237. var $1;
  41238. $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  41239. return $1;
  41240. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41241. },
  41242. args: ["anIRInstruction", "anotherIRInstruction"],
  41243. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  41244. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41245. messageSends: ["inlinedSend:with:with:", "new"]
  41246. }),
  41247. $globals.IRSendInliner);
  41248. $core.addMethod(
  41249. $core.method({
  41250. selector: "ifNotNil:",
  41251. protocol: 'inlining',
  41252. fn: function (anIRInstruction){
  41253. var self=this;
  41254. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41255. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  41256. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  41257. return $core.withContext(function($ctx1) {
  41258. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  41259. $2=$recv($IRInlinedIfNilIfNotNil())._new();
  41260. $ctx1.sendIdx["new"]=1;
  41261. $4=$recv($IRClosure())._new();
  41262. $ctx1.sendIdx["new"]=2;
  41263. $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41264. $5=$4;
  41265. $7=$recv($IRBlockSequence())._new();
  41266. $recv($7)._add_($recv($recv(self._send())._instructions())._first());
  41267. $8=$recv($7)._yourself();
  41268. $ctx1.sendIdx["yourself"]=1;
  41269. $6=$8;
  41270. $recv($5)._add_($6);
  41271. $ctx1.sendIdx["add:"]=1;
  41272. $9=$recv($4)._yourself();
  41273. $3=$9;
  41274. $1=self._inlinedSend_with_with_($2,$3,anIRInstruction);
  41275. return $1;
  41276. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41277. },
  41278. args: ["anIRInstruction"],
  41279. 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",
  41280. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41281. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  41282. }),
  41283. $globals.IRSendInliner);
  41284. $core.addMethod(
  41285. $core.method({
  41286. selector: "ifNotNil:ifNil:",
  41287. protocol: 'inlining',
  41288. fn: function (anIRInstruction,anotherIRInstruction){
  41289. var self=this;
  41290. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41291. return $core.withContext(function($ctx1) {
  41292. var $1;
  41293. $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  41294. return $1;
  41295. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41296. },
  41297. args: ["anIRInstruction", "anotherIRInstruction"],
  41298. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  41299. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41300. messageSends: ["inlinedSend:with:with:", "new"]
  41301. }),
  41302. $globals.IRSendInliner);
  41303. $core.addMethod(
  41304. $core.method({
  41305. selector: "ifTrue:",
  41306. protocol: 'inlining',
  41307. fn: function (anIRInstruction){
  41308. var self=this;
  41309. function $IRInlinedIfTrue(){return $globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  41310. return $core.withContext(function($ctx1) {
  41311. var $1;
  41312. $1=self._inlinedSend_with_($recv($IRInlinedIfTrue())._new(),anIRInstruction);
  41313. return $1;
  41314. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41315. },
  41316. args: ["anIRInstruction"],
  41317. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  41318. referencedClasses: ["IRInlinedIfTrue"],
  41319. messageSends: ["inlinedSend:with:", "new"]
  41320. }),
  41321. $globals.IRSendInliner);
  41322. $core.addMethod(
  41323. $core.method({
  41324. selector: "ifTrue:ifFalse:",
  41325. protocol: 'inlining',
  41326. fn: function (anIRInstruction,anotherIRInstruction){
  41327. var self=this;
  41328. function $IRInlinedIfTrueIfFalse(){return $globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  41329. return $core.withContext(function($ctx1) {
  41330. var $1;
  41331. $1=self._inlinedSend_with_with_($recv($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  41332. return $1;
  41333. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41334. },
  41335. args: ["anIRInstruction", "anotherIRInstruction"],
  41336. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  41337. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  41338. messageSends: ["inlinedSend:with:with:", "new"]
  41339. }),
  41340. $globals.IRSendInliner);
  41341. $core.addMethod(
  41342. $core.method({
  41343. selector: "inlineClosure:",
  41344. protocol: 'inlining',
  41345. fn: function (anIRClosure){
  41346. var self=this;
  41347. var inlinedClosure,sequence,statements;
  41348. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  41349. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  41350. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  41351. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  41352. return $core.withContext(function($ctx1) {
  41353. 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;
  41354. inlinedClosure=self._inlinedClosure();
  41355. $1=inlinedClosure;
  41356. $2=$1;
  41357. $3=$recv(anIRClosure)._scope();
  41358. $ctx1.sendIdx["scope"]=1;
  41359. $recv($2)._scope_($3);
  41360. $ctx1.sendIdx["scope:"]=1;
  41361. $4=$recv($1)._parent_($recv(anIRClosure)._parent());
  41362. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  41363. return $core.withContext(function($ctx2) {
  41364. return $recv(inlinedClosure)._add_(each);
  41365. $ctx2.sendIdx["add:"]=1;
  41366. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41367. }));
  41368. $ctx1.sendIdx["do:"]=1;
  41369. sequence=self._inlinedSequence();
  41370. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  41371. return $core.withContext(function($ctx2) {
  41372. $5=inlinedClosure;
  41373. $7=$recv($IRTempDeclaration())._new();
  41374. $ctx2.sendIdx["new"]=1;
  41375. $recv($7)._name_(each);
  41376. $ctx2.sendIdx["name:"]=1;
  41377. $8=$recv($7)._yourself();
  41378. $ctx2.sendIdx["yourself"]=1;
  41379. $6=$8;
  41380. $recv($5)._add_($6);
  41381. $ctx2.sendIdx["add:"]=2;
  41382. $9=sequence;
  41383. $11=$recv($IRAssignment())._new();
  41384. $ctx2.sendIdx["new"]=2;
  41385. $12=$11;
  41386. $14=$recv($IRVariable())._new();
  41387. $ctx2.sendIdx["new"]=3;
  41388. $16=$recv($AliasVar())._new();
  41389. $ctx2.sendIdx["new"]=4;
  41390. $17=$16;
  41391. $18=$recv(inlinedClosure)._scope();
  41392. $ctx2.sendIdx["scope"]=2;
  41393. $recv($17)._scope_($18);
  41394. $ctx2.sendIdx["scope:"]=2;
  41395. $recv($16)._name_(each);
  41396. $ctx2.sendIdx["name:"]=2;
  41397. $19=$recv($16)._yourself();
  41398. $ctx2.sendIdx["yourself"]=2;
  41399. $15=$19;
  41400. $13=$recv($14)._variable_($15);
  41401. $ctx2.sendIdx["variable:"]=1;
  41402. $recv($12)._add_($13);
  41403. $ctx2.sendIdx["add:"]=4;
  41404. $20=$11;
  41405. $22=$recv($IRVariable())._new();
  41406. $ctx2.sendIdx["new"]=5;
  41407. $24=$recv($AliasVar())._new();
  41408. $recv($24)._scope_($recv(inlinedClosure)._scope());
  41409. $recv($24)._name_("$receiver");
  41410. $25=$recv($24)._yourself();
  41411. $ctx2.sendIdx["yourself"]=3;
  41412. $23=$25;
  41413. $21=$recv($22)._variable_($23);
  41414. $recv($20)._add_($21);
  41415. $ctx2.sendIdx["add:"]=5;
  41416. $26=$recv($11)._yourself();
  41417. $10=$26;
  41418. return $recv($9)._add_($10);
  41419. $ctx2.sendIdx["add:"]=3;
  41420. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41421. }));
  41422. $ctx1.sendIdx["do:"]=2;
  41423. $recv(inlinedClosure)._add_(sequence);
  41424. $ctx1.sendIdx["add:"]=6;
  41425. $28=$recv(anIRClosure)._instructions();
  41426. $ctx1.sendIdx["instructions"]=2;
  41427. $27=$recv($28)._last();
  41428. $ctx1.sendIdx["last"]=1;
  41429. statements=$recv($27)._instructions();
  41430. $ctx1.sendIdx["instructions"]=1;
  41431. $recv(statements)._ifNotEmpty_((function(){
  41432. return $core.withContext(function($ctx2) {
  41433. $recv($recv(statements)._allButLast())._do_((function(each){
  41434. return $core.withContext(function($ctx3) {
  41435. return $recv(sequence)._add_(each);
  41436. $ctx3.sendIdx["add:"]=7;
  41437. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  41438. }));
  41439. $31=$recv(statements)._last();
  41440. $ctx2.sendIdx["last"]=2;
  41441. $30=$recv($31)._isReturn();
  41442. $29=$recv($30)._and_((function(){
  41443. return $core.withContext(function($ctx3) {
  41444. $32=$recv(statements)._last();
  41445. $ctx3.sendIdx["last"]=3;
  41446. return $recv($32)._isBlockReturn();
  41447. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  41448. }));
  41449. if($core.assert($29)){
  41450. $33=sequence;
  41451. $36=$recv(statements)._last();
  41452. $ctx2.sendIdx["last"]=4;
  41453. $35=$recv($36)._instructions();
  41454. $34=$recv($35)._first();
  41455. return $recv($33)._add_($34);
  41456. $ctx2.sendIdx["add:"]=8;
  41457. } else {
  41458. return $recv(sequence)._add_($recv(statements)._last());
  41459. };
  41460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41461. }));
  41462. $37=inlinedClosure;
  41463. return $37;
  41464. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  41465. },
  41466. args: ["anIRClosure"],
  41467. 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",
  41468. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  41469. 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"]
  41470. }),
  41471. $globals.IRSendInliner);
  41472. $core.addMethod(
  41473. $core.method({
  41474. selector: "inlineSend:",
  41475. protocol: 'inlining',
  41476. fn: function (anIRSend){
  41477. var self=this;
  41478. return $core.withContext(function($ctx1) {
  41479. var $3,$2,$1;
  41480. self._send_(anIRSend);
  41481. $3=self._send();
  41482. $ctx1.sendIdx["send"]=1;
  41483. $2=$recv($3)._selector();
  41484. $1=self._perform_withArguments_($2,$recv($recv(self._send())._instructions())._allButFirst());
  41485. return $1;
  41486. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  41487. },
  41488. args: ["anIRSend"],
  41489. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  41490. referencedClasses: [],
  41491. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
  41492. }),
  41493. $globals.IRSendInliner);
  41494. $core.addMethod(
  41495. $core.method({
  41496. selector: "inlinedClosure",
  41497. protocol: 'factory',
  41498. fn: function (){
  41499. var self=this;
  41500. function $IRInlinedClosure(){return $globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  41501. return $core.withContext(function($ctx1) {
  41502. var $1;
  41503. $1=$recv($IRInlinedClosure())._new();
  41504. return $1;
  41505. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  41506. },
  41507. args: [],
  41508. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  41509. referencedClasses: ["IRInlinedClosure"],
  41510. messageSends: ["new"]
  41511. }),
  41512. $globals.IRSendInliner);
  41513. $core.addMethod(
  41514. $core.method({
  41515. selector: "inlinedSend:with:",
  41516. protocol: 'inlining',
  41517. fn: function (inlinedSend,anIRInstruction){
  41518. var self=this;
  41519. var inlinedClosure;
  41520. return $core.withContext(function($ctx1) {
  41521. var $1,$2,$5,$4,$3,$6,$7;
  41522. $1=$recv(anIRInstruction)._isClosure();
  41523. if(!$core.assert($1)){
  41524. self._inliningError_("Message argument should be a block");
  41525. $ctx1.sendIdx["inliningError:"]=1;
  41526. };
  41527. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  41528. if(!$core.assert($2)){
  41529. self._inliningError_("Inlined block should have zero argument");
  41530. };
  41531. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  41532. $5=self._send();
  41533. $ctx1.sendIdx["send"]=1;
  41534. $4=$recv($5)._instructions();
  41535. $3=$recv($4)._first();
  41536. $recv(inlinedSend)._add_($3);
  41537. $ctx1.sendIdx["add:"]=1;
  41538. $6=$recv(inlinedSend)._add_(inlinedClosure);
  41539. $recv(self._send())._replaceWith_(inlinedSend);
  41540. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  41541. $ctx1.sendIdx["internalVariables"]=1;
  41542. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  41543. return inlinedSend;
  41544. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  41545. },
  41546. args: ["inlinedSend", "anIRInstruction"],
  41547. 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",
  41548. referencedClasses: [],
  41549. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41550. }),
  41551. $globals.IRSendInliner);
  41552. $core.addMethod(
  41553. $core.method({
  41554. selector: "inlinedSend:with:with:",
  41555. protocol: 'inlining',
  41556. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  41557. var self=this;
  41558. var inlinedClosure1,inlinedClosure2;
  41559. return $core.withContext(function($ctx1) {
  41560. var $1,$2,$3,$4,$7,$6,$5,$8,$9;
  41561. $1=$recv(anIRInstruction)._isClosure();
  41562. $ctx1.sendIdx["isClosure"]=1;
  41563. if(!$core.assert($1)){
  41564. self._inliningError_("Message argument should be a block");
  41565. $ctx1.sendIdx["inliningError:"]=1;
  41566. };
  41567. $2=$recv(anotherIRInstruction)._isClosure();
  41568. if(!$core.assert($2)){
  41569. self._inliningError_("Message argument should be a block");
  41570. };
  41571. $3=self._translator();
  41572. $ctx1.sendIdx["translator"]=1;
  41573. $4=self._inlineClosure_(anIRInstruction);
  41574. $ctx1.sendIdx["inlineClosure:"]=1;
  41575. inlinedClosure1=$recv($3)._visit_($4);
  41576. $ctx1.sendIdx["visit:"]=1;
  41577. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  41578. $7=self._send();
  41579. $ctx1.sendIdx["send"]=1;
  41580. $6=$recv($7)._instructions();
  41581. $5=$recv($6)._first();
  41582. $recv(inlinedSend)._add_($5);
  41583. $ctx1.sendIdx["add:"]=1;
  41584. $recv(inlinedSend)._add_(inlinedClosure1);
  41585. $ctx1.sendIdx["add:"]=2;
  41586. $8=$recv(inlinedSend)._add_(inlinedClosure2);
  41587. $recv(self._send())._replaceWith_(inlinedSend);
  41588. $9=$recv($recv(inlinedSend)._method())._internalVariables();
  41589. $ctx1.sendIdx["internalVariables"]=1;
  41590. $recv($9)._addAll_($recv(inlinedSend)._internalVariables());
  41591. return inlinedSend;
  41592. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  41593. },
  41594. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  41595. 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",
  41596. referencedClasses: [],
  41597. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41598. }),
  41599. $globals.IRSendInliner);
  41600. $core.addMethod(
  41601. $core.method({
  41602. selector: "inlinedSequence",
  41603. protocol: 'factory',
  41604. fn: function (){
  41605. var self=this;
  41606. function $IRInlinedSequence(){return $globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  41607. return $core.withContext(function($ctx1) {
  41608. var $1;
  41609. $1=$recv($IRInlinedSequence())._new();
  41610. return $1;
  41611. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  41612. },
  41613. args: [],
  41614. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  41615. referencedClasses: ["IRInlinedSequence"],
  41616. messageSends: ["new"]
  41617. }),
  41618. $globals.IRSendInliner);
  41619. $core.addMethod(
  41620. $core.method({
  41621. selector: "inliningError:",
  41622. protocol: 'error handling',
  41623. fn: function (aString){
  41624. var self=this;
  41625. function $InliningError(){return $globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  41626. return $core.withContext(function($ctx1) {
  41627. $recv($InliningError())._signal_(aString);
  41628. return self;
  41629. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  41630. },
  41631. args: ["aString"],
  41632. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  41633. referencedClasses: ["InliningError"],
  41634. messageSends: ["signal:"]
  41635. }),
  41636. $globals.IRSendInliner);
  41637. $core.addMethod(
  41638. $core.method({
  41639. selector: "send",
  41640. protocol: 'accessing',
  41641. fn: function (){
  41642. var self=this;
  41643. var $1;
  41644. $1=self["@send"];
  41645. return $1;
  41646. },
  41647. args: [],
  41648. source: "send\x0a\x09^ send",
  41649. referencedClasses: [],
  41650. messageSends: []
  41651. }),
  41652. $globals.IRSendInliner);
  41653. $core.addMethod(
  41654. $core.method({
  41655. selector: "send:",
  41656. protocol: 'accessing',
  41657. fn: function (anIRSend){
  41658. var self=this;
  41659. self["@send"]=anIRSend;
  41660. return self;
  41661. },
  41662. args: ["anIRSend"],
  41663. source: "send: anIRSend\x0a\x09send := anIRSend",
  41664. referencedClasses: [],
  41665. messageSends: []
  41666. }),
  41667. $globals.IRSendInliner);
  41668. $core.addMethod(
  41669. $core.method({
  41670. selector: "translator",
  41671. protocol: 'accessing',
  41672. fn: function (){
  41673. var self=this;
  41674. var $1;
  41675. $1=self["@translator"];
  41676. return $1;
  41677. },
  41678. args: [],
  41679. source: "translator\x0a\x09^ translator",
  41680. referencedClasses: [],
  41681. messageSends: []
  41682. }),
  41683. $globals.IRSendInliner);
  41684. $core.addMethod(
  41685. $core.method({
  41686. selector: "translator:",
  41687. protocol: 'accessing',
  41688. fn: function (anASTTranslator){
  41689. var self=this;
  41690. self["@translator"]=anASTTranslator;
  41691. return self;
  41692. },
  41693. args: ["anASTTranslator"],
  41694. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  41695. referencedClasses: [],
  41696. messageSends: []
  41697. }),
  41698. $globals.IRSendInliner);
  41699. $core.addMethod(
  41700. $core.method({
  41701. selector: "inlinedSelectors",
  41702. protocol: 'accessing',
  41703. fn: function (){
  41704. var self=this;
  41705. var $1;
  41706. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  41707. return $1;
  41708. },
  41709. args: [],
  41710. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  41711. referencedClasses: [],
  41712. messageSends: []
  41713. }),
  41714. $globals.IRSendInliner.klass);
  41715. $core.addMethod(
  41716. $core.method({
  41717. selector: "shouldInline:",
  41718. protocol: 'accessing',
  41719. fn: function (anIRInstruction){
  41720. var self=this;
  41721. return $core.withContext(function($ctx1) {
  41722. var $1,$2;
  41723. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector());
  41724. if(!$core.assert($1)){
  41725. return false;
  41726. };
  41727. $2=$recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._allSatisfy_((function(each){
  41728. return $core.withContext(function($ctx2) {
  41729. return $recv(each)._isClosure();
  41730. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41731. }));
  41732. return $2;
  41733. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)});
  41734. },
  41735. args: ["anIRInstruction"],
  41736. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09^ anIRInstruction instructions allButFirst allSatisfy: [ :each | each isClosure]",
  41737. referencedClasses: [],
  41738. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "allButFirst", "instructions", "isClosure"]
  41739. }),
  41740. $globals.IRSendInliner.klass);
  41741. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  41742. $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};";
  41743. $core.addMethod(
  41744. $core.method({
  41745. selector: "assignment",
  41746. protocol: 'accessing',
  41747. fn: function (){
  41748. var self=this;
  41749. var $1;
  41750. $1=self["@assignment"];
  41751. return $1;
  41752. },
  41753. args: [],
  41754. source: "assignment\x0a\x09^ assignment",
  41755. referencedClasses: [],
  41756. messageSends: []
  41757. }),
  41758. $globals.IRAssignmentInliner);
  41759. $core.addMethod(
  41760. $core.method({
  41761. selector: "assignment:",
  41762. protocol: 'accessing',
  41763. fn: function (aNode){
  41764. var self=this;
  41765. self["@assignment"]=aNode;
  41766. return self;
  41767. },
  41768. args: ["aNode"],
  41769. source: "assignment: aNode\x0a\x09assignment := aNode",
  41770. referencedClasses: [],
  41771. messageSends: []
  41772. }),
  41773. $globals.IRAssignmentInliner);
  41774. $core.addMethod(
  41775. $core.method({
  41776. selector: "inlineAssignment:",
  41777. protocol: 'inlining',
  41778. fn: function (anIRAssignment){
  41779. var self=this;
  41780. var inlinedAssignment;
  41781. function $IRInlinedAssignment(){return $globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  41782. return $core.withContext(function($ctx1) {
  41783. var $1,$2;
  41784. self._assignment_(anIRAssignment);
  41785. inlinedAssignment=$recv($IRInlinedAssignment())._new();
  41786. $1=$recv(anIRAssignment)._instructions();
  41787. $ctx1.sendIdx["instructions"]=1;
  41788. $recv($1)._do_((function(each){
  41789. return $core.withContext(function($ctx2) {
  41790. return $recv(inlinedAssignment)._add_(each);
  41791. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41792. }));
  41793. $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
  41794. self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last());
  41795. $2=inlinedAssignment;
  41796. return $2;
  41797. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
  41798. },
  41799. args: ["anIRAssignment"],
  41800. 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",
  41801. referencedClasses: ["IRInlinedAssignment"],
  41802. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  41803. }),
  41804. $globals.IRAssignmentInliner);
  41805. $core.addMethod(
  41806. $core.method({
  41807. selector: "inlineClosure:",
  41808. protocol: 'inlining',
  41809. fn: function (anIRClosure){
  41810. var self=this;
  41811. var inlinedClosure,statements;
  41812. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  41813. return $core.withContext(function($ctx1) {
  41814. var $2,$1,$4,$3,$5,$7,$8,$6,$9;
  41815. inlinedClosure=(
  41816. $ctx1.supercall = true,
  41817. $globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  41818. $ctx1.supercall = false;
  41819. $2=$recv(inlinedClosure)._instructions();
  41820. $ctx1.sendIdx["instructions"]=2;
  41821. $1=$recv($2)._last();
  41822. $ctx1.sendIdx["last"]=1;
  41823. statements=$recv($1)._instructions();
  41824. $ctx1.sendIdx["instructions"]=1;
  41825. $recv(statements)._ifNotEmpty_((function(){
  41826. return $core.withContext(function($ctx2) {
  41827. $4=$recv(statements)._last();
  41828. $ctx2.sendIdx["last"]=2;
  41829. $3=$recv($4)._canBeAssigned();
  41830. if($core.assert($3)){
  41831. $5=$recv(statements)._last();
  41832. $ctx2.sendIdx["last"]=3;
  41833. $7=$recv($IRAssignment())._new();
  41834. $recv($7)._add_($recv($recv(self._assignment())._instructions())._first());
  41835. $ctx2.sendIdx["add:"]=1;
  41836. $recv($7)._add_($recv($recv(statements)._last())._copy());
  41837. $8=$recv($7)._yourself();
  41838. $6=$8;
  41839. return $recv($5)._replaceWith_($6);
  41840. };
  41841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41842. }));
  41843. $9=inlinedClosure;
  41844. return $9;
  41845. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)});
  41846. },
  41847. args: ["anIRClosure"],
  41848. 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",
  41849. referencedClasses: ["IRAssignment"],
  41850. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
  41851. }),
  41852. $globals.IRAssignmentInliner);
  41853. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  41854. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  41855. $core.addMethod(
  41856. $core.method({
  41857. selector: "inlineClosure:",
  41858. protocol: 'inlining',
  41859. fn: function (anIRClosure){
  41860. var self=this;
  41861. var closure,statements;
  41862. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  41863. return $core.withContext(function($ctx1) {
  41864. var $1,$3,$2,$4,$5,$6,$7;
  41865. closure=(
  41866. $ctx1.supercall = true,
  41867. $globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  41868. $ctx1.supercall = false;
  41869. $1=$recv($recv(closure)._instructions())._last();
  41870. $ctx1.sendIdx["last"]=1;
  41871. statements=$recv($1)._instructions();
  41872. $ctx1.sendIdx["instructions"]=1;
  41873. $recv(statements)._ifNotEmpty_((function(){
  41874. return $core.withContext(function($ctx2) {
  41875. $3=$recv(statements)._last();
  41876. $ctx2.sendIdx["last"]=2;
  41877. $2=$recv($3)._isReturn();
  41878. if(!$core.assert($2)){
  41879. $4=$recv(statements)._last();
  41880. $ctx2.sendIdx["last"]=3;
  41881. $5=$recv($IRReturn())._new();
  41882. $recv($5)._add_($recv($recv(statements)._last())._copy());
  41883. $6=$recv($5)._yourself();
  41884. return $recv($4)._replaceWith_($6);
  41885. };
  41886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41887. }));
  41888. $7=closure;
  41889. return $7;
  41890. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
  41891. },
  41892. args: ["anIRClosure"],
  41893. 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",
  41894. referencedClasses: ["IRReturn"],
  41895. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
  41896. }),
  41897. $globals.IRReturnInliner);
  41898. $core.addMethod(
  41899. $core.method({
  41900. selector: "inlineReturn:",
  41901. protocol: 'inlining',
  41902. fn: function (anIRReturn){
  41903. var self=this;
  41904. var return_;
  41905. return $core.withContext(function($ctx1) {
  41906. var $1,$2;
  41907. return_=self._inlinedReturn();
  41908. $1=$recv(anIRReturn)._instructions();
  41909. $ctx1.sendIdx["instructions"]=1;
  41910. $recv($1)._do_((function(each){
  41911. return $core.withContext(function($ctx2) {
  41912. return $recv(return_)._add_(each);
  41913. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41914. }));
  41915. $recv(anIRReturn)._replaceWith_(return_);
  41916. self._inlineSend_($recv($recv(return_)._instructions())._last());
  41917. $2=return_;
  41918. return $2;
  41919. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
  41920. },
  41921. args: ["anIRReturn"],
  41922. 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",
  41923. referencedClasses: [],
  41924. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  41925. }),
  41926. $globals.IRReturnInliner);
  41927. $core.addMethod(
  41928. $core.method({
  41929. selector: "inlinedReturn",
  41930. protocol: 'factory',
  41931. fn: function (){
  41932. var self=this;
  41933. function $IRInlinedReturn(){return $globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  41934. return $core.withContext(function($ctx1) {
  41935. var $1;
  41936. $1=$recv($IRInlinedReturn())._new();
  41937. return $1;
  41938. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
  41939. },
  41940. args: [],
  41941. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  41942. referencedClasses: ["IRInlinedReturn"],
  41943. messageSends: ["new"]
  41944. }),
  41945. $globals.IRReturnInliner);
  41946. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  41947. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  41948. $core.addMethod(
  41949. $core.method({
  41950. selector: "compileNode:",
  41951. protocol: 'compiling',
  41952. fn: function (aNode){
  41953. var self=this;
  41954. var ir,stream;
  41955. return $core.withContext(function($ctx1) {
  41956. var $2,$3,$1;
  41957. $recv(self._semanticAnalyzer())._visit_(aNode);
  41958. $ctx1.sendIdx["visit:"]=1;
  41959. ir=$recv(self._translator())._visit_(aNode);
  41960. $ctx1.sendIdx["visit:"]=2;
  41961. $recv(self._inliner())._visit_(ir);
  41962. $ctx1.sendIdx["visit:"]=3;
  41963. $2=self._irTranslator();
  41964. $recv($2)._currentClass_(self._currentClass());
  41965. $recv($2)._visit_(ir);
  41966. $3=$recv($2)._contents();
  41967. $1=$3;
  41968. return $1;
  41969. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
  41970. },
  41971. args: ["aNode"],
  41972. 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",
  41973. referencedClasses: [],
  41974. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  41975. }),
  41976. $globals.InliningCodeGenerator);
  41977. $core.addMethod(
  41978. $core.method({
  41979. selector: "inliner",
  41980. protocol: 'compiling',
  41981. fn: function (){
  41982. var self=this;
  41983. function $IRInliner(){return $globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  41984. return $core.withContext(function($ctx1) {
  41985. var $1;
  41986. $1=$recv($IRInliner())._new();
  41987. return $1;
  41988. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  41989. },
  41990. args: [],
  41991. source: "inliner\x0a\x09^ IRInliner new",
  41992. referencedClasses: ["IRInliner"],
  41993. messageSends: ["new"]
  41994. }),
  41995. $globals.InliningCodeGenerator);
  41996. $core.addMethod(
  41997. $core.method({
  41998. selector: "irTranslator",
  41999. protocol: 'compiling',
  42000. fn: function (){
  42001. var self=this;
  42002. function $IRInliningJSTranslator(){return $globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  42003. return $core.withContext(function($ctx1) {
  42004. var $1;
  42005. $1=$recv($IRInliningJSTranslator())._new();
  42006. return $1;
  42007. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
  42008. },
  42009. args: [],
  42010. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  42011. referencedClasses: ["IRInliningJSTranslator"],
  42012. messageSends: ["new"]
  42013. }),
  42014. $globals.InliningCodeGenerator);
  42015. });
  42016. 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";
  42017. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  42018. $core.addPackage('Compiler-Interpreter');
  42019. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  42020. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42021. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  42022. $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`).";
  42023. $core.addMethod(
  42024. $core.method({
  42025. selector: "applyTo:arguments:",
  42026. protocol: 'evaluating',
  42027. fn: function (anObject,aCollection){
  42028. var self=this;
  42029. return $core.withContext(function($ctx1) {
  42030. self._interpreterError();
  42031. return self;
  42032. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  42033. },
  42034. args: ["anObject", "aCollection"],
  42035. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  42036. referencedClasses: [],
  42037. messageSends: ["interpreterError"]
  42038. }),
  42039. $globals.AIBlockClosure);
  42040. $core.addMethod(
  42041. $core.method({
  42042. selector: "compiledSource",
  42043. protocol: 'accessing',
  42044. fn: function (){
  42045. var self=this;
  42046. return "[ AST Block closure ]";
  42047. },
  42048. args: [],
  42049. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  42050. referencedClasses: [],
  42051. messageSends: []
  42052. }),
  42053. $globals.AIBlockClosure);
  42054. $core.addMethod(
  42055. $core.method({
  42056. selector: "currySelf",
  42057. protocol: 'converting',
  42058. fn: function (){
  42059. var self=this;
  42060. return $core.withContext(function($ctx1) {
  42061. self._interpreterError();
  42062. return self;
  42063. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  42064. },
  42065. args: [],
  42066. source: "currySelf\x0a\x09self interpreterError",
  42067. referencedClasses: [],
  42068. messageSends: ["interpreterError"]
  42069. }),
  42070. $globals.AIBlockClosure);
  42071. $core.addMethod(
  42072. $core.method({
  42073. selector: "initializeWithContext:node:",
  42074. protocol: 'initialization',
  42075. fn: function (aContext,aNode){
  42076. var self=this;
  42077. self["@node"]=aNode;
  42078. self["@outerContext"]=aContext;
  42079. return self;
  42080. },
  42081. args: ["aContext", "aNode"],
  42082. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  42083. referencedClasses: [],
  42084. messageSends: []
  42085. }),
  42086. $globals.AIBlockClosure);
  42087. $core.addMethod(
  42088. $core.method({
  42089. selector: "interpreterError",
  42090. protocol: 'error handling',
  42091. fn: function (){
  42092. var self=this;
  42093. function $ASTInterpreterError(){return $globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  42094. return $core.withContext(function($ctx1) {
  42095. $recv($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  42096. return self;
  42097. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  42098. },
  42099. args: [],
  42100. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  42101. referencedClasses: ["ASTInterpreterError"],
  42102. messageSends: ["signal:"]
  42103. }),
  42104. $globals.AIBlockClosure);
  42105. $core.addMethod(
  42106. $core.method({
  42107. selector: "numArgs",
  42108. protocol: 'accessing',
  42109. fn: function (){
  42110. var self=this;
  42111. return $core.withContext(function($ctx1) {
  42112. var $1;
  42113. $1=$recv($recv(self["@node"])._temps())._size();
  42114. return $1;
  42115. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  42116. },
  42117. args: [],
  42118. source: "numArgs\x0a\x09^ node temps size",
  42119. referencedClasses: [],
  42120. messageSends: ["size", "temps"]
  42121. }),
  42122. $globals.AIBlockClosure);
  42123. $core.addMethod(
  42124. $core.method({
  42125. selector: "value",
  42126. protocol: 'evaluating',
  42127. fn: function (){
  42128. var self=this;
  42129. return $core.withContext(function($ctx1) {
  42130. var $1;
  42131. $1=self._valueWithPossibleArguments_([]);
  42132. return $1;
  42133. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  42134. },
  42135. args: [],
  42136. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  42137. referencedClasses: [],
  42138. messageSends: ["valueWithPossibleArguments:"]
  42139. }),
  42140. $globals.AIBlockClosure);
  42141. $core.addMethod(
  42142. $core.method({
  42143. selector: "value:",
  42144. protocol: 'evaluating',
  42145. fn: function (anArgument){
  42146. var self=this;
  42147. return $core.withContext(function($ctx1) {
  42148. var $1;
  42149. $1=self._valueWithPossibleArguments_([anArgument]);
  42150. return $1;
  42151. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  42152. },
  42153. args: ["anArgument"],
  42154. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  42155. referencedClasses: [],
  42156. messageSends: ["valueWithPossibleArguments:"]
  42157. }),
  42158. $globals.AIBlockClosure);
  42159. $core.addMethod(
  42160. $core.method({
  42161. selector: "value:value:",
  42162. protocol: 'evaluating',
  42163. fn: function (firstArgument,secondArgument){
  42164. var self=this;
  42165. return $core.withContext(function($ctx1) {
  42166. var $1;
  42167. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  42168. return $1;
  42169. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  42170. },
  42171. args: ["firstArgument", "secondArgument"],
  42172. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  42173. referencedClasses: [],
  42174. messageSends: ["valueWithPossibleArguments:"]
  42175. }),
  42176. $globals.AIBlockClosure);
  42177. $core.addMethod(
  42178. $core.method({
  42179. selector: "value:value:value:",
  42180. protocol: 'evaluating',
  42181. fn: function (firstArgument,secondArgument,thirdArgument){
  42182. var self=this;
  42183. return $core.withContext(function($ctx1) {
  42184. var $1;
  42185. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  42186. return $1;
  42187. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  42188. },
  42189. args: ["firstArgument", "secondArgument", "thirdArgument"],
  42190. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  42191. referencedClasses: [],
  42192. messageSends: ["valueWithPossibleArguments:"]
  42193. }),
  42194. $globals.AIBlockClosure);
  42195. $core.addMethod(
  42196. $core.method({
  42197. selector: "valueWithPossibleArguments:",
  42198. protocol: 'evaluating',
  42199. fn: function (aCollection){
  42200. var self=this;
  42201. var context,sequenceNode;
  42202. return $core.withContext(function($ctx1) {
  42203. var $1,$2,$3,$4,$5,$6;
  42204. context=$recv(self["@outerContext"])._newInnerContext();
  42205. $1=$recv($recv($recv(self["@node"])._nodes())._first())._copy();
  42206. $recv($1)._parent_(nil);
  42207. $2=$recv($1)._yourself();
  42208. sequenceNode=$2;
  42209. $recv($recv(sequenceNode)._temps())._do_((function(each){
  42210. return $core.withContext(function($ctx2) {
  42211. return $recv(context)._defineLocal_(each);
  42212. $ctx2.sendIdx["defineLocal:"]=1;
  42213. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42214. }));
  42215. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  42216. return $core.withContext(function($ctx2) {
  42217. $recv(context)._defineLocal_(each);
  42218. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  42219. return nil;
  42220. })));
  42221. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  42222. }));
  42223. $3=$recv(context)._interpreter();
  42224. $ctx1.sendIdx["interpreter"]=1;
  42225. $recv($3)._node_($recv(sequenceNode)._nextChild());
  42226. $4=$recv($3)._proceed();
  42227. $5=$recv(self["@outerContext"])._interpreter();
  42228. $ctx1.sendIdx["interpreter"]=2;
  42229. $recv($5)._setNonLocalReturnFromContext_(context);
  42230. $6=$recv($recv(context)._interpreter())._pop();
  42231. return $6;
  42232. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  42233. },
  42234. args: ["aCollection"],
  42235. 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",
  42236. referencedClasses: [],
  42237. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"]
  42238. }),
  42239. $globals.AIBlockClosure);
  42240. $core.addMethod(
  42241. $core.method({
  42242. selector: "forContext:node:",
  42243. protocol: 'instance creation',
  42244. fn: function (aContext,aNode){
  42245. var self=this;
  42246. return $core.withContext(function($ctx1) {
  42247. var $2,$3,$1;
  42248. $2=self._new();
  42249. $recv($2)._initializeWithContext_node_(aContext,aNode);
  42250. $3=$recv($2)._yourself();
  42251. $1=$3;
  42252. return $1;
  42253. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  42254. },
  42255. args: ["aContext", "aNode"],
  42256. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  42257. referencedClasses: [],
  42258. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  42259. }),
  42260. $globals.AIBlockClosure.klass);
  42261. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  42262. $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)";
  42263. $core.addMethod(
  42264. $core.method({
  42265. selector: "arguments",
  42266. protocol: 'interpreting',
  42267. fn: function (){
  42268. var self=this;
  42269. return $core.withContext(function($ctx1) {
  42270. var $1;
  42271. $1=$recv($recv(self._ast())._arguments())._collect_((function(each){
  42272. return $core.withContext(function($ctx2) {
  42273. return self._localAt_ifAbsent_(each,(function(){
  42274. return $core.withContext(function($ctx3) {
  42275. return self._error_("Argument not in context");
  42276. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42277. }));
  42278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42279. }));
  42280. return $1;
  42281. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  42282. },
  42283. args: [],
  42284. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  42285. referencedClasses: [],
  42286. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  42287. }),
  42288. $globals.AIContext);
  42289. $core.addMethod(
  42290. $core.method({
  42291. selector: "ast",
  42292. protocol: 'interpreting',
  42293. fn: function (){
  42294. var self=this;
  42295. return $core.withContext(function($ctx1) {
  42296. var $1,$3,$2,$4,$5,$receiver;
  42297. $1=self._isBlockContext();
  42298. if($core.assert($1)){
  42299. $3=self._outerContext();
  42300. if(($receiver = $3) == null || $receiver.isNil){
  42301. $2=$3;
  42302. } else {
  42303. var context;
  42304. context=$receiver;
  42305. $2=$recv(context)._ast();
  42306. };
  42307. return $2;
  42308. };
  42309. $4=self["@ast"];
  42310. if(($receiver = $4) == null || $receiver.isNil){
  42311. self._initializeAST();
  42312. } else {
  42313. $4;
  42314. };
  42315. $5=self["@ast"];
  42316. return $5;
  42317. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  42318. },
  42319. args: [],
  42320. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  42321. referencedClasses: [],
  42322. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  42323. }),
  42324. $globals.AIContext);
  42325. $core.addMethod(
  42326. $core.method({
  42327. selector: "basicLocalAt:",
  42328. protocol: 'private',
  42329. fn: function (aString){
  42330. var self=this;
  42331. return $core.withContext(function($ctx1) {
  42332. var $1;
  42333. $1=$recv(self._locals())._at_(aString);
  42334. return $1;
  42335. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  42336. },
  42337. args: ["aString"],
  42338. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  42339. referencedClasses: [],
  42340. messageSends: ["at:", "locals"]
  42341. }),
  42342. $globals.AIContext);
  42343. $core.addMethod(
  42344. $core.method({
  42345. selector: "basicLocalAt:put:",
  42346. protocol: 'private',
  42347. fn: function (aString,anObject){
  42348. var self=this;
  42349. return $core.withContext(function($ctx1) {
  42350. $recv(self._locals())._at_put_(aString,anObject);
  42351. return self;
  42352. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  42353. },
  42354. args: ["aString", "anObject"],
  42355. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  42356. referencedClasses: [],
  42357. messageSends: ["at:put:", "locals"]
  42358. }),
  42359. $globals.AIContext);
  42360. $core.addMethod(
  42361. $core.method({
  42362. selector: "basicReceiver",
  42363. protocol: 'interpreting',
  42364. fn: function (){
  42365. var self=this;
  42366. return $core.withContext(function($ctx1) {
  42367. var $1;
  42368. $1=self._localAt_("self");
  42369. return $1;
  42370. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  42371. },
  42372. args: [],
  42373. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  42374. referencedClasses: [],
  42375. messageSends: ["localAt:"]
  42376. }),
  42377. $globals.AIContext);
  42378. $core.addMethod(
  42379. $core.method({
  42380. selector: "defineLocal:",
  42381. protocol: 'accessing',
  42382. fn: function (aString){
  42383. var self=this;
  42384. return $core.withContext(function($ctx1) {
  42385. $recv(self._locals())._at_put_(aString,nil);
  42386. return self;
  42387. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  42388. },
  42389. args: ["aString"],
  42390. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  42391. referencedClasses: [],
  42392. messageSends: ["at:put:", "locals"]
  42393. }),
  42394. $globals.AIContext);
  42395. $core.addMethod(
  42396. $core.method({
  42397. selector: "evaluate:on:",
  42398. protocol: 'evaluating',
  42399. fn: function (aString,anEvaluator){
  42400. var self=this;
  42401. return $core.withContext(function($ctx1) {
  42402. var $1;
  42403. $1=$recv(anEvaluator)._evaluate_context_(aString,self);
  42404. return $1;
  42405. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  42406. },
  42407. args: ["aString", "anEvaluator"],
  42408. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  42409. referencedClasses: [],
  42410. messageSends: ["evaluate:context:"]
  42411. }),
  42412. $globals.AIContext);
  42413. $core.addMethod(
  42414. $core.method({
  42415. selector: "evaluateNode:",
  42416. protocol: 'evaluating',
  42417. fn: function (aNode){
  42418. var self=this;
  42419. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  42420. return $core.withContext(function($ctx1) {
  42421. var $2,$3,$1;
  42422. $2=$recv($ASTInterpreter())._new();
  42423. $recv($2)._context_(self);
  42424. $recv($2)._node_($recv(aNode)._nextChild());
  42425. $recv($2)._proceed();
  42426. $3=$recv($2)._result();
  42427. $1=$3;
  42428. return $1;
  42429. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  42430. },
  42431. args: ["aNode"],
  42432. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  42433. referencedClasses: ["ASTInterpreter"],
  42434. messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"]
  42435. }),
  42436. $globals.AIContext);
  42437. $core.addMethod(
  42438. $core.method({
  42439. selector: "evaluatedSelector",
  42440. protocol: 'accessing',
  42441. fn: function (){
  42442. var self=this;
  42443. var $1;
  42444. $1=self["@evaluatedSelector"];
  42445. return $1;
  42446. },
  42447. args: [],
  42448. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  42449. referencedClasses: [],
  42450. messageSends: []
  42451. }),
  42452. $globals.AIContext);
  42453. $core.addMethod(
  42454. $core.method({
  42455. selector: "evaluatedSelector:",
  42456. protocol: 'accessing',
  42457. fn: function (aString){
  42458. var self=this;
  42459. self["@evaluatedSelector"]=aString;
  42460. return self;
  42461. },
  42462. args: ["aString"],
  42463. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  42464. referencedClasses: [],
  42465. messageSends: []
  42466. }),
  42467. $globals.AIContext);
  42468. $core.addMethod(
  42469. $core.method({
  42470. selector: "index",
  42471. protocol: 'accessing',
  42472. fn: function (){
  42473. var self=this;
  42474. return $core.withContext(function($ctx1) {
  42475. var $2,$1,$receiver;
  42476. $2=self["@index"];
  42477. if(($receiver = $2) == null || $receiver.isNil){
  42478. $1=(0);
  42479. } else {
  42480. $1=$2;
  42481. };
  42482. return $1;
  42483. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  42484. },
  42485. args: [],
  42486. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  42487. referencedClasses: [],
  42488. messageSends: ["ifNil:"]
  42489. }),
  42490. $globals.AIContext);
  42491. $core.addMethod(
  42492. $core.method({
  42493. selector: "index:",
  42494. protocol: 'accessing',
  42495. fn: function (anInteger){
  42496. var self=this;
  42497. self["@index"]=anInteger;
  42498. return self;
  42499. },
  42500. args: ["anInteger"],
  42501. source: "index: anInteger\x0a\x09index := anInteger",
  42502. referencedClasses: [],
  42503. messageSends: []
  42504. }),
  42505. $globals.AIContext);
  42506. $core.addMethod(
  42507. $core.method({
  42508. selector: "initializeAST",
  42509. protocol: 'initialization',
  42510. fn: function (){
  42511. var self=this;
  42512. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  42513. return $core.withContext(function($ctx1) {
  42514. var $1;
  42515. $1=self._method();
  42516. $ctx1.sendIdx["method"]=1;
  42517. self["@ast"]=$recv($1)._ast();
  42518. $recv($recv($SemanticAnalyzer())._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  42519. return self;
  42520. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  42521. },
  42522. args: [],
  42523. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  42524. referencedClasses: ["SemanticAnalyzer"],
  42525. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  42526. }),
  42527. $globals.AIContext);
  42528. $core.addMethod(
  42529. $core.method({
  42530. selector: "initializeFromMethodContext:",
  42531. protocol: 'initialization',
  42532. fn: function (aMethodContext){
  42533. var self=this;
  42534. return $core.withContext(function($ctx1) {
  42535. var $1,$2,$3,$4,$receiver;
  42536. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  42537. self._index_($recv(aMethodContext)._index());
  42538. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  42539. self._receiver_($recv(aMethodContext)._receiver());
  42540. self._supercall_($recv(aMethodContext)._supercall());
  42541. $1=self._selector_($recv(aMethodContext)._selector());
  42542. $2=$recv(aMethodContext)._outerContext();
  42543. $ctx1.sendIdx["outerContext"]=1;
  42544. if(($receiver = $2) == null || $receiver.isNil){
  42545. $2;
  42546. } else {
  42547. var outer;
  42548. outer=$receiver;
  42549. $3=$recv(outer)._methodContext();
  42550. if(($receiver = $3) == null || $receiver.isNil){
  42551. $3;
  42552. } else {
  42553. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  42554. };
  42555. $4=$recv(aMethodContext)._locals();
  42556. $ctx1.sendIdx["locals"]=1;
  42557. $recv($4)._keysAndValuesDo_((function(key,value){
  42558. return $core.withContext(function($ctx2) {
  42559. return $recv(self._locals())._at_put_(key,value);
  42560. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  42561. }));
  42562. };
  42563. return self;
  42564. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  42565. },
  42566. args: ["aMethodContext"],
  42567. 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 ] ]",
  42568. referencedClasses: [],
  42569. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  42570. }),
  42571. $globals.AIContext);
  42572. $core.addMethod(
  42573. $core.method({
  42574. selector: "initializeInterpreter",
  42575. protocol: 'initialization',
  42576. fn: function (){
  42577. var self=this;
  42578. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  42579. return $core.withContext(function($ctx1) {
  42580. var $1,$2,$3,$receiver;
  42581. $1=$recv($ASTInterpreter())._new();
  42582. $recv($1)._context_(self);
  42583. $2=$recv($1)._yourself();
  42584. self["@interpreter"]=$2;
  42585. $3=self._innerContext();
  42586. if(($receiver = $3) == null || $receiver.isNil){
  42587. $3;
  42588. } else {
  42589. self._setupInterpreter_(self["@interpreter"]);
  42590. };
  42591. return self;
  42592. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  42593. },
  42594. args: [],
  42595. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  42596. referencedClasses: ["ASTInterpreter"],
  42597. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  42598. }),
  42599. $globals.AIContext);
  42600. $core.addMethod(
  42601. $core.method({
  42602. selector: "initializeLocals",
  42603. protocol: 'initialization',
  42604. fn: function (){
  42605. var self=this;
  42606. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  42607. return $core.withContext(function($ctx1) {
  42608. self["@locals"]=$recv($Dictionary())._new();
  42609. $recv(self["@locals"])._at_put_("thisContext",self);
  42610. return self;
  42611. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  42612. },
  42613. args: [],
  42614. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  42615. referencedClasses: ["Dictionary"],
  42616. messageSends: ["new", "at:put:"]
  42617. }),
  42618. $globals.AIContext);
  42619. $core.addMethod(
  42620. $core.method({
  42621. selector: "innerContext",
  42622. protocol: 'accessing',
  42623. fn: function (){
  42624. var self=this;
  42625. var $1;
  42626. $1=self["@innerContext"];
  42627. return $1;
  42628. },
  42629. args: [],
  42630. source: "innerContext\x0a\x09^ innerContext",
  42631. referencedClasses: [],
  42632. messageSends: []
  42633. }),
  42634. $globals.AIContext);
  42635. $core.addMethod(
  42636. $core.method({
  42637. selector: "innerContext:",
  42638. protocol: 'accessing',
  42639. fn: function (anAIContext){
  42640. var self=this;
  42641. self["@innerContext"]=anAIContext;
  42642. return self;
  42643. },
  42644. args: ["anAIContext"],
  42645. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  42646. referencedClasses: [],
  42647. messageSends: []
  42648. }),
  42649. $globals.AIContext);
  42650. $core.addMethod(
  42651. $core.method({
  42652. selector: "interpreter",
  42653. protocol: 'interpreting',
  42654. fn: function (){
  42655. var self=this;
  42656. return $core.withContext(function($ctx1) {
  42657. var $1,$2,$receiver;
  42658. $1=self["@interpreter"];
  42659. if(($receiver = $1) == null || $receiver.isNil){
  42660. self._initializeInterpreter();
  42661. } else {
  42662. $1;
  42663. };
  42664. $2=self["@interpreter"];
  42665. return $2;
  42666. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  42667. },
  42668. args: [],
  42669. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  42670. referencedClasses: [],
  42671. messageSends: ["ifNil:", "initializeInterpreter"]
  42672. }),
  42673. $globals.AIContext);
  42674. $core.addMethod(
  42675. $core.method({
  42676. selector: "interpreter:",
  42677. protocol: 'interpreting',
  42678. fn: function (anInterpreter){
  42679. var self=this;
  42680. self["@interpreter"]=anInterpreter;
  42681. return self;
  42682. },
  42683. args: ["anInterpreter"],
  42684. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  42685. referencedClasses: [],
  42686. messageSends: []
  42687. }),
  42688. $globals.AIContext);
  42689. $core.addMethod(
  42690. $core.method({
  42691. selector: "isTopContext",
  42692. protocol: 'testing',
  42693. fn: function (){
  42694. var self=this;
  42695. return $core.withContext(function($ctx1) {
  42696. var $1;
  42697. $1=$recv(self._innerContext())._isNil();
  42698. return $1;
  42699. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  42700. },
  42701. args: [],
  42702. source: "isTopContext\x0a\x09^ self innerContext isNil",
  42703. referencedClasses: [],
  42704. messageSends: ["isNil", "innerContext"]
  42705. }),
  42706. $globals.AIContext);
  42707. $core.addMethod(
  42708. $core.method({
  42709. selector: "localAt:",
  42710. protocol: 'accessing',
  42711. fn: function (aString){
  42712. var self=this;
  42713. var context;
  42714. return $core.withContext(function($ctx1) {
  42715. var $1;
  42716. context=self._lookupContextForLocal_(aString);
  42717. $1=$recv(context)._basicLocalAt_(aString);
  42718. return $1;
  42719. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  42720. },
  42721. args: ["aString"],
  42722. 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",
  42723. referencedClasses: [],
  42724. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  42725. }),
  42726. $globals.AIContext);
  42727. $core.addMethod(
  42728. $core.method({
  42729. selector: "localAt:ifAbsent:",
  42730. protocol: 'accessing',
  42731. fn: function (aString,aBlock){
  42732. var self=this;
  42733. var context;
  42734. return $core.withContext(function($ctx1) {
  42735. var $1,$2;
  42736. var $early={};
  42737. try {
  42738. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  42739. return $core.withContext(function($ctx2) {
  42740. $1=$recv(aBlock)._value();
  42741. throw $early=[$1];
  42742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42743. }));
  42744. $2=$recv(context)._basicLocalAt_(aString);
  42745. return $2;
  42746. }
  42747. catch(e) {if(e===$early)return e[0]; throw e}
  42748. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  42749. },
  42750. args: ["aString", "aBlock"],
  42751. 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",
  42752. referencedClasses: [],
  42753. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  42754. }),
  42755. $globals.AIContext);
  42756. $core.addMethod(
  42757. $core.method({
  42758. selector: "localAt:put:",
  42759. protocol: 'accessing',
  42760. fn: function (aString,anObject){
  42761. var self=this;
  42762. var context;
  42763. return $core.withContext(function($ctx1) {
  42764. context=self._lookupContextForLocal_(aString);
  42765. $recv(context)._basicLocalAt_put_(aString,anObject);
  42766. return self;
  42767. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  42768. },
  42769. args: ["aString", "anObject"],
  42770. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  42771. referencedClasses: [],
  42772. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  42773. }),
  42774. $globals.AIContext);
  42775. $core.addMethod(
  42776. $core.method({
  42777. selector: "locals",
  42778. protocol: 'accessing',
  42779. fn: function (){
  42780. var self=this;
  42781. return $core.withContext(function($ctx1) {
  42782. var $1,$2,$receiver;
  42783. $1=self["@locals"];
  42784. if(($receiver = $1) == null || $receiver.isNil){
  42785. self._initializeLocals();
  42786. } else {
  42787. $1;
  42788. };
  42789. $2=self["@locals"];
  42790. return $2;
  42791. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  42792. },
  42793. args: [],
  42794. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  42795. referencedClasses: [],
  42796. messageSends: ["ifNil:", "initializeLocals"]
  42797. }),
  42798. $globals.AIContext);
  42799. $core.addMethod(
  42800. $core.method({
  42801. selector: "lookupContextForLocal:",
  42802. protocol: 'private',
  42803. fn: function (aString){
  42804. var self=this;
  42805. return $core.withContext(function($ctx1) {
  42806. var $1;
  42807. $1=self._lookupContextForLocal_ifNone_(aString,(function(){
  42808. return $core.withContext(function($ctx2) {
  42809. return self._variableNotFound();
  42810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42811. }));
  42812. return $1;
  42813. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  42814. },
  42815. args: ["aString"],
  42816. 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 ]",
  42817. referencedClasses: [],
  42818. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  42819. }),
  42820. $globals.AIContext);
  42821. $core.addMethod(
  42822. $core.method({
  42823. selector: "lookupContextForLocal:ifNone:",
  42824. protocol: 'private',
  42825. fn: function (aString,aBlock){
  42826. var self=this;
  42827. return $core.withContext(function($ctx1) {
  42828. var $2,$1;
  42829. $1=$recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  42830. return self;
  42831. }),(function(){
  42832. return $core.withContext(function($ctx2) {
  42833. $2=self._outerContext();
  42834. return $recv($2)._ifNil_ifNotNil_(aBlock,(function(context){
  42835. return $core.withContext(function($ctx3) {
  42836. return $recv(context)._lookupContextForLocal_(aString);
  42837. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  42838. }));
  42839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42840. }));
  42841. return $1;
  42842. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  42843. },
  42844. args: ["aString", "aBlock"],
  42845. 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 ] ]",
  42846. referencedClasses: [],
  42847. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  42848. }),
  42849. $globals.AIContext);
  42850. $core.addMethod(
  42851. $core.method({
  42852. selector: "newInnerContext",
  42853. protocol: 'factory',
  42854. fn: function (){
  42855. var self=this;
  42856. return $core.withContext(function($ctx1) {
  42857. var $2,$3,$1;
  42858. $2=$recv(self._class())._new();
  42859. $recv($2)._outerContext_(self);
  42860. $3=$recv($2)._yourself();
  42861. $1=$3;
  42862. return $1;
  42863. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  42864. },
  42865. args: [],
  42866. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  42867. referencedClasses: [],
  42868. messageSends: ["outerContext:", "new", "class", "yourself"]
  42869. }),
  42870. $globals.AIContext);
  42871. $core.addMethod(
  42872. $core.method({
  42873. selector: "outerContext",
  42874. protocol: 'accessing',
  42875. fn: function (){
  42876. var self=this;
  42877. var $1;
  42878. $1=self["@outerContext"];
  42879. return $1;
  42880. },
  42881. args: [],
  42882. source: "outerContext\x0a\x09^ outerContext",
  42883. referencedClasses: [],
  42884. messageSends: []
  42885. }),
  42886. $globals.AIContext);
  42887. $core.addMethod(
  42888. $core.method({
  42889. selector: "outerContext:",
  42890. protocol: 'accessing',
  42891. fn: function (anAIContext){
  42892. var self=this;
  42893. return $core.withContext(function($ctx1) {
  42894. var $1,$receiver;
  42895. self["@outerContext"]=anAIContext;
  42896. $1=self["@outerContext"];
  42897. if(($receiver = $1) == null || $receiver.isNil){
  42898. $1;
  42899. } else {
  42900. var context;
  42901. context=$receiver;
  42902. $recv(context)._innerContext_(self);
  42903. };
  42904. return self;
  42905. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  42906. },
  42907. args: ["anAIContext"],
  42908. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  42909. referencedClasses: [],
  42910. messageSends: ["ifNotNil:", "innerContext:"]
  42911. }),
  42912. $globals.AIContext);
  42913. $core.addMethod(
  42914. $core.method({
  42915. selector: "receiver:",
  42916. protocol: 'interpreting',
  42917. fn: function (anObject){
  42918. var self=this;
  42919. return $core.withContext(function($ctx1) {
  42920. $recv(self._locals())._at_put_("self",anObject);
  42921. return self;
  42922. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  42923. },
  42924. args: ["anObject"],
  42925. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  42926. referencedClasses: [],
  42927. messageSends: ["at:put:", "locals"]
  42928. }),
  42929. $globals.AIContext);
  42930. $core.addMethod(
  42931. $core.method({
  42932. selector: "selector",
  42933. protocol: 'accessing',
  42934. fn: function (){
  42935. var self=this;
  42936. var $1;
  42937. $1=self["@selector"];
  42938. return $1;
  42939. },
  42940. args: [],
  42941. source: "selector\x0a\x09^ selector",
  42942. referencedClasses: [],
  42943. messageSends: []
  42944. }),
  42945. $globals.AIContext);
  42946. $core.addMethod(
  42947. $core.method({
  42948. selector: "selector:",
  42949. protocol: 'accessing',
  42950. fn: function (aString){
  42951. var self=this;
  42952. self["@selector"]=aString;
  42953. return self;
  42954. },
  42955. args: ["aString"],
  42956. source: "selector: aString\x0a\x09selector := aString",
  42957. referencedClasses: [],
  42958. messageSends: []
  42959. }),
  42960. $globals.AIContext);
  42961. $core.addMethod(
  42962. $core.method({
  42963. selector: "sendIndexAt:",
  42964. protocol: 'accessing',
  42965. fn: function (aString){
  42966. var self=this;
  42967. return $core.withContext(function($ctx1) {
  42968. var $1;
  42969. $1=$recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  42970. return (0);
  42971. }));
  42972. return $1;
  42973. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  42974. },
  42975. args: ["aString"],
  42976. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  42977. referencedClasses: [],
  42978. messageSends: ["at:ifAbsent:", "sendIndexes"]
  42979. }),
  42980. $globals.AIContext);
  42981. $core.addMethod(
  42982. $core.method({
  42983. selector: "sendIndexes",
  42984. protocol: 'accessing',
  42985. fn: function (){
  42986. var self=this;
  42987. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  42988. return $core.withContext(function($ctx1) {
  42989. var $2,$1,$receiver;
  42990. $2=self["@sendIndexes"];
  42991. if(($receiver = $2) == null || $receiver.isNil){
  42992. $1=$recv($Dictionary())._new();
  42993. } else {
  42994. $1=$2;
  42995. };
  42996. return $1;
  42997. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  42998. },
  42999. args: [],
  43000. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  43001. referencedClasses: ["Dictionary"],
  43002. messageSends: ["ifNil:", "new"]
  43003. }),
  43004. $globals.AIContext);
  43005. $core.addMethod(
  43006. $core.method({
  43007. selector: "sendIndexes:",
  43008. protocol: 'accessing',
  43009. fn: function (aDictionary){
  43010. var self=this;
  43011. self["@sendIndexes"]=aDictionary;
  43012. return self;
  43013. },
  43014. args: ["aDictionary"],
  43015. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  43016. referencedClasses: [],
  43017. messageSends: []
  43018. }),
  43019. $globals.AIContext);
  43020. $core.addMethod(
  43021. $core.method({
  43022. selector: "setupInterpreter:",
  43023. protocol: 'interpreting',
  43024. fn: function (anInterpreter){
  43025. var self=this;
  43026. var currentNode;
  43027. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  43028. return $core.withContext(function($ctx1) {
  43029. var $1,$2,$3,$4,$5,$8,$7,$6,$receiver;
  43030. $1=$recv($ASTPCNodeVisitor())._new();
  43031. $recv($1)._selector_(self._evaluatedSelector());
  43032. $recv($1)._context_(self);
  43033. $2=$1;
  43034. $3=self._ast();
  43035. $ctx1.sendIdx["ast"]=1;
  43036. $recv($2)._visit_($3);
  43037. $4=$recv($1)._currentNode();
  43038. currentNode=$4;
  43039. $5=$recv(self._ast())._sequenceNode();
  43040. if(($receiver = $5) == null || $receiver.isNil){
  43041. $5;
  43042. } else {
  43043. var sequence;
  43044. sequence=$receiver;
  43045. $recv($recv(sequence)._temps())._do_((function(each){
  43046. return $core.withContext(function($ctx2) {
  43047. return self._defineLocal_(each);
  43048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43049. }));
  43050. $ctx1.sendIdx["do:"]=1;
  43051. };
  43052. $recv(anInterpreter)._node_(currentNode);
  43053. $8=self._innerContext();
  43054. $ctx1.sendIdx["innerContext"]=1;
  43055. $7=$recv($8)._arguments();
  43056. $6=$recv($7)._reversed();
  43057. $recv($6)._do_((function(each){
  43058. return $core.withContext(function($ctx2) {
  43059. return $recv(anInterpreter)._push_(each);
  43060. $ctx2.sendIdx["push:"]=1;
  43061. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  43062. }));
  43063. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  43064. return self;
  43065. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  43066. },
  43067. args: ["anInterpreter"],
  43068. 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)",
  43069. referencedClasses: ["ASTPCNodeVisitor"],
  43070. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  43071. }),
  43072. $globals.AIContext);
  43073. $core.addMethod(
  43074. $core.method({
  43075. selector: "supercall",
  43076. protocol: 'interpreting',
  43077. fn: function (){
  43078. var self=this;
  43079. return $core.withContext(function($ctx1) {
  43080. var $2,$1,$receiver;
  43081. $2=self["@supercall"];
  43082. if(($receiver = $2) == null || $receiver.isNil){
  43083. $1=false;
  43084. } else {
  43085. $1=$2;
  43086. };
  43087. return $1;
  43088. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  43089. },
  43090. args: [],
  43091. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  43092. referencedClasses: [],
  43093. messageSends: ["ifNil:"]
  43094. }),
  43095. $globals.AIContext);
  43096. $core.addMethod(
  43097. $core.method({
  43098. selector: "supercall:",
  43099. protocol: 'interpreting',
  43100. fn: function (aBoolean){
  43101. var self=this;
  43102. self["@supercall"]=aBoolean;
  43103. return self;
  43104. },
  43105. args: ["aBoolean"],
  43106. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  43107. referencedClasses: [],
  43108. messageSends: []
  43109. }),
  43110. $globals.AIContext);
  43111. $core.addMethod(
  43112. $core.method({
  43113. selector: "variableNotFound",
  43114. protocol: 'error handling',
  43115. fn: function (){
  43116. var self=this;
  43117. return $core.withContext(function($ctx1) {
  43118. self._error_("Variable missing");
  43119. return self;
  43120. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  43121. },
  43122. args: [],
  43123. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  43124. referencedClasses: [],
  43125. messageSends: ["error:"]
  43126. }),
  43127. $globals.AIContext);
  43128. $core.addMethod(
  43129. $core.method({
  43130. selector: "fromMethodContext:",
  43131. protocol: 'instance creation',
  43132. fn: function (aMethodContext){
  43133. var self=this;
  43134. return $core.withContext(function($ctx1) {
  43135. var $2,$3,$1;
  43136. $2=self._new();
  43137. $recv($2)._initializeFromMethodContext_(aMethodContext);
  43138. $3=$recv($2)._yourself();
  43139. $1=$3;
  43140. return $1;
  43141. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  43142. },
  43143. args: ["aMethodContext"],
  43144. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  43145. referencedClasses: [],
  43146. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  43147. }),
  43148. $globals.AIContext.klass);
  43149. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  43150. $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.";
  43151. $core.addMethod(
  43152. $core.method({
  43153. selector: "context",
  43154. protocol: 'accessing',
  43155. fn: function (){
  43156. var self=this;
  43157. var $1;
  43158. $1=self["@context"];
  43159. return $1;
  43160. },
  43161. args: [],
  43162. source: "context\x0a\x09^ context",
  43163. referencedClasses: [],
  43164. messageSends: []
  43165. }),
  43166. $globals.AISemanticAnalyzer);
  43167. $core.addMethod(
  43168. $core.method({
  43169. selector: "context:",
  43170. protocol: 'accessing',
  43171. fn: function (anAIContext){
  43172. var self=this;
  43173. self["@context"]=anAIContext;
  43174. return self;
  43175. },
  43176. args: ["anAIContext"],
  43177. source: "context: anAIContext\x0a\x09context := anAIContext",
  43178. referencedClasses: [],
  43179. messageSends: []
  43180. }),
  43181. $globals.AISemanticAnalyzer);
  43182. $core.addMethod(
  43183. $core.method({
  43184. selector: "visitVariableNode:",
  43185. protocol: 'visiting',
  43186. fn: function (aNode){
  43187. var self=this;
  43188. function $ASTContextVar(){return $globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)}
  43189. return $core.withContext(function($ctx1) {
  43190. var $1;
  43191. var $early={};
  43192. try {
  43193. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  43194. return $core.withContext(function($ctx2) {
  43195. $1=(
  43196. $ctx2.supercall = true,
  43197. $globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  43198. $ctx2.supercall = false;
  43199. throw $early=[$1];
  43200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43201. }));
  43202. $recv(aNode)._binding_($recv($ASTContextVar())._new());
  43203. return self;
  43204. }
  43205. catch(e) {if(e===$early)return e[0]; throw e}
  43206. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  43207. },
  43208. args: ["aNode"],
  43209. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  43210. referencedClasses: ["ASTContextVar"],
  43211. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  43212. }),
  43213. $globals.AISemanticAnalyzer);
  43214. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  43215. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  43216. $core.addMethod(
  43217. $core.method({
  43218. selector: "context",
  43219. protocol: 'accessing',
  43220. fn: function (){
  43221. var self=this;
  43222. var $1;
  43223. $1=self["@context"];
  43224. return $1;
  43225. },
  43226. args: [],
  43227. source: "context\x0a\x09^ context",
  43228. referencedClasses: [],
  43229. messageSends: []
  43230. }),
  43231. $globals.ASTContextVar);
  43232. $core.addMethod(
  43233. $core.method({
  43234. selector: "context:",
  43235. protocol: 'accessing',
  43236. fn: function (anObject){
  43237. var self=this;
  43238. self["@context"]=anObject;
  43239. return self;
  43240. },
  43241. args: ["anObject"],
  43242. source: "context: anObject\x0a\x09context := anObject",
  43243. referencedClasses: [],
  43244. messageSends: []
  43245. }),
  43246. $globals.ASTContextVar);
  43247. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  43248. $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.";
  43249. $core.addMethod(
  43250. $core.method({
  43251. selector: "atEnd",
  43252. protocol: 'testing',
  43253. fn: function (){
  43254. var self=this;
  43255. return $core.withContext(function($ctx1) {
  43256. var $1,$2,$receiver;
  43257. $1=self._context();
  43258. $ctx1.sendIdx["context"]=1;
  43259. if(($receiver = $1) == null || $receiver.isNil){
  43260. return true;
  43261. } else {
  43262. $1;
  43263. };
  43264. $2=$recv($recv(self._interpreter())._atEnd())._and_((function(){
  43265. return $core.withContext(function($ctx2) {
  43266. return $recv(self._context())._isTopContext();
  43267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43268. }));
  43269. return $2;
  43270. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  43271. },
  43272. args: [],
  43273. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  43274. referencedClasses: [],
  43275. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  43276. }),
  43277. $globals.ASTDebugger);
  43278. $core.addMethod(
  43279. $core.method({
  43280. selector: "context",
  43281. protocol: 'accessing',
  43282. fn: function (){
  43283. var self=this;
  43284. var $1;
  43285. $1=self["@context"];
  43286. return $1;
  43287. },
  43288. args: [],
  43289. source: "context\x0a\x09^ context",
  43290. referencedClasses: [],
  43291. messageSends: []
  43292. }),
  43293. $globals.ASTDebugger);
  43294. $core.addMethod(
  43295. $core.method({
  43296. selector: "context:",
  43297. protocol: 'accessing',
  43298. fn: function (aContext){
  43299. var self=this;
  43300. self["@context"]=aContext;
  43301. return self;
  43302. },
  43303. args: ["aContext"],
  43304. source: "context: aContext\x0a\x09context := aContext",
  43305. referencedClasses: [],
  43306. messageSends: []
  43307. }),
  43308. $globals.ASTDebugger);
  43309. $core.addMethod(
  43310. $core.method({
  43311. selector: "flushInnerContexts",
  43312. protocol: 'actions',
  43313. fn: function (){
  43314. var self=this;
  43315. return $core.withContext(function($ctx1) {
  43316. var $1,$receiver;
  43317. $1=self._context();
  43318. if(($receiver = $1) == null || $receiver.isNil){
  43319. $1;
  43320. } else {
  43321. var cxt;
  43322. cxt=$receiver;
  43323. $recv(cxt)._innerContext_(nil);
  43324. };
  43325. return self;
  43326. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  43327. },
  43328. args: [],
  43329. 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 ]",
  43330. referencedClasses: [],
  43331. messageSends: ["ifNotNil:", "context", "innerContext:"]
  43332. }),
  43333. $globals.ASTDebugger);
  43334. $core.addMethod(
  43335. $core.method({
  43336. selector: "interpreter",
  43337. protocol: 'accessing',
  43338. fn: function (){
  43339. var self=this;
  43340. return $core.withContext(function($ctx1) {
  43341. var $2,$1,$receiver;
  43342. $2=self._context();
  43343. if(($receiver = $2) == null || $receiver.isNil){
  43344. $1=$2;
  43345. } else {
  43346. var ctx;
  43347. ctx=$receiver;
  43348. $1=$recv(ctx)._interpreter();
  43349. };
  43350. return $1;
  43351. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  43352. },
  43353. args: [],
  43354. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  43355. referencedClasses: [],
  43356. messageSends: ["ifNotNil:", "context", "interpreter"]
  43357. }),
  43358. $globals.ASTDebugger);
  43359. $core.addMethod(
  43360. $core.method({
  43361. selector: "method",
  43362. protocol: 'accessing',
  43363. fn: function (){
  43364. var self=this;
  43365. return $core.withContext(function($ctx1) {
  43366. var $1;
  43367. $1=$recv(self._context())._method();
  43368. return $1;
  43369. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  43370. },
  43371. args: [],
  43372. source: "method\x0a\x09^ self context method",
  43373. referencedClasses: [],
  43374. messageSends: ["method", "context"]
  43375. }),
  43376. $globals.ASTDebugger);
  43377. $core.addMethod(
  43378. $core.method({
  43379. selector: "node",
  43380. protocol: 'accessing',
  43381. fn: function (){
  43382. var self=this;
  43383. return $core.withContext(function($ctx1) {
  43384. var $2,$1,$receiver;
  43385. $2=self._interpreter();
  43386. $ctx1.sendIdx["interpreter"]=1;
  43387. if(($receiver = $2) == null || $receiver.isNil){
  43388. $1=$2;
  43389. } else {
  43390. $1=$recv(self._interpreter())._node();
  43391. };
  43392. return $1;
  43393. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  43394. },
  43395. args: [],
  43396. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  43397. referencedClasses: [],
  43398. messageSends: ["ifNotNil:", "interpreter", "node"]
  43399. }),
  43400. $globals.ASTDebugger);
  43401. $core.addMethod(
  43402. $core.method({
  43403. selector: "onStep",
  43404. protocol: 'private',
  43405. fn: function (){
  43406. var self=this;
  43407. return $core.withContext(function($ctx1) {
  43408. var $1,$3,$2,$4,$6,$5,$receiver;
  43409. $1=self._interpreter();
  43410. $ctx1.sendIdx["interpreter"]=1;
  43411. self["@result"]=$recv($1)._result();
  43412. $3=self._interpreter();
  43413. $ctx1.sendIdx["interpreter"]=2;
  43414. $2=$recv($3)._atEnd();
  43415. $ctx1.sendIdx["atEnd"]=1;
  43416. if($core.assert($2)){
  43417. $4=$recv(self._context())._outerContext();
  43418. if(($receiver = $4) == null || $receiver.isNil){
  43419. $4;
  43420. } else {
  43421. var outerContext;
  43422. outerContext=$receiver;
  43423. self._context_(outerContext);
  43424. };
  43425. $6=self._interpreter();
  43426. $ctx1.sendIdx["interpreter"]=3;
  43427. $5=$recv($6)._atEnd();
  43428. if(!$core.assert($5)){
  43429. $recv(self._interpreter())._skip();
  43430. };
  43431. };
  43432. self._flushInnerContexts();
  43433. return self;
  43434. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  43435. },
  43436. args: [],
  43437. 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",
  43438. referencedClasses: [],
  43439. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  43440. }),
  43441. $globals.ASTDebugger);
  43442. $core.addMethod(
  43443. $core.method({
  43444. selector: "proceed",
  43445. protocol: 'stepping',
  43446. fn: function (){
  43447. var self=this;
  43448. return $core.withContext(function($ctx1) {
  43449. $recv((function(){
  43450. return $core.withContext(function($ctx2) {
  43451. return self._atEnd();
  43452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43453. }))._whileFalse_((function(){
  43454. return $core.withContext(function($ctx2) {
  43455. return self._stepOver();
  43456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43457. }));
  43458. return self;
  43459. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  43460. },
  43461. args: [],
  43462. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  43463. referencedClasses: [],
  43464. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  43465. }),
  43466. $globals.ASTDebugger);
  43467. $core.addMethod(
  43468. $core.method({
  43469. selector: "restart",
  43470. protocol: 'stepping',
  43471. fn: function (){
  43472. var self=this;
  43473. return $core.withContext(function($ctx1) {
  43474. $recv(self._interpreter())._restart();
  43475. self._flushInnerContexts();
  43476. return self;
  43477. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  43478. },
  43479. args: [],
  43480. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  43481. referencedClasses: [],
  43482. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  43483. }),
  43484. $globals.ASTDebugger);
  43485. $core.addMethod(
  43486. $core.method({
  43487. selector: "result",
  43488. protocol: 'accessing',
  43489. fn: function (){
  43490. var self=this;
  43491. var $1;
  43492. $1=self["@result"];
  43493. return $1;
  43494. },
  43495. args: [],
  43496. source: "result\x0a\x09^ result",
  43497. referencedClasses: [],
  43498. messageSends: []
  43499. }),
  43500. $globals.ASTDebugger);
  43501. $core.addMethod(
  43502. $core.method({
  43503. selector: "stepInto",
  43504. protocol: 'stepping',
  43505. fn: function (){
  43506. var self=this;
  43507. return $core.withContext(function($ctx1) {
  43508. self._shouldBeImplemented();
  43509. return self;
  43510. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  43511. },
  43512. args: [],
  43513. source: "stepInto\x0a\x09self shouldBeImplemented",
  43514. referencedClasses: [],
  43515. messageSends: ["shouldBeImplemented"]
  43516. }),
  43517. $globals.ASTDebugger);
  43518. $core.addMethod(
  43519. $core.method({
  43520. selector: "stepOver",
  43521. protocol: 'stepping',
  43522. fn: function (){
  43523. var self=this;
  43524. return $core.withContext(function($ctx1) {
  43525. var $1,$2;
  43526. $1=$recv(self._context())._isTopContext();
  43527. if($core.assert($1)){
  43528. $recv(self._interpreter())._stepOver();
  43529. } else {
  43530. $2=self._interpreter();
  43531. $ctx1.sendIdx["interpreter"]=1;
  43532. $recv($2)._skip();
  43533. };
  43534. self._onStep();
  43535. return self;
  43536. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  43537. },
  43538. args: [],
  43539. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  43540. referencedClasses: [],
  43541. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  43542. }),
  43543. $globals.ASTDebugger);
  43544. $core.addMethod(
  43545. $core.method({
  43546. selector: "context:",
  43547. protocol: 'instance creation',
  43548. fn: function (aContext){
  43549. var self=this;
  43550. return $core.withContext(function($ctx1) {
  43551. var $2,$3,$1;
  43552. $2=self._new();
  43553. $recv($2)._context_(aContext);
  43554. $3=$recv($2)._yourself();
  43555. $1=$3;
  43556. return $1;
  43557. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  43558. },
  43559. args: ["aContext"],
  43560. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  43561. referencedClasses: [],
  43562. messageSends: ["context:", "new", "yourself"]
  43563. }),
  43564. $globals.ASTDebugger.klass);
  43565. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  43566. $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";
  43567. $core.addMethod(
  43568. $core.method({
  43569. selector: "assign:to:",
  43570. protocol: 'private',
  43571. fn: function (aNode,anObject){
  43572. var self=this;
  43573. return $core.withContext(function($ctx1) {
  43574. var $1,$3,$2,$4;
  43575. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  43576. if($core.assert($1)){
  43577. $3=self._context();
  43578. $ctx1.sendIdx["context"]=1;
  43579. $2=$recv($3)._receiver();
  43580. $4=$recv(aNode)._value();
  43581. $ctx1.sendIdx["value"]=1;
  43582. $recv($2)._instVarAt_put_($4,anObject);
  43583. } else {
  43584. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  43585. };
  43586. return self;
  43587. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  43588. },
  43589. args: ["aNode", "anObject"],
  43590. 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 ]",
  43591. referencedClasses: [],
  43592. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  43593. }),
  43594. $globals.ASTInterpreter);
  43595. $core.addMethod(
  43596. $core.method({
  43597. selector: "atEnd",
  43598. protocol: 'testing',
  43599. fn: function (){
  43600. var self=this;
  43601. return $core.withContext(function($ctx1) {
  43602. var $1,$2;
  43603. $1=self["@forceAtEnd"];
  43604. if($core.assert($1)){
  43605. return true;
  43606. };
  43607. $2=$recv(self._hasReturned())._or_((function(){
  43608. return $core.withContext(function($ctx2) {
  43609. return $recv(self._node())._isNil();
  43610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43611. }));
  43612. return $2;
  43613. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  43614. },
  43615. args: [],
  43616. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  43617. referencedClasses: [],
  43618. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  43619. }),
  43620. $globals.ASTInterpreter);
  43621. $core.addMethod(
  43622. $core.method({
  43623. selector: "context",
  43624. protocol: 'accessing',
  43625. fn: function (){
  43626. var self=this;
  43627. var $1;
  43628. $1=self["@context"];
  43629. return $1;
  43630. },
  43631. args: [],
  43632. source: "context\x0a\x09^ context",
  43633. referencedClasses: [],
  43634. messageSends: []
  43635. }),
  43636. $globals.ASTInterpreter);
  43637. $core.addMethod(
  43638. $core.method({
  43639. selector: "context:",
  43640. protocol: 'accessing',
  43641. fn: function (aContext){
  43642. var self=this;
  43643. self["@context"]=aContext;
  43644. return self;
  43645. },
  43646. args: ["aContext"],
  43647. source: "context: aContext\x0a\x09context := aContext",
  43648. referencedClasses: [],
  43649. messageSends: []
  43650. }),
  43651. $globals.ASTInterpreter);
  43652. $core.addMethod(
  43653. $core.method({
  43654. selector: "eval:",
  43655. protocol: 'private',
  43656. fn: function (aString){
  43657. var self=this;
  43658. var source,function_;
  43659. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  43660. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  43661. return $core.withContext(function($ctx1) {
  43662. var $3,$2,$1,$4,$5;
  43663. source=$recv($String())._streamContents_((function(str){
  43664. return $core.withContext(function($ctx2) {
  43665. $recv(str)._nextPutAll_("0,(function(");
  43666. $ctx2.sendIdx["nextPutAll:"]=1;
  43667. $3=self._context();
  43668. $ctx2.sendIdx["context"]=1;
  43669. $2=$recv($3)._locals();
  43670. $ctx2.sendIdx["locals"]=1;
  43671. $1=$recv($2)._keys();
  43672. $recv($1)._do_separatedBy_((function(each){
  43673. return $core.withContext(function($ctx3) {
  43674. return $recv(str)._nextPutAll_(each);
  43675. $ctx3.sendIdx["nextPutAll:"]=2;
  43676. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  43677. }),(function(){
  43678. return $core.withContext(function($ctx3) {
  43679. return $recv(str)._nextPutAll_(",");
  43680. $ctx3.sendIdx["nextPutAll:"]=3;
  43681. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  43682. }));
  43683. $recv(str)._nextPutAll_("){ return (function() {");
  43684. $ctx2.sendIdx["nextPutAll:"]=4;
  43685. $recv(str)._nextPutAll_(aString);
  43686. $ctx2.sendIdx["nextPutAll:"]=5;
  43687. $4=$recv(str)._nextPutAll_("})()})");
  43688. return $4;
  43689. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  43690. }));
  43691. function_=$recv($recv($Compiler())._new())._eval_(source);
  43692. $5=$recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  43693. return $5;
  43694. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  43695. },
  43696. args: ["aString"],
  43697. 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",
  43698. referencedClasses: ["String", "Compiler"],
  43699. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  43700. }),
  43701. $globals.ASTInterpreter);
  43702. $core.addMethod(
  43703. $core.method({
  43704. selector: "hasReturned",
  43705. protocol: 'testing',
  43706. fn: function (){
  43707. var self=this;
  43708. return $core.withContext(function($ctx1) {
  43709. var $2,$1,$receiver;
  43710. $2=self["@returned"];
  43711. if(($receiver = $2) == null || $receiver.isNil){
  43712. $1=false;
  43713. } else {
  43714. $1=$2;
  43715. };
  43716. return $1;
  43717. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  43718. },
  43719. args: [],
  43720. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  43721. referencedClasses: [],
  43722. messageSends: ["ifNil:"]
  43723. }),
  43724. $globals.ASTInterpreter);
  43725. $core.addMethod(
  43726. $core.method({
  43727. selector: "initialize",
  43728. protocol: 'initialization',
  43729. fn: function (){
  43730. var self=this;
  43731. return $core.withContext(function($ctx1) {
  43732. (
  43733. $ctx1.supercall = true,
  43734. $globals.ASTInterpreter.superclass.fn.prototype._initialize.apply($recv(self), []));
  43735. $ctx1.supercall = false;
  43736. self["@forceAtEnd"]=false;
  43737. return self;
  43738. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  43739. },
  43740. args: [],
  43741. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  43742. referencedClasses: [],
  43743. messageSends: ["initialize"]
  43744. }),
  43745. $globals.ASTInterpreter);
  43746. $core.addMethod(
  43747. $core.method({
  43748. selector: "interpret",
  43749. protocol: 'interpreting',
  43750. fn: function (){
  43751. var self=this;
  43752. return $core.withContext(function($ctx1) {
  43753. self._visit_(self._node());
  43754. return self;
  43755. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  43756. },
  43757. args: [],
  43758. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  43759. referencedClasses: [],
  43760. messageSends: ["visit:", "node"]
  43761. }),
  43762. $globals.ASTInterpreter);
  43763. $core.addMethod(
  43764. $core.method({
  43765. selector: "interpret:",
  43766. protocol: 'interpreting',
  43767. fn: function (aNode){
  43768. var self=this;
  43769. return $core.withContext(function($ctx1) {
  43770. self._node_(aNode);
  43771. self._interpret();
  43772. return self;
  43773. }, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},$globals.ASTInterpreter)});
  43774. },
  43775. args: ["aNode"],
  43776. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  43777. referencedClasses: [],
  43778. messageSends: ["node:", "interpret"]
  43779. }),
  43780. $globals.ASTInterpreter);
  43781. $core.addMethod(
  43782. $core.method({
  43783. selector: "messageFromSendNode:arguments:",
  43784. protocol: 'private',
  43785. fn: function (aSendNode,aCollection){
  43786. var self=this;
  43787. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  43788. return $core.withContext(function($ctx1) {
  43789. var $2,$3,$1;
  43790. $2=$recv($Message())._new();
  43791. $recv($2)._selector_($recv(aSendNode)._selector());
  43792. $recv($2)._arguments_(aCollection);
  43793. $3=$recv($2)._yourself();
  43794. $1=$3;
  43795. return $1;
  43796. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  43797. },
  43798. args: ["aSendNode", "aCollection"],
  43799. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  43800. referencedClasses: ["Message"],
  43801. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  43802. }),
  43803. $globals.ASTInterpreter);
  43804. $core.addMethod(
  43805. $core.method({
  43806. selector: "messageNotUnderstood:receiver:",
  43807. protocol: 'private',
  43808. fn: function (aMessage,anObject){
  43809. var self=this;
  43810. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  43811. return $core.withContext(function($ctx1) {
  43812. var $1,$2;
  43813. $1=$recv($MessageNotUnderstood())._new();
  43814. $recv($1)._meesage_(aMessage);
  43815. $recv($1)._receiver_(anObject);
  43816. $2=$recv($1)._signal();
  43817. return self;
  43818. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  43819. },
  43820. args: ["aMessage", "anObject"],
  43821. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  43822. referencedClasses: ["MessageNotUnderstood"],
  43823. messageSends: ["meesage:", "new", "receiver:", "signal"]
  43824. }),
  43825. $globals.ASTInterpreter);
  43826. $core.addMethod(
  43827. $core.method({
  43828. selector: "next",
  43829. protocol: 'interpreting',
  43830. fn: function (){
  43831. var self=this;
  43832. return $core.withContext(function($ctx1) {
  43833. self._node_($recv(self._node())._nextNode());
  43834. return self;
  43835. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ASTInterpreter)});
  43836. },
  43837. args: [],
  43838. source: "next\x0a\x09self node: self node nextNode",
  43839. referencedClasses: [],
  43840. messageSends: ["node:", "nextNode", "node"]
  43841. }),
  43842. $globals.ASTInterpreter);
  43843. $core.addMethod(
  43844. $core.method({
  43845. selector: "node",
  43846. protocol: 'accessing',
  43847. fn: function (){
  43848. var self=this;
  43849. var $1;
  43850. $1=self["@node"];
  43851. return $1;
  43852. },
  43853. args: [],
  43854. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  43855. referencedClasses: [],
  43856. messageSends: []
  43857. }),
  43858. $globals.ASTInterpreter);
  43859. $core.addMethod(
  43860. $core.method({
  43861. selector: "node:",
  43862. protocol: 'accessing',
  43863. fn: function (aNode){
  43864. var self=this;
  43865. self["@node"]=aNode;
  43866. return self;
  43867. },
  43868. args: ["aNode"],
  43869. source: "node: aNode\x0a\x09node := aNode",
  43870. referencedClasses: [],
  43871. messageSends: []
  43872. }),
  43873. $globals.ASTInterpreter);
  43874. $core.addMethod(
  43875. $core.method({
  43876. selector: "peek",
  43877. protocol: 'stack',
  43878. fn: function (){
  43879. var self=this;
  43880. return $core.withContext(function($ctx1) {
  43881. var $1,$2;
  43882. var $early={};
  43883. try {
  43884. $1=self._stack();
  43885. $ctx1.sendIdx["stack"]=1;
  43886. $recv($1)._ifEmpty_((function(){
  43887. throw $early=[nil];
  43888. }));
  43889. $2=$recv(self._stack())._last();
  43890. return $2;
  43891. }
  43892. catch(e) {if(e===$early)return e[0]; throw e}
  43893. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  43894. },
  43895. args: [],
  43896. 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",
  43897. referencedClasses: [],
  43898. messageSends: ["ifEmpty:", "stack", "last"]
  43899. }),
  43900. $globals.ASTInterpreter);
  43901. $core.addMethod(
  43902. $core.method({
  43903. selector: "pop",
  43904. protocol: 'stack',
  43905. fn: function (){
  43906. var self=this;
  43907. var peekedValue;
  43908. return $core.withContext(function($ctx1) {
  43909. var $1;
  43910. peekedValue=self._peek();
  43911. $recv(self._stack())._removeLast();
  43912. $1=peekedValue;
  43913. return $1;
  43914. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  43915. },
  43916. args: [],
  43917. 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",
  43918. referencedClasses: [],
  43919. messageSends: ["peek", "removeLast", "stack"]
  43920. }),
  43921. $globals.ASTInterpreter);
  43922. $core.addMethod(
  43923. $core.method({
  43924. selector: "proceed",
  43925. protocol: 'interpreting',
  43926. fn: function (){
  43927. var self=this;
  43928. return $core.withContext(function($ctx1) {
  43929. $recv((function(){
  43930. return $core.withContext(function($ctx2) {
  43931. return self._atEnd();
  43932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43933. }))._whileFalse_((function(){
  43934. return $core.withContext(function($ctx2) {
  43935. return self._step();
  43936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43937. }));
  43938. return self;
  43939. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  43940. },
  43941. args: [],
  43942. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  43943. referencedClasses: [],
  43944. messageSends: ["whileFalse:", "atEnd", "step"]
  43945. }),
  43946. $globals.ASTInterpreter);
  43947. $core.addMethod(
  43948. $core.method({
  43949. selector: "push:",
  43950. protocol: 'stack',
  43951. fn: function (anObject){
  43952. var self=this;
  43953. return $core.withContext(function($ctx1) {
  43954. var $1;
  43955. $1=$recv(self._stack())._add_(anObject);
  43956. return $1;
  43957. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  43958. },
  43959. args: ["anObject"],
  43960. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  43961. referencedClasses: [],
  43962. messageSends: ["add:", "stack"]
  43963. }),
  43964. $globals.ASTInterpreter);
  43965. $core.addMethod(
  43966. $core.method({
  43967. selector: "restart",
  43968. protocol: 'interpreting',
  43969. fn: function (){
  43970. var self=this;
  43971. return $core.withContext(function($ctx1) {
  43972. self._node_($recv($recv(self._context())._ast())._nextChild());
  43973. return self;
  43974. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  43975. },
  43976. args: [],
  43977. source: "restart\x0a\x09self node: self context ast nextChild",
  43978. referencedClasses: [],
  43979. messageSends: ["node:", "nextChild", "ast", "context"]
  43980. }),
  43981. $globals.ASTInterpreter);
  43982. $core.addMethod(
  43983. $core.method({
  43984. selector: "result",
  43985. protocol: 'accessing',
  43986. fn: function (){
  43987. var self=this;
  43988. return $core.withContext(function($ctx1) {
  43989. var $2,$1;
  43990. $2=self._hasReturned();
  43991. if($core.assert($2)){
  43992. $1=self._returnValue();
  43993. } else {
  43994. $1=$recv(self._context())._receiver();
  43995. };
  43996. return $1;
  43997. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  43998. },
  43999. args: [],
  44000. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  44001. referencedClasses: [],
  44002. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  44003. }),
  44004. $globals.ASTInterpreter);
  44005. $core.addMethod(
  44006. $core.method({
  44007. selector: "returnValue",
  44008. protocol: 'accessing',
  44009. fn: function (){
  44010. var self=this;
  44011. var $1;
  44012. $1=self["@returnValue"];
  44013. return $1;
  44014. },
  44015. args: [],
  44016. source: "returnValue\x0a\x09^ returnValue",
  44017. referencedClasses: [],
  44018. messageSends: []
  44019. }),
  44020. $globals.ASTInterpreter);
  44021. $core.addMethod(
  44022. $core.method({
  44023. selector: "returnValue:",
  44024. protocol: 'accessing',
  44025. fn: function (anObject){
  44026. var self=this;
  44027. self["@returnValue"]=anObject;
  44028. return self;
  44029. },
  44030. args: ["anObject"],
  44031. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  44032. referencedClasses: [],
  44033. messageSends: []
  44034. }),
  44035. $globals.ASTInterpreter);
  44036. $core.addMethod(
  44037. $core.method({
  44038. selector: "sendMessage:to:superSend:",
  44039. protocol: 'private',
  44040. fn: function (aMessage,anObject,aBoolean){
  44041. var self=this;
  44042. var method;
  44043. return $core.withContext(function($ctx1) {
  44044. var $1,$3,$2,$4,$5,$6,$receiver;
  44045. var $early={};
  44046. try {
  44047. if(!$core.assert(aBoolean)){
  44048. $1=$recv(aMessage)._sendTo_(anObject);
  44049. return $1;
  44050. };
  44051. $3=$recv(anObject)._class();
  44052. $ctx1.sendIdx["class"]=1;
  44053. $2=$recv($3)._superclass();
  44054. $ctx1.sendIdx["superclass"]=1;
  44055. if(($receiver = $2) == null || $receiver.isNil){
  44056. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  44057. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  44058. return $4;
  44059. } else {
  44060. $2;
  44061. };
  44062. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  44063. return $core.withContext(function($ctx2) {
  44064. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  44065. throw $early=[$5];
  44066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44067. }));
  44068. $6=$recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  44069. return $6;
  44070. }
  44071. catch(e) {if(e===$early)return e[0]; throw e}
  44072. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  44073. },
  44074. args: ["aMessage", "anObject", "aBoolean"],
  44075. 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",
  44076. referencedClasses: [],
  44077. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  44078. }),
  44079. $globals.ASTInterpreter);
  44080. $core.addMethod(
  44081. $core.method({
  44082. selector: "setNonLocalReturnFromContext:",
  44083. protocol: 'interpreting',
  44084. fn: function (aContext){
  44085. var self=this;
  44086. return $core.withContext(function($ctx1) {
  44087. var $2,$1;
  44088. $2=$recv(aContext)._interpreter();
  44089. $ctx1.sendIdx["interpreter"]=1;
  44090. $1=$recv($2)._hasReturned();
  44091. if($core.assert($1)){
  44092. self["@returned"]=true;
  44093. self["@returned"];
  44094. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  44095. };
  44096. return self;
  44097. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  44098. },
  44099. args: ["aContext"],
  44100. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  44101. referencedClasses: [],
  44102. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  44103. }),
  44104. $globals.ASTInterpreter);
  44105. $core.addMethod(
  44106. $core.method({
  44107. selector: "skip",
  44108. protocol: 'interpreting',
  44109. fn: function (){
  44110. var self=this;
  44111. return $core.withContext(function($ctx1) {
  44112. self._next();
  44113. return self;
  44114. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  44115. },
  44116. args: [],
  44117. source: "skip\x0a\x09self next",
  44118. referencedClasses: [],
  44119. messageSends: ["next"]
  44120. }),
  44121. $globals.ASTInterpreter);
  44122. $core.addMethod(
  44123. $core.method({
  44124. selector: "stack",
  44125. protocol: 'accessing',
  44126. fn: function (){
  44127. var self=this;
  44128. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44129. return $core.withContext(function($ctx1) {
  44130. var $2,$1,$receiver;
  44131. $2=self["@stack"];
  44132. if(($receiver = $2) == null || $receiver.isNil){
  44133. self["@stack"]=$recv($OrderedCollection())._new();
  44134. $1=self["@stack"];
  44135. } else {
  44136. $1=$2;
  44137. };
  44138. return $1;
  44139. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  44140. },
  44141. args: [],
  44142. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  44143. referencedClasses: ["OrderedCollection"],
  44144. messageSends: ["ifNil:", "new"]
  44145. }),
  44146. $globals.ASTInterpreter);
  44147. $core.addMethod(
  44148. $core.method({
  44149. selector: "step",
  44150. protocol: 'interpreting',
  44151. fn: function (){
  44152. var self=this;
  44153. return $core.withContext(function($ctx1) {
  44154. var $1;
  44155. self._interpret();
  44156. $1=self._next();
  44157. return self;
  44158. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  44159. },
  44160. args: [],
  44161. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  44162. referencedClasses: [],
  44163. messageSends: ["interpret", "next"]
  44164. }),
  44165. $globals.ASTInterpreter);
  44166. $core.addMethod(
  44167. $core.method({
  44168. selector: "stepOver",
  44169. protocol: 'interpreting',
  44170. fn: function (){
  44171. var self=this;
  44172. return $core.withContext(function($ctx1) {
  44173. var $2,$1;
  44174. self._step();
  44175. $ctx1.sendIdx["step"]=1;
  44176. $recv((function(){
  44177. return $core.withContext(function($ctx2) {
  44178. $2=self._node();
  44179. $ctx2.sendIdx["node"]=1;
  44180. $1=$recv($2)._isNil();
  44181. return $recv($1)._or_((function(){
  44182. return $core.withContext(function($ctx3) {
  44183. return $recv(self._node())._isSteppingNode();
  44184. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44185. }));
  44186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44187. }))._whileFalse_((function(){
  44188. return $core.withContext(function($ctx2) {
  44189. return self._step();
  44190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44191. }));
  44192. return self;
  44193. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  44194. },
  44195. args: [],
  44196. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  44197. referencedClasses: [],
  44198. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  44199. }),
  44200. $globals.ASTInterpreter);
  44201. $core.addMethod(
  44202. $core.method({
  44203. selector: "visit:",
  44204. protocol: 'visiting',
  44205. fn: function (aNode){
  44206. var self=this;
  44207. return $core.withContext(function($ctx1) {
  44208. var $1;
  44209. $1=self._hasReturned();
  44210. if(!$core.assert($1)){
  44211. (
  44212. $ctx1.supercall = true,
  44213. $globals.ASTInterpreter.superclass.fn.prototype._visit_.apply($recv(self), [aNode]));
  44214. $ctx1.supercall = false;
  44215. };
  44216. return self;
  44217. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  44218. },
  44219. args: ["aNode"],
  44220. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  44221. referencedClasses: [],
  44222. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  44223. }),
  44224. $globals.ASTInterpreter);
  44225. $core.addMethod(
  44226. $core.method({
  44227. selector: "visitAssignmentNode:",
  44228. protocol: 'visiting',
  44229. fn: function (aNode){
  44230. var self=this;
  44231. var poppedValue;
  44232. return $core.withContext(function($ctx1) {
  44233. poppedValue=self._pop();
  44234. $ctx1.sendIdx["pop"]=1;
  44235. self._pop();
  44236. self._push_(poppedValue);
  44237. self._assign_to_($recv(aNode)._left(),poppedValue);
  44238. return self;
  44239. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  44240. },
  44241. args: ["aNode"],
  44242. 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",
  44243. referencedClasses: [],
  44244. messageSends: ["pop", "push:", "assign:to:", "left"]
  44245. }),
  44246. $globals.ASTInterpreter);
  44247. $core.addMethod(
  44248. $core.method({
  44249. selector: "visitBlockNode:",
  44250. protocol: 'visiting',
  44251. fn: function (aNode){
  44252. var self=this;
  44253. var block;
  44254. function $AIBlockClosure(){return $globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  44255. return $core.withContext(function($ctx1) {
  44256. block=$recv($AIBlockClosure())._forContext_node_(self._context(),aNode);
  44257. self._push_(block);
  44258. return self;
  44259. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  44260. },
  44261. args: ["aNode"],
  44262. 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",
  44263. referencedClasses: ["AIBlockClosure"],
  44264. messageSends: ["forContext:node:", "context", "push:"]
  44265. }),
  44266. $globals.ASTInterpreter);
  44267. $core.addMethod(
  44268. $core.method({
  44269. selector: "visitBlockSequenceNode:",
  44270. protocol: 'visiting',
  44271. fn: function (aNode){
  44272. var self=this;
  44273. return $core.withContext(function($ctx1) {
  44274. (
  44275. $ctx1.supercall = true,
  44276. $globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  44277. $ctx1.supercall = false;
  44278. self["@forceAtEnd"]=true;
  44279. return self;
  44280. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44281. },
  44282. args: ["aNode"],
  44283. 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",
  44284. referencedClasses: [],
  44285. messageSends: ["visitBlockSequenceNode:"]
  44286. }),
  44287. $globals.ASTInterpreter);
  44288. $core.addMethod(
  44289. $core.method({
  44290. selector: "visitDynamicArrayNode:",
  44291. protocol: 'visiting',
  44292. fn: function (aNode){
  44293. var self=this;
  44294. var array;
  44295. return $core.withContext(function($ctx1) {
  44296. array=[];
  44297. $recv($recv(aNode)._nodes())._do_((function(each){
  44298. return $core.withContext(function($ctx2) {
  44299. return $recv(array)._addFirst_(self._pop());
  44300. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44301. }));
  44302. self._push_(array);
  44303. return self;
  44304. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  44305. },
  44306. args: ["aNode"],
  44307. 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",
  44308. referencedClasses: [],
  44309. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  44310. }),
  44311. $globals.ASTInterpreter);
  44312. $core.addMethod(
  44313. $core.method({
  44314. selector: "visitDynamicDictionaryNode:",
  44315. protocol: 'visiting',
  44316. fn: function (aNode){
  44317. var self=this;
  44318. var keyValueList;
  44319. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44320. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  44321. return $core.withContext(function($ctx1) {
  44322. keyValueList=$recv($OrderedCollection())._new();
  44323. $recv($recv(aNode)._nodes())._do_((function(each){
  44324. return $core.withContext(function($ctx2) {
  44325. return $recv(keyValueList)._add_(self._pop());
  44326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44327. }));
  44328. self._push_($recv($HashedCollection())._newFromPairs_($recv(keyValueList)._reversed()));
  44329. return self;
  44330. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  44331. },
  44332. args: ["aNode"],
  44333. 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)",
  44334. referencedClasses: ["OrderedCollection", "HashedCollection"],
  44335. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  44336. }),
  44337. $globals.ASTInterpreter);
  44338. $core.addMethod(
  44339. $core.method({
  44340. selector: "visitJSStatementNode:",
  44341. protocol: 'visiting',
  44342. fn: function (aNode){
  44343. var self=this;
  44344. return $core.withContext(function($ctx1) {
  44345. self["@returned"]=true;
  44346. self._returnValue_(self._eval_($recv(aNode)._source()));
  44347. return self;
  44348. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44349. },
  44350. args: ["aNode"],
  44351. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  44352. referencedClasses: [],
  44353. messageSends: ["returnValue:", "eval:", "source"]
  44354. }),
  44355. $globals.ASTInterpreter);
  44356. $core.addMethod(
  44357. $core.method({
  44358. selector: "visitNode:",
  44359. protocol: 'visiting',
  44360. fn: function (aNode){
  44361. var self=this;
  44362. return self;
  44363. },
  44364. args: ["aNode"],
  44365. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  44366. referencedClasses: [],
  44367. messageSends: []
  44368. }),
  44369. $globals.ASTInterpreter);
  44370. $core.addMethod(
  44371. $core.method({
  44372. selector: "visitReturnNode:",
  44373. protocol: 'visiting',
  44374. fn: function (aNode){
  44375. var self=this;
  44376. return $core.withContext(function($ctx1) {
  44377. self["@returned"]=true;
  44378. self._returnValue_(self._pop());
  44379. return self;
  44380. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44381. },
  44382. args: ["aNode"],
  44383. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  44384. referencedClasses: [],
  44385. messageSends: ["returnValue:", "pop"]
  44386. }),
  44387. $globals.ASTInterpreter);
  44388. $core.addMethod(
  44389. $core.method({
  44390. selector: "visitSendNode:",
  44391. protocol: 'visiting',
  44392. fn: function (aNode){
  44393. var self=this;
  44394. var receiver,args,message,result;
  44395. return $core.withContext(function($ctx1) {
  44396. var $1;
  44397. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  44398. return $core.withContext(function($ctx2) {
  44399. return self._pop();
  44400. $ctx2.sendIdx["pop"]=1;
  44401. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44402. }));
  44403. receiver=self._pop();
  44404. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  44405. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  44406. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  44407. return $core.withContext(function($ctx2) {
  44408. return $recv($recv(aNode)._isLastChild())._not();
  44409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44410. }));
  44411. if($core.assert($1)){
  44412. self._push_(receiver);
  44413. $ctx1.sendIdx["push:"]=1;
  44414. } else {
  44415. self._push_(result);
  44416. };
  44417. return self;
  44418. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  44419. },
  44420. args: ["aNode"],
  44421. 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 ]",
  44422. referencedClasses: [],
  44423. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  44424. }),
  44425. $globals.ASTInterpreter);
  44426. $core.addMethod(
  44427. $core.method({
  44428. selector: "visitSequenceNode:",
  44429. protocol: 'visiting',
  44430. fn: function (aNode){
  44431. var self=this;
  44432. return $core.withContext(function($ctx1) {
  44433. $recv($recv(aNode)._temps())._do_((function(each){
  44434. return $core.withContext(function($ctx2) {
  44435. return $recv(self._context())._defineLocal_(each);
  44436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44437. }));
  44438. return self;
  44439. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44440. },
  44441. args: ["aNode"],
  44442. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]",
  44443. referencedClasses: [],
  44444. messageSends: ["do:", "temps", "defineLocal:", "context"]
  44445. }),
  44446. $globals.ASTInterpreter);
  44447. $core.addMethod(
  44448. $core.method({
  44449. selector: "visitValueNode:",
  44450. protocol: 'visiting',
  44451. fn: function (aNode){
  44452. var self=this;
  44453. return $core.withContext(function($ctx1) {
  44454. self._push_($recv(aNode)._value());
  44455. return self;
  44456. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44457. },
  44458. args: ["aNode"],
  44459. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  44460. referencedClasses: [],
  44461. messageSends: ["push:", "value"]
  44462. }),
  44463. $globals.ASTInterpreter);
  44464. $core.addMethod(
  44465. $core.method({
  44466. selector: "visitVariableNode:",
  44467. protocol: 'visiting',
  44468. fn: function (aNode){
  44469. var self=this;
  44470. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  44471. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  44472. return $core.withContext(function($ctx1) {
  44473. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  44474. $2=$recv(aNode)._binding();
  44475. $ctx1.sendIdx["binding"]=1;
  44476. $1=$recv($2)._isUnknownVar();
  44477. if($core.assert($1)){
  44478. $5=$recv($Platform())._globals();
  44479. $ctx1.sendIdx["globals"]=1;
  44480. $6=$recv(aNode)._value();
  44481. $ctx1.sendIdx["value"]=1;
  44482. $4=$recv($5)._at_ifAbsent_($6,(function(){
  44483. return $core.withContext(function($ctx2) {
  44484. return self._error_("Unknown variable");
  44485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44486. }));
  44487. $ctx1.sendIdx["at:ifAbsent:"]=1;
  44488. $3=self._push_($4);
  44489. $ctx1.sendIdx["push:"]=1;
  44490. return $3;
  44491. };
  44492. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  44493. if($core.assert($8)){
  44494. $10=self._context();
  44495. $ctx1.sendIdx["context"]=1;
  44496. $9=$recv($10)._receiver();
  44497. $11=$recv(aNode)._value();
  44498. $ctx1.sendIdx["value"]=2;
  44499. $7=$recv($9)._instVarAt_($11);
  44500. } else {
  44501. $12=self._context();
  44502. $13=$recv(aNode)._value();
  44503. $ctx1.sendIdx["value"]=3;
  44504. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  44505. return $core.withContext(function($ctx2) {
  44506. $15=$recv(aNode)._value();
  44507. $ctx2.sendIdx["value"]=4;
  44508. $14=$recv($15)._isCapitalized();
  44509. if($core.assert($14)){
  44510. $16=$recv($Smalltalk())._globals();
  44511. $ctx2.sendIdx["globals"]=2;
  44512. $17=$recv(aNode)._value();
  44513. $ctx2.sendIdx["value"]=5;
  44514. return $recv($16)._at_ifAbsent_($17,(function(){
  44515. return $core.withContext(function($ctx3) {
  44516. return $recv($recv($Platform())._globals())._at_($recv(aNode)._value());
  44517. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  44518. }));
  44519. };
  44520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  44521. }));
  44522. };
  44523. self._push_($7);
  44524. return self;
  44525. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44526. },
  44527. args: ["aNode"],
  44528. 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 ] ] ] ])",
  44529. referencedClasses: ["Platform", "Smalltalk"],
  44530. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  44531. }),
  44532. $globals.ASTInterpreter);
  44533. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  44534. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  44535. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  44536. $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`";
  44537. $core.addMethod(
  44538. $core.method({
  44539. selector: "context",
  44540. protocol: 'accessing',
  44541. fn: function (){
  44542. var self=this;
  44543. var $1;
  44544. $1=self["@context"];
  44545. return $1;
  44546. },
  44547. args: [],
  44548. source: "context\x0a\x09^ context",
  44549. referencedClasses: [],
  44550. messageSends: []
  44551. }),
  44552. $globals.ASTPCNodeVisitor);
  44553. $core.addMethod(
  44554. $core.method({
  44555. selector: "context:",
  44556. protocol: 'accessing',
  44557. fn: function (aContext){
  44558. var self=this;
  44559. self["@context"]=aContext;
  44560. return self;
  44561. },
  44562. args: ["aContext"],
  44563. source: "context: aContext\x0a\x09context := aContext",
  44564. referencedClasses: [],
  44565. messageSends: []
  44566. }),
  44567. $globals.ASTPCNodeVisitor);
  44568. $core.addMethod(
  44569. $core.method({
  44570. selector: "currentNode",
  44571. protocol: 'accessing',
  44572. fn: function (){
  44573. var self=this;
  44574. var $1;
  44575. $1=self["@currentNode"];
  44576. return $1;
  44577. },
  44578. args: [],
  44579. source: "currentNode\x0a\x09^ currentNode",
  44580. referencedClasses: [],
  44581. messageSends: []
  44582. }),
  44583. $globals.ASTPCNodeVisitor);
  44584. $core.addMethod(
  44585. $core.method({
  44586. selector: "increaseIndex",
  44587. protocol: 'accessing',
  44588. fn: function (){
  44589. var self=this;
  44590. return $core.withContext(function($ctx1) {
  44591. self["@index"]=$recv(self._index()).__plus((1));
  44592. return self;
  44593. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)});
  44594. },
  44595. args: [],
  44596. source: "increaseIndex\x0a\x09index := self index + 1",
  44597. referencedClasses: [],
  44598. messageSends: ["+", "index"]
  44599. }),
  44600. $globals.ASTPCNodeVisitor);
  44601. $core.addMethod(
  44602. $core.method({
  44603. selector: "index",
  44604. protocol: 'accessing',
  44605. fn: function (){
  44606. var self=this;
  44607. return $core.withContext(function($ctx1) {
  44608. var $2,$1,$receiver;
  44609. $2=self["@index"];
  44610. if(($receiver = $2) == null || $receiver.isNil){
  44611. self["@index"]=(0);
  44612. $1=self["@index"];
  44613. } else {
  44614. $1=$2;
  44615. };
  44616. return $1;
  44617. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)});
  44618. },
  44619. args: [],
  44620. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  44621. referencedClasses: [],
  44622. messageSends: ["ifNil:"]
  44623. }),
  44624. $globals.ASTPCNodeVisitor);
  44625. $core.addMethod(
  44626. $core.method({
  44627. selector: "selector",
  44628. protocol: 'accessing',
  44629. fn: function (){
  44630. var self=this;
  44631. var $1;
  44632. $1=self["@selector"];
  44633. return $1;
  44634. },
  44635. args: [],
  44636. source: "selector\x0a\x09^ selector",
  44637. referencedClasses: [],
  44638. messageSends: []
  44639. }),
  44640. $globals.ASTPCNodeVisitor);
  44641. $core.addMethod(
  44642. $core.method({
  44643. selector: "selector:",
  44644. protocol: 'accessing',
  44645. fn: function (aString){
  44646. var self=this;
  44647. self["@selector"]=aString;
  44648. return self;
  44649. },
  44650. args: ["aString"],
  44651. source: "selector: aString\x0a\x09selector := aString",
  44652. referencedClasses: [],
  44653. messageSends: []
  44654. }),
  44655. $globals.ASTPCNodeVisitor);
  44656. $core.addMethod(
  44657. $core.method({
  44658. selector: "visitJSStatementNode:",
  44659. protocol: 'visiting',
  44660. fn: function (aNode){
  44661. var self=this;
  44662. self["@currentNode"]=aNode;
  44663. return self;
  44664. },
  44665. args: ["aNode"],
  44666. 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",
  44667. referencedClasses: [],
  44668. messageSends: []
  44669. }),
  44670. $globals.ASTPCNodeVisitor);
  44671. $core.addMethod(
  44672. $core.method({
  44673. selector: "visitSendNode:",
  44674. protocol: 'visiting',
  44675. fn: function (aNode){
  44676. var self=this;
  44677. var sendIndex;
  44678. return $core.withContext(function($ctx1) {
  44679. var $1,$2,$4,$3,$5;
  44680. $1=self._context();
  44681. $2=self._selector();
  44682. $ctx1.sendIdx["selector"]=1;
  44683. sendIndex=$recv($1)._sendIndexAt_($2);
  44684. (
  44685. $ctx1.supercall = true,
  44686. $globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  44687. $ctx1.supercall = false;
  44688. $4=self._selector();
  44689. $ctx1.sendIdx["selector"]=2;
  44690. $3=$recv($4).__eq($recv(aNode)._selector());
  44691. $ctx1.sendIdx["="]=1;
  44692. if($core.assert($3)){
  44693. $5=$recv(self._index()).__eq(sendIndex);
  44694. if($core.assert($5)){
  44695. self["@currentNode"]=aNode;
  44696. self["@currentNode"];
  44697. };
  44698. self._increaseIndex();
  44699. };
  44700. return self;
  44701. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)});
  44702. },
  44703. args: ["aNode"],
  44704. 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 ]",
  44705. referencedClasses: [],
  44706. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  44707. }),
  44708. $globals.ASTPCNodeVisitor);
  44709. $core.addMethod(
  44710. $core.method({
  44711. selector: "isSteppingNode",
  44712. protocol: '*Compiler-Interpreter',
  44713. fn: function (){
  44714. var self=this;
  44715. return true;
  44716. },
  44717. args: [],
  44718. source: "isSteppingNode\x0a\x09^ true",
  44719. referencedClasses: [],
  44720. messageSends: []
  44721. }),
  44722. $globals.AssignmentNode);
  44723. $core.addMethod(
  44724. $core.method({
  44725. selector: "isSteppingNode",
  44726. protocol: '*Compiler-Interpreter',
  44727. fn: function (){
  44728. var self=this;
  44729. return true;
  44730. },
  44731. args: [],
  44732. source: "isSteppingNode\x0a\x09^ true",
  44733. referencedClasses: [],
  44734. messageSends: []
  44735. }),
  44736. $globals.BlockNode);
  44737. $core.addMethod(
  44738. $core.method({
  44739. selector: "isSteppingNode",
  44740. protocol: '*Compiler-Interpreter',
  44741. fn: function (){
  44742. var self=this;
  44743. return true;
  44744. },
  44745. args: [],
  44746. source: "isSteppingNode\x0a\x09^ true",
  44747. referencedClasses: [],
  44748. messageSends: []
  44749. }),
  44750. $globals.DynamicArrayNode);
  44751. $core.addMethod(
  44752. $core.method({
  44753. selector: "isSteppingNode",
  44754. protocol: '*Compiler-Interpreter',
  44755. fn: function (){
  44756. var self=this;
  44757. return true;
  44758. },
  44759. args: [],
  44760. source: "isSteppingNode\x0a\x09^ true",
  44761. referencedClasses: [],
  44762. messageSends: []
  44763. }),
  44764. $globals.DynamicDictionaryNode);
  44765. $core.addMethod(
  44766. $core.method({
  44767. selector: "isSteppingNode",
  44768. protocol: '*Compiler-Interpreter',
  44769. fn: function (){
  44770. var self=this;
  44771. return true;
  44772. },
  44773. args: [],
  44774. source: "isSteppingNode\x0a\x09^ true",
  44775. referencedClasses: [],
  44776. messageSends: []
  44777. }),
  44778. $globals.JSStatementNode);
  44779. $core.addMethod(
  44780. $core.method({
  44781. selector: "isSteppingNode",
  44782. protocol: '*Compiler-Interpreter',
  44783. fn: function (){
  44784. var self=this;
  44785. return false;
  44786. },
  44787. args: [],
  44788. source: "isSteppingNode\x0a\x09^ false",
  44789. referencedClasses: [],
  44790. messageSends: []
  44791. }),
  44792. $globals.Node);
  44793. $core.addMethod(
  44794. $core.method({
  44795. selector: "isSteppingNode",
  44796. protocol: '*Compiler-Interpreter',
  44797. fn: function (){
  44798. var self=this;
  44799. return true;
  44800. },
  44801. args: [],
  44802. source: "isSteppingNode\x0a\x09^ true",
  44803. referencedClasses: [],
  44804. messageSends: []
  44805. }),
  44806. $globals.SendNode);
  44807. });
  44808. define('amber/lang',[
  44809. './helpers', // pre-fetch, dep of ./deploy
  44810. './deploy',
  44811. './parser',
  44812. // --- packages for the Amber reflection begin here ---
  44813. 'amber_core/Platform-ImportExport',
  44814. 'amber_core/Compiler-Exceptions',
  44815. 'amber_core/Compiler-Core',
  44816. 'amber_core/Compiler-AST',
  44817. 'amber_core/Compiler-Semantic',
  44818. 'amber_core/Compiler-IR',
  44819. 'amber_core/Compiler-Inlining',
  44820. 'amber_core/Compiler-Interpreter'
  44821. // --- packages for the Amber reflection end here ---
  44822. ], function (amber) { return amber; });
  44823. 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";
  44824. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  44825. $core.addPackage('SUnit');
  44826. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  44827. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44828. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  44829. $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.";
  44830. $core.addMethod(
  44831. $core.method({
  44832. selector: "result",
  44833. protocol: 'accessing',
  44834. fn: function (){
  44835. var self=this;
  44836. var $1;
  44837. $1=self["@result"];
  44838. return $1;
  44839. },
  44840. args: [],
  44841. source: "result\x0a\x09^ result",
  44842. referencedClasses: [],
  44843. messageSends: []
  44844. }),
  44845. $globals.ResultAnnouncement);
  44846. $core.addMethod(
  44847. $core.method({
  44848. selector: "result:",
  44849. protocol: 'accessing',
  44850. fn: function (aTestResult){
  44851. var self=this;
  44852. self["@result"]=aTestResult;
  44853. return self;
  44854. },
  44855. args: ["aTestResult"],
  44856. source: "result: aTestResult\x0a\x09result := aTestResult",
  44857. referencedClasses: [],
  44858. messageSends: []
  44859. }),
  44860. $globals.ResultAnnouncement);
  44861. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  44862. $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.";
  44863. $core.addMethod(
  44864. $core.method({
  44865. selector: "assert:",
  44866. protocol: 'testing',
  44867. fn: function (aBoolean){
  44868. var self=this;
  44869. return $core.withContext(function($ctx1) {
  44870. self._assert_description_(aBoolean,"Assertion failed");
  44871. return self;
  44872. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  44873. },
  44874. args: ["aBoolean"],
  44875. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  44876. referencedClasses: [],
  44877. messageSends: ["assert:description:"]
  44878. }),
  44879. $globals.TestCase);
  44880. $core.addMethod(
  44881. $core.method({
  44882. selector: "assert:description:",
  44883. protocol: 'testing',
  44884. fn: function (aBoolean,aString){
  44885. var self=this;
  44886. return $core.withContext(function($ctx1) {
  44887. if(!$core.assert(aBoolean)){
  44888. self._signalFailure_(aString);
  44889. };
  44890. return self;
  44891. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  44892. },
  44893. args: ["aBoolean", "aString"],
  44894. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  44895. referencedClasses: [],
  44896. messageSends: ["ifFalse:", "signalFailure:"]
  44897. }),
  44898. $globals.TestCase);
  44899. $core.addMethod(
  44900. $core.method({
  44901. selector: "assert:equals:",
  44902. protocol: 'testing',
  44903. fn: function (actual,expected){
  44904. var self=this;
  44905. return $core.withContext(function($ctx1) {
  44906. var $2,$6,$5,$4,$3,$1;
  44907. $2=$recv(actual).__eq(expected);
  44908. $6=$recv(expected)._printString();
  44909. $ctx1.sendIdx["printString"]=1;
  44910. $5="Expected: ".__comma($6);
  44911. $4=$recv($5).__comma(" but was: ");
  44912. $ctx1.sendIdx[","]=2;
  44913. $3=$recv($4).__comma($recv(actual)._printString());
  44914. $ctx1.sendIdx[","]=1;
  44915. $1=self._assert_description_($2,$3);
  44916. return $1;
  44917. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  44918. },
  44919. args: ["actual", "expected"],
  44920. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  44921. referencedClasses: [],
  44922. messageSends: ["assert:description:", "=", ",", "printString"]
  44923. }),
  44924. $globals.TestCase);
  44925. $core.addMethod(
  44926. $core.method({
  44927. selector: "async:",
  44928. protocol: 'async',
  44929. fn: function (aBlock){
  44930. var self=this;
  44931. var c;
  44932. return $core.withContext(function($ctx1) {
  44933. var $2,$1;
  44934. self._errorIfNotAsync_("#async");
  44935. c=self["@context"];
  44936. $1=(function(){
  44937. return $core.withContext(function($ctx2) {
  44938. $2=self._isAsync();
  44939. if($core.assert($2)){
  44940. return $recv(c)._execute_(aBlock);
  44941. };
  44942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44943. });
  44944. return $1;
  44945. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  44946. },
  44947. args: ["aBlock"],
  44948. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  44949. referencedClasses: [],
  44950. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  44951. }),
  44952. $globals.TestCase);
  44953. $core.addMethod(
  44954. $core.method({
  44955. selector: "context:",
  44956. protocol: 'accessing',
  44957. fn: function (aRunningTestContext){
  44958. var self=this;
  44959. self["@context"]=aRunningTestContext;
  44960. return self;
  44961. },
  44962. args: ["aRunningTestContext"],
  44963. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  44964. referencedClasses: [],
  44965. messageSends: []
  44966. }),
  44967. $globals.TestCase);
  44968. $core.addMethod(
  44969. $core.method({
  44970. selector: "deny:",
  44971. protocol: 'testing',
  44972. fn: function (aBoolean){
  44973. var self=this;
  44974. return $core.withContext(function($ctx1) {
  44975. self._assert_($recv(aBoolean)._not());
  44976. return self;
  44977. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  44978. },
  44979. args: ["aBoolean"],
  44980. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  44981. referencedClasses: [],
  44982. messageSends: ["assert:", "not"]
  44983. }),
  44984. $globals.TestCase);
  44985. $core.addMethod(
  44986. $core.method({
  44987. selector: "errorIfNotAsync:",
  44988. protocol: 'error handling',
  44989. fn: function (aString){
  44990. var self=this;
  44991. return $core.withContext(function($ctx1) {
  44992. var $1;
  44993. $1=self._isAsync();
  44994. if(!$core.assert($1)){
  44995. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  44996. };
  44997. return self;
  44998. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  44999. },
  45000. args: ["aString"],
  45001. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  45002. referencedClasses: [],
  45003. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  45004. }),
  45005. $globals.TestCase);
  45006. $core.addMethod(
  45007. $core.method({
  45008. selector: "finished",
  45009. protocol: 'async',
  45010. fn: function (){
  45011. var self=this;
  45012. return $core.withContext(function($ctx1) {
  45013. self._errorIfNotAsync_("#finished");
  45014. self["@asyncTimeout"]=nil;
  45015. return self;
  45016. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  45017. },
  45018. args: [],
  45019. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  45020. referencedClasses: [],
  45021. messageSends: ["errorIfNotAsync:"]
  45022. }),
  45023. $globals.TestCase);
  45024. $core.addMethod(
  45025. $core.method({
  45026. selector: "isAsync",
  45027. protocol: 'testing',
  45028. fn: function (){
  45029. var self=this;
  45030. return $core.withContext(function($ctx1) {
  45031. var $1;
  45032. $1=$recv(self["@asyncTimeout"])._notNil();
  45033. return $1;
  45034. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  45035. },
  45036. args: [],
  45037. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  45038. referencedClasses: [],
  45039. messageSends: ["notNil"]
  45040. }),
  45041. $globals.TestCase);
  45042. $core.addMethod(
  45043. $core.method({
  45044. selector: "performTest",
  45045. protocol: 'running',
  45046. fn: function (){
  45047. var self=this;
  45048. return $core.withContext(function($ctx1) {
  45049. self["@asyncTimeout"]=nil;
  45050. self._perform_(self._selector());
  45051. return self;
  45052. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  45053. },
  45054. args: [],
  45055. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  45056. referencedClasses: [],
  45057. messageSends: ["perform:", "selector"]
  45058. }),
  45059. $globals.TestCase);
  45060. $core.addMethod(
  45061. $core.method({
  45062. selector: "runCase",
  45063. protocol: 'running',
  45064. fn: function (){
  45065. var self=this;
  45066. function $TestContext(){return $globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)}
  45067. return $core.withContext(function($ctx1) {
  45068. $recv($recv($TestContext())._testCase_(self))._start();
  45069. return self;
  45070. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  45071. },
  45072. args: [],
  45073. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  45074. referencedClasses: ["TestContext"],
  45075. messageSends: ["start", "testCase:"]
  45076. }),
  45077. $globals.TestCase);
  45078. $core.addMethod(
  45079. $core.method({
  45080. selector: "selector",
  45081. protocol: 'accessing',
  45082. fn: function (){
  45083. var self=this;
  45084. var $1;
  45085. $1=self["@testSelector"];
  45086. return $1;
  45087. },
  45088. args: [],
  45089. source: "selector\x0a\x09^ testSelector",
  45090. referencedClasses: [],
  45091. messageSends: []
  45092. }),
  45093. $globals.TestCase);
  45094. $core.addMethod(
  45095. $core.method({
  45096. selector: "setTestSelector:",
  45097. protocol: 'accessing',
  45098. fn: function (aSelector){
  45099. var self=this;
  45100. self["@testSelector"]=aSelector;
  45101. return self;
  45102. },
  45103. args: ["aSelector"],
  45104. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  45105. referencedClasses: [],
  45106. messageSends: []
  45107. }),
  45108. $globals.TestCase);
  45109. $core.addMethod(
  45110. $core.method({
  45111. selector: "setUp",
  45112. protocol: 'running',
  45113. fn: function (){
  45114. var self=this;
  45115. return self;
  45116. },
  45117. args: [],
  45118. source: "setUp",
  45119. referencedClasses: [],
  45120. messageSends: []
  45121. }),
  45122. $globals.TestCase);
  45123. $core.addMethod(
  45124. $core.method({
  45125. selector: "should:",
  45126. protocol: 'testing',
  45127. fn: function (aBlock){
  45128. var self=this;
  45129. return $core.withContext(function($ctx1) {
  45130. self._assert_($recv(aBlock)._value());
  45131. return self;
  45132. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  45133. },
  45134. args: ["aBlock"],
  45135. source: "should: aBlock\x0a\x09self assert: aBlock value",
  45136. referencedClasses: [],
  45137. messageSends: ["assert:", "value"]
  45138. }),
  45139. $globals.TestCase);
  45140. $core.addMethod(
  45141. $core.method({
  45142. selector: "should:raise:",
  45143. protocol: 'testing',
  45144. fn: function (aBlock,anExceptionClass){
  45145. var self=this;
  45146. return $core.withContext(function($ctx1) {
  45147. self._assert_($recv((function(){
  45148. return $core.withContext(function($ctx2) {
  45149. $recv(aBlock)._value();
  45150. return false;
  45151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45152. }))._on_do_(anExceptionClass,(function(ex){
  45153. return true;
  45154. })));
  45155. return self;
  45156. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45157. },
  45158. args: ["aBlock", "anExceptionClass"],
  45159. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  45160. referencedClasses: [],
  45161. messageSends: ["assert:", "on:do:", "value"]
  45162. }),
  45163. $globals.TestCase);
  45164. $core.addMethod(
  45165. $core.method({
  45166. selector: "shouldnt:raise:",
  45167. protocol: 'testing',
  45168. fn: function (aBlock,anExceptionClass){
  45169. var self=this;
  45170. return $core.withContext(function($ctx1) {
  45171. self._assert_($recv((function(){
  45172. return $core.withContext(function($ctx2) {
  45173. $recv(aBlock)._value();
  45174. return true;
  45175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45176. }))._on_do_(anExceptionClass,(function(ex){
  45177. return false;
  45178. })));
  45179. return self;
  45180. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45181. },
  45182. args: ["aBlock", "anExceptionClass"],
  45183. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  45184. referencedClasses: [],
  45185. messageSends: ["assert:", "on:do:", "value"]
  45186. }),
  45187. $globals.TestCase);
  45188. $core.addMethod(
  45189. $core.method({
  45190. selector: "signalFailure:",
  45191. protocol: 'private',
  45192. fn: function (aString){
  45193. var self=this;
  45194. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45195. return $core.withContext(function($ctx1) {
  45196. var $1,$2;
  45197. $1=$recv($TestFailure())._new();
  45198. $recv($1)._messageText_(aString);
  45199. $2=$recv($1)._signal();
  45200. return self;
  45201. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  45202. },
  45203. args: ["aString"],
  45204. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  45205. referencedClasses: ["TestFailure"],
  45206. messageSends: ["messageText:", "new", "signal"]
  45207. }),
  45208. $globals.TestCase);
  45209. $core.addMethod(
  45210. $core.method({
  45211. selector: "tearDown",
  45212. protocol: 'running',
  45213. fn: function (){
  45214. var self=this;
  45215. return self;
  45216. },
  45217. args: [],
  45218. source: "tearDown",
  45219. referencedClasses: [],
  45220. messageSends: []
  45221. }),
  45222. $globals.TestCase);
  45223. $core.addMethod(
  45224. $core.method({
  45225. selector: "timeout:",
  45226. protocol: 'async',
  45227. fn: function (aNumber){
  45228. var self=this;
  45229. return $core.withContext(function($ctx1) {
  45230. var $1,$receiver;
  45231. $1=self["@asyncTimeout"];
  45232. if(($receiver = $1) == null || $receiver.isNil){
  45233. $1;
  45234. } else {
  45235. $recv(self["@asyncTimeout"])._clearTimeout();
  45236. };
  45237. self["@asyncTimeout"]=(0);
  45238. self["@asyncTimeout"]=$recv(self._async_((function(){
  45239. return $core.withContext(function($ctx2) {
  45240. return self._assert_description_(false,"SUnit grace time exhausted");
  45241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45242. })))._valueWithTimeout_(aNumber);
  45243. return self;
  45244. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  45245. },
  45246. args: ["aNumber"],
  45247. 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",
  45248. referencedClasses: [],
  45249. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  45250. }),
  45251. $globals.TestCase);
  45252. $core.addMethod(
  45253. $core.method({
  45254. selector: "allTestSelectors",
  45255. protocol: 'accessing',
  45256. fn: function (){
  45257. var self=this;
  45258. var selectors;
  45259. return $core.withContext(function($ctx1) {
  45260. var $1,$2;
  45261. selectors=self._testSelectors();
  45262. $1=self._shouldInheritSelectors();
  45263. if($core.assert($1)){
  45264. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  45265. };
  45266. $2=selectors;
  45267. return $2;
  45268. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  45269. },
  45270. args: [],
  45271. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  45272. referencedClasses: [],
  45273. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  45274. }),
  45275. $globals.TestCase.klass);
  45276. $core.addMethod(
  45277. $core.method({
  45278. selector: "buildSuite",
  45279. protocol: 'accessing',
  45280. fn: function (){
  45281. var self=this;
  45282. return $core.withContext(function($ctx1) {
  45283. var $1;
  45284. $1=$recv(self._allTestSelectors())._collect_((function(each){
  45285. return $core.withContext(function($ctx2) {
  45286. return self._selector_(each);
  45287. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45288. }));
  45289. return $1;
  45290. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  45291. },
  45292. args: [],
  45293. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  45294. referencedClasses: [],
  45295. messageSends: ["collect:", "allTestSelectors", "selector:"]
  45296. }),
  45297. $globals.TestCase.klass);
  45298. $core.addMethod(
  45299. $core.method({
  45300. selector: "classTag",
  45301. protocol: 'accessing',
  45302. fn: function (){
  45303. var self=this;
  45304. return "test";
  45305. },
  45306. args: [],
  45307. 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'",
  45308. referencedClasses: [],
  45309. messageSends: []
  45310. }),
  45311. $globals.TestCase.klass);
  45312. $core.addMethod(
  45313. $core.method({
  45314. selector: "isAbstract",
  45315. protocol: 'testing',
  45316. fn: function (){
  45317. var self=this;
  45318. return $core.withContext(function($ctx1) {
  45319. var $1;
  45320. $1=$recv(self._name()).__eq("TestCase");
  45321. return $1;
  45322. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  45323. },
  45324. args: [],
  45325. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  45326. referencedClasses: [],
  45327. messageSends: ["=", "name"]
  45328. }),
  45329. $globals.TestCase.klass);
  45330. $core.addMethod(
  45331. $core.method({
  45332. selector: "lookupHierarchyRoot",
  45333. protocol: 'accessing',
  45334. fn: function (){
  45335. var self=this;
  45336. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  45337. return $TestCase();
  45338. },
  45339. args: [],
  45340. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  45341. referencedClasses: ["TestCase"],
  45342. messageSends: []
  45343. }),
  45344. $globals.TestCase.klass);
  45345. $core.addMethod(
  45346. $core.method({
  45347. selector: "selector:",
  45348. protocol: 'accessing',
  45349. fn: function (aSelector){
  45350. var self=this;
  45351. return $core.withContext(function($ctx1) {
  45352. var $2,$3,$1;
  45353. $2=self._new();
  45354. $recv($2)._setTestSelector_(aSelector);
  45355. $3=$recv($2)._yourself();
  45356. $1=$3;
  45357. return $1;
  45358. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  45359. },
  45360. args: ["aSelector"],
  45361. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  45362. referencedClasses: [],
  45363. messageSends: ["setTestSelector:", "new", "yourself"]
  45364. }),
  45365. $globals.TestCase.klass);
  45366. $core.addMethod(
  45367. $core.method({
  45368. selector: "shouldInheritSelectors",
  45369. protocol: 'testing',
  45370. fn: function (){
  45371. var self=this;
  45372. return $core.withContext(function($ctx1) {
  45373. var $1;
  45374. $1=self.__tild_eq(self._lookupHierarchyRoot());
  45375. return $1;
  45376. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  45377. },
  45378. args: [],
  45379. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  45380. referencedClasses: [],
  45381. messageSends: ["~=", "lookupHierarchyRoot"]
  45382. }),
  45383. $globals.TestCase.klass);
  45384. $core.addMethod(
  45385. $core.method({
  45386. selector: "testSelectors",
  45387. protocol: 'accessing',
  45388. fn: function (){
  45389. var self=this;
  45390. return $core.withContext(function($ctx1) {
  45391. var $1;
  45392. $1=$recv($recv(self._methodDictionary())._keys())._select_((function(each){
  45393. return $core.withContext(function($ctx2) {
  45394. return $recv(each)._match_("^test");
  45395. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45396. }));
  45397. return $1;
  45398. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  45399. },
  45400. args: [],
  45401. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  45402. referencedClasses: [],
  45403. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  45404. }),
  45405. $globals.TestCase.klass);
  45406. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  45407. $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).";
  45408. $core.addMethod(
  45409. $core.method({
  45410. selector: "execute:",
  45411. protocol: 'running',
  45412. fn: function (aBlock){
  45413. var self=this;
  45414. var failed;
  45415. return $core.withContext(function($ctx1) {
  45416. var $1,$2;
  45417. $recv(self["@testCase"])._context_(self);
  45418. $ctx1.sendIdx["context:"]=1;
  45419. $recv((function(){
  45420. return $core.withContext(function($ctx2) {
  45421. failed=true;
  45422. failed;
  45423. $recv(aBlock)._value();
  45424. failed=false;
  45425. return failed;
  45426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45427. }))._ensure_((function(){
  45428. return $core.withContext(function($ctx2) {
  45429. $recv(self["@testCase"])._context_(nil);
  45430. $1=$recv(failed)._and_((function(){
  45431. return $core.withContext(function($ctx3) {
  45432. return $recv(self["@testCase"])._isAsync();
  45433. $ctx3.sendIdx["isAsync"]=1;
  45434. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45435. }));
  45436. if($core.assert($1)){
  45437. $recv(self["@testCase"])._finished();
  45438. };
  45439. $2=$recv(self["@testCase"])._isAsync();
  45440. if(!$core.assert($2)){
  45441. return $recv(self["@testCase"])._tearDown();
  45442. };
  45443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45444. }));
  45445. return self;
  45446. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  45447. },
  45448. args: ["aBlock"],
  45449. 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 ] ]",
  45450. referencedClasses: [],
  45451. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  45452. }),
  45453. $globals.TestContext);
  45454. $core.addMethod(
  45455. $core.method({
  45456. selector: "start",
  45457. protocol: 'running',
  45458. fn: function (){
  45459. var self=this;
  45460. return $core.withContext(function($ctx1) {
  45461. self._execute_((function(){
  45462. return $core.withContext(function($ctx2) {
  45463. $recv(self["@testCase"])._setUp();
  45464. return $recv(self["@testCase"])._performTest();
  45465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45466. }));
  45467. return self;
  45468. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  45469. },
  45470. args: [],
  45471. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  45472. referencedClasses: [],
  45473. messageSends: ["execute:", "setUp", "performTest"]
  45474. }),
  45475. $globals.TestContext);
  45476. $core.addMethod(
  45477. $core.method({
  45478. selector: "testCase:",
  45479. protocol: 'accessing',
  45480. fn: function (aTestCase){
  45481. var self=this;
  45482. self["@testCase"]=aTestCase;
  45483. return self;
  45484. },
  45485. args: ["aTestCase"],
  45486. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  45487. referencedClasses: [],
  45488. messageSends: []
  45489. }),
  45490. $globals.TestContext);
  45491. $core.addMethod(
  45492. $core.method({
  45493. selector: "testCase:",
  45494. protocol: 'instance creation',
  45495. fn: function (aTestCase){
  45496. var self=this;
  45497. return $core.withContext(function($ctx1) {
  45498. var $2,$3,$1;
  45499. $2=self._new();
  45500. $recv($2)._testCase_(aTestCase);
  45501. $3=$recv($2)._yourself();
  45502. $1=$3;
  45503. return $1;
  45504. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  45505. },
  45506. args: ["aTestCase"],
  45507. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  45508. referencedClasses: [],
  45509. messageSends: ["testCase:", "new", "yourself"]
  45510. }),
  45511. $globals.TestContext.klass);
  45512. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  45513. $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`.";
  45514. $core.addMethod(
  45515. $core.method({
  45516. selector: "execute:",
  45517. protocol: 'running',
  45518. fn: function (aBlock){
  45519. var self=this;
  45520. return $core.withContext(function($ctx1) {
  45521. var $1;
  45522. $recv((function(){
  45523. return $core.withContext(function($ctx2) {
  45524. return self._withErrorReporting_((function(){
  45525. return $core.withContext(function($ctx3) {
  45526. return (
  45527. $ctx3.supercall = true,
  45528. $globals.ReportingTestContext.superclass.fn.prototype._execute_.apply($recv(self), [aBlock]));
  45529. $ctx3.supercall = false;
  45530. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45531. }));
  45532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45533. }))._ensure_((function(){
  45534. return $core.withContext(function($ctx2) {
  45535. $1=$recv(self["@testCase"])._isAsync();
  45536. if(!$core.assert($1)){
  45537. $recv(self["@result"])._increaseRuns();
  45538. return $recv(self["@finished"])._value();
  45539. };
  45540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45541. }));
  45542. return self;
  45543. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  45544. },
  45545. args: ["aBlock"],
  45546. 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 ] ]",
  45547. referencedClasses: [],
  45548. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  45549. }),
  45550. $globals.ReportingTestContext);
  45551. $core.addMethod(
  45552. $core.method({
  45553. selector: "finished:",
  45554. protocol: 'accessing',
  45555. fn: function (aBlock){
  45556. var self=this;
  45557. self["@finished"]=aBlock;
  45558. return self;
  45559. },
  45560. args: ["aBlock"],
  45561. source: "finished: aBlock\x0a\x09finished := aBlock",
  45562. referencedClasses: [],
  45563. messageSends: []
  45564. }),
  45565. $globals.ReportingTestContext);
  45566. $core.addMethod(
  45567. $core.method({
  45568. selector: "result:",
  45569. protocol: 'accessing',
  45570. fn: function (aTestResult){
  45571. var self=this;
  45572. self["@result"]=aTestResult;
  45573. return self;
  45574. },
  45575. args: ["aTestResult"],
  45576. source: "result: aTestResult\x0a\x09result := aTestResult",
  45577. referencedClasses: [],
  45578. messageSends: []
  45579. }),
  45580. $globals.ReportingTestContext);
  45581. $core.addMethod(
  45582. $core.method({
  45583. selector: "withErrorReporting:",
  45584. protocol: 'private',
  45585. fn: function (aBlock){
  45586. var self=this;
  45587. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45588. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  45589. return $core.withContext(function($ctx1) {
  45590. $recv((function(){
  45591. return $core.withContext(function($ctx2) {
  45592. return $recv(aBlock)._on_do_($TestFailure(),(function(ex){
  45593. return $core.withContext(function($ctx3) {
  45594. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  45595. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  45596. }));
  45597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45598. }))._on_do_($Error(),(function(ex){
  45599. return $core.withContext(function($ctx2) {
  45600. return $recv(self["@result"])._addError_(self["@testCase"]);
  45601. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  45602. }));
  45603. $ctx1.sendIdx["on:do:"]=1;
  45604. return self;
  45605. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  45606. },
  45607. args: ["aBlock"],
  45608. 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 ]",
  45609. referencedClasses: ["TestFailure", "Error"],
  45610. messageSends: ["on:do:", "addFailure:", "addError:"]
  45611. }),
  45612. $globals.ReportingTestContext);
  45613. $core.addMethod(
  45614. $core.method({
  45615. selector: "testCase:result:finished:",
  45616. protocol: 'instance creation',
  45617. fn: function (aTestCase,aTestResult,aBlock){
  45618. var self=this;
  45619. return $core.withContext(function($ctx1) {
  45620. var $2,$3,$1;
  45621. $2=(
  45622. $ctx1.supercall = true,
  45623. $globals.ReportingTestContext.klass.superclass.fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  45624. $ctx1.supercall = false;
  45625. $recv($2)._result_(aTestResult);
  45626. $recv($2)._finished_(aBlock);
  45627. $3=$recv($2)._yourself();
  45628. $1=$3;
  45629. return $1;
  45630. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  45631. },
  45632. args: ["aTestCase", "aTestResult", "aBlock"],
  45633. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  45634. referencedClasses: [],
  45635. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  45636. }),
  45637. $globals.ReportingTestContext.klass);
  45638. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  45639. $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.";
  45640. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  45641. $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";
  45642. $core.addMethod(
  45643. $core.method({
  45644. selector: "addError:",
  45645. protocol: 'accessing',
  45646. fn: function (anError){
  45647. var self=this;
  45648. return $core.withContext(function($ctx1) {
  45649. $recv(self._errors())._add_(anError);
  45650. return self;
  45651. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  45652. },
  45653. args: ["anError"],
  45654. source: "addError: anError\x0a\x09self errors add: anError",
  45655. referencedClasses: [],
  45656. messageSends: ["add:", "errors"]
  45657. }),
  45658. $globals.TestResult);
  45659. $core.addMethod(
  45660. $core.method({
  45661. selector: "addFailure:",
  45662. protocol: 'accessing',
  45663. fn: function (aFailure){
  45664. var self=this;
  45665. return $core.withContext(function($ctx1) {
  45666. $recv(self._failures())._add_(aFailure);
  45667. return self;
  45668. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  45669. },
  45670. args: ["aFailure"],
  45671. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  45672. referencedClasses: [],
  45673. messageSends: ["add:", "failures"]
  45674. }),
  45675. $globals.TestResult);
  45676. $core.addMethod(
  45677. $core.method({
  45678. selector: "errors",
  45679. protocol: 'accessing',
  45680. fn: function (){
  45681. var self=this;
  45682. var $1;
  45683. $1=self["@errors"];
  45684. return $1;
  45685. },
  45686. args: [],
  45687. source: "errors\x0a\x09^ errors",
  45688. referencedClasses: [],
  45689. messageSends: []
  45690. }),
  45691. $globals.TestResult);
  45692. $core.addMethod(
  45693. $core.method({
  45694. selector: "failures",
  45695. protocol: 'accessing',
  45696. fn: function (){
  45697. var self=this;
  45698. var $1;
  45699. $1=self["@failures"];
  45700. return $1;
  45701. },
  45702. args: [],
  45703. source: "failures\x0a\x09^ failures",
  45704. referencedClasses: [],
  45705. messageSends: []
  45706. }),
  45707. $globals.TestResult);
  45708. $core.addMethod(
  45709. $core.method({
  45710. selector: "increaseRuns",
  45711. protocol: 'accessing',
  45712. fn: function (){
  45713. var self=this;
  45714. return $core.withContext(function($ctx1) {
  45715. self["@runs"]=$recv(self["@runs"]).__plus((1));
  45716. return self;
  45717. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  45718. },
  45719. args: [],
  45720. source: "increaseRuns\x0a\x09runs := runs + 1",
  45721. referencedClasses: [],
  45722. messageSends: ["+"]
  45723. }),
  45724. $globals.TestResult);
  45725. $core.addMethod(
  45726. $core.method({
  45727. selector: "initialize",
  45728. protocol: 'initialization',
  45729. fn: function (){
  45730. var self=this;
  45731. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  45732. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  45733. return $core.withContext(function($ctx1) {
  45734. (
  45735. $ctx1.supercall = true,
  45736. $globals.TestResult.superclass.fn.prototype._initialize.apply($recv(self), []));
  45737. $ctx1.supercall = false;
  45738. self["@timestamp"]=$recv($Date())._now();
  45739. self["@runs"]=(0);
  45740. self["@errors"]=$recv($Array())._new();
  45741. $ctx1.sendIdx["new"]=1;
  45742. self["@failures"]=$recv($Array())._new();
  45743. self["@total"]=(0);
  45744. return self;
  45745. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  45746. },
  45747. args: [],
  45748. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  45749. referencedClasses: ["Date", "Array"],
  45750. messageSends: ["initialize", "now", "new"]
  45751. }),
  45752. $globals.TestResult);
  45753. $core.addMethod(
  45754. $core.method({
  45755. selector: "nextRunDo:",
  45756. protocol: 'running',
  45757. fn: function (aBlock){
  45758. var self=this;
  45759. return $core.withContext(function($ctx1) {
  45760. var $3,$2,$1;
  45761. $3=self._runs();
  45762. $ctx1.sendIdx["runs"]=1;
  45763. $2=$recv($3).__eq_eq(self._total());
  45764. if(!$core.assert($2)){
  45765. $1=$recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  45766. };
  45767. return $1;
  45768. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  45769. },
  45770. args: ["aBlock"],
  45771. 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 ]",
  45772. referencedClasses: [],
  45773. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  45774. }),
  45775. $globals.TestResult);
  45776. $core.addMethod(
  45777. $core.method({
  45778. selector: "runCase:",
  45779. protocol: 'running',
  45780. fn: function (aTestCase){
  45781. var self=this;
  45782. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45783. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  45784. return $core.withContext(function($ctx1) {
  45785. $recv((function(){
  45786. return $core.withContext(function($ctx2) {
  45787. return $recv((function(){
  45788. return $core.withContext(function($ctx3) {
  45789. self._increaseRuns();
  45790. return $recv(aTestCase)._runCase();
  45791. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45792. }))._on_do_($TestFailure(),(function(ex){
  45793. return $core.withContext(function($ctx3) {
  45794. return self._addFailure_(aTestCase);
  45795. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  45796. }));
  45797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45798. }))._on_do_($Error(),(function(ex){
  45799. return $core.withContext(function($ctx2) {
  45800. return self._addError_(aTestCase);
  45801. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  45802. }));
  45803. $ctx1.sendIdx["on:do:"]=1;
  45804. return self;
  45805. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  45806. },
  45807. args: ["aTestCase"],
  45808. 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 ]",
  45809. referencedClasses: ["TestFailure", "Error"],
  45810. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  45811. }),
  45812. $globals.TestResult);
  45813. $core.addMethod(
  45814. $core.method({
  45815. selector: "runs",
  45816. protocol: 'accessing',
  45817. fn: function (){
  45818. var self=this;
  45819. var $1;
  45820. $1=self["@runs"];
  45821. return $1;
  45822. },
  45823. args: [],
  45824. source: "runs\x0a\x09^ runs",
  45825. referencedClasses: [],
  45826. messageSends: []
  45827. }),
  45828. $globals.TestResult);
  45829. $core.addMethod(
  45830. $core.method({
  45831. selector: "status",
  45832. protocol: 'accessing',
  45833. fn: function (){
  45834. var self=this;
  45835. return $core.withContext(function($ctx1) {
  45836. var $2,$3,$1;
  45837. $2=$recv(self._errors())._isEmpty();
  45838. $ctx1.sendIdx["isEmpty"]=1;
  45839. if($core.assert($2)){
  45840. $3=$recv(self._failures())._isEmpty();
  45841. if($core.assert($3)){
  45842. $1="success";
  45843. } else {
  45844. $1="failure";
  45845. };
  45846. } else {
  45847. $1="error";
  45848. };
  45849. return $1;
  45850. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  45851. },
  45852. args: [],
  45853. 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' ]",
  45854. referencedClasses: [],
  45855. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
  45856. }),
  45857. $globals.TestResult);
  45858. $core.addMethod(
  45859. $core.method({
  45860. selector: "timestamp",
  45861. protocol: 'accessing',
  45862. fn: function (){
  45863. var self=this;
  45864. var $1;
  45865. $1=self["@timestamp"];
  45866. return $1;
  45867. },
  45868. args: [],
  45869. source: "timestamp\x0a\x09^ timestamp",
  45870. referencedClasses: [],
  45871. messageSends: []
  45872. }),
  45873. $globals.TestResult);
  45874. $core.addMethod(
  45875. $core.method({
  45876. selector: "total",
  45877. protocol: 'accessing',
  45878. fn: function (){
  45879. var self=this;
  45880. var $1;
  45881. $1=self["@total"];
  45882. return $1;
  45883. },
  45884. args: [],
  45885. source: "total\x0a\x09^ total",
  45886. referencedClasses: [],
  45887. messageSends: []
  45888. }),
  45889. $globals.TestResult);
  45890. $core.addMethod(
  45891. $core.method({
  45892. selector: "total:",
  45893. protocol: 'accessing',
  45894. fn: function (aNumber){
  45895. var self=this;
  45896. self["@total"]=aNumber;
  45897. return self;
  45898. },
  45899. args: ["aNumber"],
  45900. source: "total: aNumber\x0a\x09total := aNumber",
  45901. referencedClasses: [],
  45902. messageSends: []
  45903. }),
  45904. $globals.TestResult);
  45905. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  45906. $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`.";
  45907. $core.addMethod(
  45908. $core.method({
  45909. selector: "announcer",
  45910. protocol: 'accessing',
  45911. fn: function (){
  45912. var self=this;
  45913. var $1;
  45914. $1=self["@announcer"];
  45915. return $1;
  45916. },
  45917. args: [],
  45918. source: "announcer\x0a\x09^ announcer",
  45919. referencedClasses: [],
  45920. messageSends: []
  45921. }),
  45922. $globals.TestSuiteRunner);
  45923. $core.addMethod(
  45924. $core.method({
  45925. selector: "contextOf:",
  45926. protocol: 'private',
  45927. fn: function (anInteger){
  45928. var self=this;
  45929. function $ReportingTestContext(){return $globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)}
  45930. return $core.withContext(function($ctx1) {
  45931. var $1;
  45932. $1=$recv($ReportingTestContext())._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  45933. return $core.withContext(function($ctx2) {
  45934. return self._resume();
  45935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45936. }));
  45937. return $1;
  45938. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  45939. },
  45940. args: ["anInteger"],
  45941. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  45942. referencedClasses: ["ReportingTestContext"],
  45943. messageSends: ["testCase:result:finished:", "at:", "resume"]
  45944. }),
  45945. $globals.TestSuiteRunner);
  45946. $core.addMethod(
  45947. $core.method({
  45948. selector: "initialize",
  45949. protocol: 'initialization',
  45950. fn: function (){
  45951. var self=this;
  45952. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  45953. function $TestResult(){return $globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)}
  45954. return $core.withContext(function($ctx1) {
  45955. var $1;
  45956. (
  45957. $ctx1.supercall = true,
  45958. $globals.TestSuiteRunner.superclass.fn.prototype._initialize.apply($recv(self), []));
  45959. $ctx1.supercall = false;
  45960. self["@announcer"]=$recv($Announcer())._new();
  45961. $ctx1.sendIdx["new"]=1;
  45962. self["@result"]=$recv($TestResult())._new();
  45963. self["@runNextTest"]=(function(){
  45964. var runs;
  45965. return $core.withContext(function($ctx2) {
  45966. runs=$recv(self["@result"])._runs();
  45967. runs;
  45968. $1=$recv(runs).__lt($recv(self["@result"])._total());
  45969. if($core.assert($1)){
  45970. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  45971. };
  45972. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  45973. });
  45974. return self;
  45975. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  45976. },
  45977. args: [],
  45978. 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 ] ].",
  45979. referencedClasses: ["Announcer", "TestResult"],
  45980. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  45981. }),
  45982. $globals.TestSuiteRunner);
  45983. $core.addMethod(
  45984. $core.method({
  45985. selector: "result",
  45986. protocol: 'accessing',
  45987. fn: function (){
  45988. var self=this;
  45989. var $1;
  45990. $1=self["@result"];
  45991. return $1;
  45992. },
  45993. args: [],
  45994. source: "result\x0a\x09^ result",
  45995. referencedClasses: [],
  45996. messageSends: []
  45997. }),
  45998. $globals.TestSuiteRunner);
  45999. $core.addMethod(
  46000. $core.method({
  46001. selector: "resume",
  46002. protocol: 'actions',
  46003. fn: function (){
  46004. var self=this;
  46005. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  46006. return $core.withContext(function($ctx1) {
  46007. $recv(self["@runNextTest"])._fork();
  46008. $recv(self["@announcer"])._announce_($recv($recv($ResultAnnouncement())._new())._result_(self["@result"]));
  46009. return self;
  46010. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  46011. },
  46012. args: [],
  46013. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  46014. referencedClasses: ["ResultAnnouncement"],
  46015. messageSends: ["fork", "announce:", "result:", "new"]
  46016. }),
  46017. $globals.TestSuiteRunner);
  46018. $core.addMethod(
  46019. $core.method({
  46020. selector: "run",
  46021. protocol: 'actions',
  46022. fn: function (){
  46023. var self=this;
  46024. return $core.withContext(function($ctx1) {
  46025. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  46026. self._resume();
  46027. return self;
  46028. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  46029. },
  46030. args: [],
  46031. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  46032. referencedClasses: [],
  46033. messageSends: ["total:", "size", "resume"]
  46034. }),
  46035. $globals.TestSuiteRunner);
  46036. $core.addMethod(
  46037. $core.method({
  46038. selector: "suite:",
  46039. protocol: 'accessing',
  46040. fn: function (aCollection){
  46041. var self=this;
  46042. self["@suite"]=aCollection;
  46043. return self;
  46044. },
  46045. args: ["aCollection"],
  46046. source: "suite: aCollection\x0a\x09suite := aCollection",
  46047. referencedClasses: [],
  46048. messageSends: []
  46049. }),
  46050. $globals.TestSuiteRunner);
  46051. $core.addMethod(
  46052. $core.method({
  46053. selector: "new",
  46054. protocol: 'instance creation',
  46055. fn: function (){
  46056. var self=this;
  46057. return $core.withContext(function($ctx1) {
  46058. self._shouldNotImplement();
  46059. return self;
  46060. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  46061. },
  46062. args: [],
  46063. source: "new\x0a\x09self shouldNotImplement",
  46064. referencedClasses: [],
  46065. messageSends: ["shouldNotImplement"]
  46066. }),
  46067. $globals.TestSuiteRunner.klass);
  46068. $core.addMethod(
  46069. $core.method({
  46070. selector: "on:",
  46071. protocol: 'instance creation',
  46072. fn: function (aCollection){
  46073. var self=this;
  46074. return $core.withContext(function($ctx1) {
  46075. var $2,$1;
  46076. $2=(
  46077. $ctx1.supercall = true,
  46078. $globals.TestSuiteRunner.klass.superclass.fn.prototype._new.apply($recv(self), []));
  46079. $ctx1.supercall = false;
  46080. $1=$recv($2)._suite_(aCollection);
  46081. return $1;
  46082. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  46083. },
  46084. args: ["aCollection"],
  46085. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  46086. referencedClasses: [],
  46087. messageSends: ["suite:", "new"]
  46088. }),
  46089. $globals.TestSuiteRunner.klass);
  46090. $core.addMethod(
  46091. $core.method({
  46092. selector: "isTestClass",
  46093. protocol: '*SUnit',
  46094. fn: function (){
  46095. var self=this;
  46096. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  46097. return $core.withContext(function($ctx1) {
  46098. var $1;
  46099. $1=$recv(self._includesBehavior_($TestCase()))._and_((function(){
  46100. return $core.withContext(function($ctx2) {
  46101. return $recv(self._isAbstract())._not();
  46102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46103. }));
  46104. return $1;
  46105. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  46106. },
  46107. args: [],
  46108. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  46109. referencedClasses: ["TestCase"],
  46110. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  46111. }),
  46112. $globals.Behavior);
  46113. $core.addMethod(
  46114. $core.method({
  46115. selector: "isTestPackage",
  46116. protocol: '*SUnit',
  46117. fn: function (){
  46118. var self=this;
  46119. return $core.withContext(function($ctx1) {
  46120. var $1;
  46121. $1=$recv(self._classes())._anySatisfy_((function(each){
  46122. return $core.withContext(function($ctx2) {
  46123. return $recv(each)._isTestClass();
  46124. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46125. }));
  46126. return $1;
  46127. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  46128. },
  46129. args: [],
  46130. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  46131. referencedClasses: [],
  46132. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  46133. }),
  46134. $globals.Package);
  46135. });
  46136. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  46137. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  46138. $core.addPackage('Compiler-Tests');
  46139. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  46140. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46141. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  46142. $core.addMethod(
  46143. $core.method({
  46144. selector: "analyze:forClass:",
  46145. protocol: 'convenience',
  46146. fn: function (aNode,aClass){
  46147. var self=this;
  46148. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  46149. return $core.withContext(function($ctx1) {
  46150. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  46151. return aNode;
  46152. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  46153. },
  46154. args: ["aNode", "aClass"],
  46155. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46156. referencedClasses: ["SemanticAnalyzer"],
  46157. messageSends: ["visit:", "on:"]
  46158. }),
  46159. $globals.ASTParsingTest);
  46160. $core.addMethod(
  46161. $core.method({
  46162. selector: "parse:",
  46163. protocol: 'parsing',
  46164. fn: function (aString){
  46165. var self=this;
  46166. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46167. return $core.withContext(function($ctx1) {
  46168. var $1;
  46169. $1=$recv($Smalltalk())._parse_(aString);
  46170. return $1;
  46171. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  46172. },
  46173. args: ["aString"],
  46174. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46175. referencedClasses: ["Smalltalk"],
  46176. messageSends: ["parse:"]
  46177. }),
  46178. $globals.ASTParsingTest);
  46179. $core.addMethod(
  46180. $core.method({
  46181. selector: "parse:forClass:",
  46182. protocol: 'parsing',
  46183. fn: function (aString,aClass){
  46184. var self=this;
  46185. return $core.withContext(function($ctx1) {
  46186. var $1;
  46187. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  46188. return $1;
  46189. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  46190. },
  46191. args: ["aString", "aClass"],
  46192. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46193. referencedClasses: [],
  46194. messageSends: ["analyze:forClass:", "parse:"]
  46195. }),
  46196. $globals.ASTParsingTest);
  46197. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  46198. $core.addMethod(
  46199. $core.method({
  46200. selector: "astPCNodeVisitor",
  46201. protocol: 'factory',
  46202. fn: function (){
  46203. var self=this;
  46204. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  46205. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  46206. return $core.withContext(function($ctx1) {
  46207. var $2,$3,$4,$5,$1;
  46208. $2=$recv($ASTPCNodeVisitor())._new();
  46209. $ctx1.sendIdx["new"]=1;
  46210. $3=$2;
  46211. $4=$recv($recv($AIContext())._new())._yourself();
  46212. $ctx1.sendIdx["yourself"]=1;
  46213. $recv($3)._context_($4);
  46214. $5=$recv($2)._yourself();
  46215. $1=$5;
  46216. return $1;
  46217. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  46218. },
  46219. args: [],
  46220. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  46221. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  46222. messageSends: ["context:", "new", "yourself"]
  46223. }),
  46224. $globals.ASTPCNodeVisitorTest);
  46225. $core.addMethod(
  46226. $core.method({
  46227. selector: "astPCNodeVisitorForSelector:",
  46228. protocol: 'factory',
  46229. fn: function (aString){
  46230. var self=this;
  46231. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  46232. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  46233. return $core.withContext(function($ctx1) {
  46234. var $2,$3,$4,$5,$1;
  46235. $2=$recv($ASTPCNodeVisitor())._new();
  46236. $ctx1.sendIdx["new"]=1;
  46237. $recv($2)._selector_(aString);
  46238. $3=$2;
  46239. $4=$recv($recv($AIContext())._new())._yourself();
  46240. $ctx1.sendIdx["yourself"]=1;
  46241. $recv($3)._context_($4);
  46242. $5=$recv($2)._yourself();
  46243. $1=$5;
  46244. return $1;
  46245. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  46246. },
  46247. args: ["aString"],
  46248. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  46249. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  46250. messageSends: ["selector:", "new", "context:", "yourself"]
  46251. }),
  46252. $globals.ASTPCNodeVisitorTest);
  46253. $core.addMethod(
  46254. $core.method({
  46255. selector: "testJSStatementNode",
  46256. protocol: 'tests',
  46257. fn: function (){
  46258. var self=this;
  46259. var ast,visitor;
  46260. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46261. return $core.withContext(function($ctx1) {
  46262. var $1,$2;
  46263. ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
  46264. $1=self._astPCNodeVisitor();
  46265. $recv($1)._visit_(ast);
  46266. $2=$recv($1)._currentNode();
  46267. self._assert_($recv($2)._isJSStatementNode());
  46268. return self;
  46269. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46270. },
  46271. args: [],
  46272. 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",
  46273. referencedClasses: ["Object"],
  46274. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46275. }),
  46276. $globals.ASTPCNodeVisitorTest);
  46277. $core.addMethod(
  46278. $core.method({
  46279. selector: "testMessageSend",
  46280. protocol: 'tests',
  46281. fn: function (){
  46282. var self=this;
  46283. var ast;
  46284. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46285. return $core.withContext(function($ctx1) {
  46286. var $1,$2;
  46287. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
  46288. $1=self._astPCNodeVisitorForSelector_("yourself");
  46289. $recv($1)._visit_(ast);
  46290. $2=$recv($1)._currentNode();
  46291. self._assert_equals_($recv($2)._selector(),"yourself");
  46292. return self;
  46293. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46294. },
  46295. args: [],
  46296. 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'",
  46297. referencedClasses: ["Object"],
  46298. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46299. }),
  46300. $globals.ASTPCNodeVisitorTest);
  46301. $core.addMethod(
  46302. $core.method({
  46303. selector: "testMessageSendWithBlocks",
  46304. protocol: 'tests',
  46305. fn: function (){
  46306. var self=this;
  46307. var ast;
  46308. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46309. return $core.withContext(function($ctx1) {
  46310. var $1,$2;
  46311. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object());
  46312. $1=self._astPCNodeVisitorForSelector_("yourself");
  46313. $recv($1)._visit_(ast);
  46314. $2=$recv($1)._currentNode();
  46315. self._assert_equals_($recv($2)._selector(),"yourself");
  46316. return self;
  46317. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46318. },
  46319. args: [],
  46320. 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'",
  46321. referencedClasses: ["Object"],
  46322. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46323. }),
  46324. $globals.ASTPCNodeVisitorTest);
  46325. $core.addMethod(
  46326. $core.method({
  46327. selector: "testMessageSendWithInlining",
  46328. protocol: 'tests',
  46329. fn: function (){
  46330. var self=this;
  46331. var ast;
  46332. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46333. return $core.withContext(function($ctx1) {
  46334. var $3,$4,$2,$1,$5,$6;
  46335. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  46336. $ctx1.sendIdx["parse:forClass:"]=1;
  46337. $3=self._astPCNodeVisitorForSelector_("yourself");
  46338. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  46339. $recv($3)._visit_(ast);
  46340. $ctx1.sendIdx["visit:"]=1;
  46341. $4=$recv($3)._currentNode();
  46342. $ctx1.sendIdx["currentNode"]=1;
  46343. $2=$4;
  46344. $1=$recv($2)._selector();
  46345. $ctx1.sendIdx["selector"]=1;
  46346. self._assert_equals_($1,"yourself");
  46347. $ctx1.sendIdx["assert:equals:"]=1;
  46348. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  46349. $5=self._astPCNodeVisitorForSelector_("asBoolean");
  46350. $recv($5)._visit_(ast);
  46351. $6=$recv($5)._currentNode();
  46352. self._assert_equals_($recv($6)._selector(),"asBoolean");
  46353. return self;
  46354. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46355. },
  46356. args: [],
  46357. 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'",
  46358. referencedClasses: ["Object"],
  46359. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46360. }),
  46361. $globals.ASTPCNodeVisitorTest);
  46362. $core.addMethod(
  46363. $core.method({
  46364. selector: "testNoMessageSend",
  46365. protocol: 'tests',
  46366. fn: function (){
  46367. var self=this;
  46368. var ast;
  46369. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46370. return $core.withContext(function($ctx1) {
  46371. var $1,$2;
  46372. ast=self._parse_forClass_("foo ^ self",$Object());
  46373. $1=self._astPCNodeVisitor();
  46374. $recv($1)._visit_(ast);
  46375. $2=$recv($1)._currentNode();
  46376. self._assert_($recv($2)._isNil());
  46377. return self;
  46378. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46379. },
  46380. args: [],
  46381. 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",
  46382. referencedClasses: ["Object"],
  46383. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  46384. }),
  46385. $globals.ASTPCNodeVisitorTest);
  46386. $core.addMethod(
  46387. $core.method({
  46388. selector: "testPC",
  46389. protocol: 'tests',
  46390. fn: function (){
  46391. var self=this;
  46392. var ast,visitor;
  46393. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46394. return $core.withContext(function($ctx1) {
  46395. var $1,$2;
  46396. ast=self._parse_forClass_("foo <console.log(1)>",$Object());
  46397. $1=self._astPCNodeVisitor();
  46398. $recv($1)._visit_(ast);
  46399. $2=$recv($1)._currentNode();
  46400. self._assert_($recv($2)._isJSStatementNode());
  46401. return self;
  46402. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46403. },
  46404. args: [],
  46405. 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",
  46406. referencedClasses: ["Object"],
  46407. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46408. }),
  46409. $globals.ASTPCNodeVisitorTest);
  46410. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  46411. $core.addMethod(
  46412. $core.method({
  46413. selector: "testNodeAtPosition",
  46414. protocol: 'tests',
  46415. fn: function (){
  46416. var self=this;
  46417. var node;
  46418. return $core.withContext(function($ctx1) {
  46419. var $3,$4,$2,$1,$7,$8,$6,$5;
  46420. node=self._parse_("yourself\x0a\x09^ self");
  46421. $ctx1.sendIdx["parse:"]=1;
  46422. $3=node;
  46423. $4=(2).__at((4));
  46424. $ctx1.sendIdx["@"]=1;
  46425. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  46426. return nil;
  46427. }));
  46428. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  46429. $1=$recv($2)._source();
  46430. self._assert_equals_($1,"self");
  46431. $ctx1.sendIdx["assert:equals:"]=1;
  46432. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  46433. $ctx1.sendIdx["parse:"]=2;
  46434. $7=node;
  46435. $8=(2).__at((7));
  46436. $ctx1.sendIdx["@"]=2;
  46437. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  46438. return nil;
  46439. }));
  46440. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  46441. $5=$recv($6)._selector();
  46442. $ctx1.sendIdx["selector"]=1;
  46443. self._assert_equals_($5,"ifTrue:");
  46444. $ctx1.sendIdx["assert:equals:"]=2;
  46445. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  46446. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  46447. return nil;
  46448. })))._selector(),"foo");
  46449. return self;
  46450. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  46451. },
  46452. args: [],
  46453. 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'",
  46454. referencedClasses: [],
  46455. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  46456. }),
  46457. $globals.ASTPositionTest);
  46458. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  46459. $core.addMethod(
  46460. $core.method({
  46461. selector: "codeGeneratorClass",
  46462. protocol: 'accessing',
  46463. fn: function (){
  46464. var self=this;
  46465. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  46466. return $CodeGenerator();
  46467. },
  46468. args: [],
  46469. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  46470. referencedClasses: ["CodeGenerator"],
  46471. messageSends: []
  46472. }),
  46473. $globals.CodeGeneratorTest);
  46474. $core.addMethod(
  46475. $core.method({
  46476. selector: "compiler",
  46477. protocol: 'factory',
  46478. fn: function (){
  46479. var self=this;
  46480. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  46481. return $core.withContext(function($ctx1) {
  46482. var $2,$3,$1;
  46483. $2=$recv($Compiler())._new();
  46484. $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
  46485. $3=$recv($2)._yourself();
  46486. $1=$3;
  46487. return $1;
  46488. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  46489. },
  46490. args: [],
  46491. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  46492. referencedClasses: ["Compiler"],
  46493. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  46494. }),
  46495. $globals.CodeGeneratorTest);
  46496. $core.addMethod(
  46497. $core.method({
  46498. selector: "setUp",
  46499. protocol: 'initialization',
  46500. fn: function (){
  46501. var self=this;
  46502. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  46503. return $core.withContext(function($ctx1) {
  46504. self["@receiver"]=$recv($DoIt())._new();
  46505. return self;
  46506. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  46507. },
  46508. args: [],
  46509. source: "setUp\x0a\x09receiver := DoIt new",
  46510. referencedClasses: ["DoIt"],
  46511. messageSends: ["new"]
  46512. }),
  46513. $globals.CodeGeneratorTest);
  46514. $core.addMethod(
  46515. $core.method({
  46516. selector: "should:receiver:return:",
  46517. protocol: 'testing',
  46518. fn: function (aString,anObject,aResult){
  46519. var self=this;
  46520. var method,result;
  46521. return $core.withContext(function($ctx1) {
  46522. var $1,$2;
  46523. self["@receiver"]=anObject;
  46524. $1=self._compiler();
  46525. $2=$recv(anObject)._class();
  46526. $ctx1.sendIdx["class"]=1;
  46527. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  46528. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  46529. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  46530. self._assert_equals_(aResult,result);
  46531. return self;
  46532. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  46533. },
  46534. args: ["aString", "anObject", "aResult"],
  46535. 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",
  46536. referencedClasses: [],
  46537. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  46538. }),
  46539. $globals.CodeGeneratorTest);
  46540. $core.addMethod(
  46541. $core.method({
  46542. selector: "should:return:",
  46543. protocol: 'testing',
  46544. fn: function (aString,anObject){
  46545. var self=this;
  46546. return $core.withContext(function($ctx1) {
  46547. var $1;
  46548. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  46549. return $1;
  46550. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  46551. },
  46552. args: ["aString", "anObject"],
  46553. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  46554. referencedClasses: [],
  46555. messageSends: ["should:receiver:return:"]
  46556. }),
  46557. $globals.CodeGeneratorTest);
  46558. $core.addMethod(
  46559. $core.method({
  46560. selector: "tearDown",
  46561. protocol: 'initialization',
  46562. fn: function (){
  46563. var self=this;
  46564. return self;
  46565. },
  46566. args: [],
  46567. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  46568. referencedClasses: [],
  46569. messageSends: []
  46570. }),
  46571. $globals.CodeGeneratorTest);
  46572. $core.addMethod(
  46573. $core.method({
  46574. selector: "testAssignment",
  46575. protocol: 'tests',
  46576. fn: function (){
  46577. var self=this;
  46578. return $core.withContext(function($ctx1) {
  46579. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  46580. $ctx1.sendIdx["should:return:"]=1;
  46581. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  46582. $ctx1.sendIdx["should:return:"]=2;
  46583. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  46584. return self;
  46585. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  46586. },
  46587. args: [],
  46588. 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",
  46589. referencedClasses: [],
  46590. messageSends: ["should:return:"]
  46591. }),
  46592. $globals.CodeGeneratorTest);
  46593. $core.addMethod(
  46594. $core.method({
  46595. selector: "testBackslashSelectors",
  46596. protocol: 'tests',
  46597. fn: function (){
  46598. var self=this;
  46599. return $core.withContext(function($ctx1) {
  46600. self._should_return_("\x5c arg ^ 4",(4));
  46601. $ctx1.sendIdx["should:return:"]=1;
  46602. self._should_return_("\x5c\x5c arg ^ 42",(42));
  46603. return self;
  46604. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  46605. },
  46606. args: [],
  46607. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  46608. referencedClasses: [],
  46609. messageSends: ["should:return:"]
  46610. }),
  46611. $globals.CodeGeneratorTest);
  46612. $core.addMethod(
  46613. $core.method({
  46614. selector: "testBlockReturn",
  46615. protocol: 'tests',
  46616. fn: function (){
  46617. var self=this;
  46618. return $core.withContext(function($ctx1) {
  46619. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  46620. $ctx1.sendIdx["should:return:"]=1;
  46621. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  46622. $ctx1.sendIdx["should:return:"]=2;
  46623. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  46624. return self;
  46625. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  46626. },
  46627. args: [],
  46628. 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).",
  46629. referencedClasses: [],
  46630. messageSends: ["should:return:"]
  46631. }),
  46632. $globals.CodeGeneratorTest);
  46633. $core.addMethod(
  46634. $core.method({
  46635. selector: "testCascades",
  46636. protocol: 'tests',
  46637. fn: function (){
  46638. var self=this;
  46639. return $core.withContext(function($ctx1) {
  46640. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  46641. return self;
  46642. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  46643. },
  46644. args: [],
  46645. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  46646. referencedClasses: [],
  46647. messageSends: ["should:return:"]
  46648. }),
  46649. $globals.CodeGeneratorTest);
  46650. $core.addMethod(
  46651. $core.method({
  46652. selector: "testCascadesWithInlining",
  46653. protocol: 'tests',
  46654. fn: function (){
  46655. var self=this;
  46656. return $core.withContext(function($ctx1) {
  46657. self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  46658. $ctx1.sendIdx["should:return:"]=1;
  46659. self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  46660. return self;
  46661. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  46662. },
  46663. args: [],
  46664. 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",
  46665. referencedClasses: [],
  46666. messageSends: ["should:return:"]
  46667. }),
  46668. $globals.CodeGeneratorTest);
  46669. $core.addMethod(
  46670. $core.method({
  46671. selector: "testDynamicArrayElementsOrdered",
  46672. protocol: 'tests',
  46673. fn: function (){
  46674. var self=this;
  46675. return $core.withContext(function($ctx1) {
  46676. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  46677. $ctx1.sendIdx["should:return:"]=1;
  46678. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  46679. return self;
  46680. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  46681. },
  46682. args: [],
  46683. 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).",
  46684. referencedClasses: [],
  46685. messageSends: ["should:return:"]
  46686. }),
  46687. $globals.CodeGeneratorTest);
  46688. $core.addMethod(
  46689. $core.method({
  46690. selector: "testDynamicDictionaryElementsOrdered",
  46691. protocol: 'tests',
  46692. fn: function (){
  46693. var self=this;
  46694. return $core.withContext(function($ctx1) {
  46695. 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)]));
  46696. return self;
  46697. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  46698. },
  46699. args: [],
  46700. 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}.",
  46701. referencedClasses: [],
  46702. messageSends: ["should:return:"]
  46703. }),
  46704. $globals.CodeGeneratorTest);
  46705. $core.addMethod(
  46706. $core.method({
  46707. selector: "testDynamicDictionaryWithMoreArrows",
  46708. protocol: 'tests',
  46709. fn: function (){
  46710. var self=this;
  46711. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  46712. return $core.withContext(function($ctx1) {
  46713. var $2,$1;
  46714. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  46715. $ctx1.sendIdx["->"]=1;
  46716. $1=$recv($HashedCollection())._with_($2);
  46717. self._should_return_("foo ^ #{1->2->3}",$1);
  46718. return self;
  46719. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  46720. },
  46721. args: [],
  46722. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  46723. referencedClasses: ["HashedCollection"],
  46724. messageSends: ["should:return:", "with:", "->"]
  46725. }),
  46726. $globals.CodeGeneratorTest);
  46727. $core.addMethod(
  46728. $core.method({
  46729. selector: "testGlobalVar",
  46730. protocol: 'tests',
  46731. fn: function (){
  46732. var self=this;
  46733. function $BlockClosure(){return $globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
  46734. return $core.withContext(function($ctx1) {
  46735. self._should_return_("foo ^ eval class",$BlockClosure());
  46736. $ctx1.sendIdx["should:return:"]=1;
  46737. self._should_return_("foo ^ Math cos: 0",(1));
  46738. $ctx1.sendIdx["should:return:"]=2;
  46739. self._should_return_("foo ^ NonExistingVar",nil);
  46740. return self;
  46741. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  46742. },
  46743. args: [],
  46744. 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",
  46745. referencedClasses: ["BlockClosure"],
  46746. messageSends: ["should:return:"]
  46747. }),
  46748. $globals.CodeGeneratorTest);
  46749. $core.addMethod(
  46750. $core.method({
  46751. selector: "testInnerTemporalDependentElementsOrdered",
  46752. protocol: 'tests',
  46753. fn: function (){
  46754. var self=this;
  46755. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  46756. return $core.withContext(function($ctx1) {
  46757. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  46758. $2="foo".__minus_gt($Array());
  46759. $ctx1.sendIdx["->"]=1;
  46760. $3="bar".__minus_gt((2));
  46761. $ctx1.sendIdx["->"]=2;
  46762. $1=[$2,$3];
  46763. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  46764. $ctx1.sendIdx["should:return:"]=1;
  46765. $5="foo".__minus_gt($Array());
  46766. $ctx1.sendIdx["->"]=3;
  46767. $6="bar".__minus_gt((2));
  46768. $ctx1.sendIdx["->"]=4;
  46769. $4=[$5,$6];
  46770. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  46771. $ctx1.sendIdx["should:return:"]=2;
  46772. $8="foo".__minus_gt((1));
  46773. $ctx1.sendIdx["->"]=5;
  46774. $9="bar".__minus_gt((2));
  46775. $ctx1.sendIdx["->"]=6;
  46776. $7=[$8,$9];
  46777. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  46778. $ctx1.sendIdx["should:return:"]=3;
  46779. $11="foo".__minus_gt((1));
  46780. $ctx1.sendIdx["->"]=7;
  46781. $10=[$11,"bar".__minus_gt((2))];
  46782. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  46783. $ctx1.sendIdx["should:return:"]=4;
  46784. 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)]));
  46785. return self;
  46786. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  46787. },
  46788. args: [],
  46789. 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}.",
  46790. referencedClasses: ["Array"],
  46791. messageSends: ["should:return:", "->"]
  46792. }),
  46793. $globals.CodeGeneratorTest);
  46794. $core.addMethod(
  46795. $core.method({
  46796. selector: "testJSStatement",
  46797. protocol: 'tests',
  46798. fn: function (){
  46799. var self=this;
  46800. return $core.withContext(function($ctx1) {
  46801. self._should_return_("foo <return 2+3>",(5));
  46802. return self;
  46803. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  46804. },
  46805. args: [],
  46806. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  46807. referencedClasses: [],
  46808. messageSends: ["should:return:"]
  46809. }),
  46810. $globals.CodeGeneratorTest);
  46811. $core.addMethod(
  46812. $core.method({
  46813. selector: "testLexicalScope",
  46814. protocol: 'tests',
  46815. fn: function (){
  46816. var self=this;
  46817. return $core.withContext(function($ctx1) {
  46818. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  46819. return self;
  46820. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  46821. },
  46822. args: [],
  46823. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  46824. referencedClasses: [],
  46825. messageSends: ["should:return:"]
  46826. }),
  46827. $globals.CodeGeneratorTest);
  46828. $core.addMethod(
  46829. $core.method({
  46830. selector: "testLiterals",
  46831. protocol: 'tests',
  46832. fn: function (){
  46833. var self=this;
  46834. return $core.withContext(function($ctx1) {
  46835. self._should_return_("foo ^ 1",(1));
  46836. $ctx1.sendIdx["should:return:"]=1;
  46837. self._should_return_("foo ^ 'hello'","hello");
  46838. $ctx1.sendIdx["should:return:"]=2;
  46839. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  46840. $ctx1.sendIdx["should:return:"]=3;
  46841. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  46842. $ctx1.sendIdx["should:return:"]=4;
  46843. self._should_return_("foo ^ true",true);
  46844. $ctx1.sendIdx["should:return:"]=5;
  46845. self._should_return_("foo ^ false",false);
  46846. $ctx1.sendIdx["should:return:"]=6;
  46847. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  46848. $ctx1.sendIdx["should:return:"]=7;
  46849. self._should_return_("foo ^ #hello","hello");
  46850. $ctx1.sendIdx["should:return:"]=8;
  46851. self._should_return_("foo ^ $h","h");
  46852. $ctx1.sendIdx["should:return:"]=9;
  46853. self._should_return_("foo ^ -123.456",(-123.456));
  46854. $ctx1.sendIdx["should:return:"]=10;
  46855. self._should_return_("foo ^ -2.5e4",(-25000));
  46856. return self;
  46857. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  46858. },
  46859. args: [],
  46860. 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.",
  46861. referencedClasses: [],
  46862. messageSends: ["should:return:"]
  46863. }),
  46864. $globals.CodeGeneratorTest);
  46865. $core.addMethod(
  46866. $core.method({
  46867. selector: "testLocalReturn",
  46868. protocol: 'tests',
  46869. fn: function (){
  46870. var self=this;
  46871. return $core.withContext(function($ctx1) {
  46872. self._should_return_("foo ^ 1",(1));
  46873. $ctx1.sendIdx["should:return:"]=1;
  46874. self._should_return_("foo ^ 1 + 1",(2));
  46875. $ctx1.sendIdx["should:return:"]=2;
  46876. self._should_return_("foo ",self["@receiver"]);
  46877. $ctx1.sendIdx["should:return:"]=3;
  46878. self._should_return_("foo self asString",self["@receiver"]);
  46879. $ctx1.sendIdx["should:return:"]=4;
  46880. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  46881. return self;
  46882. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  46883. },
  46884. args: [],
  46885. 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",
  46886. referencedClasses: [],
  46887. messageSends: ["should:return:"]
  46888. }),
  46889. $globals.CodeGeneratorTest);
  46890. $core.addMethod(
  46891. $core.method({
  46892. selector: "testMessageSends",
  46893. protocol: 'tests',
  46894. fn: function (){
  46895. var self=this;
  46896. return $core.withContext(function($ctx1) {
  46897. self._should_return_("foo ^ 1 asString","1");
  46898. $ctx1.sendIdx["should:return:"]=1;
  46899. self._should_return_("foo ^ 1 + 1",(2));
  46900. $ctx1.sendIdx["should:return:"]=2;
  46901. self._should_return_("foo ^ 1 + 2 * 3",(9));
  46902. $ctx1.sendIdx["should:return:"]=3;
  46903. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  46904. $ctx1.sendIdx["should:return:"]=4;
  46905. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  46906. return self;
  46907. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  46908. },
  46909. args: [],
  46910. 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)",
  46911. referencedClasses: [],
  46912. messageSends: ["should:return:"]
  46913. }),
  46914. $globals.CodeGeneratorTest);
  46915. $core.addMethod(
  46916. $core.method({
  46917. selector: "testMultipleSequences",
  46918. protocol: 'tests',
  46919. fn: function (){
  46920. var self=this;
  46921. return $core.withContext(function($ctx1) {
  46922. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  46923. return self;
  46924. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  46925. },
  46926. args: [],
  46927. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  46928. referencedClasses: [],
  46929. messageSends: ["should:return:"]
  46930. }),
  46931. $globals.CodeGeneratorTest);
  46932. $core.addMethod(
  46933. $core.method({
  46934. selector: "testMutableLiterals",
  46935. protocol: 'tests',
  46936. fn: function (){
  46937. var self=this;
  46938. return $core.withContext(function($ctx1) {
  46939. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  46940. return self;
  46941. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  46942. },
  46943. args: [],
  46944. 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)",
  46945. referencedClasses: [],
  46946. messageSends: ["should:return:"]
  46947. }),
  46948. $globals.CodeGeneratorTest);
  46949. $core.addMethod(
  46950. $core.method({
  46951. selector: "testNestedIfTrue",
  46952. protocol: 'tests',
  46953. fn: function (){
  46954. var self=this;
  46955. return $core.withContext(function($ctx1) {
  46956. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  46957. $ctx1.sendIdx["should:return:"]=1;
  46958. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  46959. $ctx1.sendIdx["should:return:"]=2;
  46960. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  46961. $ctx1.sendIdx["should:return:"]=3;
  46962. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  46963. return self;
  46964. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  46965. },
  46966. args: [],
  46967. 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.",
  46968. referencedClasses: [],
  46969. messageSends: ["should:return:"]
  46970. }),
  46971. $globals.CodeGeneratorTest);
  46972. $core.addMethod(
  46973. $core.method({
  46974. selector: "testNestedSends",
  46975. protocol: 'tests',
  46976. fn: function (){
  46977. var self=this;
  46978. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  46979. return $core.withContext(function($ctx1) {
  46980. self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($Point())._x_y_((2).__at((3)),(4)))._asString());
  46981. return self;
  46982. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  46983. },
  46984. args: [],
  46985. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  46986. referencedClasses: ["Point"],
  46987. messageSends: ["should:return:", "asString", "x:y:", "@"]
  46988. }),
  46989. $globals.CodeGeneratorTest);
  46990. $core.addMethod(
  46991. $core.method({
  46992. selector: "testNonLocalReturn",
  46993. protocol: 'tests',
  46994. fn: function (){
  46995. var self=this;
  46996. return $core.withContext(function($ctx1) {
  46997. self._should_return_("foo [ ^ 1 ] value",(1));
  46998. $ctx1.sendIdx["should:return:"]=1;
  46999. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  47000. $ctx1.sendIdx["should:return:"]=2;
  47001. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  47002. $ctx1.sendIdx["should:return:"]=3;
  47003. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  47004. return self;
  47005. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  47006. },
  47007. args: [],
  47008. 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",
  47009. referencedClasses: [],
  47010. messageSends: ["should:return:"]
  47011. }),
  47012. $globals.CodeGeneratorTest);
  47013. $core.addMethod(
  47014. $core.method({
  47015. selector: "testPascalCaseGlobal",
  47016. protocol: 'tests',
  47017. fn: function (){
  47018. var self=this;
  47019. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47020. return $core.withContext(function($ctx1) {
  47021. self._should_return_("foo ^Object",$recv($recv($Smalltalk())._globals())._at_("Object"));
  47022. $ctx1.sendIdx["should:return:"]=1;
  47023. self._should_return_("foo ^NonExistent",nil);
  47024. return self;
  47025. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  47026. },
  47027. args: [],
  47028. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  47029. referencedClasses: ["Smalltalk"],
  47030. messageSends: ["should:return:", "at:", "globals"]
  47031. }),
  47032. $globals.CodeGeneratorTest);
  47033. $core.addMethod(
  47034. $core.method({
  47035. selector: "testSendReceiverAndArgumentsOrdered",
  47036. protocol: 'tests',
  47037. fn: function (){
  47038. var self=this;
  47039. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  47040. return $core.withContext(function($ctx1) {
  47041. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  47042. $ctx1.sendIdx["should:return:"]=1;
  47043. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
  47044. return self;
  47045. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  47046. },
  47047. args: [],
  47048. 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}.",
  47049. referencedClasses: ["Array"],
  47050. messageSends: ["should:return:"]
  47051. }),
  47052. $globals.CodeGeneratorTest);
  47053. $core.addMethod(
  47054. $core.method({
  47055. selector: "testSuperSend",
  47056. protocol: 'tests',
  47057. fn: function (){
  47058. var self=this;
  47059. return $core.withContext(function($ctx1) {
  47060. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  47061. return self;
  47062. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  47063. },
  47064. args: [],
  47065. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  47066. referencedClasses: [],
  47067. messageSends: ["should:receiver:return:"]
  47068. }),
  47069. $globals.CodeGeneratorTest);
  47070. $core.addMethod(
  47071. $core.method({
  47072. selector: "testTempVariables",
  47073. protocol: 'tests',
  47074. fn: function (){
  47075. var self=this;
  47076. return $core.withContext(function($ctx1) {
  47077. self._should_return_("foo | a | ^ a",nil);
  47078. $ctx1.sendIdx["should:return:"]=1;
  47079. self._should_return_("foo | AVariable | ^ AVariable",nil);
  47080. $ctx1.sendIdx["should:return:"]=2;
  47081. self._should_return_("foo | a b c | ^ c",nil);
  47082. $ctx1.sendIdx["should:return:"]=3;
  47083. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  47084. $ctx1.sendIdx["should:return:"]=4;
  47085. self._should_return_("foo | a | a:= 1. ^ a",(1));
  47086. $ctx1.sendIdx["should:return:"]=5;
  47087. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  47088. return self;
  47089. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  47090. },
  47091. args: [],
  47092. 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.",
  47093. referencedClasses: [],
  47094. messageSends: ["should:return:"]
  47095. }),
  47096. $globals.CodeGeneratorTest);
  47097. $core.addMethod(
  47098. $core.method({
  47099. selector: "testThisContext",
  47100. protocol: 'tests',
  47101. fn: function (){
  47102. var self=this;
  47103. return $core.withContext(function($ctx1) {
  47104. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  47105. return self;
  47106. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  47107. },
  47108. args: [],
  47109. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  47110. referencedClasses: [],
  47111. messageSends: ["should:return:"]
  47112. }),
  47113. $globals.CodeGeneratorTest);
  47114. $core.addMethod(
  47115. $core.method({
  47116. selector: "testifFalse",
  47117. protocol: 'tests',
  47118. fn: function (){
  47119. var self=this;
  47120. return $core.withContext(function($ctx1) {
  47121. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  47122. $ctx1.sendIdx["should:return:"]=1;
  47123. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  47124. $ctx1.sendIdx["should:return:"]=2;
  47125. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  47126. $ctx1.sendIdx["should:return:"]=3;
  47127. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  47128. return self;
  47129. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  47130. },
  47131. args: [],
  47132. 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.",
  47133. referencedClasses: [],
  47134. messageSends: ["should:return:"]
  47135. }),
  47136. $globals.CodeGeneratorTest);
  47137. $core.addMethod(
  47138. $core.method({
  47139. selector: "testifFalseIfTrue",
  47140. protocol: 'tests',
  47141. fn: function (){
  47142. var self=this;
  47143. return $core.withContext(function($ctx1) {
  47144. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  47145. $ctx1.sendIdx["should:return:"]=1;
  47146. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  47147. $ctx1.sendIdx["should:return:"]=2;
  47148. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  47149. $ctx1.sendIdx["should:return:"]=3;
  47150. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  47151. return self;
  47152. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  47153. },
  47154. args: [],
  47155. 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.",
  47156. referencedClasses: [],
  47157. messageSends: ["should:return:"]
  47158. }),
  47159. $globals.CodeGeneratorTest);
  47160. $core.addMethod(
  47161. $core.method({
  47162. selector: "testifNil",
  47163. protocol: 'tests',
  47164. fn: function (){
  47165. var self=this;
  47166. return $core.withContext(function($ctx1) {
  47167. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  47168. $ctx1.sendIdx["should:return:"]=1;
  47169. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  47170. $ctx1.sendIdx["should:return:"]=2;
  47171. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  47172. $ctx1.sendIdx["should:return:"]=3;
  47173. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  47174. return self;
  47175. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  47176. },
  47177. args: [],
  47178. 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.",
  47179. referencedClasses: [],
  47180. messageSends: ["should:return:"]
  47181. }),
  47182. $globals.CodeGeneratorTest);
  47183. $core.addMethod(
  47184. $core.method({
  47185. selector: "testifNilIfNotNil",
  47186. protocol: 'tests',
  47187. fn: function (){
  47188. var self=this;
  47189. return $core.withContext(function($ctx1) {
  47190. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  47191. $ctx1.sendIdx["should:return:"]=1;
  47192. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  47193. $ctx1.sendIdx["should:return:"]=2;
  47194. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  47195. $ctx1.sendIdx["should:return:"]=3;
  47196. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  47197. return self;
  47198. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  47199. },
  47200. args: [],
  47201. 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.",
  47202. referencedClasses: [],
  47203. messageSends: ["should:return:"]
  47204. }),
  47205. $globals.CodeGeneratorTest);
  47206. $core.addMethod(
  47207. $core.method({
  47208. selector: "testifNotNil",
  47209. protocol: 'tests',
  47210. fn: function (){
  47211. var self=this;
  47212. return $core.withContext(function($ctx1) {
  47213. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  47214. $ctx1.sendIdx["should:return:"]=1;
  47215. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  47216. $ctx1.sendIdx["should:return:"]=2;
  47217. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  47218. $ctx1.sendIdx["should:return:"]=3;
  47219. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  47220. return self;
  47221. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  47222. },
  47223. args: [],
  47224. 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.",
  47225. referencedClasses: [],
  47226. messageSends: ["should:return:"]
  47227. }),
  47228. $globals.CodeGeneratorTest);
  47229. $core.addMethod(
  47230. $core.method({
  47231. selector: "testifNotNilWithArgument",
  47232. protocol: 'tests',
  47233. fn: function (){
  47234. var self=this;
  47235. return $core.withContext(function($ctx1) {
  47236. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  47237. $ctx1.sendIdx["should:return:"]=1;
  47238. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  47239. $ctx1.sendIdx["should:return:"]=2;
  47240. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  47241. $ctx1.sendIdx["should:return:"]=3;
  47242. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  47243. $ctx1.sendIdx["should:return:"]=4;
  47244. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  47245. $ctx1.sendIdx["should:return:"]=5;
  47246. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  47247. return self;
  47248. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  47249. },
  47250. args: [],
  47251. 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",
  47252. referencedClasses: [],
  47253. messageSends: ["should:return:"]
  47254. }),
  47255. $globals.CodeGeneratorTest);
  47256. $core.addMethod(
  47257. $core.method({
  47258. selector: "testifTrue",
  47259. protocol: 'tests',
  47260. fn: function (){
  47261. var self=this;
  47262. return $core.withContext(function($ctx1) {
  47263. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  47264. $ctx1.sendIdx["should:return:"]=1;
  47265. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  47266. $ctx1.sendIdx["should:return:"]=2;
  47267. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  47268. $ctx1.sendIdx["should:return:"]=3;
  47269. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  47270. return self;
  47271. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  47272. },
  47273. args: [],
  47274. 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.",
  47275. referencedClasses: [],
  47276. messageSends: ["should:return:"]
  47277. }),
  47278. $globals.CodeGeneratorTest);
  47279. $core.addMethod(
  47280. $core.method({
  47281. selector: "testifTrueIfFalse",
  47282. protocol: 'tests',
  47283. fn: function (){
  47284. var self=this;
  47285. return $core.withContext(function($ctx1) {
  47286. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  47287. $ctx1.sendIdx["should:return:"]=1;
  47288. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  47289. $ctx1.sendIdx["should:return:"]=2;
  47290. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  47291. $ctx1.sendIdx["should:return:"]=3;
  47292. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  47293. return self;
  47294. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  47295. },
  47296. args: [],
  47297. 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.",
  47298. referencedClasses: [],
  47299. messageSends: ["should:return:"]
  47300. }),
  47301. $globals.CodeGeneratorTest);
  47302. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  47303. $core.addMethod(
  47304. $core.method({
  47305. selector: "analyze:forClass:",
  47306. protocol: 'parsing',
  47307. fn: function (aNode,aClass){
  47308. var self=this;
  47309. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47310. return $core.withContext(function($ctx1) {
  47311. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  47312. return aNode;
  47313. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  47314. },
  47315. args: ["aNode", "aClass"],
  47316. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  47317. referencedClasses: ["SemanticAnalyzer"],
  47318. messageSends: ["visit:", "on:"]
  47319. }),
  47320. $globals.ASTInterpreterTest);
  47321. $core.addMethod(
  47322. $core.method({
  47323. selector: "interpret:receiver:withArguments:",
  47324. protocol: 'private',
  47325. fn: function (aString,anObject,aDictionary){
  47326. var self=this;
  47327. var ctx,ast,interpreter;
  47328. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  47329. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  47330. return $core.withContext(function($ctx1) {
  47331. var $1,$2,$3,$5,$6,$4,$receiver;
  47332. interpreter=$recv($ASTInterpreter())._new();
  47333. $ctx1.sendIdx["new"]=1;
  47334. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  47335. $1=$recv($AIContext())._new();
  47336. $recv($1)._receiver_(anObject);
  47337. $recv($1)._interpreter_(interpreter);
  47338. $2=$recv($1)._yourself();
  47339. ctx=$2;
  47340. $3=$recv(ast)._sequenceNode();
  47341. if(($receiver = $3) == null || $receiver.isNil){
  47342. $3;
  47343. } else {
  47344. var sequence;
  47345. sequence=$receiver;
  47346. $recv($recv(sequence)._temps())._do_((function(each){
  47347. return $core.withContext(function($ctx2) {
  47348. return $recv(ctx)._defineLocal_(each);
  47349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47350. }));
  47351. };
  47352. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  47353. return $core.withContext(function($ctx2) {
  47354. return $recv(ctx)._localAt_put_(key,value);
  47355. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47356. }));
  47357. $5=interpreter;
  47358. $recv($5)._context_(ctx);
  47359. $recv($5)._interpret_($recv(ast)._nextChild());
  47360. $recv($5)._proceed();
  47361. $6=$recv($5)._result();
  47362. $4=$6;
  47363. return $4;
  47364. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  47365. },
  47366. args: ["aString", "anObject", "aDictionary"],
  47367. 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",
  47368. referencedClasses: ["ASTInterpreter", "AIContext"],
  47369. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"]
  47370. }),
  47371. $globals.ASTInterpreterTest);
  47372. $core.addMethod(
  47373. $core.method({
  47374. selector: "parse:",
  47375. protocol: 'parsing',
  47376. fn: function (aString){
  47377. var self=this;
  47378. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47379. return $core.withContext(function($ctx1) {
  47380. var $1;
  47381. $1=$recv($Smalltalk())._parse_(aString);
  47382. return $1;
  47383. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  47384. },
  47385. args: ["aString"],
  47386. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  47387. referencedClasses: ["Smalltalk"],
  47388. messageSends: ["parse:"]
  47389. }),
  47390. $globals.ASTInterpreterTest);
  47391. $core.addMethod(
  47392. $core.method({
  47393. selector: "parse:forClass:",
  47394. protocol: 'parsing',
  47395. fn: function (aString,aClass){
  47396. var self=this;
  47397. return $core.withContext(function($ctx1) {
  47398. var $1;
  47399. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  47400. return $1;
  47401. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  47402. },
  47403. args: ["aString", "aClass"],
  47404. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  47405. referencedClasses: [],
  47406. messageSends: ["analyze:forClass:", "parse:"]
  47407. }),
  47408. $globals.ASTInterpreterTest);
  47409. $core.addMethod(
  47410. $core.method({
  47411. selector: "should:receiver:return:",
  47412. protocol: 'testing',
  47413. fn: function (aString,anObject,aResult){
  47414. var self=this;
  47415. return $core.withContext(function($ctx1) {
  47416. var $1;
  47417. self["@receiver"]=anObject;
  47418. $1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  47419. return $1;
  47420. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  47421. },
  47422. args: ["aString", "anObject", "aResult"],
  47423. 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",
  47424. referencedClasses: [],
  47425. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  47426. }),
  47427. $globals.ASTInterpreterTest);
  47428. $core.addMethod(
  47429. $core.method({
  47430. selector: "should:return:",
  47431. protocol: 'testing',
  47432. fn: function (aString,anObject){
  47433. var self=this;
  47434. return $core.withContext(function($ctx1) {
  47435. var $1;
  47436. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  47437. return $1;
  47438. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.ASTInterpreterTest)});
  47439. },
  47440. args: ["aString", "anObject"],
  47441. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject",
  47442. referencedClasses: [],
  47443. messageSends: ["should:receiver:return:"]
  47444. }),
  47445. $globals.ASTInterpreterTest);
  47446. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  47447. $core.addMethod(
  47448. $core.method({
  47449. selector: "interpret:receiver:withArguments:",
  47450. protocol: 'private',
  47451. fn: function (aString,anObject,aDictionary){
  47452. var self=this;
  47453. var ctx,ast,debugger_;
  47454. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  47455. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  47456. function $ASTDebugger(){return $globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
  47457. return $core.withContext(function($ctx1) {
  47458. var $1,$2,$3,$4,$6,$7,$5,$receiver;
  47459. $1=$recv($AIContext())._new();
  47460. $ctx1.sendIdx["new"]=1;
  47461. $recv($1)._receiver_(anObject);
  47462. $recv($1)._interpreter_($recv($ASTInterpreter())._new());
  47463. $2=$recv($1)._yourself();
  47464. ctx=$2;
  47465. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  47466. $3=$recv(ast)._sequenceNode();
  47467. if(($receiver = $3) == null || $receiver.isNil){
  47468. $3;
  47469. } else {
  47470. var sequence;
  47471. sequence=$receiver;
  47472. $recv($recv(sequence)._temps())._do_((function(each){
  47473. return $core.withContext(function($ctx2) {
  47474. return $recv(ctx)._defineLocal_(each);
  47475. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47476. }));
  47477. };
  47478. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  47479. return $core.withContext(function($ctx2) {
  47480. return $recv(ctx)._localAt_put_(key,value);
  47481. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47482. }));
  47483. $4=$recv(ctx)._interpreter();
  47484. $ctx1.sendIdx["interpreter"]=1;
  47485. $recv($4)._context_(ctx);
  47486. $ctx1.sendIdx["context:"]=1;
  47487. $recv($recv(ctx)._interpreter())._node_($recv(ast)._nextChild());
  47488. debugger_=$recv($ASTDebugger())._context_(ctx);
  47489. $6=debugger_;
  47490. $recv($6)._proceed();
  47491. $7=$recv($6)._result();
  47492. $5=$7;
  47493. return $5;
  47494. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  47495. },
  47496. args: ["aString", "anObject", "aDictionary"],
  47497. 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",
  47498. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  47499. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"]
  47500. }),
  47501. $globals.ASTDebuggerTest);
  47502. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  47503. $core.addMethod(
  47504. $core.method({
  47505. selector: "codeGeneratorClass",
  47506. protocol: 'accessing',
  47507. fn: function (){
  47508. var self=this;
  47509. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  47510. return $InliningCodeGenerator();
  47511. },
  47512. args: [],
  47513. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  47514. referencedClasses: ["InliningCodeGenerator"],
  47515. messageSends: []
  47516. }),
  47517. $globals.InliningCodeGeneratorTest);
  47518. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  47519. $core.addMethod(
  47520. $core.method({
  47521. selector: "testClassRefVar",
  47522. protocol: 'tests',
  47523. fn: function (){
  47524. var self=this;
  47525. var node;
  47526. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47527. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47528. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47529. return $core.withContext(function($ctx1) {
  47530. var $1,$2,$3,$4;
  47531. $1=$recv($VariableNode())._new();
  47532. $ctx1.sendIdx["new"]=1;
  47533. $recv($1)._value_("Object");
  47534. $2=$recv($1)._yourself();
  47535. node=$2;
  47536. $3=$recv($SemanticAnalyzer())._new();
  47537. $ctx1.sendIdx["new"]=2;
  47538. $recv($3)._pushScope_($recv($MethodLexicalScope())._new());
  47539. $4=$recv($3)._visit_(node);
  47540. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  47541. return self;
  47542. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  47543. },
  47544. args: [],
  47545. 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",
  47546. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  47547. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  47548. }),
  47549. $globals.ScopeVarTest);
  47550. $core.addMethod(
  47551. $core.method({
  47552. selector: "testInstanceVar",
  47553. protocol: 'tests',
  47554. fn: function (){
  47555. var self=this;
  47556. var node,scope;
  47557. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47558. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47559. return $core.withContext(function($ctx1) {
  47560. var $1,$2;
  47561. $1=$recv($VariableNode())._new();
  47562. $ctx1.sendIdx["new"]=1;
  47563. $recv($1)._value_("bzzz");
  47564. $2=$recv($1)._yourself();
  47565. node=$2;
  47566. scope=$recv($MethodLexicalScope())._new();
  47567. $recv(scope)._addIVar_("bzzz");
  47568. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  47569. return self;
  47570. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  47571. },
  47572. args: [],
  47573. 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",
  47574. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47575. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  47576. }),
  47577. $globals.ScopeVarTest);
  47578. $core.addMethod(
  47579. $core.method({
  47580. selector: "testPseudoVar",
  47581. protocol: 'tests',
  47582. fn: function (){
  47583. var self=this;
  47584. var node,pseudoVars;
  47585. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47586. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47587. return $core.withContext(function($ctx1) {
  47588. var $1,$2;
  47589. pseudoVars=["self", "super", "true", "false", "nil"];
  47590. $recv(pseudoVars)._do_((function(each){
  47591. return $core.withContext(function($ctx2) {
  47592. $1=$recv($VariableNode())._new();
  47593. $ctx2.sendIdx["new"]=1;
  47594. $recv($1)._value_(each);
  47595. $2=$recv($1)._yourself();
  47596. node=$2;
  47597. node;
  47598. return self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
  47599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47600. }));
  47601. return self;
  47602. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  47603. },
  47604. args: [],
  47605. 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]",
  47606. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47607. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  47608. }),
  47609. $globals.ScopeVarTest);
  47610. $core.addMethod(
  47611. $core.method({
  47612. selector: "testTempVar",
  47613. protocol: 'tests',
  47614. fn: function (){
  47615. var self=this;
  47616. var node,scope;
  47617. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47618. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47619. return $core.withContext(function($ctx1) {
  47620. var $1,$2;
  47621. $1=$recv($VariableNode())._new();
  47622. $ctx1.sendIdx["new"]=1;
  47623. $recv($1)._value_("bzzz");
  47624. $2=$recv($1)._yourself();
  47625. node=$2;
  47626. scope=$recv($MethodLexicalScope())._new();
  47627. $recv(scope)._addTemp_("bzzz");
  47628. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  47629. return self;
  47630. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  47631. },
  47632. args: [],
  47633. 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",
  47634. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47635. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  47636. }),
  47637. $globals.ScopeVarTest);
  47638. $core.addMethod(
  47639. $core.method({
  47640. selector: "testUnknownVar",
  47641. protocol: 'tests',
  47642. fn: function (){
  47643. var self=this;
  47644. var node;
  47645. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47646. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47647. return $core.withContext(function($ctx1) {
  47648. var $1,$2;
  47649. $1=$recv($VariableNode())._new();
  47650. $ctx1.sendIdx["new"]=1;
  47651. $recv($1)._value_("bzzz");
  47652. $2=$recv($1)._yourself();
  47653. node=$2;
  47654. self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
  47655. return self;
  47656. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  47657. },
  47658. args: [],
  47659. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  47660. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47661. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  47662. }),
  47663. $globals.ScopeVarTest);
  47664. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  47665. $core.addMethod(
  47666. $core.method({
  47667. selector: "setUp",
  47668. protocol: 'running',
  47669. fn: function (){
  47670. var self=this;
  47671. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47672. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  47673. return $core.withContext(function($ctx1) {
  47674. self["@analyzer"]=$recv($SemanticAnalyzer())._on_($Object());
  47675. return self;
  47676. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  47677. },
  47678. args: [],
  47679. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  47680. referencedClasses: ["SemanticAnalyzer", "Object"],
  47681. messageSends: ["on:"]
  47682. }),
  47683. $globals.SemanticAnalyzerTest);
  47684. $core.addMethod(
  47685. $core.method({
  47686. selector: "testAssignment",
  47687. protocol: 'tests',
  47688. fn: function (){
  47689. var self=this;
  47690. var src,ast;
  47691. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47692. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  47693. return $core.withContext(function($ctx1) {
  47694. src="foo self := 1";
  47695. ast=$recv($Smalltalk())._parse_(src);
  47696. self._should_raise_((function(){
  47697. return $core.withContext(function($ctx2) {
  47698. return $recv(self["@analyzer"])._visit_(ast);
  47699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47700. }),$InvalidAssignmentError());
  47701. return self;
  47702. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47703. },
  47704. args: [],
  47705. 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",
  47706. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  47707. messageSends: ["parse:", "should:raise:", "visit:"]
  47708. }),
  47709. $globals.SemanticAnalyzerTest);
  47710. $core.addMethod(
  47711. $core.method({
  47712. selector: "testNonLocalReturn",
  47713. protocol: 'tests',
  47714. fn: function (){
  47715. var self=this;
  47716. var src,ast;
  47717. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47718. return $core.withContext(function($ctx1) {
  47719. src="foo | a | a + 1. ^ a";
  47720. ast=$recv($Smalltalk())._parse_(src);
  47721. $recv(self["@analyzer"])._visit_(ast);
  47722. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  47723. return self;
  47724. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47725. },
  47726. args: [],
  47727. 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",
  47728. referencedClasses: ["Smalltalk"],
  47729. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  47730. }),
  47731. $globals.SemanticAnalyzerTest);
  47732. $core.addMethod(
  47733. $core.method({
  47734. selector: "testNonLocalReturn2",
  47735. protocol: 'tests',
  47736. fn: function (){
  47737. var self=this;
  47738. var src,ast;
  47739. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47740. return $core.withContext(function($ctx1) {
  47741. src="foo | a | a + 1. [ [ ^ a] ]";
  47742. ast=$recv($Smalltalk())._parse_(src);
  47743. $recv(self["@analyzer"])._visit_(ast);
  47744. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  47745. return self;
  47746. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47747. },
  47748. args: [],
  47749. 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",
  47750. referencedClasses: ["Smalltalk"],
  47751. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  47752. }),
  47753. $globals.SemanticAnalyzerTest);
  47754. $core.addMethod(
  47755. $core.method({
  47756. selector: "testScope",
  47757. protocol: 'tests',
  47758. fn: function (){
  47759. var self=this;
  47760. var src,ast;
  47761. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47762. return $core.withContext(function($ctx1) {
  47763. var $4,$3,$2,$1;
  47764. src="foo | a | a + 1. [ | b | b := a ]";
  47765. ast=$recv($Smalltalk())._parse_(src);
  47766. $recv(self["@analyzer"])._visit_(ast);
  47767. $4=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47768. $ctx1.sendIdx["nodes"]=1;
  47769. $3=$recv($4)._last();
  47770. $2=$recv($3)._scope();
  47771. $ctx1.sendIdx["scope"]=1;
  47772. $1=$recv($2).__eq_eq($recv(ast)._scope());
  47773. self._deny_($1);
  47774. return self;
  47775. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47776. },
  47777. args: [],
  47778. 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.",
  47779. referencedClasses: ["Smalltalk"],
  47780. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  47781. }),
  47782. $globals.SemanticAnalyzerTest);
  47783. $core.addMethod(
  47784. $core.method({
  47785. selector: "testScope2",
  47786. protocol: 'tests',
  47787. fn: function (){
  47788. var self=this;
  47789. var src,ast;
  47790. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47791. return $core.withContext(function($ctx1) {
  47792. var $8,$7,$6,$5,$4,$3,$2,$1;
  47793. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  47794. ast=$recv($Smalltalk())._parse_(src);
  47795. $recv(self["@analyzer"])._visit_(ast);
  47796. $8=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47797. $ctx1.sendIdx["nodes"]=3;
  47798. $7=$recv($8)._last();
  47799. $6=$recv($7)._nodes();
  47800. $ctx1.sendIdx["nodes"]=2;
  47801. $5=$recv($6)._first();
  47802. $ctx1.sendIdx["first"]=2;
  47803. $4=$recv($5)._nodes();
  47804. $ctx1.sendIdx["nodes"]=1;
  47805. $3=$recv($4)._first();
  47806. $ctx1.sendIdx["first"]=1;
  47807. $2=$recv($3)._scope();
  47808. $ctx1.sendIdx["scope"]=1;
  47809. $1=$recv($2).__eq_eq($recv(ast)._scope());
  47810. self._deny_($1);
  47811. return self;
  47812. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47813. },
  47814. args: [],
  47815. 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.",
  47816. referencedClasses: ["Smalltalk"],
  47817. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  47818. }),
  47819. $globals.SemanticAnalyzerTest);
  47820. $core.addMethod(
  47821. $core.method({
  47822. selector: "testScopeLevel",
  47823. protocol: 'tests',
  47824. fn: function (){
  47825. var self=this;
  47826. var src,ast;
  47827. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47828. return $core.withContext(function($ctx1) {
  47829. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  47830. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  47831. ast=$recv($Smalltalk())._parse_(src);
  47832. $recv(self["@analyzer"])._visit_(ast);
  47833. $2=$recv(ast)._scope();
  47834. $ctx1.sendIdx["scope"]=1;
  47835. $1=$recv($2)._scopeLevel();
  47836. $ctx1.sendIdx["scopeLevel"]=1;
  47837. self._assert_equals_($1,(1));
  47838. $ctx1.sendIdx["assert:equals:"]=1;
  47839. $10=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47840. $ctx1.sendIdx["nodes"]=3;
  47841. $9=$recv($10)._last();
  47842. $8=$recv($9)._nodes();
  47843. $ctx1.sendIdx["nodes"]=2;
  47844. $7=$recv($8)._first();
  47845. $ctx1.sendIdx["first"]=2;
  47846. $6=$recv($7)._nodes();
  47847. $ctx1.sendIdx["nodes"]=1;
  47848. $5=$recv($6)._first();
  47849. $ctx1.sendIdx["first"]=1;
  47850. $4=$recv($5)._scope();
  47851. $3=$recv($4)._scopeLevel();
  47852. self._assert_equals_($3,(3));
  47853. return self;
  47854. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47855. },
  47856. args: [],
  47857. 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",
  47858. referencedClasses: ["Smalltalk"],
  47859. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  47860. }),
  47861. $globals.SemanticAnalyzerTest);
  47862. $core.addMethod(
  47863. $core.method({
  47864. selector: "testUnknownVariables",
  47865. protocol: 'tests',
  47866. fn: function (){
  47867. var self=this;
  47868. var src,ast;
  47869. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47870. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  47871. return $core.withContext(function($ctx1) {
  47872. src="foo | a | b + a";
  47873. ast=$recv($Smalltalk())._parse_(src);
  47874. self._should_raise_((function(){
  47875. return $core.withContext(function($ctx2) {
  47876. return $recv(self["@analyzer"])._visit_(ast);
  47877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47878. }),$UnknownVariableError());
  47879. return self;
  47880. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47881. },
  47882. args: [],
  47883. 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",
  47884. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47885. messageSends: ["parse:", "should:raise:", "visit:"]
  47886. }),
  47887. $globals.SemanticAnalyzerTest);
  47888. $core.addMethod(
  47889. $core.method({
  47890. selector: "testUnknownVariablesWithScope",
  47891. protocol: 'tests',
  47892. fn: function (){
  47893. var self=this;
  47894. var src,ast;
  47895. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47896. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  47897. return $core.withContext(function($ctx1) {
  47898. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  47899. ast=$recv($Smalltalk())._parse_(src);
  47900. self._should_raise_((function(){
  47901. return $core.withContext(function($ctx2) {
  47902. return $recv(self["@analyzer"])._visit_(ast);
  47903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47904. }),$UnknownVariableError());
  47905. return self;
  47906. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47907. },
  47908. args: [],
  47909. 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",
  47910. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47911. messageSends: ["parse:", "should:raise:", "visit:"]
  47912. }),
  47913. $globals.SemanticAnalyzerTest);
  47914. $core.addMethod(
  47915. $core.method({
  47916. selector: "testVariableShadowing",
  47917. protocol: 'tests',
  47918. fn: function (){
  47919. var self=this;
  47920. var src,ast;
  47921. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47922. return $core.withContext(function($ctx1) {
  47923. src="foo | a | a + 1";
  47924. ast=$recv($Smalltalk())._parse_(src);
  47925. $recv(self["@analyzer"])._visit_(ast);
  47926. return self;
  47927. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47928. },
  47929. args: [],
  47930. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47931. referencedClasses: ["Smalltalk"],
  47932. messageSends: ["parse:", "visit:"]
  47933. }),
  47934. $globals.SemanticAnalyzerTest);
  47935. $core.addMethod(
  47936. $core.method({
  47937. selector: "testVariableShadowing2",
  47938. protocol: 'tests',
  47939. fn: function (){
  47940. var self=this;
  47941. var src,ast;
  47942. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47943. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  47944. return $core.withContext(function($ctx1) {
  47945. src="foo | a | a + 1. [ | a | a := 2 ]";
  47946. ast=$recv($Smalltalk())._parse_(src);
  47947. self._should_raise_((function(){
  47948. return $core.withContext(function($ctx2) {
  47949. return $recv(self["@analyzer"])._visit_(ast);
  47950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47951. }),$ShadowingVariableError());
  47952. return self;
  47953. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47954. },
  47955. args: [],
  47956. 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",
  47957. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  47958. messageSends: ["parse:", "should:raise:", "visit:"]
  47959. }),
  47960. $globals.SemanticAnalyzerTest);
  47961. $core.addMethod(
  47962. $core.method({
  47963. selector: "testVariableShadowing3",
  47964. protocol: 'tests',
  47965. fn: function (){
  47966. var self=this;
  47967. var src,ast;
  47968. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47969. return $core.withContext(function($ctx1) {
  47970. src="foo | a | a + 1. [ | b | b := 2 ]";
  47971. ast=$recv($Smalltalk())._parse_(src);
  47972. $recv(self["@analyzer"])._visit_(ast);
  47973. return self;
  47974. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47975. },
  47976. args: [],
  47977. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47978. referencedClasses: ["Smalltalk"],
  47979. messageSends: ["parse:", "visit:"]
  47980. }),
  47981. $globals.SemanticAnalyzerTest);
  47982. $core.addMethod(
  47983. $core.method({
  47984. selector: "testVariableShadowing4",
  47985. protocol: 'tests',
  47986. fn: function (){
  47987. var self=this;
  47988. var src,ast;
  47989. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47990. return $core.withContext(function($ctx1) {
  47991. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  47992. ast=$recv($Smalltalk())._parse_(src);
  47993. $recv(self["@analyzer"])._visit_(ast);
  47994. return self;
  47995. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47996. },
  47997. args: [],
  47998. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47999. referencedClasses: ["Smalltalk"],
  48000. messageSends: ["parse:", "visit:"]
  48001. }),
  48002. $globals.SemanticAnalyzerTest);
  48003. $core.addMethod(
  48004. $core.method({
  48005. selector: "testVariableShadowing5",
  48006. protocol: 'tests',
  48007. fn: function (){
  48008. var self=this;
  48009. var src,ast;
  48010. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48011. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  48012. return $core.withContext(function($ctx1) {
  48013. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  48014. ast=$recv($Smalltalk())._parse_(src);
  48015. self._should_raise_((function(){
  48016. return $core.withContext(function($ctx2) {
  48017. return $recv(self["@analyzer"])._visit_(ast);
  48018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48019. }),$ShadowingVariableError());
  48020. return self;
  48021. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48022. },
  48023. args: [],
  48024. 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",
  48025. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  48026. messageSends: ["parse:", "should:raise:", "visit:"]
  48027. }),
  48028. $globals.SemanticAnalyzerTest);
  48029. $core.addMethod(
  48030. $core.method({
  48031. selector: "testVariablesLookup",
  48032. protocol: 'tests',
  48033. fn: function (){
  48034. var self=this;
  48035. var src,ast;
  48036. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48037. return $core.withContext(function($ctx1) {
  48038. 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;
  48039. src="foo | a | a + 1. [ | b | b := a ]";
  48040. ast=$recv($Smalltalk())._parse_(src);
  48041. $recv(self["@analyzer"])._visit_(ast);
  48042. $7=$recv(ast)._nodes();
  48043. $ctx1.sendIdx["nodes"]=2;
  48044. $6=$recv($7)._first();
  48045. $ctx1.sendIdx["first"]=2;
  48046. $5=$recv($6)._nodes();
  48047. $ctx1.sendIdx["nodes"]=1;
  48048. $4=$recv($5)._first();
  48049. $ctx1.sendIdx["first"]=1;
  48050. $3=$recv($4)._receiver();
  48051. $ctx1.sendIdx["receiver"]=1;
  48052. $2=$recv($3)._binding();
  48053. $ctx1.sendIdx["binding"]=1;
  48054. $1=$recv($2)._isTempVar();
  48055. $ctx1.sendIdx["isTempVar"]=1;
  48056. self._assert_($1);
  48057. $ctx1.sendIdx["assert:"]=1;
  48058. $15=$recv(ast)._nodes();
  48059. $ctx1.sendIdx["nodes"]=4;
  48060. $14=$recv($15)._first();
  48061. $ctx1.sendIdx["first"]=4;
  48062. $13=$recv($14)._nodes();
  48063. $ctx1.sendIdx["nodes"]=3;
  48064. $12=$recv($13)._first();
  48065. $ctx1.sendIdx["first"]=3;
  48066. $11=$recv($12)._receiver();
  48067. $10=$recv($11)._binding();
  48068. $ctx1.sendIdx["binding"]=2;
  48069. $9=$recv($10)._scope();
  48070. $ctx1.sendIdx["scope"]=1;
  48071. $16=$recv(ast)._scope();
  48072. $ctx1.sendIdx["scope"]=2;
  48073. $8=$recv($9).__eq_eq($16);
  48074. $ctx1.sendIdx["=="]=1;
  48075. self._assert_($8);
  48076. $ctx1.sendIdx["assert:"]=2;
  48077. $27=$recv(ast)._nodes();
  48078. $ctx1.sendIdx["nodes"]=8;
  48079. $26=$recv($27)._first();
  48080. $ctx1.sendIdx["first"]=7;
  48081. $25=$recv($26)._nodes();
  48082. $ctx1.sendIdx["nodes"]=7;
  48083. $24=$recv($25)._last();
  48084. $ctx1.sendIdx["last"]=1;
  48085. $23=$recv($24)._nodes();
  48086. $ctx1.sendIdx["nodes"]=6;
  48087. $22=$recv($23)._first();
  48088. $ctx1.sendIdx["first"]=6;
  48089. $21=$recv($22)._nodes();
  48090. $ctx1.sendIdx["nodes"]=5;
  48091. $20=$recv($21)._first();
  48092. $ctx1.sendIdx["first"]=5;
  48093. $19=$recv($20)._left();
  48094. $ctx1.sendIdx["left"]=1;
  48095. $18=$recv($19)._binding();
  48096. $ctx1.sendIdx["binding"]=3;
  48097. $17=$recv($18)._isTempVar();
  48098. self._assert_($17);
  48099. $ctx1.sendIdx["assert:"]=3;
  48100. $39=$recv(ast)._nodes();
  48101. $ctx1.sendIdx["nodes"]=12;
  48102. $38=$recv($39)._first();
  48103. $ctx1.sendIdx["first"]=10;
  48104. $37=$recv($38)._nodes();
  48105. $ctx1.sendIdx["nodes"]=11;
  48106. $36=$recv($37)._last();
  48107. $ctx1.sendIdx["last"]=2;
  48108. $35=$recv($36)._nodes();
  48109. $ctx1.sendIdx["nodes"]=10;
  48110. $34=$recv($35)._first();
  48111. $ctx1.sendIdx["first"]=9;
  48112. $33=$recv($34)._nodes();
  48113. $ctx1.sendIdx["nodes"]=9;
  48114. $32=$recv($33)._first();
  48115. $ctx1.sendIdx["first"]=8;
  48116. $31=$recv($32)._left();
  48117. $30=$recv($31)._binding();
  48118. $29=$recv($30)._scope();
  48119. $ctx1.sendIdx["scope"]=3;
  48120. $42=$recv($recv($recv(ast)._nodes())._first())._nodes();
  48121. $ctx1.sendIdx["nodes"]=13;
  48122. $41=$recv($42)._last();
  48123. $40=$recv($41)._scope();
  48124. $28=$recv($29).__eq_eq($40);
  48125. self._assert_($28);
  48126. return self;
  48127. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48128. },
  48129. args: [],
  48130. 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.",
  48131. referencedClasses: ["Smalltalk"],
  48132. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  48133. }),
  48134. $globals.SemanticAnalyzerTest);
  48135. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  48136. $core.addMethod(
  48137. $core.method({
  48138. selector: "setUp",
  48139. protocol: 'running',
  48140. fn: function (){
  48141. var self=this;
  48142. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  48143. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48144. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  48145. return $core.withContext(function($ctx1) {
  48146. var $1,$2,$4,$5,$3,$6;
  48147. $1=$recv($AISemanticAnalyzer())._on_($Object());
  48148. $2=$1;
  48149. $4=$recv($AIContext())._new();
  48150. $recv($4)._defineLocal_("local");
  48151. $recv($4)._localAt_put_("local",(3));
  48152. $5=$recv($4)._yourself();
  48153. $ctx1.sendIdx["yourself"]=1;
  48154. $3=$5;
  48155. $recv($2)._context_($3);
  48156. $6=$recv($1)._yourself();
  48157. self["@analyzer"]=$6;
  48158. return self;
  48159. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  48160. },
  48161. args: [],
  48162. 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",
  48163. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  48164. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  48165. }),
  48166. $globals.AISemanticAnalyzerTest);
  48167. $core.addMethod(
  48168. $core.method({
  48169. selector: "testContextVariables",
  48170. protocol: 'tests',
  48171. fn: function (){
  48172. var self=this;
  48173. var src,ast;
  48174. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48175. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  48176. return $core.withContext(function($ctx1) {
  48177. src="foo | a | local + a";
  48178. ast=$recv($Smalltalk())._parse_(src);
  48179. self._shouldnt_raise_((function(){
  48180. return $core.withContext(function($ctx2) {
  48181. return $recv(self["@analyzer"])._visit_(ast);
  48182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48183. }),$UnknownVariableError());
  48184. return self;
  48185. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  48186. },
  48187. args: [],
  48188. 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",
  48189. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48190. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  48191. }),
  48192. $globals.AISemanticAnalyzerTest);
  48193. });
  48194. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){"use strict";
  48195. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  48196. $core.addPackage('Kernel-Tests');
  48197. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  48198. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48199. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  48200. $core.addMethod(
  48201. $core.method({
  48202. selector: "testAddExtensionMethod",
  48203. protocol: 'tests',
  48204. fn: function (){
  48205. var self=this;
  48206. var method,dirty;
  48207. return $core.withContext(function($ctx1) {
  48208. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  48209. $2=self._class();
  48210. $ctx1.sendIdx["class"]=1;
  48211. $1=$recv($2)._package();
  48212. $ctx1.sendIdx["package"]=1;
  48213. dirty=$recv($1)._isDirty();
  48214. $ctx1.sendIdx["isDirty"]=1;
  48215. $4=self._class();
  48216. $ctx1.sendIdx["class"]=2;
  48217. $3=$recv($4)._package();
  48218. $ctx1.sendIdx["package"]=2;
  48219. $recv($3)._beClean();
  48220. $5=self._class();
  48221. $ctx1.sendIdx["class"]=3;
  48222. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  48223. $8=self._class();
  48224. $ctx1.sendIdx["class"]=4;
  48225. $7=$recv($8)._package();
  48226. $ctx1.sendIdx["package"]=3;
  48227. $6=$recv($7)._isDirty();
  48228. self._deny_($6);
  48229. $9=self._class();
  48230. $ctx1.sendIdx["class"]=5;
  48231. $recv($9)._removeCompiledMethod_(method);
  48232. $10=dirty;
  48233. if($core.assert($10)){
  48234. $recv($recv(self._class())._package())._beDirty();
  48235. };
  48236. return self;
  48237. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  48238. },
  48239. args: [],
  48240. 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 ]",
  48241. referencedClasses: [],
  48242. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  48243. }),
  48244. $globals.AnnouncementSubscriptionTest);
  48245. $core.addMethod(
  48246. $core.method({
  48247. selector: "testHandlesAnnouncement",
  48248. protocol: 'tests',
  48249. fn: function (){
  48250. var self=this;
  48251. var subscription,announcementClass1,announcementClass2,classBuilder;
  48252. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  48253. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48254. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  48255. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48256. return $core.withContext(function($ctx1) {
  48257. var $1,$2;
  48258. classBuilder=$recv($ClassBuilder())._new();
  48259. $ctx1.sendIdx["new"]=1;
  48260. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  48261. subscription=$recv($recv($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  48262. $1=$recv(subscription)._handlesAnnouncement_($SystemAnnouncement());
  48263. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  48264. self._assert_equals_($1,true);
  48265. $ctx1.sendIdx["assert:equals:"]=1;
  48266. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  48267. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  48268. self._assert_equals_($2,true);
  48269. $ctx1.sendIdx["assert:equals:"]=2;
  48270. self._assert_equals_($recv(subscription)._handlesAnnouncement_($Object()),false);
  48271. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  48272. return self;
  48273. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  48274. },
  48275. args: [],
  48276. 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.",
  48277. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  48278. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  48279. }),
  48280. $globals.AnnouncementSubscriptionTest);
  48281. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  48282. $core.addMethod(
  48283. $core.method({
  48284. selector: "testOnDo",
  48285. protocol: 'tests',
  48286. fn: function (){
  48287. var self=this;
  48288. var counter,announcer;
  48289. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48290. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48291. return $core.withContext(function($ctx1) {
  48292. var $1,$2;
  48293. counter=(0);
  48294. announcer=$recv($Announcer())._new();
  48295. $ctx1.sendIdx["new"]=1;
  48296. $recv(announcer)._on_do_($SystemAnnouncement(),(function(){
  48297. return $core.withContext(function($ctx2) {
  48298. counter=$recv(counter).__plus((1));
  48299. return counter;
  48300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48301. }));
  48302. $1=announcer;
  48303. $2=$recv($SystemAnnouncement())._new();
  48304. $ctx1.sendIdx["new"]=2;
  48305. $recv($1)._announce_($2);
  48306. $ctx1.sendIdx["announce:"]=1;
  48307. self._assert_equals_(counter,(1));
  48308. $ctx1.sendIdx["assert:equals:"]=1;
  48309. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48310. self._assert_equals_(counter,(2));
  48311. return self;
  48312. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48313. },
  48314. args: [],
  48315. 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.",
  48316. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48317. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  48318. }),
  48319. $globals.AnnouncerTest);
  48320. $core.addMethod(
  48321. $core.method({
  48322. selector: "testOnDoFor",
  48323. protocol: 'tests',
  48324. fn: function (){
  48325. var self=this;
  48326. var counter,announcer;
  48327. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48328. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48329. return $core.withContext(function($ctx1) {
  48330. var $1,$2,$3,$4;
  48331. counter=(0);
  48332. announcer=$recv($Announcer())._new();
  48333. $ctx1.sendIdx["new"]=1;
  48334. $recv(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  48335. return $core.withContext(function($ctx2) {
  48336. counter=$recv(counter).__plus((1));
  48337. return counter;
  48338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48339. }),self);
  48340. $1=announcer;
  48341. $2=$recv($SystemAnnouncement())._new();
  48342. $ctx1.sendIdx["new"]=2;
  48343. $recv($1)._announce_($2);
  48344. $ctx1.sendIdx["announce:"]=1;
  48345. self._assert_equals_(counter,(1));
  48346. $ctx1.sendIdx["assert:equals:"]=1;
  48347. $3=announcer;
  48348. $4=$recv($SystemAnnouncement())._new();
  48349. $ctx1.sendIdx["new"]=3;
  48350. $recv($3)._announce_($4);
  48351. $ctx1.sendIdx["announce:"]=2;
  48352. self._assert_equals_(counter,(2));
  48353. $ctx1.sendIdx["assert:equals:"]=2;
  48354. $recv(announcer)._unsubscribe_(self);
  48355. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48356. self._assert_equals_(counter,(2));
  48357. return self;
  48358. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48359. },
  48360. args: [],
  48361. 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.",
  48362. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48363. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  48364. }),
  48365. $globals.AnnouncerTest);
  48366. $core.addMethod(
  48367. $core.method({
  48368. selector: "testOnDoOnce",
  48369. protocol: 'tests',
  48370. fn: function (){
  48371. var self=this;
  48372. var counter,announcer;
  48373. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48374. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48375. return $core.withContext(function($ctx1) {
  48376. var $1,$2;
  48377. counter=(0);
  48378. announcer=$recv($Announcer())._new();
  48379. $ctx1.sendIdx["new"]=1;
  48380. $recv(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  48381. return $core.withContext(function($ctx2) {
  48382. counter=$recv(counter).__plus((1));
  48383. return counter;
  48384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48385. }));
  48386. $1=announcer;
  48387. $2=$recv($SystemAnnouncement())._new();
  48388. $ctx1.sendIdx["new"]=2;
  48389. $recv($1)._announce_($2);
  48390. $ctx1.sendIdx["announce:"]=1;
  48391. self._assert_equals_(counter,(1));
  48392. $ctx1.sendIdx["assert:equals:"]=1;
  48393. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48394. self._assert_equals_(counter,(1));
  48395. return self;
  48396. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48397. },
  48398. args: [],
  48399. 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.",
  48400. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48401. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  48402. }),
  48403. $globals.AnnouncerTest);
  48404. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  48405. $core.addMethod(
  48406. $core.method({
  48407. selector: "localReturnOnDoCatch",
  48408. protocol: 'fixture',
  48409. fn: function (){
  48410. var self=this;
  48411. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48412. return $core.withContext(function($ctx1) {
  48413. var $early={};
  48414. try {
  48415. $recv((function(){
  48416. throw $early=[(2)];
  48417. }))._on_do_($Error(),(function(){
  48418. }));
  48419. return (3);
  48420. }
  48421. catch(e) {if(e===$early)return e[0]; throw e}
  48422. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  48423. },
  48424. args: [],
  48425. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  48426. referencedClasses: ["Error"],
  48427. messageSends: ["on:do:"]
  48428. }),
  48429. $globals.BlockClosureTest);
  48430. $core.addMethod(
  48431. $core.method({
  48432. selector: "localReturnOnDoMiss",
  48433. protocol: 'fixture',
  48434. fn: function (){
  48435. var self=this;
  48436. function $Class(){return $globals.Class||(typeof Class=="undefined"?nil:Class)}
  48437. return $core.withContext(function($ctx1) {
  48438. var $early={};
  48439. try {
  48440. $recv((function(){
  48441. throw $early=[(2)];
  48442. }))._on_do_($Class(),(function(){
  48443. }));
  48444. return (3);
  48445. }
  48446. catch(e) {if(e===$early)return e[0]; throw e}
  48447. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  48448. },
  48449. args: [],
  48450. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  48451. referencedClasses: ["Class"],
  48452. messageSends: ["on:do:"]
  48453. }),
  48454. $globals.BlockClosureTest);
  48455. $core.addMethod(
  48456. $core.method({
  48457. selector: "testCanClearInterval",
  48458. protocol: 'tests',
  48459. fn: function (){
  48460. var self=this;
  48461. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48462. return $core.withContext(function($ctx1) {
  48463. self._shouldnt_raise_((function(){
  48464. return $core.withContext(function($ctx2) {
  48465. return $recv($recv((function(){
  48466. return $core.withContext(function($ctx3) {
  48467. return $recv($recv($Error())._new())._signal();
  48468. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48469. }))._valueWithInterval_((0)))._clearInterval();
  48470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48471. }),$Error());
  48472. return self;
  48473. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  48474. },
  48475. args: [],
  48476. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  48477. referencedClasses: ["Error"],
  48478. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  48479. }),
  48480. $globals.BlockClosureTest);
  48481. $core.addMethod(
  48482. $core.method({
  48483. selector: "testCanClearTimeout",
  48484. protocol: 'tests',
  48485. fn: function (){
  48486. var self=this;
  48487. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48488. return $core.withContext(function($ctx1) {
  48489. self._shouldnt_raise_((function(){
  48490. return $core.withContext(function($ctx2) {
  48491. return $recv($recv((function(){
  48492. return $core.withContext(function($ctx3) {
  48493. return $recv($recv($Error())._new())._signal();
  48494. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48495. }))._valueWithTimeout_((0)))._clearTimeout();
  48496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48497. }),$Error());
  48498. return self;
  48499. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  48500. },
  48501. args: [],
  48502. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  48503. referencedClasses: ["Error"],
  48504. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  48505. }),
  48506. $globals.BlockClosureTest);
  48507. $core.addMethod(
  48508. $core.method({
  48509. selector: "testCompiledSource",
  48510. protocol: 'tests',
  48511. fn: function (){
  48512. var self=this;
  48513. return $core.withContext(function($ctx1) {
  48514. self._assert_($recv($recv((function(){
  48515. return $core.withContext(function($ctx2) {
  48516. return (1).__plus((1));
  48517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48518. }))._compiledSource())._includesSubString_("function"));
  48519. return self;
  48520. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  48521. },
  48522. args: [],
  48523. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  48524. referencedClasses: [],
  48525. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  48526. }),
  48527. $globals.BlockClosureTest);
  48528. $core.addMethod(
  48529. $core.method({
  48530. selector: "testCurrySelf",
  48531. protocol: 'tests',
  48532. fn: function (){
  48533. var self=this;
  48534. var curriedMethod,array;
  48535. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  48536. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  48537. return $core.withContext(function($ctx1) {
  48538. curriedMethod=$recv($recv((function(selfarg,x){
  48539. return $core.withContext(function($ctx2) {
  48540. return $recv(selfarg)._at_(x);
  48541. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  48542. }))._currySelf())._asCompiledMethod_("foo:");
  48543. array=[(3), (1), (4)];
  48544. $recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  48545. $recv((function(){
  48546. return $core.withContext(function($ctx2) {
  48547. return self._assert_equals_($recv(array)._foo_((2)),(1));
  48548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48549. }))._ensure_((function(){
  48550. return $core.withContext(function($ctx2) {
  48551. return $recv($Array())._removeCompiledMethod_(curriedMethod);
  48552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48553. }));
  48554. return self;
  48555. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  48556. },
  48557. args: [],
  48558. 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 ]",
  48559. referencedClasses: ["ClassBuilder", "Array"],
  48560. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  48561. }),
  48562. $globals.BlockClosureTest);
  48563. $core.addMethod(
  48564. $core.method({
  48565. selector: "testEnsure",
  48566. protocol: 'tests',
  48567. fn: function (){
  48568. var self=this;
  48569. return $core.withContext(function($ctx1) {
  48570. self._assert_equals_($recv((function(){
  48571. return (3);
  48572. }))._ensure_((function(){
  48573. return (4);
  48574. })),(3));
  48575. return self;
  48576. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  48577. },
  48578. args: [],
  48579. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  48580. referencedClasses: [],
  48581. messageSends: ["assert:equals:", "ensure:"]
  48582. }),
  48583. $globals.BlockClosureTest);
  48584. $core.addMethod(
  48585. $core.method({
  48586. selector: "testEnsureRaises",
  48587. protocol: 'tests',
  48588. fn: function (){
  48589. var self=this;
  48590. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48591. return $core.withContext(function($ctx1) {
  48592. self._should_raise_((function(){
  48593. return $core.withContext(function($ctx2) {
  48594. return $recv((function(){
  48595. return $core.withContext(function($ctx3) {
  48596. return $recv($recv($Error())._new())._signal();
  48597. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48598. }))._ensure_((function(){
  48599. return true;
  48600. }));
  48601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48602. }),$Error());
  48603. return self;
  48604. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  48605. },
  48606. args: [],
  48607. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  48608. referencedClasses: ["Error"],
  48609. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  48610. }),
  48611. $globals.BlockClosureTest);
  48612. $core.addMethod(
  48613. $core.method({
  48614. selector: "testExceptionSemantics",
  48615. protocol: 'tests',
  48616. fn: function (){
  48617. var self=this;
  48618. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48619. return $core.withContext(function($ctx1) {
  48620. self._timeout_((100));
  48621. $recv(self._async_((function(){
  48622. return $core.withContext(function($ctx2) {
  48623. return $recv((function(){
  48624. return $core.withContext(function($ctx3) {
  48625. self._assert_(true);
  48626. $recv($Error())._signal();
  48627. self._deny_(true);
  48628. return self._finished();
  48629. $ctx3.sendIdx["finished"]=1;
  48630. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48631. }))._on_do_($Error(),(function(ex){
  48632. return $core.withContext(function($ctx3) {
  48633. return self._finished();
  48634. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48635. }));
  48636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48637. })))._valueWithTimeout_((0));
  48638. return self;
  48639. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  48640. },
  48641. args: [],
  48642. 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",
  48643. referencedClasses: ["Error"],
  48644. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  48645. }),
  48646. $globals.BlockClosureTest);
  48647. $core.addMethod(
  48648. $core.method({
  48649. selector: "testLocalReturnOnDoCatch",
  48650. protocol: 'tests',
  48651. fn: function (){
  48652. var self=this;
  48653. return $core.withContext(function($ctx1) {
  48654. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  48655. return self;
  48656. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  48657. },
  48658. args: [],
  48659. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  48660. referencedClasses: [],
  48661. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  48662. }),
  48663. $globals.BlockClosureTest);
  48664. $core.addMethod(
  48665. $core.method({
  48666. selector: "testLocalReturnOnDoMiss",
  48667. protocol: 'tests',
  48668. fn: function (){
  48669. var self=this;
  48670. return $core.withContext(function($ctx1) {
  48671. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  48672. return self;
  48673. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  48674. },
  48675. args: [],
  48676. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  48677. referencedClasses: [],
  48678. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  48679. }),
  48680. $globals.BlockClosureTest);
  48681. $core.addMethod(
  48682. $core.method({
  48683. selector: "testNewWithValues",
  48684. protocol: 'tests',
  48685. fn: function (){
  48686. var self=this;
  48687. return $core.withContext(function($ctx1) {
  48688. function TestConstructor(arg1, arg2, arg3) {}
  48689. TestConstructor.prototype.name = 'theTestPrototype';
  48690. var wrappedConstructor = $recv(TestConstructor);
  48691. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  48692. self._assert_(result instanceof TestConstructor);
  48693. self._assert_equals_(result.name, 'theTestPrototype');
  48694. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  48695. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);;
  48696. return self;
  48697. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  48698. },
  48699. args: [],
  48700. 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>",
  48701. referencedClasses: [],
  48702. messageSends: []
  48703. }),
  48704. $globals.BlockClosureTest);
  48705. $core.addMethod(
  48706. $core.method({
  48707. selector: "testNumArgs",
  48708. protocol: 'tests',
  48709. fn: function (){
  48710. var self=this;
  48711. return $core.withContext(function($ctx1) {
  48712. var $1;
  48713. $1=$recv((function(){
  48714. }))._numArgs();
  48715. $ctx1.sendIdx["numArgs"]=1;
  48716. self._assert_equals_($1,(0));
  48717. $ctx1.sendIdx["assert:equals:"]=1;
  48718. self._assert_equals_($recv((function(a,b){
  48719. }))._numArgs(),(2));
  48720. return self;
  48721. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  48722. },
  48723. args: [],
  48724. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  48725. referencedClasses: [],
  48726. messageSends: ["assert:equals:", "numArgs"]
  48727. }),
  48728. $globals.BlockClosureTest);
  48729. $core.addMethod(
  48730. $core.method({
  48731. selector: "testOnDo",
  48732. protocol: 'tests',
  48733. fn: function (){
  48734. var self=this;
  48735. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48736. return $core.withContext(function($ctx1) {
  48737. self._assert_($recv((function(){
  48738. return $core.withContext(function($ctx2) {
  48739. return $recv($recv($Error())._new())._signal();
  48740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48741. }))._on_do_($Error(),(function(ex){
  48742. return true;
  48743. })));
  48744. return self;
  48745. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  48746. },
  48747. args: [],
  48748. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  48749. referencedClasses: ["Error"],
  48750. messageSends: ["assert:", "on:do:", "signal", "new"]
  48751. }),
  48752. $globals.BlockClosureTest);
  48753. $core.addMethod(
  48754. $core.method({
  48755. selector: "testValue",
  48756. protocol: 'tests',
  48757. fn: function (){
  48758. var self=this;
  48759. return $core.withContext(function($ctx1) {
  48760. var $1;
  48761. $1=$recv((function(){
  48762. return $core.withContext(function($ctx2) {
  48763. return (1).__plus((1));
  48764. $ctx2.sendIdx["+"]=1;
  48765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48766. }))._value();
  48767. $ctx1.sendIdx["value"]=1;
  48768. self._assert_equals_($1,(2));
  48769. $ctx1.sendIdx["assert:equals:"]=1;
  48770. self._assert_equals_($recv((function(x){
  48771. return $core.withContext(function($ctx2) {
  48772. return $recv(x).__plus((1));
  48773. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  48774. }))._value_((2)),(3));
  48775. $ctx1.sendIdx["assert:equals:"]=2;
  48776. self._assert_equals_($recv((function(x,y){
  48777. return $core.withContext(function($ctx2) {
  48778. return $recv(x).__star(y);
  48779. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  48780. }))._value_value_((2),(4)),(8));
  48781. $ctx1.sendIdx["assert:equals:"]=3;
  48782. self._assert_equals_($recv((function(a,b,c){
  48783. return (1);
  48784. }))._value(),(1));
  48785. return self;
  48786. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  48787. },
  48788. args: [],
  48789. 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",
  48790. referencedClasses: [],
  48791. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  48792. }),
  48793. $globals.BlockClosureTest);
  48794. $core.addMethod(
  48795. $core.method({
  48796. selector: "testValueWithPossibleArguments",
  48797. protocol: 'tests',
  48798. fn: function (){
  48799. var self=this;
  48800. return $core.withContext(function($ctx1) {
  48801. var $1,$2;
  48802. $1=$recv((function(){
  48803. return (1);
  48804. }))._valueWithPossibleArguments_([(3), (4)]);
  48805. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  48806. self._assert_equals_($1,(1));
  48807. $ctx1.sendIdx["assert:equals:"]=1;
  48808. $2=$recv((function(a){
  48809. return $core.withContext(function($ctx2) {
  48810. return $recv(a).__plus((4));
  48811. $ctx2.sendIdx["+"]=1;
  48812. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  48813. }))._valueWithPossibleArguments_([(3), (4)]);
  48814. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  48815. self._assert_equals_($2,(7));
  48816. $ctx1.sendIdx["assert:equals:"]=2;
  48817. self._assert_equals_($recv((function(a,b){
  48818. return $core.withContext(function($ctx2) {
  48819. return $recv(a).__plus(b);
  48820. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  48821. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  48822. return self;
  48823. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  48824. },
  48825. args: [],
  48826. 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.",
  48827. referencedClasses: [],
  48828. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  48829. }),
  48830. $globals.BlockClosureTest);
  48831. $core.addMethod(
  48832. $core.method({
  48833. selector: "testWhileFalse",
  48834. protocol: 'tests',
  48835. fn: function (){
  48836. var self=this;
  48837. var i;
  48838. return $core.withContext(function($ctx1) {
  48839. i=(0);
  48840. $recv((function(){
  48841. return $core.withContext(function($ctx2) {
  48842. return $recv(i).__gt((5));
  48843. $ctx2.sendIdx[">"]=1;
  48844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48845. }))._whileFalse_((function(){
  48846. return $core.withContext(function($ctx2) {
  48847. i=$recv(i).__plus((1));
  48848. $ctx2.sendIdx["+"]=1;
  48849. return i;
  48850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48851. }));
  48852. self._assert_equals_(i,(6));
  48853. $ctx1.sendIdx["assert:equals:"]=1;
  48854. i=(0);
  48855. $recv((function(){
  48856. return $core.withContext(function($ctx2) {
  48857. i=$recv(i).__plus((1));
  48858. i;
  48859. return $recv(i).__gt((5));
  48860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48861. }))._whileFalse();
  48862. self._assert_equals_(i,(6));
  48863. return self;
  48864. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  48865. },
  48866. args: [],
  48867. 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",
  48868. referencedClasses: [],
  48869. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  48870. }),
  48871. $globals.BlockClosureTest);
  48872. $core.addMethod(
  48873. $core.method({
  48874. selector: "testWhileTrue",
  48875. protocol: 'tests',
  48876. fn: function (){
  48877. var self=this;
  48878. var i;
  48879. return $core.withContext(function($ctx1) {
  48880. i=(0);
  48881. $recv((function(){
  48882. return $core.withContext(function($ctx2) {
  48883. return $recv(i).__lt((5));
  48884. $ctx2.sendIdx["<"]=1;
  48885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48886. }))._whileTrue_((function(){
  48887. return $core.withContext(function($ctx2) {
  48888. i=$recv(i).__plus((1));
  48889. $ctx2.sendIdx["+"]=1;
  48890. return i;
  48891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48892. }));
  48893. self._assert_equals_(i,(5));
  48894. $ctx1.sendIdx["assert:equals:"]=1;
  48895. i=(0);
  48896. $recv((function(){
  48897. return $core.withContext(function($ctx2) {
  48898. i=$recv(i).__plus((1));
  48899. i;
  48900. return $recv(i).__lt((5));
  48901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48902. }))._whileTrue();
  48903. self._assert_equals_(i,(5));
  48904. return self;
  48905. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  48906. },
  48907. args: [],
  48908. 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",
  48909. referencedClasses: [],
  48910. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  48911. }),
  48912. $globals.BlockClosureTest);
  48913. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  48914. $core.addMethod(
  48915. $core.method({
  48916. selector: "testEquality",
  48917. protocol: 'tests',
  48918. fn: function (){
  48919. var self=this;
  48920. return $core.withContext(function($ctx1) {
  48921. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  48922. $1=(0).__eq(false);
  48923. $ctx1.sendIdx["="]=1;
  48924. self._deny_($1);
  48925. $ctx1.sendIdx["deny:"]=1;
  48926. $2=false.__eq((0));
  48927. $ctx1.sendIdx["="]=2;
  48928. self._deny_($2);
  48929. $ctx1.sendIdx["deny:"]=2;
  48930. $3="".__eq(false);
  48931. $ctx1.sendIdx["="]=3;
  48932. self._deny_($3);
  48933. $ctx1.sendIdx["deny:"]=3;
  48934. $4=false.__eq("");
  48935. $ctx1.sendIdx["="]=4;
  48936. self._deny_($4);
  48937. $ctx1.sendIdx["deny:"]=4;
  48938. $5=true.__eq(true);
  48939. $ctx1.sendIdx["="]=5;
  48940. self._assert_($5);
  48941. $ctx1.sendIdx["assert:"]=1;
  48942. $6=false.__eq(true);
  48943. $ctx1.sendIdx["="]=6;
  48944. self._deny_($6);
  48945. $ctx1.sendIdx["deny:"]=5;
  48946. $7=true.__eq(false);
  48947. $ctx1.sendIdx["="]=7;
  48948. self._deny_($7);
  48949. $8=false.__eq(false);
  48950. $ctx1.sendIdx["="]=8;
  48951. self._assert_($8);
  48952. $ctx1.sendIdx["assert:"]=2;
  48953. $10=true._yourself();
  48954. $ctx1.sendIdx["yourself"]=1;
  48955. $9=$recv($10).__eq(true);
  48956. $ctx1.sendIdx["="]=9;
  48957. self._assert_($9);
  48958. $ctx1.sendIdx["assert:"]=3;
  48959. $12=true._yourself();
  48960. $ctx1.sendIdx["yourself"]=2;
  48961. $11=$recv($12).__eq(true._yourself());
  48962. self._assert_($11);
  48963. return self;
  48964. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  48965. },
  48966. args: [],
  48967. 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)",
  48968. referencedClasses: [],
  48969. messageSends: ["deny:", "=", "assert:", "yourself"]
  48970. }),
  48971. $globals.BooleanTest);
  48972. $core.addMethod(
  48973. $core.method({
  48974. selector: "testIdentity",
  48975. protocol: 'tests',
  48976. fn: function (){
  48977. var self=this;
  48978. return $core.withContext(function($ctx1) {
  48979. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  48980. $1=(0).__eq_eq(false);
  48981. $ctx1.sendIdx["=="]=1;
  48982. self._deny_($1);
  48983. $ctx1.sendIdx["deny:"]=1;
  48984. $2=false.__eq_eq((0));
  48985. $ctx1.sendIdx["=="]=2;
  48986. self._deny_($2);
  48987. $ctx1.sendIdx["deny:"]=2;
  48988. $3="".__eq_eq(false);
  48989. $ctx1.sendIdx["=="]=3;
  48990. self._deny_($3);
  48991. $ctx1.sendIdx["deny:"]=3;
  48992. $4=false.__eq_eq("");
  48993. $ctx1.sendIdx["=="]=4;
  48994. self._deny_($4);
  48995. $ctx1.sendIdx["deny:"]=4;
  48996. $5=true.__eq_eq(true);
  48997. $ctx1.sendIdx["=="]=5;
  48998. self._assert_($5);
  48999. $ctx1.sendIdx["assert:"]=1;
  49000. $6=false.__eq_eq(true);
  49001. $ctx1.sendIdx["=="]=6;
  49002. self._deny_($6);
  49003. $ctx1.sendIdx["deny:"]=5;
  49004. $7=true.__eq_eq(false);
  49005. $ctx1.sendIdx["=="]=7;
  49006. self._deny_($7);
  49007. $8=false.__eq_eq(false);
  49008. $ctx1.sendIdx["=="]=8;
  49009. self._assert_($8);
  49010. $ctx1.sendIdx["assert:"]=2;
  49011. $10=true._yourself();
  49012. $ctx1.sendIdx["yourself"]=1;
  49013. $9=$recv($10).__eq_eq(true);
  49014. $ctx1.sendIdx["=="]=9;
  49015. self._assert_($9);
  49016. $ctx1.sendIdx["assert:"]=3;
  49017. $12=true._yourself();
  49018. $ctx1.sendIdx["yourself"]=2;
  49019. $11=$recv($12).__eq_eq(true._yourself());
  49020. self._assert_($11);
  49021. return self;
  49022. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  49023. },
  49024. args: [],
  49025. 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",
  49026. referencedClasses: [],
  49027. messageSends: ["deny:", "==", "assert:", "yourself"]
  49028. }),
  49029. $globals.BooleanTest);
  49030. $core.addMethod(
  49031. $core.method({
  49032. selector: "testIfTrueIfFalse",
  49033. protocol: 'tests',
  49034. fn: function (){
  49035. var self=this;
  49036. return $core.withContext(function($ctx1) {
  49037. var $1,$2,$3,$4,$5,$6,$7,$8;
  49038. if($core.assert(true)){
  49039. $1="alternative block";
  49040. };
  49041. self._assert_equals_($1,"alternative block");
  49042. $ctx1.sendIdx["assert:equals:"]=1;
  49043. if(!$core.assert(true)){
  49044. $2="alternative block";
  49045. };
  49046. self._assert_equals_($2,nil);
  49047. $ctx1.sendIdx["assert:equals:"]=2;
  49048. if($core.assert(false)){
  49049. $3="alternative block";
  49050. };
  49051. self._assert_equals_($3,nil);
  49052. $ctx1.sendIdx["assert:equals:"]=3;
  49053. if(!$core.assert(false)){
  49054. $4="alternative block";
  49055. };
  49056. self._assert_equals_($4,"alternative block");
  49057. $ctx1.sendIdx["assert:equals:"]=4;
  49058. if($core.assert(false)){
  49059. $5="alternative block";
  49060. } else {
  49061. $5="alternative block2";
  49062. };
  49063. self._assert_equals_($5,"alternative block2");
  49064. $ctx1.sendIdx["assert:equals:"]=5;
  49065. if($core.assert(false)){
  49066. $6="alternative block2";
  49067. } else {
  49068. $6="alternative block";
  49069. };
  49070. self._assert_equals_($6,"alternative block");
  49071. $ctx1.sendIdx["assert:equals:"]=6;
  49072. if($core.assert(true)){
  49073. $7="alternative block";
  49074. } else {
  49075. $7="alternative block2";
  49076. };
  49077. self._assert_equals_($7,"alternative block");
  49078. $ctx1.sendIdx["assert:equals:"]=7;
  49079. if($core.assert(true)){
  49080. $8="alternative block2";
  49081. } else {
  49082. $8="alternative block";
  49083. };
  49084. self._assert_equals_($8,"alternative block2");
  49085. return self;
  49086. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  49087. },
  49088. args: [],
  49089. 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'.",
  49090. referencedClasses: [],
  49091. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49092. }),
  49093. $globals.BooleanTest);
  49094. $core.addMethod(
  49095. $core.method({
  49096. selector: "testIfTrueIfFalseWithBoxing",
  49097. protocol: 'tests',
  49098. fn: function (){
  49099. var self=this;
  49100. return $core.withContext(function($ctx1) {
  49101. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  49102. $2=true._yourself();
  49103. $ctx1.sendIdx["yourself"]=1;
  49104. if($core.assert($2)){
  49105. $1="alternative block";
  49106. };
  49107. self._assert_equals_($1,"alternative block");
  49108. $ctx1.sendIdx["assert:equals:"]=1;
  49109. $4=true._yourself();
  49110. $ctx1.sendIdx["yourself"]=2;
  49111. if(!$core.assert($4)){
  49112. $3="alternative block";
  49113. };
  49114. self._assert_equals_($3,nil);
  49115. $ctx1.sendIdx["assert:equals:"]=2;
  49116. $6=false._yourself();
  49117. $ctx1.sendIdx["yourself"]=3;
  49118. if($core.assert($6)){
  49119. $5="alternative block";
  49120. };
  49121. self._assert_equals_($5,nil);
  49122. $ctx1.sendIdx["assert:equals:"]=3;
  49123. $8=false._yourself();
  49124. $ctx1.sendIdx["yourself"]=4;
  49125. if(!$core.assert($8)){
  49126. $7="alternative block";
  49127. };
  49128. self._assert_equals_($7,"alternative block");
  49129. $ctx1.sendIdx["assert:equals:"]=4;
  49130. $10=false._yourself();
  49131. $ctx1.sendIdx["yourself"]=5;
  49132. if($core.assert($10)){
  49133. $9="alternative block";
  49134. } else {
  49135. $9="alternative block2";
  49136. };
  49137. self._assert_equals_($9,"alternative block2");
  49138. $ctx1.sendIdx["assert:equals:"]=5;
  49139. $12=false._yourself();
  49140. $ctx1.sendIdx["yourself"]=6;
  49141. if($core.assert($12)){
  49142. $11="alternative block2";
  49143. } else {
  49144. $11="alternative block";
  49145. };
  49146. self._assert_equals_($11,"alternative block");
  49147. $ctx1.sendIdx["assert:equals:"]=6;
  49148. $14=true._yourself();
  49149. $ctx1.sendIdx["yourself"]=7;
  49150. if($core.assert($14)){
  49151. $13="alternative block";
  49152. } else {
  49153. $13="alternative block2";
  49154. };
  49155. self._assert_equals_($13,"alternative block");
  49156. $ctx1.sendIdx["assert:equals:"]=7;
  49157. $16=true._yourself();
  49158. if($core.assert($16)){
  49159. $15="alternative block2";
  49160. } else {
  49161. $15="alternative block";
  49162. };
  49163. self._assert_equals_($15,"alternative block2");
  49164. return self;
  49165. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  49166. },
  49167. args: [],
  49168. 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'.",
  49169. referencedClasses: [],
  49170. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49171. }),
  49172. $globals.BooleanTest);
  49173. $core.addMethod(
  49174. $core.method({
  49175. selector: "testLogic",
  49176. protocol: 'tests',
  49177. fn: function (){
  49178. var self=this;
  49179. return $core.withContext(function($ctx1) {
  49180. 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;
  49181. $1=true.__and(true);
  49182. $ctx1.sendIdx["&"]=1;
  49183. self._assert_($1);
  49184. $ctx1.sendIdx["assert:"]=1;
  49185. $2=true.__and(false);
  49186. $ctx1.sendIdx["&"]=2;
  49187. self._deny_($2);
  49188. $ctx1.sendIdx["deny:"]=1;
  49189. $3=false.__and(true);
  49190. $ctx1.sendIdx["&"]=3;
  49191. self._deny_($3);
  49192. $ctx1.sendIdx["deny:"]=2;
  49193. $5=false.__and(false);
  49194. $ctx1.sendIdx["&"]=4;
  49195. $4=self._deny_($5);
  49196. $ctx1.sendIdx["deny:"]=3;
  49197. $6=true.__or(true);
  49198. $ctx1.sendIdx["|"]=1;
  49199. self._assert_($6);
  49200. $ctx1.sendIdx["assert:"]=2;
  49201. $7=true.__or(false);
  49202. $ctx1.sendIdx["|"]=2;
  49203. self._assert_($7);
  49204. $ctx1.sendIdx["assert:"]=3;
  49205. $8=false.__or(true);
  49206. $ctx1.sendIdx["|"]=3;
  49207. self._assert_($8);
  49208. $ctx1.sendIdx["assert:"]=4;
  49209. $10=false.__or(false);
  49210. $ctx1.sendIdx["|"]=4;
  49211. $9=self._deny_($10);
  49212. $ctx1.sendIdx["deny:"]=4;
  49213. $12=(1).__gt((0));
  49214. $ctx1.sendIdx[">"]=1;
  49215. $11=true.__and($12);
  49216. $ctx1.sendIdx["&"]=5;
  49217. self._assert_($11);
  49218. $ctx1.sendIdx["assert:"]=5;
  49219. $14=(1).__gt((0));
  49220. $ctx1.sendIdx[">"]=2;
  49221. $13=$recv($14).__and(false);
  49222. $ctx1.sendIdx["&"]=6;
  49223. self._deny_($13);
  49224. $ctx1.sendIdx["deny:"]=5;
  49225. $17=(1).__gt((0));
  49226. $ctx1.sendIdx[">"]=3;
  49227. $18=(1).__gt((2));
  49228. $ctx1.sendIdx[">"]=4;
  49229. $16=$recv($17).__and($18);
  49230. $15=self._deny_($16);
  49231. $20=(1).__gt((0));
  49232. $ctx1.sendIdx[">"]=5;
  49233. $19=false.__or($20);
  49234. $ctx1.sendIdx["|"]=5;
  49235. self._assert_($19);
  49236. $ctx1.sendIdx["assert:"]=6;
  49237. $22=(1).__gt((0));
  49238. $ctx1.sendIdx[">"]=6;
  49239. $21=$recv($22).__or(false);
  49240. $ctx1.sendIdx["|"]=6;
  49241. self._assert_($21);
  49242. $ctx1.sendIdx["assert:"]=7;
  49243. $25=(1).__gt((0));
  49244. $ctx1.sendIdx[">"]=7;
  49245. $24=$recv($25).__or((1).__gt((2)));
  49246. $23=self._assert_($24);
  49247. return self;
  49248. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  49249. },
  49250. args: [],
  49251. 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))",
  49252. referencedClasses: [],
  49253. messageSends: ["assert:", "&", "deny:", "|", ">"]
  49254. }),
  49255. $globals.BooleanTest);
  49256. $core.addMethod(
  49257. $core.method({
  49258. selector: "testLogicKeywords",
  49259. protocol: 'tests',
  49260. fn: function (){
  49261. var self=this;
  49262. return $core.withContext(function($ctx1) {
  49263. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  49264. $1=true._and_((function(){
  49265. return true;
  49266. }));
  49267. $ctx1.sendIdx["and:"]=1;
  49268. self._assert_($1);
  49269. $ctx1.sendIdx["assert:"]=1;
  49270. $2=true._and_((function(){
  49271. return false;
  49272. }));
  49273. $ctx1.sendIdx["and:"]=2;
  49274. self._deny_($2);
  49275. $ctx1.sendIdx["deny:"]=1;
  49276. $3=false._and_((function(){
  49277. return true;
  49278. }));
  49279. $ctx1.sendIdx["and:"]=3;
  49280. self._deny_($3);
  49281. $ctx1.sendIdx["deny:"]=2;
  49282. $5=false._and_((function(){
  49283. return false;
  49284. }));
  49285. $ctx1.sendIdx["and:"]=4;
  49286. $4=self._deny_($5);
  49287. $ctx1.sendIdx["deny:"]=3;
  49288. $6=true._or_((function(){
  49289. return true;
  49290. }));
  49291. $ctx1.sendIdx["or:"]=1;
  49292. self._assert_($6);
  49293. $ctx1.sendIdx["assert:"]=2;
  49294. $7=true._or_((function(){
  49295. return false;
  49296. }));
  49297. $ctx1.sendIdx["or:"]=2;
  49298. self._assert_($7);
  49299. $ctx1.sendIdx["assert:"]=3;
  49300. $8=false._or_((function(){
  49301. return true;
  49302. }));
  49303. $ctx1.sendIdx["or:"]=3;
  49304. self._assert_($8);
  49305. $ctx1.sendIdx["assert:"]=4;
  49306. $10=false._or_((function(){
  49307. return false;
  49308. }));
  49309. $ctx1.sendIdx["or:"]=4;
  49310. $9=self._deny_($10);
  49311. $ctx1.sendIdx["deny:"]=4;
  49312. $11=true._and_((function(){
  49313. return $core.withContext(function($ctx2) {
  49314. return (1).__gt((0));
  49315. $ctx2.sendIdx[">"]=1;
  49316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  49317. }));
  49318. $ctx1.sendIdx["and:"]=5;
  49319. self._assert_($11);
  49320. $ctx1.sendIdx["assert:"]=5;
  49321. $13=(1).__gt((0));
  49322. $ctx1.sendIdx[">"]=2;
  49323. $12=$recv($13)._and_((function(){
  49324. return false;
  49325. }));
  49326. $ctx1.sendIdx["and:"]=6;
  49327. self._deny_($12);
  49328. $ctx1.sendIdx["deny:"]=5;
  49329. $16=(1).__gt((0));
  49330. $ctx1.sendIdx[">"]=3;
  49331. $15=$recv($16)._and_((function(){
  49332. return $core.withContext(function($ctx2) {
  49333. return (1).__gt((2));
  49334. $ctx2.sendIdx[">"]=4;
  49335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  49336. }));
  49337. $14=self._deny_($15);
  49338. $17=false._or_((function(){
  49339. return $core.withContext(function($ctx2) {
  49340. return (1).__gt((0));
  49341. $ctx2.sendIdx[">"]=5;
  49342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  49343. }));
  49344. $ctx1.sendIdx["or:"]=5;
  49345. self._assert_($17);
  49346. $ctx1.sendIdx["assert:"]=6;
  49347. $19=(1).__gt((0));
  49348. $ctx1.sendIdx[">"]=6;
  49349. $18=$recv($19)._or_((function(){
  49350. return false;
  49351. }));
  49352. $ctx1.sendIdx["or:"]=6;
  49353. self._assert_($18);
  49354. $ctx1.sendIdx["assert:"]=7;
  49355. $22=(1).__gt((0));
  49356. $ctx1.sendIdx[">"]=7;
  49357. $21=$recv($22)._or_((function(){
  49358. return $core.withContext(function($ctx2) {
  49359. return (1).__gt((2));
  49360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  49361. }));
  49362. $20=self._assert_($21);
  49363. return self;
  49364. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  49365. },
  49366. args: [],
  49367. 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 ])",
  49368. referencedClasses: [],
  49369. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  49370. }),
  49371. $globals.BooleanTest);
  49372. $core.addMethod(
  49373. $core.method({
  49374. selector: "testNonBooleanError",
  49375. protocol: 'tests',
  49376. fn: function (){
  49377. var self=this;
  49378. function $NonBooleanReceiver(){return $globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  49379. return $core.withContext(function($ctx1) {
  49380. self._should_raise_((function(){
  49381. return $core.withContext(function($ctx2) {
  49382. if($core.assert("")){
  49383. } else {
  49384. };
  49385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49386. }),$NonBooleanReceiver());
  49387. return self;
  49388. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  49389. },
  49390. args: [],
  49391. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  49392. referencedClasses: ["NonBooleanReceiver"],
  49393. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  49394. }),
  49395. $globals.BooleanTest);
  49396. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  49397. $core.addMethod(
  49398. $core.method({
  49399. selector: "setUp",
  49400. protocol: 'running',
  49401. fn: function (){
  49402. var self=this;
  49403. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  49404. return $core.withContext(function($ctx1) {
  49405. self["@builder"]=$recv($ClassBuilder())._new();
  49406. return self;
  49407. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  49408. },
  49409. args: [],
  49410. source: "setUp\x0a\x09builder := ClassBuilder new",
  49411. referencedClasses: ["ClassBuilder"],
  49412. messageSends: ["new"]
  49413. }),
  49414. $globals.ClassBuilderTest);
  49415. $core.addMethod(
  49416. $core.method({
  49417. selector: "tearDown",
  49418. protocol: 'running',
  49419. fn: function (){
  49420. var self=this;
  49421. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49422. return $core.withContext(function($ctx1) {
  49423. var $1,$receiver;
  49424. $1=self["@theClass"];
  49425. if(($receiver = $1) == null || $receiver.isNil){
  49426. $1;
  49427. } else {
  49428. $recv($Smalltalk())._removeClass_(self["@theClass"]);
  49429. self["@theClass"]=nil;
  49430. self["@theClass"];
  49431. };
  49432. return self;
  49433. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  49434. },
  49435. args: [],
  49436. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  49437. referencedClasses: ["Smalltalk"],
  49438. messageSends: ["ifNotNil:", "removeClass:"]
  49439. }),
  49440. $globals.ClassBuilderTest);
  49441. $core.addMethod(
  49442. $core.method({
  49443. selector: "testClassCopy",
  49444. protocol: 'tests',
  49445. fn: function (){
  49446. var self=this;
  49447. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49448. return $core.withContext(function($ctx1) {
  49449. var $2,$1,$4,$3,$6,$5,$8,$7;
  49450. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49451. $2=$recv(self["@theClass"])._superclass();
  49452. $ctx1.sendIdx["superclass"]=1;
  49453. $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
  49454. $ctx1.sendIdx["=="]=1;
  49455. self._assert_($1);
  49456. $ctx1.sendIdx["assert:"]=1;
  49457. $4=$recv(self["@theClass"])._instanceVariableNames();
  49458. $ctx1.sendIdx["instanceVariableNames"]=1;
  49459. $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
  49460. $ctx1.sendIdx["=="]=2;
  49461. self._assert_($3);
  49462. $ctx1.sendIdx["assert:"]=2;
  49463. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  49464. $ctx1.sendIdx["assert:equals:"]=1;
  49465. $6=$recv(self["@theClass"])._package();
  49466. $ctx1.sendIdx["package"]=1;
  49467. $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
  49468. self._assert_($5);
  49469. $8=$recv(self["@theClass"])._methodDictionary();
  49470. $ctx1.sendIdx["methodDictionary"]=1;
  49471. $7=$recv($8)._keys();
  49472. $ctx1.sendIdx["keys"]=1;
  49473. self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
  49474. return self;
  49475. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  49476. },
  49477. args: [],
  49478. 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",
  49479. referencedClasses: ["ObjectMock"],
  49480. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  49481. }),
  49482. $globals.ClassBuilderTest);
  49483. $core.addMethod(
  49484. $core.method({
  49485. selector: "testClassMigration",
  49486. protocol: 'tests',
  49487. fn: function (){
  49488. var self=this;
  49489. var instance,oldClass;
  49490. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49491. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49492. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49493. return $core.withContext(function($ctx1) {
  49494. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  49495. oldClass=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49496. $2=$recv($Smalltalk())._globals();
  49497. $ctx1.sendIdx["globals"]=1;
  49498. $1=$recv($2)._at_("ObjectMock2");
  49499. $ctx1.sendIdx["at:"]=1;
  49500. instance=$recv($1)._new();
  49501. $4=$recv($Smalltalk())._globals();
  49502. $ctx1.sendIdx["globals"]=2;
  49503. $3=$recv($4)._at_("ObjectMock2");
  49504. $ctx1.sendIdx["at:"]=2;
  49505. $recv($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  49506. $5=$recv(oldClass).__eq_eq($ObjectMock2());
  49507. $ctx1.sendIdx["=="]=1;
  49508. self._deny_($5);
  49509. $ctx1.sendIdx["deny:"]=1;
  49510. $6=$recv($recv($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  49511. $ctx1.sendIdx["=="]=2;
  49512. self._assert_($6);
  49513. $ctx1.sendIdx["assert:"]=1;
  49514. self._assert_($recv($recv($ObjectMock2())._instanceVariableNames())._isEmpty());
  49515. $ctx1.sendIdx["assert:"]=2;
  49516. $7=$recv($ObjectMock2())._selectors();
  49517. $ctx1.sendIdx["selectors"]=1;
  49518. self._assert_equals_($7,$recv(oldClass)._selectors());
  49519. $ctx1.sendIdx["assert:equals:"]=1;
  49520. $8=$recv($ObjectMock2())._comment();
  49521. $ctx1.sendIdx["comment"]=1;
  49522. self._assert_equals_($8,$recv(oldClass)._comment());
  49523. $ctx1.sendIdx["assert:equals:"]=2;
  49524. $9=$recv($recv($ObjectMock2())._package())._name();
  49525. $ctx1.sendIdx["name"]=1;
  49526. self._assert_equals_($9,"Kernel-Tests");
  49527. $11=$recv(instance)._class();
  49528. $ctx1.sendIdx["class"]=1;
  49529. $10=$recv($11).__eq_eq($ObjectMock2());
  49530. self._deny_($10);
  49531. self._assert_($recv($recv($recv($Smalltalk())._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  49532. $recv($Smalltalk())._removeClass_($ObjectMock2());
  49533. return self;
  49534. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  49535. },
  49536. args: [],
  49537. 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",
  49538. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  49539. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  49540. }),
  49541. $globals.ClassBuilderTest);
  49542. $core.addMethod(
  49543. $core.method({
  49544. selector: "testClassMigrationWithClassInstanceVariables",
  49545. protocol: 'tests',
  49546. fn: function (){
  49547. var self=this;
  49548. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49549. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49550. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49551. return $core.withContext(function($ctx1) {
  49552. var $1;
  49553. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49554. $1=$recv($ObjectMock2())._class();
  49555. $ctx1.sendIdx["class"]=1;
  49556. $recv($1)._instanceVariableNames_("foo bar");
  49557. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  49558. self._assert_equals_($recv($recv($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  49559. $recv($Smalltalk())._removeClass_($ObjectMock2());
  49560. return self;
  49561. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  49562. },
  49563. args: [],
  49564. 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",
  49565. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  49566. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  49567. }),
  49568. $globals.ClassBuilderTest);
  49569. $core.addMethod(
  49570. $core.method({
  49571. selector: "testClassMigrationWithSubclasses",
  49572. protocol: 'tests',
  49573. fn: function (){
  49574. var self=this;
  49575. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49576. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49577. function $ObjectMock3(){return $globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  49578. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49579. function $ObjectMock4(){return $globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  49580. return $core.withContext(function($ctx1) {
  49581. var $2,$1,$4,$3;
  49582. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49583. $recv($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  49584. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  49585. $recv($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  49586. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  49587. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  49588. $2=$recv($ObjectMock())._subclasses();
  49589. $ctx1.sendIdx["subclasses"]=1;
  49590. $1=$recv($2)._includes_($ObjectMock2());
  49591. $ctx1.sendIdx["includes:"]=1;
  49592. self._assert_($1);
  49593. $ctx1.sendIdx["assert:"]=1;
  49594. $4=$recv($ObjectMock2())._subclasses();
  49595. $ctx1.sendIdx["subclasses"]=2;
  49596. $3=$recv($4)._includes_($ObjectMock3());
  49597. $ctx1.sendIdx["includes:"]=2;
  49598. self._assert_($3);
  49599. $ctx1.sendIdx["assert:"]=2;
  49600. self._assert_($recv($recv($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  49601. $recv($recv($ObjectMock())._allSubclasses())._do_((function(each){
  49602. return $core.withContext(function($ctx2) {
  49603. return $recv($Smalltalk())._removeClass_(each);
  49604. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49605. }));
  49606. return self;
  49607. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  49608. },
  49609. args: [],
  49610. 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 ]",
  49611. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  49612. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  49613. }),
  49614. $globals.ClassBuilderTest);
  49615. $core.addMethod(
  49616. $core.method({
  49617. selector: "testInstanceVariableNames",
  49618. protocol: 'tests',
  49619. fn: function (){
  49620. var self=this;
  49621. return $core.withContext(function($ctx1) {
  49622. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  49623. return self;
  49624. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  49625. },
  49626. args: [],
  49627. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  49628. referencedClasses: [],
  49629. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  49630. }),
  49631. $globals.ClassBuilderTest);
  49632. $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  49633. $core.addMethod(
  49634. $core.method({
  49635. selector: "jsConstructor",
  49636. protocol: 'running',
  49637. fn: function (){
  49638. var self=this;
  49639. return $core.withContext(function($ctx1) {
  49640. function Foo(){}
  49641. Foo.prototype.valueOf = function () {return 4;};
  49642. return Foo;
  49643. ;
  49644. return self;
  49645. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  49646. },
  49647. args: [],
  49648. source: "jsConstructor\x0a\x09<\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09>",
  49649. referencedClasses: [],
  49650. messageSends: []
  49651. }),
  49652. $globals.ClassTest);
  49653. $core.addMethod(
  49654. $core.method({
  49655. selector: "setUp",
  49656. protocol: 'running',
  49657. fn: function (){
  49658. var self=this;
  49659. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  49660. return $core.withContext(function($ctx1) {
  49661. self["@builder"]=$recv($ClassBuilder())._new();
  49662. return self;
  49663. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  49664. },
  49665. args: [],
  49666. source: "setUp\x0a\x09builder := ClassBuilder new",
  49667. referencedClasses: ["ClassBuilder"],
  49668. messageSends: ["new"]
  49669. }),
  49670. $globals.ClassTest);
  49671. $core.addMethod(
  49672. $core.method({
  49673. selector: "tearDown",
  49674. protocol: 'running',
  49675. fn: function (){
  49676. var self=this;
  49677. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49678. return $core.withContext(function($ctx1) {
  49679. var $1,$receiver;
  49680. $1=self["@theClass"];
  49681. if(($receiver = $1) == null || $receiver.isNil){
  49682. $1;
  49683. } else {
  49684. $recv($Smalltalk())._removeClass_(self["@theClass"]);
  49685. self["@theClass"]=nil;
  49686. self["@theClass"];
  49687. };
  49688. return self;
  49689. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  49690. },
  49691. args: [],
  49692. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  49693. referencedClasses: ["Smalltalk"],
  49694. messageSends: ["ifNotNil:", "removeClass:"]
  49695. }),
  49696. $globals.ClassTest);
  49697. $core.addMethod(
  49698. $core.method({
  49699. selector: "testSetJavaScriptConstructor",
  49700. protocol: 'tests',
  49701. fn: function (){
  49702. var self=this;
  49703. var instance;
  49704. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49705. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  49706. return $core.withContext(function($ctx1) {
  49707. var $2,$1,$4,$3,$6,$5,$8,$7;
  49708. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49709. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  49710. $2=$recv(self["@theClass"])._superclass();
  49711. $ctx1.sendIdx["superclass"]=1;
  49712. $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
  49713. $ctx1.sendIdx["=="]=1;
  49714. self._assert_($1);
  49715. $ctx1.sendIdx["assert:"]=1;
  49716. $4=$recv(self["@theClass"])._instanceVariableNames();
  49717. $ctx1.sendIdx["instanceVariableNames"]=1;
  49718. $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
  49719. $ctx1.sendIdx["=="]=2;
  49720. self._assert_($3);
  49721. $ctx1.sendIdx["assert:"]=2;
  49722. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  49723. $ctx1.sendIdx["assert:equals:"]=1;
  49724. $6=$recv(self["@theClass"])._package();
  49725. $ctx1.sendIdx["package"]=1;
  49726. $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
  49727. $ctx1.sendIdx["=="]=3;
  49728. self._assert_($5);
  49729. $ctx1.sendIdx["assert:"]=3;
  49730. $8=$recv(self["@theClass"])._methodDictionary();
  49731. $ctx1.sendIdx["methodDictionary"]=1;
  49732. $7=$recv($8)._keys();
  49733. $ctx1.sendIdx["keys"]=1;
  49734. self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
  49735. $ctx1.sendIdx["assert:equals:"]=2;
  49736. instance=$recv(self["@theClass"])._new();
  49737. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  49738. self._assert_equals_($recv(instance)._value(),(4));
  49739. $ctx1.sendIdx["assert:equals:"]=3;
  49740. self._shouldnt_raise_((function(){
  49741. return $core.withContext(function($ctx2) {
  49742. return $recv(instance)._foo_((9));
  49743. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49744. }),$Error());
  49745. self._assert_equals_($recv(instance)._foo(),(9));
  49746. return self;
  49747. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  49748. },
  49749. args: [],
  49750. 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",
  49751. referencedClasses: ["ObjectMock", "Error"],
  49752. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  49753. }),
  49754. $globals.ClassTest);
  49755. $core.addClass('CollectionTest', $globals.TestCase, [], 'Kernel-Tests');
  49756. $core.addMethod(
  49757. $core.method({
  49758. selector: "assertSameContents:as:",
  49759. protocol: 'convenience',
  49760. fn: function (aCollection,anotherCollection){
  49761. var self=this;
  49762. return $core.withContext(function($ctx1) {
  49763. var $2,$1,$4,$3;
  49764. $2=$recv(aCollection)._size();
  49765. $ctx1.sendIdx["size"]=1;
  49766. $1=$recv($2).__eq($recv(anotherCollection)._size());
  49767. $ctx1.sendIdx["="]=1;
  49768. self._assert_($1);
  49769. $ctx1.sendIdx["assert:"]=1;
  49770. $recv(aCollection)._do_((function(each){
  49771. return $core.withContext(function($ctx2) {
  49772. $4=$recv(aCollection)._occurrencesOf_(each);
  49773. $ctx2.sendIdx["occurrencesOf:"]=1;
  49774. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  49775. return self._assert_($3);
  49776. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49777. }));
  49778. return self;
  49779. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  49780. },
  49781. args: ["aCollection", "anotherCollection"],
  49782. 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)) ]",
  49783. referencedClasses: [],
  49784. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  49785. }),
  49786. $globals.CollectionTest);
  49787. $core.addMethod(
  49788. $core.method({
  49789. selector: "collection",
  49790. protocol: 'fixture',
  49791. fn: function (){
  49792. var self=this;
  49793. return $core.withContext(function($ctx1) {
  49794. self._subclassResponsibility();
  49795. return self;
  49796. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  49797. },
  49798. args: [],
  49799. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  49800. referencedClasses: [],
  49801. messageSends: ["subclassResponsibility"]
  49802. }),
  49803. $globals.CollectionTest);
  49804. $core.addMethod(
  49805. $core.method({
  49806. selector: "collectionClass",
  49807. protocol: 'fixture',
  49808. fn: function (){
  49809. var self=this;
  49810. return $core.withContext(function($ctx1) {
  49811. var $1;
  49812. $1=$recv(self._class())._collectionClass();
  49813. return $1;
  49814. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  49815. },
  49816. args: [],
  49817. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  49818. referencedClasses: [],
  49819. messageSends: ["collectionClass", "class"]
  49820. }),
  49821. $globals.CollectionTest);
  49822. $core.addMethod(
  49823. $core.method({
  49824. selector: "collectionOfPrintStrings",
  49825. protocol: 'fixture',
  49826. fn: function (){
  49827. var self=this;
  49828. return $core.withContext(function($ctx1) {
  49829. self._subclassResponsibility();
  49830. return self;
  49831. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  49832. },
  49833. args: [],
  49834. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  49835. referencedClasses: [],
  49836. messageSends: ["subclassResponsibility"]
  49837. }),
  49838. $globals.CollectionTest);
  49839. $core.addMethod(
  49840. $core.method({
  49841. selector: "collectionSize",
  49842. protocol: 'fixture',
  49843. fn: function (){
  49844. var self=this;
  49845. return $core.withContext(function($ctx1) {
  49846. self._subclassResponsibility();
  49847. return self;
  49848. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  49849. },
  49850. args: [],
  49851. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  49852. referencedClasses: [],
  49853. messageSends: ["subclassResponsibility"]
  49854. }),
  49855. $globals.CollectionTest);
  49856. $core.addMethod(
  49857. $core.method({
  49858. selector: "collectionWithDuplicates",
  49859. protocol: 'fixture',
  49860. fn: function (){
  49861. var self=this;
  49862. return $core.withContext(function($ctx1) {
  49863. self._subclassResponsibility();
  49864. return self;
  49865. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  49866. },
  49867. args: [],
  49868. 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",
  49869. referencedClasses: [],
  49870. messageSends: ["subclassResponsibility"]
  49871. }),
  49872. $globals.CollectionTest);
  49873. $core.addMethod(
  49874. $core.method({
  49875. selector: "collectionWithNewValue",
  49876. protocol: 'fixture',
  49877. fn: function (){
  49878. var self=this;
  49879. return $core.withContext(function($ctx1) {
  49880. self._subclassResponsibility();
  49881. return self;
  49882. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  49883. },
  49884. args: [],
  49885. 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",
  49886. referencedClasses: [],
  49887. messageSends: ["subclassResponsibility"]
  49888. }),
  49889. $globals.CollectionTest);
  49890. $core.addMethod(
  49891. $core.method({
  49892. selector: "isCollectionReadOnly",
  49893. protocol: 'testing',
  49894. fn: function (){
  49895. var self=this;
  49896. return false;
  49897. },
  49898. args: [],
  49899. source: "isCollectionReadOnly\x0a\x09^ false",
  49900. referencedClasses: [],
  49901. messageSends: []
  49902. }),
  49903. $globals.CollectionTest);
  49904. $core.addMethod(
  49905. $core.method({
  49906. selector: "sampleNewValue",
  49907. protocol: 'fixture',
  49908. fn: function (){
  49909. var self=this;
  49910. return "N";
  49911. },
  49912. args: [],
  49913. 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'",
  49914. referencedClasses: [],
  49915. messageSends: []
  49916. }),
  49917. $globals.CollectionTest);
  49918. $core.addMethod(
  49919. $core.method({
  49920. selector: "sampleNewValueAsCollection",
  49921. protocol: 'fixture',
  49922. fn: function (){
  49923. var self=this;
  49924. return $core.withContext(function($ctx1) {
  49925. var $1;
  49926. $1=$recv(self._collectionClass())._with_(self._sampleNewValue());
  49927. return $1;
  49928. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  49929. },
  49930. args: [],
  49931. 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",
  49932. referencedClasses: [],
  49933. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  49934. }),
  49935. $globals.CollectionTest);
  49936. $core.addMethod(
  49937. $core.method({
  49938. selector: "testAddAll",
  49939. protocol: 'tests',
  49940. fn: function (){
  49941. var self=this;
  49942. return $core.withContext(function($ctx1) {
  49943. 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;
  49944. $2=self._collection();
  49945. $ctx1.sendIdx["collection"]=1;
  49946. $3=$2;
  49947. $5=self._collectionClass();
  49948. $ctx1.sendIdx["collectionClass"]=1;
  49949. $4=$recv($5)._new();
  49950. $ctx1.sendIdx["new"]=1;
  49951. $recv($3)._addAll_($4);
  49952. $ctx1.sendIdx["addAll:"]=1;
  49953. $6=$recv($2)._yourself();
  49954. $ctx1.sendIdx["yourself"]=1;
  49955. $1=$6;
  49956. $7=self._collection();
  49957. $ctx1.sendIdx["collection"]=2;
  49958. self._assert_equals_($1,$7);
  49959. $ctx1.sendIdx["assert:equals:"]=1;
  49960. $10=self._collectionClass();
  49961. $ctx1.sendIdx["collectionClass"]=2;
  49962. $9=$recv($10)._new();
  49963. $ctx1.sendIdx["new"]=2;
  49964. $11=$9;
  49965. $12=self._collection();
  49966. $ctx1.sendIdx["collection"]=3;
  49967. $recv($11)._addAll_($12);
  49968. $ctx1.sendIdx["addAll:"]=2;
  49969. $13=$recv($9)._yourself();
  49970. $ctx1.sendIdx["yourself"]=2;
  49971. $8=$13;
  49972. $14=self._collection();
  49973. $ctx1.sendIdx["collection"]=4;
  49974. self._assert_equals_($8,$14);
  49975. $ctx1.sendIdx["assert:equals:"]=2;
  49976. $17=self._collectionClass();
  49977. $ctx1.sendIdx["collectionClass"]=3;
  49978. $16=$recv($17)._new();
  49979. $ctx1.sendIdx["new"]=3;
  49980. $18=$16;
  49981. $20=self._collectionClass();
  49982. $ctx1.sendIdx["collectionClass"]=4;
  49983. $19=$recv($20)._new();
  49984. $ctx1.sendIdx["new"]=4;
  49985. $recv($18)._addAll_($19);
  49986. $ctx1.sendIdx["addAll:"]=3;
  49987. $21=$recv($16)._yourself();
  49988. $ctx1.sendIdx["yourself"]=3;
  49989. $15=$21;
  49990. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49991. $ctx1.sendIdx["assert:equals:"]=3;
  49992. $23=self._collection();
  49993. $ctx1.sendIdx["collection"]=5;
  49994. $24=$23;
  49995. $25=self._sampleNewValueAsCollection();
  49996. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49997. $recv($24)._addAll_($25);
  49998. $ctx1.sendIdx["addAll:"]=4;
  49999. $26=$recv($23)._yourself();
  50000. $ctx1.sendIdx["yourself"]=4;
  50001. $22=$26;
  50002. $27=self._collectionWithNewValue();
  50003. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50004. self._assert_equals_($22,$27);
  50005. $28=self._sampleNewValueAsCollection();
  50006. $recv($28)._addAll_(self._collection());
  50007. $29=$recv($28)._yourself();
  50008. self._assertSameContents_as_($29,self._collectionWithNewValue());
  50009. return self;
  50010. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  50011. },
  50012. args: [],
  50013. 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",
  50014. referencedClasses: [],
  50015. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  50016. }),
  50017. $globals.CollectionTest);
  50018. $core.addMethod(
  50019. $core.method({
  50020. selector: "testAllSatisfy",
  50021. protocol: 'tests',
  50022. fn: function (){
  50023. var self=this;
  50024. var collection,anyOne;
  50025. return $core.withContext(function($ctx1) {
  50026. var $1;
  50027. collection=self._collection();
  50028. anyOne=$recv(collection)._anyOne();
  50029. $1=$recv(collection)._allSatisfy_((function(each){
  50030. return $core.withContext(function($ctx2) {
  50031. return $recv(collection)._includes_(each);
  50032. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50033. }));
  50034. $ctx1.sendIdx["allSatisfy:"]=1;
  50035. self._assert_($1);
  50036. self._deny_($recv(collection)._allSatisfy_((function(each){
  50037. return $core.withContext(function($ctx2) {
  50038. return $recv(each).__tild_eq(anyOne);
  50039. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50040. })));
  50041. return self;
  50042. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  50043. },
  50044. args: [],
  50045. 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 ])",
  50046. referencedClasses: [],
  50047. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  50048. }),
  50049. $globals.CollectionTest);
  50050. $core.addMethod(
  50051. $core.method({
  50052. selector: "testAnyOne",
  50053. protocol: 'tests',
  50054. fn: function (){
  50055. var self=this;
  50056. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50057. return $core.withContext(function($ctx1) {
  50058. var $2,$1;
  50059. self._should_raise_((function(){
  50060. return $core.withContext(function($ctx2) {
  50061. return $recv($recv(self._collectionClass())._new())._anyOne();
  50062. $ctx2.sendIdx["anyOne"]=1;
  50063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50064. }),$Error());
  50065. $2=self._collection();
  50066. $ctx1.sendIdx["collection"]=1;
  50067. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  50068. self._assert_($1);
  50069. return self;
  50070. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  50071. },
  50072. args: [],
  50073. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  50074. referencedClasses: ["Error"],
  50075. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  50076. }),
  50077. $globals.CollectionTest);
  50078. $core.addMethod(
  50079. $core.method({
  50080. selector: "testAnySatisfy",
  50081. protocol: 'tests',
  50082. fn: function (){
  50083. var self=this;
  50084. var anyOne;
  50085. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50086. return $core.withContext(function($ctx1) {
  50087. var $1,$3,$2;
  50088. $1=self._collection();
  50089. $ctx1.sendIdx["collection"]=1;
  50090. anyOne=$recv($1)._anyOne();
  50091. $3=self._collection();
  50092. $ctx1.sendIdx["collection"]=2;
  50093. $2=$recv($3)._anySatisfy_((function(each){
  50094. return $core.withContext(function($ctx2) {
  50095. return $recv(each).__eq(anyOne);
  50096. $ctx2.sendIdx["="]=1;
  50097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50098. }));
  50099. $ctx1.sendIdx["anySatisfy:"]=1;
  50100. self._assert_($2);
  50101. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  50102. return $core.withContext(function($ctx2) {
  50103. return $recv(each).__eq($recv($Object())._new());
  50104. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50105. })));
  50106. return self;
  50107. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  50108. },
  50109. args: [],
  50110. 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 ])",
  50111. referencedClasses: ["Object"],
  50112. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  50113. }),
  50114. $globals.CollectionTest);
  50115. $core.addMethod(
  50116. $core.method({
  50117. selector: "testAsArray",
  50118. protocol: 'tests',
  50119. fn: function (){
  50120. var self=this;
  50121. return $core.withContext(function($ctx1) {
  50122. var $1;
  50123. $1=self._collection();
  50124. $ctx1.sendIdx["collection"]=1;
  50125. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  50126. return self;
  50127. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  50128. },
  50129. args: [],
  50130. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  50131. referencedClasses: [],
  50132. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  50133. }),
  50134. $globals.CollectionTest);
  50135. $core.addMethod(
  50136. $core.method({
  50137. selector: "testAsOrderedCollection",
  50138. protocol: 'tests',
  50139. fn: function (){
  50140. var self=this;
  50141. return $core.withContext(function($ctx1) {
  50142. var $1;
  50143. $1=self._collection();
  50144. $ctx1.sendIdx["collection"]=1;
  50145. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  50146. return self;
  50147. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  50148. },
  50149. args: [],
  50150. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  50151. referencedClasses: [],
  50152. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  50153. }),
  50154. $globals.CollectionTest);
  50155. $core.addMethod(
  50156. $core.method({
  50157. selector: "testAsSet",
  50158. protocol: 'tests',
  50159. fn: function (){
  50160. var self=this;
  50161. var c,set;
  50162. return $core.withContext(function($ctx1) {
  50163. c=self._collectionWithDuplicates();
  50164. set=$recv(c)._asSet();
  50165. self._assert_equals_($recv(set)._size(),(5));
  50166. $recv(c)._do_((function(each){
  50167. return $core.withContext(function($ctx2) {
  50168. return self._assert_($recv(set)._includes_(each));
  50169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50170. }));
  50171. return self;
  50172. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  50173. },
  50174. args: [],
  50175. 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) ]",
  50176. referencedClasses: [],
  50177. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  50178. }),
  50179. $globals.CollectionTest);
  50180. $core.addMethod(
  50181. $core.method({
  50182. selector: "testCollect",
  50183. protocol: 'tests',
  50184. fn: function (){
  50185. var self=this;
  50186. return $core.withContext(function($ctx1) {
  50187. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  50188. $2=self._collection();
  50189. $ctx1.sendIdx["collection"]=1;
  50190. $1=$recv($2)._collect_((function(each){
  50191. return each;
  50192. }));
  50193. $ctx1.sendIdx["collect:"]=1;
  50194. $3=self._collection();
  50195. $ctx1.sendIdx["collection"]=2;
  50196. self._assert_equals_($1,$3);
  50197. $ctx1.sendIdx["assert:equals:"]=1;
  50198. $5=self._collectionWithNewValue();
  50199. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50200. $4=$recv($5)._collect_((function(each){
  50201. return each;
  50202. }));
  50203. $ctx1.sendIdx["collect:"]=2;
  50204. self._assert_equals_($4,self._collectionWithNewValue());
  50205. $ctx1.sendIdx["assert:equals:"]=2;
  50206. $8=self._collectionClass();
  50207. $ctx1.sendIdx["collectionClass"]=1;
  50208. $7=$recv($8)._new();
  50209. $ctx1.sendIdx["new"]=1;
  50210. $6=$recv($7)._collect_((function(each){
  50211. return $core.withContext(function($ctx2) {
  50212. return $recv(each)._printString();
  50213. $ctx2.sendIdx["printString"]=1;
  50214. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  50215. }));
  50216. $ctx1.sendIdx["collect:"]=3;
  50217. self._assert_equals_($6,$recv(self._collectionClass())._new());
  50218. $ctx1.sendIdx["assert:equals:"]=3;
  50219. $11=self._collection();
  50220. $ctx1.sendIdx["collection"]=3;
  50221. $10=$recv($11)._collect_((function(){
  50222. return $core.withContext(function($ctx2) {
  50223. return self._sampleNewValue();
  50224. $ctx2.sendIdx["sampleNewValue"]=1;
  50225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  50226. }));
  50227. $ctx1.sendIdx["collect:"]=4;
  50228. $9=$recv($10)._detect_((function(){
  50229. return true;
  50230. }));
  50231. self._assert_equals_($9,self._sampleNewValue());
  50232. $ctx1.sendIdx["assert:equals:"]=4;
  50233. self._assert_equals_($recv(self._collection())._collect_((function(each){
  50234. return $core.withContext(function($ctx2) {
  50235. return $recv(each)._printString();
  50236. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50237. })),self._collectionOfPrintStrings());
  50238. return self;
  50239. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  50240. },
  50241. args: [],
  50242. 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",
  50243. referencedClasses: [],
  50244. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  50245. }),
  50246. $globals.CollectionTest);
  50247. $core.addMethod(
  50248. $core.method({
  50249. selector: "testComma",
  50250. protocol: 'tests',
  50251. fn: function (){
  50252. var self=this;
  50253. return $core.withContext(function($ctx1) {
  50254. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  50255. $2=self._collection();
  50256. $ctx1.sendIdx["collection"]=1;
  50257. $4=self._collectionClass();
  50258. $ctx1.sendIdx["collectionClass"]=1;
  50259. $3=$recv($4)._new();
  50260. $ctx1.sendIdx["new"]=1;
  50261. $1=$recv($2).__comma($3);
  50262. $ctx1.sendIdx[","]=1;
  50263. $5=self._collection();
  50264. $ctx1.sendIdx["collection"]=2;
  50265. self._assert_equals_($1,$5);
  50266. $ctx1.sendIdx["assert:equals:"]=1;
  50267. $8=self._collectionClass();
  50268. $ctx1.sendIdx["collectionClass"]=2;
  50269. $7=$recv($8)._new();
  50270. $ctx1.sendIdx["new"]=2;
  50271. $9=self._collection();
  50272. $ctx1.sendIdx["collection"]=3;
  50273. $6=$recv($7).__comma($9);
  50274. $ctx1.sendIdx[","]=2;
  50275. $10=self._collection();
  50276. $ctx1.sendIdx["collection"]=4;
  50277. self._assert_equals_($6,$10);
  50278. $ctx1.sendIdx["assert:equals:"]=2;
  50279. $13=self._collectionClass();
  50280. $ctx1.sendIdx["collectionClass"]=3;
  50281. $12=$recv($13)._new();
  50282. $ctx1.sendIdx["new"]=3;
  50283. $15=self._collectionClass();
  50284. $ctx1.sendIdx["collectionClass"]=4;
  50285. $14=$recv($15)._new();
  50286. $ctx1.sendIdx["new"]=4;
  50287. $11=$recv($12).__comma($14);
  50288. $ctx1.sendIdx[","]=3;
  50289. self._assert_equals_($11,$recv(self._collectionClass())._new());
  50290. $ctx1.sendIdx["assert:equals:"]=3;
  50291. $17=self._collection();
  50292. $ctx1.sendIdx["collection"]=5;
  50293. $18=self._sampleNewValueAsCollection();
  50294. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  50295. $16=$recv($17).__comma($18);
  50296. $ctx1.sendIdx[","]=4;
  50297. $19=self._collectionWithNewValue();
  50298. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50299. self._assert_equals_($16,$19);
  50300. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  50301. return self;
  50302. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  50303. },
  50304. args: [],
  50305. 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",
  50306. referencedClasses: [],
  50307. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  50308. }),
  50309. $globals.CollectionTest);
  50310. $core.addMethod(
  50311. $core.method({
  50312. selector: "testDetect",
  50313. protocol: 'tests',
  50314. fn: function (){
  50315. var self=this;
  50316. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50317. return $core.withContext(function($ctx1) {
  50318. var $1,$2,$3,$4,$6,$5,$7;
  50319. self._shouldnt_raise_((function(){
  50320. return $core.withContext(function($ctx2) {
  50321. $1=self._collection();
  50322. $ctx2.sendIdx["collection"]=1;
  50323. return $recv($1)._detect_((function(){
  50324. return true;
  50325. }));
  50326. $ctx2.sendIdx["detect:"]=1;
  50327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50328. }),$Error());
  50329. self._should_raise_((function(){
  50330. return $core.withContext(function($ctx2) {
  50331. $2=self._collection();
  50332. $ctx2.sendIdx["collection"]=2;
  50333. return $recv($2)._detect_((function(){
  50334. return false;
  50335. }));
  50336. $ctx2.sendIdx["detect:"]=2;
  50337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50338. }),$Error());
  50339. $ctx1.sendIdx["should:raise:"]=1;
  50340. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  50341. return true;
  50342. }));
  50343. $ctx1.sendIdx["detect:"]=3;
  50344. $4=self._sampleNewValue();
  50345. $ctx1.sendIdx["sampleNewValue"]=1;
  50346. self._assert_equals_($3,$4);
  50347. $ctx1.sendIdx["assert:equals:"]=1;
  50348. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  50349. return $core.withContext(function($ctx2) {
  50350. $6=self._sampleNewValue();
  50351. $ctx2.sendIdx["sampleNewValue"]=2;
  50352. return $recv(each).__eq($6);
  50353. $ctx2.sendIdx["="]=1;
  50354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50355. }));
  50356. $ctx1.sendIdx["detect:"]=4;
  50357. $7=self._sampleNewValue();
  50358. $ctx1.sendIdx["sampleNewValue"]=3;
  50359. self._assert_equals_($5,$7);
  50360. self._should_raise_((function(){
  50361. return $core.withContext(function($ctx2) {
  50362. return $recv(self._collection())._detect_((function(each){
  50363. return $core.withContext(function($ctx3) {
  50364. return $recv(each).__eq(self._sampleNewValue());
  50365. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  50366. }));
  50367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  50368. }),$Error());
  50369. return self;
  50370. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  50371. },
  50372. args: [],
  50373. 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",
  50374. referencedClasses: ["Error"],
  50375. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  50376. }),
  50377. $globals.CollectionTest);
  50378. $core.addMethod(
  50379. $core.method({
  50380. selector: "testDetectIfNone",
  50381. protocol: 'tests',
  50382. fn: function (){
  50383. var self=this;
  50384. var sentinel;
  50385. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50386. return $core.withContext(function($ctx1) {
  50387. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  50388. sentinel=$recv($Object())._new();
  50389. $3=self._collection();
  50390. $ctx1.sendIdx["collection"]=1;
  50391. $2=$recv($3)._detect_ifNone_((function(){
  50392. return true;
  50393. }),(function(){
  50394. return sentinel;
  50395. }));
  50396. $ctx1.sendIdx["detect:ifNone:"]=1;
  50397. $1=$recv($2).__tild_eq(sentinel);
  50398. self._assert_($1);
  50399. $5=self._collection();
  50400. $ctx1.sendIdx["collection"]=2;
  50401. $4=$recv($5)._detect_ifNone_((function(){
  50402. return false;
  50403. }),(function(){
  50404. return sentinel;
  50405. }));
  50406. $ctx1.sendIdx["detect:ifNone:"]=2;
  50407. self._assert_equals_($4,sentinel);
  50408. $ctx1.sendIdx["assert:equals:"]=1;
  50409. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  50410. return true;
  50411. }),(function(){
  50412. return sentinel;
  50413. }));
  50414. $ctx1.sendIdx["detect:ifNone:"]=3;
  50415. $7=self._sampleNewValue();
  50416. $ctx1.sendIdx["sampleNewValue"]=1;
  50417. self._assert_equals_($6,$7);
  50418. $ctx1.sendIdx["assert:equals:"]=2;
  50419. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  50420. return $core.withContext(function($ctx2) {
  50421. $9=self._sampleNewValue();
  50422. $ctx2.sendIdx["sampleNewValue"]=2;
  50423. return $recv(each).__eq($9);
  50424. $ctx2.sendIdx["="]=1;
  50425. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  50426. }),(function(){
  50427. return sentinel;
  50428. }));
  50429. $ctx1.sendIdx["detect:ifNone:"]=4;
  50430. $10=self._sampleNewValue();
  50431. $ctx1.sendIdx["sampleNewValue"]=3;
  50432. self._assert_equals_($8,$10);
  50433. $ctx1.sendIdx["assert:equals:"]=3;
  50434. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  50435. return $core.withContext(function($ctx2) {
  50436. return $recv(each).__eq(self._sampleNewValue());
  50437. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  50438. }),(function(){
  50439. return sentinel;
  50440. })),sentinel);
  50441. return self;
  50442. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  50443. },
  50444. args: [],
  50445. 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",
  50446. referencedClasses: ["Object"],
  50447. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  50448. }),
  50449. $globals.CollectionTest);
  50450. $core.addMethod(
  50451. $core.method({
  50452. selector: "testDo",
  50453. protocol: 'tests',
  50454. fn: function (){
  50455. var self=this;
  50456. var newCollection;
  50457. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  50458. return $core.withContext(function($ctx1) {
  50459. var $1,$2;
  50460. newCollection=$recv($OrderedCollection())._new();
  50461. $ctx1.sendIdx["new"]=1;
  50462. $1=self._collection();
  50463. $ctx1.sendIdx["collection"]=1;
  50464. $recv($1)._do_((function(each){
  50465. return $core.withContext(function($ctx2) {
  50466. return $recv(newCollection)._add_(each);
  50467. $ctx2.sendIdx["add:"]=1;
  50468. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50469. }));
  50470. $ctx1.sendIdx["do:"]=1;
  50471. self._assertSameContents_as_(self._collection(),newCollection);
  50472. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50473. newCollection=$recv($OrderedCollection())._new();
  50474. $2=self._collectionWithDuplicates();
  50475. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  50476. $recv($2)._do_((function(each){
  50477. return $core.withContext(function($ctx2) {
  50478. return $recv(newCollection)._add_(each);
  50479. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50480. }));
  50481. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  50482. return self;
  50483. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  50484. },
  50485. args: [],
  50486. 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",
  50487. referencedClasses: ["OrderedCollection"],
  50488. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  50489. }),
  50490. $globals.CollectionTest);
  50491. $core.addMethod(
  50492. $core.method({
  50493. selector: "testIfEmptyFamily",
  50494. protocol: 'tests',
  50495. fn: function (){
  50496. var self=this;
  50497. return $core.withContext(function($ctx1) {
  50498. 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;
  50499. $3=self._collectionClass();
  50500. $ctx1.sendIdx["collectionClass"]=1;
  50501. $2=$recv($3)._new();
  50502. $ctx1.sendIdx["new"]=1;
  50503. $1=$recv($2)._ifEmpty_((function(){
  50504. return (42);
  50505. }));
  50506. $ctx1.sendIdx["ifEmpty:"]=1;
  50507. self._assert_equals_($1,(42));
  50508. $ctx1.sendIdx["assert:equals:"]=1;
  50509. $5=self._collection();
  50510. $ctx1.sendIdx["collection"]=1;
  50511. $4=$recv($5)._ifEmpty_((function(){
  50512. return (42);
  50513. }));
  50514. $6=self._collection();
  50515. $ctx1.sendIdx["collection"]=2;
  50516. self._assert_equals_($4,$6);
  50517. $ctx1.sendIdx["assert:equals:"]=2;
  50518. $9=self._collectionClass();
  50519. $ctx1.sendIdx["collectionClass"]=2;
  50520. $8=$recv($9)._new();
  50521. $ctx1.sendIdx["new"]=2;
  50522. $7=$recv($8)._ifNotEmpty_((function(){
  50523. return (42);
  50524. }));
  50525. $ctx1.sendIdx["ifNotEmpty:"]=1;
  50526. $11=self._collectionClass();
  50527. $ctx1.sendIdx["collectionClass"]=3;
  50528. $10=$recv($11)._new();
  50529. $ctx1.sendIdx["new"]=3;
  50530. self._assert_equals_($7,$10);
  50531. $ctx1.sendIdx["assert:equals:"]=3;
  50532. $13=self._collection();
  50533. $ctx1.sendIdx["collection"]=3;
  50534. $12=$recv($13)._ifNotEmpty_((function(){
  50535. return (42);
  50536. }));
  50537. $ctx1.sendIdx["ifNotEmpty:"]=2;
  50538. self._assert_equals_($12,(42));
  50539. $ctx1.sendIdx["assert:equals:"]=4;
  50540. $15=self._collection();
  50541. $ctx1.sendIdx["collection"]=4;
  50542. $14=$recv($15)._ifNotEmpty_((function(col){
  50543. return col;
  50544. }));
  50545. $16=self._collection();
  50546. $ctx1.sendIdx["collection"]=5;
  50547. self._assert_equals_($14,$16);
  50548. $ctx1.sendIdx["assert:equals:"]=5;
  50549. $19=self._collectionClass();
  50550. $ctx1.sendIdx["collectionClass"]=4;
  50551. $18=$recv($19)._new();
  50552. $ctx1.sendIdx["new"]=4;
  50553. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  50554. return (42);
  50555. }),(function(){
  50556. return (999);
  50557. }));
  50558. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  50559. self._assert_equals_($17,(42));
  50560. $ctx1.sendIdx["assert:equals:"]=6;
  50561. $21=self._collection();
  50562. $ctx1.sendIdx["collection"]=6;
  50563. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  50564. return (42);
  50565. }),(function(){
  50566. return (999);
  50567. }));
  50568. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  50569. self._assert_equals_($20,(999));
  50570. $ctx1.sendIdx["assert:equals:"]=7;
  50571. $23=self._collection();
  50572. $ctx1.sendIdx["collection"]=7;
  50573. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  50574. return (42);
  50575. }),(function(col){
  50576. return col;
  50577. }));
  50578. $24=self._collection();
  50579. $ctx1.sendIdx["collection"]=8;
  50580. self._assert_equals_($22,$24);
  50581. $ctx1.sendIdx["assert:equals:"]=8;
  50582. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  50583. return (42);
  50584. }),(function(){
  50585. return (999);
  50586. }));
  50587. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  50588. self._assert_equals_($25,(999));
  50589. $ctx1.sendIdx["assert:equals:"]=9;
  50590. $27=self._collection();
  50591. $ctx1.sendIdx["collection"]=9;
  50592. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  50593. return (42);
  50594. }),(function(){
  50595. return (999);
  50596. }));
  50597. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  50598. self._assert_equals_($26,(42));
  50599. $ctx1.sendIdx["assert:equals:"]=10;
  50600. $29=self._collection();
  50601. $ctx1.sendIdx["collection"]=10;
  50602. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  50603. return col;
  50604. }),(function(){
  50605. return (999);
  50606. }));
  50607. self._assert_equals_($28,self._collection());
  50608. return self;
  50609. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  50610. },
  50611. args: [],
  50612. 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.",
  50613. referencedClasses: [],
  50614. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  50615. }),
  50616. $globals.CollectionTest);
  50617. $core.addMethod(
  50618. $core.method({
  50619. selector: "testIsEmpty",
  50620. protocol: 'tests',
  50621. fn: function (){
  50622. var self=this;
  50623. return $core.withContext(function($ctx1) {
  50624. var $1;
  50625. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  50626. $ctx1.sendIdx["isEmpty"]=1;
  50627. self._assert_($1);
  50628. self._deny_($recv(self._collection())._isEmpty());
  50629. return self;
  50630. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  50631. },
  50632. args: [],
  50633. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  50634. referencedClasses: [],
  50635. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  50636. }),
  50637. $globals.CollectionTest);
  50638. $core.addMethod(
  50639. $core.method({
  50640. selector: "testNoneSatisfy",
  50641. protocol: 'tests',
  50642. fn: function (){
  50643. var self=this;
  50644. var anyOne;
  50645. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50646. return $core.withContext(function($ctx1) {
  50647. var $1,$3,$2;
  50648. $1=self._collection();
  50649. $ctx1.sendIdx["collection"]=1;
  50650. anyOne=$recv($1)._anyOne();
  50651. $3=self._collection();
  50652. $ctx1.sendIdx["collection"]=2;
  50653. $2=$recv($3)._noneSatisfy_((function(each){
  50654. return $core.withContext(function($ctx2) {
  50655. return $recv(each).__eq(anyOne);
  50656. $ctx2.sendIdx["="]=1;
  50657. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50658. }));
  50659. $ctx1.sendIdx["noneSatisfy:"]=1;
  50660. self._deny_($2);
  50661. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  50662. return $core.withContext(function($ctx2) {
  50663. return $recv(each).__eq($recv($Object())._new());
  50664. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50665. })));
  50666. return self;
  50667. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  50668. },
  50669. args: [],
  50670. 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 ])",
  50671. referencedClasses: ["Object"],
  50672. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  50673. }),
  50674. $globals.CollectionTest);
  50675. $core.addMethod(
  50676. $core.method({
  50677. selector: "testRemoveAll",
  50678. protocol: 'tests',
  50679. fn: function (){
  50680. var self=this;
  50681. return $core.withContext(function($ctx1) {
  50682. var $1,$2;
  50683. $1=self._collection();
  50684. $recv($1)._removeAll();
  50685. $2=$recv($1)._yourself();
  50686. self._assert_equals_($2,$recv(self._collectionClass())._new());
  50687. return self;
  50688. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  50689. },
  50690. args: [],
  50691. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  50692. referencedClasses: [],
  50693. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  50694. }),
  50695. $globals.CollectionTest);
  50696. $core.addMethod(
  50697. $core.method({
  50698. selector: "testSelect",
  50699. protocol: 'tests',
  50700. fn: function (){
  50701. var self=this;
  50702. return $core.withContext(function($ctx1) {
  50703. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  50704. $2=self._collection();
  50705. $ctx1.sendIdx["collection"]=1;
  50706. $1=$recv($2)._select_((function(){
  50707. return false;
  50708. }));
  50709. $ctx1.sendIdx["select:"]=1;
  50710. $4=self._collectionClass();
  50711. $ctx1.sendIdx["collectionClass"]=1;
  50712. $3=$recv($4)._new();
  50713. $ctx1.sendIdx["new"]=1;
  50714. self._assert_equals_($1,$3);
  50715. $ctx1.sendIdx["assert:equals:"]=1;
  50716. $6=self._collection();
  50717. $ctx1.sendIdx["collection"]=2;
  50718. $5=$recv($6)._select_((function(){
  50719. return true;
  50720. }));
  50721. $ctx1.sendIdx["select:"]=2;
  50722. $7=self._collection();
  50723. $ctx1.sendIdx["collection"]=3;
  50724. self._assert_equals_($5,$7);
  50725. $ctx1.sendIdx["assert:equals:"]=2;
  50726. $9=self._collectionWithNewValue();
  50727. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50728. $8=$recv($9)._select_((function(each){
  50729. return $core.withContext(function($ctx2) {
  50730. $10=self._sampleNewValue();
  50731. $ctx2.sendIdx["sampleNewValue"]=1;
  50732. return $recv(each).__eq($10);
  50733. $ctx2.sendIdx["="]=1;
  50734. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  50735. }));
  50736. $ctx1.sendIdx["select:"]=3;
  50737. self._assert_equals_($8,self._sampleNewValueAsCollection());
  50738. $ctx1.sendIdx["assert:equals:"]=3;
  50739. $12=self._collectionWithNewValue();
  50740. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50741. $11=$recv($12)._select_((function(each){
  50742. return $core.withContext(function($ctx2) {
  50743. $13=self._sampleNewValue();
  50744. $ctx2.sendIdx["sampleNewValue"]=2;
  50745. return $recv(each).__tild_eq($13);
  50746. $ctx2.sendIdx["~="]=1;
  50747. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  50748. }));
  50749. $ctx1.sendIdx["select:"]=4;
  50750. $14=self._collection();
  50751. $ctx1.sendIdx["collection"]=4;
  50752. self._assert_equals_($11,$14);
  50753. $ctx1.sendIdx["assert:equals:"]=4;
  50754. $16=self._collection();
  50755. $ctx1.sendIdx["collection"]=5;
  50756. $15=$recv($16)._select_((function(each){
  50757. return $core.withContext(function($ctx2) {
  50758. $17=self._sampleNewValue();
  50759. $ctx2.sendIdx["sampleNewValue"]=3;
  50760. return $recv(each).__eq($17);
  50761. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  50762. }));
  50763. $ctx1.sendIdx["select:"]=5;
  50764. self._assert_equals_($15,$recv(self._collectionClass())._new());
  50765. $ctx1.sendIdx["assert:equals:"]=5;
  50766. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  50767. return $core.withContext(function($ctx2) {
  50768. return $recv(each).__tild_eq(self._sampleNewValue());
  50769. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50770. })),self._collection());
  50771. return self;
  50772. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  50773. },
  50774. args: [],
  50775. 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",
  50776. referencedClasses: [],
  50777. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  50778. }),
  50779. $globals.CollectionTest);
  50780. $core.addMethod(
  50781. $core.method({
  50782. selector: "testSize",
  50783. protocol: 'tests',
  50784. fn: function (){
  50785. var self=this;
  50786. return $core.withContext(function($ctx1) {
  50787. var $1,$2;
  50788. $1=$recv($recv(self._collectionClass())._new())._size();
  50789. $ctx1.sendIdx["size"]=1;
  50790. self._assert_equals_($1,(0));
  50791. $ctx1.sendIdx["assert:equals:"]=1;
  50792. $2=$recv(self._sampleNewValueAsCollection())._size();
  50793. $ctx1.sendIdx["size"]=2;
  50794. self._assert_equals_($2,(1));
  50795. $ctx1.sendIdx["assert:equals:"]=2;
  50796. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  50797. return self;
  50798. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  50799. },
  50800. args: [],
  50801. 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",
  50802. referencedClasses: [],
  50803. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  50804. }),
  50805. $globals.CollectionTest);
  50806. $core.addMethod(
  50807. $core.method({
  50808. selector: "collectionClass",
  50809. protocol: 'fixture',
  50810. fn: function (){
  50811. var self=this;
  50812. return nil;
  50813. },
  50814. args: [],
  50815. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  50816. referencedClasses: [],
  50817. messageSends: []
  50818. }),
  50819. $globals.CollectionTest.klass);
  50820. $core.addMethod(
  50821. $core.method({
  50822. selector: "isAbstract",
  50823. protocol: 'testing',
  50824. fn: function (){
  50825. var self=this;
  50826. return $core.withContext(function($ctx1) {
  50827. var $1;
  50828. $1=$recv(self._collectionClass())._isNil();
  50829. return $1;
  50830. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  50831. },
  50832. args: [],
  50833. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  50834. referencedClasses: [],
  50835. messageSends: ["isNil", "collectionClass"]
  50836. }),
  50837. $globals.CollectionTest.klass);
  50838. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  50839. $core.addMethod(
  50840. $core.method({
  50841. selector: "collectionWithNewValue",
  50842. protocol: 'fixture',
  50843. fn: function (){
  50844. var self=this;
  50845. return $core.withContext(function($ctx1) {
  50846. self._subclassResponsibility();
  50847. return self;
  50848. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  50849. },
  50850. args: [],
  50851. 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",
  50852. referencedClasses: [],
  50853. messageSends: ["subclassResponsibility"]
  50854. }),
  50855. $globals.IndexableCollectionTest);
  50856. $core.addMethod(
  50857. $core.method({
  50858. selector: "sampleNewIndex",
  50859. protocol: 'fixture',
  50860. fn: function (){
  50861. var self=this;
  50862. return $core.withContext(function($ctx1) {
  50863. self._subclassResponsibility();
  50864. return self;
  50865. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  50866. },
  50867. args: [],
  50868. 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",
  50869. referencedClasses: [],
  50870. messageSends: ["subclassResponsibility"]
  50871. }),
  50872. $globals.IndexableCollectionTest);
  50873. $core.addMethod(
  50874. $core.method({
  50875. selector: "sampleNonIndexesDo:",
  50876. protocol: 'fixture',
  50877. fn: function (aBlock){
  50878. var self=this;
  50879. return $core.withContext(function($ctx1) {
  50880. self._subclassResponsibility();
  50881. return self;
  50882. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50883. },
  50884. args: ["aBlock"],
  50885. 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",
  50886. referencedClasses: [],
  50887. messageSends: ["subclassResponsibility"]
  50888. }),
  50889. $globals.IndexableCollectionTest);
  50890. $core.addMethod(
  50891. $core.method({
  50892. selector: "samplesDo:",
  50893. protocol: 'fixture',
  50894. fn: function (aBlock){
  50895. var self=this;
  50896. return $core.withContext(function($ctx1) {
  50897. self._subclassResponsibility();
  50898. return self;
  50899. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50900. },
  50901. args: ["aBlock"],
  50902. 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",
  50903. referencedClasses: [],
  50904. messageSends: ["subclassResponsibility"]
  50905. }),
  50906. $globals.IndexableCollectionTest);
  50907. $core.addMethod(
  50908. $core.method({
  50909. selector: "testAt",
  50910. protocol: 'tests',
  50911. fn: function (){
  50912. var self=this;
  50913. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50914. return $core.withContext(function($ctx1) {
  50915. var $1;
  50916. self._nonIndexesDo_((function(each){
  50917. return $core.withContext(function($ctx2) {
  50918. return self._should_raise_((function(){
  50919. return $core.withContext(function($ctx3) {
  50920. $1=self._collection();
  50921. $ctx3.sendIdx["collection"]=1;
  50922. return $recv($1)._at_(each);
  50923. $ctx3.sendIdx["at:"]=1;
  50924. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50925. }),$Error());
  50926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50927. }));
  50928. self._samplesDo_((function(index,value){
  50929. return $core.withContext(function($ctx2) {
  50930. return self._assert_equals_($recv(self._collection())._at_(index),value);
  50931. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50932. }));
  50933. return self;
  50934. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  50935. },
  50936. args: [],
  50937. 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 ]",
  50938. referencedClasses: ["Error"],
  50939. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  50940. }),
  50941. $globals.IndexableCollectionTest);
  50942. $core.addMethod(
  50943. $core.method({
  50944. selector: "testAtIfAbsent",
  50945. protocol: 'tests',
  50946. fn: function (){
  50947. var self=this;
  50948. return $core.withContext(function($ctx1) {
  50949. var $2,$1,$3;
  50950. self._nonIndexesDo_((function(each){
  50951. return $core.withContext(function($ctx2) {
  50952. $2=self._collection();
  50953. $ctx2.sendIdx["collection"]=1;
  50954. $1=$recv($2)._at_ifAbsent_(each,(function(){
  50955. return $core.withContext(function($ctx3) {
  50956. return self._sampleNewValue();
  50957. $ctx3.sendIdx["sampleNewValue"]=1;
  50958. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50959. }));
  50960. $ctx2.sendIdx["at:ifAbsent:"]=1;
  50961. $3=self._sampleNewValue();
  50962. $ctx2.sendIdx["sampleNewValue"]=2;
  50963. return self._assert_equals_($1,$3);
  50964. $ctx2.sendIdx["assert:equals:"]=1;
  50965. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50966. }));
  50967. self._samplesDo_((function(index,value){
  50968. return $core.withContext(function($ctx2) {
  50969. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  50970. return $core.withContext(function($ctx3) {
  50971. return self._sampleNewValue();
  50972. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50973. })),value);
  50974. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50975. }));
  50976. return self;
  50977. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  50978. },
  50979. args: [],
  50980. 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 ].",
  50981. referencedClasses: [],
  50982. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  50983. }),
  50984. $globals.IndexableCollectionTest);
  50985. $core.addMethod(
  50986. $core.method({
  50987. selector: "testAtIfAbsentPut",
  50988. protocol: 'tests',
  50989. fn: function (){
  50990. var self=this;
  50991. var newCollection;
  50992. return $core.withContext(function($ctx1) {
  50993. var $1;
  50994. newCollection=self._collection();
  50995. $ctx1.sendIdx["collection"]=1;
  50996. self._samplesDo_((function(index,value){
  50997. return $core.withContext(function($ctx2) {
  50998. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  50999. return $core.withContext(function($ctx3) {
  51000. return self._sampleNewValue();
  51001. $ctx3.sendIdx["sampleNewValue"]=1;
  51002. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51003. }));
  51004. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  51005. return self._assert_equals_($1,value);
  51006. $ctx2.sendIdx["assert:equals:"]=1;
  51007. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51008. }));
  51009. self._assert_equals_(newCollection,self._collection());
  51010. $ctx1.sendIdx["assert:equals:"]=2;
  51011. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  51012. return $core.withContext(function($ctx2) {
  51013. return self._sampleNewValue();
  51014. $ctx2.sendIdx["sampleNewValue"]=2;
  51015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51016. })),self._sampleNewValue());
  51017. $ctx1.sendIdx["assert:equals:"]=3;
  51018. self._assert_equals_(newCollection,self._collectionWithNewValue());
  51019. return self;
  51020. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  51021. },
  51022. args: [],
  51023. 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",
  51024. referencedClasses: [],
  51025. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  51026. }),
  51027. $globals.IndexableCollectionTest);
  51028. $core.addMethod(
  51029. $core.method({
  51030. selector: "testAtIfPresent",
  51031. protocol: 'tests',
  51032. fn: function (){
  51033. var self=this;
  51034. var visited,sentinel;
  51035. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  51036. return $core.withContext(function($ctx1) {
  51037. var $2,$1,$4,$3;
  51038. sentinel=$recv($Object())._new();
  51039. self._nonIndexesDo_((function(each){
  51040. return $core.withContext(function($ctx2) {
  51041. visited=nil;
  51042. visited;
  51043. $2=self._collection();
  51044. $ctx2.sendIdx["collection"]=1;
  51045. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  51046. visited=value1;
  51047. visited;
  51048. return sentinel;
  51049. }));
  51050. $ctx2.sendIdx["at:ifPresent:"]=1;
  51051. self._assert_equals_($1,nil);
  51052. $ctx2.sendIdx["assert:equals:"]=1;
  51053. return self._assert_($recv(visited)._isNil());
  51054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51055. }));
  51056. self._samplesDo_((function(index,value){
  51057. return $core.withContext(function($ctx2) {
  51058. visited=nil;
  51059. visited;
  51060. $4=self._collection();
  51061. $ctx2.sendIdx["collection"]=2;
  51062. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  51063. visited=value2;
  51064. visited;
  51065. return sentinel;
  51066. }));
  51067. self._assert_equals_($3,sentinel);
  51068. $ctx2.sendIdx["assert:equals:"]=2;
  51069. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  51070. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  51071. }));
  51072. return self;
  51073. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  51074. },
  51075. args: [],
  51076. 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) ]",
  51077. referencedClasses: ["Object"],
  51078. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  51079. }),
  51080. $globals.IndexableCollectionTest);
  51081. $core.addMethod(
  51082. $core.method({
  51083. selector: "testAtIfPresentIfAbsent",
  51084. protocol: 'tests',
  51085. fn: function (){
  51086. var self=this;
  51087. var visited,sentinel;
  51088. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  51089. return $core.withContext(function($ctx1) {
  51090. var $2,$1,$3,$5,$4;
  51091. sentinel=$recv($Object())._new();
  51092. self._nonIndexesDo_((function(each){
  51093. return $core.withContext(function($ctx2) {
  51094. visited=nil;
  51095. visited;
  51096. $2=self._collection();
  51097. $ctx2.sendIdx["collection"]=1;
  51098. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  51099. visited=value1;
  51100. visited;
  51101. return sentinel;
  51102. }),(function(){
  51103. return $core.withContext(function($ctx3) {
  51104. return self._sampleNewValue();
  51105. $ctx3.sendIdx["sampleNewValue"]=1;
  51106. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  51107. }));
  51108. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  51109. $3=self._sampleNewValue();
  51110. $ctx2.sendIdx["sampleNewValue"]=2;
  51111. self._assert_equals_($1,$3);
  51112. $ctx2.sendIdx["assert:equals:"]=1;
  51113. return self._assert_($recv(visited)._isNil());
  51114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51115. }));
  51116. self._samplesDo_((function(index,value){
  51117. return $core.withContext(function($ctx2) {
  51118. visited=nil;
  51119. visited;
  51120. $5=self._collection();
  51121. $ctx2.sendIdx["collection"]=2;
  51122. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  51123. visited=value2;
  51124. visited;
  51125. return sentinel;
  51126. }),(function(){
  51127. return $core.withContext(function($ctx3) {
  51128. return self._sampleNewValue();
  51129. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  51130. }));
  51131. self._assert_equals_($4,sentinel);
  51132. $ctx2.sendIdx["assert:equals:"]=2;
  51133. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  51134. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  51135. }));
  51136. return self;
  51137. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  51138. },
  51139. args: [],
  51140. 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) ]",
  51141. referencedClasses: ["Object"],
  51142. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  51143. }),
  51144. $globals.IndexableCollectionTest);
  51145. $core.addMethod(
  51146. $core.method({
  51147. selector: "testAtPut",
  51148. protocol: 'tests',
  51149. fn: function (){
  51150. var self=this;
  51151. var newCollection;
  51152. return $core.withContext(function($ctx1) {
  51153. newCollection=self._collection();
  51154. $ctx1.sendIdx["collection"]=1;
  51155. self._samplesDo_((function(index,value){
  51156. return $core.withContext(function($ctx2) {
  51157. return $recv(newCollection)._at_put_(index,value);
  51158. $ctx2.sendIdx["at:put:"]=1;
  51159. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51160. }));
  51161. self._assert_equals_(newCollection,self._collection());
  51162. $ctx1.sendIdx["assert:equals:"]=1;
  51163. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  51164. self._assert_equals_(newCollection,self._collectionWithNewValue());
  51165. return self;
  51166. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  51167. },
  51168. args: [],
  51169. 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",
  51170. referencedClasses: [],
  51171. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  51172. }),
  51173. $globals.IndexableCollectionTest);
  51174. $core.addMethod(
  51175. $core.method({
  51176. selector: "testEquality",
  51177. protocol: 'tests',
  51178. fn: function (){
  51179. var self=this;
  51180. return $core.withContext(function($ctx1) {
  51181. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  51182. $2=self._collectionClass();
  51183. $ctx1.sendIdx["collectionClass"]=1;
  51184. $1=$recv($2)._new();
  51185. $ctx1.sendIdx["new"]=1;
  51186. $4=self._collectionClass();
  51187. $ctx1.sendIdx["collectionClass"]=2;
  51188. $3=$recv($4)._new();
  51189. $ctx1.sendIdx["new"]=2;
  51190. self._assert_equals_($1,$3);
  51191. $ctx1.sendIdx["assert:equals:"]=1;
  51192. $5=self._collection();
  51193. $ctx1.sendIdx["collection"]=1;
  51194. $6=self._collection();
  51195. $ctx1.sendIdx["collection"]=2;
  51196. self._assert_equals_($5,$6);
  51197. $ctx1.sendIdx["assert:equals:"]=2;
  51198. $7=self._collectionWithNewValue();
  51199. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51200. self._assert_equals_($7,self._collectionWithNewValue());
  51201. $10=self._collectionClass();
  51202. $ctx1.sendIdx["collectionClass"]=3;
  51203. $9=$recv($10)._new();
  51204. $ctx1.sendIdx["new"]=3;
  51205. $11=self._collection();
  51206. $ctx1.sendIdx["collection"]=3;
  51207. $8=$recv($9).__eq($11);
  51208. $ctx1.sendIdx["="]=1;
  51209. self._deny_($8);
  51210. $ctx1.sendIdx["deny:"]=1;
  51211. self._deny_($recv(self._collection()).__eq($recv(self._collectionClass())._new()));
  51212. return self;
  51213. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.IndexableCollectionTest)});
  51214. },
  51215. args: [],
  51216. 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",
  51217. referencedClasses: [],
  51218. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  51219. }),
  51220. $globals.IndexableCollectionTest);
  51221. $core.addMethod(
  51222. $core.method({
  51223. selector: "testIndexOf",
  51224. protocol: 'tests',
  51225. fn: function (){
  51226. var self=this;
  51227. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51228. return $core.withContext(function($ctx1) {
  51229. var $1;
  51230. self._should_raise_((function(){
  51231. return $core.withContext(function($ctx2) {
  51232. $1=self._collection();
  51233. $ctx2.sendIdx["collection"]=1;
  51234. return $recv($1)._indexOf_(self._sampleNewValue());
  51235. $ctx2.sendIdx["indexOf:"]=1;
  51236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51237. }),$Error());
  51238. self._samplesDo_((function(index,value){
  51239. return $core.withContext(function($ctx2) {
  51240. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  51241. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  51242. }));
  51243. return self;
  51244. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  51245. },
  51246. args: [],
  51247. 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 ]",
  51248. referencedClasses: ["Error"],
  51249. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  51250. }),
  51251. $globals.IndexableCollectionTest);
  51252. $core.addMethod(
  51253. $core.method({
  51254. selector: "testIndexOfWithNull",
  51255. protocol: 'tests',
  51256. fn: function (){
  51257. var self=this;
  51258. var jsNull;
  51259. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  51260. return $core.withContext(function($ctx1) {
  51261. var $1,$2;
  51262. jsNull=$recv($JSON())._parse_("null");
  51263. self._samplesDo_((function(index,value){
  51264. return $core.withContext(function($ctx2) {
  51265. $1=self._collection();
  51266. $recv($1)._at_put_(index,jsNull);
  51267. $2=$recv($1)._indexOf_(jsNull);
  51268. return self._assert_equals_($2,index);
  51269. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51270. }));
  51271. return self;
  51272. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  51273. },
  51274. args: [],
  51275. 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 ]",
  51276. referencedClasses: ["JSON"],
  51277. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  51278. }),
  51279. $globals.IndexableCollectionTest);
  51280. $core.addMethod(
  51281. $core.method({
  51282. selector: "testWithIndexDo",
  51283. protocol: 'tests',
  51284. fn: function (){
  51285. var self=this;
  51286. var collection;
  51287. return $core.withContext(function($ctx1) {
  51288. collection=self._collection();
  51289. $ctx1.sendIdx["collection"]=1;
  51290. $recv(self._collection())._withIndexDo_((function(each,index){
  51291. return $core.withContext(function($ctx2) {
  51292. return self._assert_equals_($recv(collection)._at_(index),each);
  51293. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  51294. }));
  51295. return self;
  51296. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  51297. },
  51298. args: [],
  51299. 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 ]",
  51300. referencedClasses: [],
  51301. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  51302. }),
  51303. $globals.IndexableCollectionTest);
  51304. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  51305. $core.addMethod(
  51306. $core.method({
  51307. selector: "collectionKeys",
  51308. protocol: 'fixture',
  51309. fn: function (){
  51310. var self=this;
  51311. return $core.withContext(function($ctx1) {
  51312. self._subclassResponsibility();
  51313. return self;
  51314. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  51315. },
  51316. args: [],
  51317. source: "collectionKeys\x0a\x09self subclassResponsibility",
  51318. referencedClasses: [],
  51319. messageSends: ["subclassResponsibility"]
  51320. }),
  51321. $globals.AssociativeCollectionTest);
  51322. $core.addMethod(
  51323. $core.method({
  51324. selector: "collectionValues",
  51325. protocol: 'fixture',
  51326. fn: function (){
  51327. var self=this;
  51328. return $core.withContext(function($ctx1) {
  51329. self._subclassResponsibility();
  51330. return self;
  51331. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  51332. },
  51333. args: [],
  51334. source: "collectionValues\x0a\x09self subclassResponsibility",
  51335. referencedClasses: [],
  51336. messageSends: ["subclassResponsibility"]
  51337. }),
  51338. $globals.AssociativeCollectionTest);
  51339. $core.addMethod(
  51340. $core.method({
  51341. selector: "nonIndexesDo:",
  51342. protocol: 'fixture',
  51343. fn: function (aBlock){
  51344. var self=this;
  51345. return $core.withContext(function($ctx1) {
  51346. $recv(aBlock)._value_((5));
  51347. $ctx1.sendIdx["value:"]=1;
  51348. $recv(aBlock)._value_("z");
  51349. return self;
  51350. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  51351. },
  51352. args: ["aBlock"],
  51353. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  51354. referencedClasses: [],
  51355. messageSends: ["value:"]
  51356. }),
  51357. $globals.AssociativeCollectionTest);
  51358. $core.addMethod(
  51359. $core.method({
  51360. selector: "sampleNewIndex",
  51361. protocol: 'fixture',
  51362. fn: function (){
  51363. var self=this;
  51364. return "new";
  51365. },
  51366. args: [],
  51367. source: "sampleNewIndex\x0a\x09^ 'new'",
  51368. referencedClasses: [],
  51369. messageSends: []
  51370. }),
  51371. $globals.AssociativeCollectionTest);
  51372. $core.addMethod(
  51373. $core.method({
  51374. selector: "samplesDo:",
  51375. protocol: 'fixture',
  51376. fn: function (aBlock){
  51377. var self=this;
  51378. return $core.withContext(function($ctx1) {
  51379. $recv(aBlock)._value_value_("a",(2));
  51380. return self;
  51381. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  51382. },
  51383. args: ["aBlock"],
  51384. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  51385. referencedClasses: [],
  51386. messageSends: ["value:value:"]
  51387. }),
  51388. $globals.AssociativeCollectionTest);
  51389. $core.addMethod(
  51390. $core.method({
  51391. selector: "testAddAll",
  51392. protocol: 'tests',
  51393. fn: function (){
  51394. var self=this;
  51395. return $core.withContext(function($ctx1) {
  51396. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  51397. (
  51398. $ctx1.supercall = true,
  51399. $globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
  51400. $ctx1.supercall = false;
  51401. $2=self._collection();
  51402. $ctx1.sendIdx["collection"]=1;
  51403. $3=$2;
  51404. $4=self._collection();
  51405. $ctx1.sendIdx["collection"]=2;
  51406. $recv($3)._addAll_($4);
  51407. $ctx1.sendIdx["addAll:"]=1;
  51408. $5=$recv($2)._yourself();
  51409. $ctx1.sendIdx["yourself"]=1;
  51410. $1=$5;
  51411. $6=self._collection();
  51412. $ctx1.sendIdx["collection"]=3;
  51413. self._assert_equals_($1,$6);
  51414. $ctx1.sendIdx["assert:equals:"]=1;
  51415. $8=self._collection();
  51416. $ctx1.sendIdx["collection"]=4;
  51417. $9=$8;
  51418. $10=self._collectionWithNewValue();
  51419. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51420. $recv($9)._addAll_($10);
  51421. $ctx1.sendIdx["addAll:"]=2;
  51422. $11=$recv($8)._yourself();
  51423. $ctx1.sendIdx["yourself"]=2;
  51424. $7=$11;
  51425. $12=self._collectionWithNewValue();
  51426. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51427. self._assert_equals_($7,$12);
  51428. $ctx1.sendIdx["assert:equals:"]=2;
  51429. $14=self._collectionWithNewValue();
  51430. $ctx1.sendIdx["collectionWithNewValue"]=3;
  51431. $recv($14)._addAll_(self._collection());
  51432. $15=$recv($14)._yourself();
  51433. $13=$15;
  51434. self._assert_equals_($13,self._collectionWithNewValue());
  51435. return self;
  51436. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  51437. },
  51438. args: [],
  51439. 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",
  51440. referencedClasses: [],
  51441. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  51442. }),
  51443. $globals.AssociativeCollectionTest);
  51444. $core.addMethod(
  51445. $core.method({
  51446. selector: "testAsDictionary",
  51447. protocol: 'tests',
  51448. fn: function (){
  51449. var self=this;
  51450. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51451. return $core.withContext(function($ctx1) {
  51452. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  51453. return self;
  51454. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  51455. },
  51456. args: [],
  51457. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  51458. referencedClasses: ["Dictionary"],
  51459. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  51460. }),
  51461. $globals.AssociativeCollectionTest);
  51462. $core.addMethod(
  51463. $core.method({
  51464. selector: "testAsHashedCollection",
  51465. protocol: 'tests',
  51466. fn: function (){
  51467. var self=this;
  51468. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  51469. return $core.withContext(function($ctx1) {
  51470. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  51471. return self;
  51472. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  51473. },
  51474. args: [],
  51475. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  51476. referencedClasses: ["HashedCollection"],
  51477. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  51478. }),
  51479. $globals.AssociativeCollectionTest);
  51480. $core.addMethod(
  51481. $core.method({
  51482. selector: "testComma",
  51483. protocol: 'tests',
  51484. fn: function (){
  51485. var self=this;
  51486. return $core.withContext(function($ctx1) {
  51487. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  51488. (
  51489. $ctx1.supercall = true,
  51490. $globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply($recv(self), []));
  51491. $ctx1.supercall = false;
  51492. $2=self._collection();
  51493. $ctx1.sendIdx["collection"]=1;
  51494. $3=self._collection();
  51495. $ctx1.sendIdx["collection"]=2;
  51496. $1=$recv($2).__comma($3);
  51497. $ctx1.sendIdx[","]=1;
  51498. $4=self._collection();
  51499. $ctx1.sendIdx["collection"]=3;
  51500. self._assert_equals_($1,$4);
  51501. $ctx1.sendIdx["assert:equals:"]=1;
  51502. $6=self._collection();
  51503. $ctx1.sendIdx["collection"]=4;
  51504. $7=self._collectionWithNewValue();
  51505. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51506. $5=$recv($6).__comma($7);
  51507. $ctx1.sendIdx[","]=2;
  51508. $8=self._collectionWithNewValue();
  51509. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51510. self._assert_equals_($5,$8);
  51511. $ctx1.sendIdx["assert:equals:"]=2;
  51512. $10=self._collectionWithNewValue();
  51513. $ctx1.sendIdx["collectionWithNewValue"]=3;
  51514. $9=$recv($10).__comma(self._collection());
  51515. self._assert_equals_($9,self._collectionWithNewValue());
  51516. return self;
  51517. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  51518. },
  51519. args: [],
  51520. 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",
  51521. referencedClasses: [],
  51522. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  51523. }),
  51524. $globals.AssociativeCollectionTest);
  51525. $core.addMethod(
  51526. $core.method({
  51527. selector: "testFrom",
  51528. protocol: 'tests',
  51529. fn: function (){
  51530. var self=this;
  51531. var associations;
  51532. return $core.withContext(function($ctx1) {
  51533. var $1;
  51534. $1="a".__minus_gt((1));
  51535. $ctx1.sendIdx["->"]=1;
  51536. associations=[$1,"b".__minus_gt((2))];
  51537. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  51538. return self;
  51539. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  51540. },
  51541. args: [],
  51542. 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 }.",
  51543. referencedClasses: [],
  51544. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  51545. }),
  51546. $globals.AssociativeCollectionTest);
  51547. $core.addMethod(
  51548. $core.method({
  51549. selector: "testKeys",
  51550. protocol: 'tests',
  51551. fn: function (){
  51552. var self=this;
  51553. return $core.withContext(function($ctx1) {
  51554. var $2,$1,$3,$4;
  51555. $2=$recv($recv(self._collectionClass())._new())._keys();
  51556. $ctx1.sendIdx["keys"]=1;
  51557. $1=$recv($2)._isEmpty();
  51558. self._assert_($1);
  51559. $3=$recv(self._collection())._keys();
  51560. $ctx1.sendIdx["keys"]=2;
  51561. $4=self._collectionKeys();
  51562. $ctx1.sendIdx["collectionKeys"]=1;
  51563. self._assertSameContents_as_($3,$4);
  51564. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51565. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  51566. return self;
  51567. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  51568. },
  51569. args: [],
  51570. 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 }",
  51571. referencedClasses: [],
  51572. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  51573. }),
  51574. $globals.AssociativeCollectionTest);
  51575. $core.addMethod(
  51576. $core.method({
  51577. selector: "testNewFromPairs",
  51578. protocol: 'tests',
  51579. fn: function (){
  51580. var self=this;
  51581. var flattenedAssociations;
  51582. return $core.withContext(function($ctx1) {
  51583. flattenedAssociations=["a",(1),"b",(2)];
  51584. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  51585. return self;
  51586. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  51587. },
  51588. args: [],
  51589. 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 }.",
  51590. referencedClasses: [],
  51591. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  51592. }),
  51593. $globals.AssociativeCollectionTest);
  51594. $core.addMethod(
  51595. $core.method({
  51596. selector: "testPrintString",
  51597. protocol: 'tests',
  51598. fn: function (){
  51599. var self=this;
  51600. return $core.withContext(function($ctx1) {
  51601. var $3,$2,$4,$1,$5;
  51602. $3=self._collectionClass();
  51603. $ctx1.sendIdx["collectionClass"]=1;
  51604. $2=$recv($3)._new();
  51605. $recv($2)._at_put_("firstname","James");
  51606. $ctx1.sendIdx["at:put:"]=1;
  51607. $recv($2)._at_put_("lastname","Bond");
  51608. $4=$recv($2)._printString();
  51609. $1=$4;
  51610. $5=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  51611. $ctx1.sendIdx[","]=1;
  51612. self._assert_equals_($1,$5);
  51613. return self;
  51614. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  51615. },
  51616. args: [],
  51617. 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'')'",
  51618. referencedClasses: [],
  51619. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  51620. }),
  51621. $globals.AssociativeCollectionTest);
  51622. $core.addMethod(
  51623. $core.method({
  51624. selector: "testRemoveKey",
  51625. protocol: 'tests',
  51626. fn: function (){
  51627. var self=this;
  51628. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51629. return $core.withContext(function($ctx1) {
  51630. var $1,$2,$3,$5,$6,$4,$7,$8;
  51631. self._nonIndexesDo_((function(each){
  51632. var collection;
  51633. return $core.withContext(function($ctx2) {
  51634. collection=self._collection();
  51635. $ctx2.sendIdx["collection"]=1;
  51636. collection;
  51637. self._should_raise_((function(){
  51638. return $core.withContext(function($ctx3) {
  51639. return $recv(collection)._removeKey_(each);
  51640. $ctx3.sendIdx["removeKey:"]=1;
  51641. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51642. }),$Error());
  51643. $1=collection;
  51644. $2=self._collection();
  51645. $ctx2.sendIdx["collection"]=2;
  51646. return self._assert_equals_($1,$2);
  51647. $ctx2.sendIdx["assert:equals:"]=1;
  51648. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  51649. }));
  51650. self._samplesDo_((function(index,value){
  51651. var collection;
  51652. return $core.withContext(function($ctx2) {
  51653. collection=self._collection();
  51654. $ctx2.sendIdx["collection"]=3;
  51655. collection;
  51656. $3=$recv(collection)._removeKey_(index);
  51657. $ctx2.sendIdx["removeKey:"]=2;
  51658. self._assert_equals_($3,value);
  51659. $ctx2.sendIdx["assert:equals:"]=2;
  51660. $5=collection;
  51661. $6=self._collection();
  51662. $ctx2.sendIdx["collection"]=4;
  51663. $4=$recv($5).__eq($6);
  51664. return self._deny_($4);
  51665. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  51666. }));
  51667. $7=self._collectionWithNewValue();
  51668. $recv($7)._removeKey_(self._sampleNewIndex());
  51669. $8=$recv($7)._yourself();
  51670. self._assert_equals_($8,self._collection());
  51671. return self;
  51672. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  51673. },
  51674. args: [],
  51675. 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",
  51676. referencedClasses: ["Error"],
  51677. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  51678. }),
  51679. $globals.AssociativeCollectionTest);
  51680. $core.addMethod(
  51681. $core.method({
  51682. selector: "testRemoveKeyIfAbsent",
  51683. protocol: 'tests',
  51684. fn: function (){
  51685. var self=this;
  51686. return $core.withContext(function($ctx1) {
  51687. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  51688. self._nonIndexesDo_((function(each){
  51689. var collection;
  51690. return $core.withContext(function($ctx2) {
  51691. collection=self._collection();
  51692. $ctx2.sendIdx["collection"]=1;
  51693. collection;
  51694. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  51695. return $core.withContext(function($ctx3) {
  51696. return self._sampleNewValue();
  51697. $ctx3.sendIdx["sampleNewValue"]=1;
  51698. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51699. }));
  51700. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  51701. $2=self._sampleNewValue();
  51702. $ctx2.sendIdx["sampleNewValue"]=2;
  51703. self._assert_equals_($1,$2);
  51704. $ctx2.sendIdx["assert:equals:"]=1;
  51705. $3=collection;
  51706. $4=self._collection();
  51707. $ctx2.sendIdx["collection"]=2;
  51708. return self._assert_equals_($3,$4);
  51709. $ctx2.sendIdx["assert:equals:"]=2;
  51710. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  51711. }));
  51712. self._samplesDo_((function(index,value){
  51713. var collection;
  51714. return $core.withContext(function($ctx2) {
  51715. collection=self._collection();
  51716. $ctx2.sendIdx["collection"]=3;
  51717. collection;
  51718. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  51719. return $core.withContext(function($ctx3) {
  51720. return self._sampleNewValue();
  51721. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  51722. }));
  51723. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  51724. self._assert_equals_($5,value);
  51725. $ctx2.sendIdx["assert:equals:"]=3;
  51726. $7=collection;
  51727. $8=self._collection();
  51728. $ctx2.sendIdx["collection"]=4;
  51729. $6=$recv($7).__eq($8);
  51730. return self._deny_($6);
  51731. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  51732. }));
  51733. $9=self._collectionWithNewValue();
  51734. $recv($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  51735. return $core.withContext(function($ctx2) {
  51736. return self._assert_(false);
  51737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  51738. }));
  51739. $10=$recv($9)._yourself();
  51740. self._assert_equals_($10,self._collection());
  51741. return self;
  51742. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  51743. },
  51744. args: [],
  51745. 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",
  51746. referencedClasses: [],
  51747. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  51748. }),
  51749. $globals.AssociativeCollectionTest);
  51750. $core.addMethod(
  51751. $core.method({
  51752. selector: "testValues",
  51753. protocol: 'tests',
  51754. fn: function (){
  51755. var self=this;
  51756. return $core.withContext(function($ctx1) {
  51757. var $2,$1,$3,$4;
  51758. $2=$recv($recv(self._collectionClass())._new())._values();
  51759. $ctx1.sendIdx["values"]=1;
  51760. $1=$recv($2)._isEmpty();
  51761. self._assert_($1);
  51762. $3=$recv(self._collection())._values();
  51763. $ctx1.sendIdx["values"]=2;
  51764. $4=self._collectionValues();
  51765. $ctx1.sendIdx["collectionValues"]=1;
  51766. self._assertSameContents_as_($3,$4);
  51767. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51768. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  51769. return self;
  51770. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  51771. },
  51772. args: [],
  51773. 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 }",
  51774. referencedClasses: [],
  51775. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  51776. }),
  51777. $globals.AssociativeCollectionTest);
  51778. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  51779. $core.addMethod(
  51780. $core.method({
  51781. selector: "collection",
  51782. protocol: 'fixture',
  51783. fn: function (){
  51784. var self=this;
  51785. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51786. return $core.withContext(function($ctx1) {
  51787. var $2,$3,$1;
  51788. $2=$recv($Dictionary())._new();
  51789. $recv($2)._at_put_((1),(1));
  51790. $ctx1.sendIdx["at:put:"]=1;
  51791. $recv($2)._at_put_("a",(2));
  51792. $ctx1.sendIdx["at:put:"]=2;
  51793. $recv($2)._at_put_(true,(3));
  51794. $ctx1.sendIdx["at:put:"]=3;
  51795. $recv($2)._at_put_((1).__at((3)),(-4));
  51796. $3=$recv($2)._yourself();
  51797. $1=$3;
  51798. return $1;
  51799. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  51800. },
  51801. args: [],
  51802. 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",
  51803. referencedClasses: ["Dictionary"],
  51804. messageSends: ["at:put:", "new", "@", "yourself"]
  51805. }),
  51806. $globals.DictionaryTest);
  51807. $core.addMethod(
  51808. $core.method({
  51809. selector: "collectionKeys",
  51810. protocol: 'fixture',
  51811. fn: function (){
  51812. var self=this;
  51813. return $core.withContext(function($ctx1) {
  51814. var $1;
  51815. $1=[(1),"a",true,(1).__at((3))];
  51816. return $1;
  51817. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  51818. },
  51819. args: [],
  51820. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  51821. referencedClasses: [],
  51822. messageSends: ["@"]
  51823. }),
  51824. $globals.DictionaryTest);
  51825. $core.addMethod(
  51826. $core.method({
  51827. selector: "collectionOfPrintStrings",
  51828. protocol: 'fixture',
  51829. fn: function (){
  51830. var self=this;
  51831. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51832. return $core.withContext(function($ctx1) {
  51833. var $2,$3,$1;
  51834. $2=$recv($Dictionary())._new();
  51835. $recv($2)._at_put_((1),"1");
  51836. $ctx1.sendIdx["at:put:"]=1;
  51837. $recv($2)._at_put_("a","2");
  51838. $ctx1.sendIdx["at:put:"]=2;
  51839. $recv($2)._at_put_(true,"3");
  51840. $ctx1.sendIdx["at:put:"]=3;
  51841. $recv($2)._at_put_((1).__at((3)),"-4");
  51842. $3=$recv($2)._yourself();
  51843. $1=$3;
  51844. return $1;
  51845. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  51846. },
  51847. args: [],
  51848. 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",
  51849. referencedClasses: ["Dictionary"],
  51850. messageSends: ["at:put:", "new", "@", "yourself"]
  51851. }),
  51852. $globals.DictionaryTest);
  51853. $core.addMethod(
  51854. $core.method({
  51855. selector: "collectionSize",
  51856. protocol: 'fixture',
  51857. fn: function (){
  51858. var self=this;
  51859. return (4);
  51860. },
  51861. args: [],
  51862. source: "collectionSize\x0a\x09^ 4",
  51863. referencedClasses: [],
  51864. messageSends: []
  51865. }),
  51866. $globals.DictionaryTest);
  51867. $core.addMethod(
  51868. $core.method({
  51869. selector: "collectionValues",
  51870. protocol: 'fixture',
  51871. fn: function (){
  51872. var self=this;
  51873. var $1;
  51874. $1=[(1),(2),(3),(-4)];
  51875. return $1;
  51876. },
  51877. args: [],
  51878. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  51879. referencedClasses: [],
  51880. messageSends: []
  51881. }),
  51882. $globals.DictionaryTest);
  51883. $core.addMethod(
  51884. $core.method({
  51885. selector: "collectionWithDuplicates",
  51886. protocol: 'fixture',
  51887. fn: function (){
  51888. var self=this;
  51889. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51890. return $core.withContext(function($ctx1) {
  51891. var $2,$3,$1;
  51892. $2=$recv($Dictionary())._new();
  51893. $recv($2)._at_put_((1),(1));
  51894. $ctx1.sendIdx["at:put:"]=1;
  51895. $recv($2)._at_put_("a",(2));
  51896. $ctx1.sendIdx["at:put:"]=2;
  51897. $recv($2)._at_put_(true,(3));
  51898. $ctx1.sendIdx["at:put:"]=3;
  51899. $recv($2)._at_put_((4),(-4));
  51900. $ctx1.sendIdx["at:put:"]=4;
  51901. $recv($2)._at_put_("b",(1));
  51902. $ctx1.sendIdx["at:put:"]=5;
  51903. $recv($2)._at_put_((3),(3));
  51904. $ctx1.sendIdx["at:put:"]=6;
  51905. $recv($2)._at_put_(false,(12));
  51906. $3=$recv($2)._yourself();
  51907. $1=$3;
  51908. return $1;
  51909. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  51910. },
  51911. args: [],
  51912. 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",
  51913. referencedClasses: ["Dictionary"],
  51914. messageSends: ["at:put:", "new", "yourself"]
  51915. }),
  51916. $globals.DictionaryTest);
  51917. $core.addMethod(
  51918. $core.method({
  51919. selector: "collectionWithNewValue",
  51920. protocol: 'fixture',
  51921. fn: function (){
  51922. var self=this;
  51923. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51924. return $core.withContext(function($ctx1) {
  51925. var $2,$3,$1;
  51926. $2=$recv($Dictionary())._new();
  51927. $recv($2)._at_put_((1),(1));
  51928. $ctx1.sendIdx["at:put:"]=1;
  51929. $recv($2)._at_put_("a",(2));
  51930. $ctx1.sendIdx["at:put:"]=2;
  51931. $recv($2)._at_put_(true,(3));
  51932. $ctx1.sendIdx["at:put:"]=3;
  51933. $recv($2)._at_put_((1).__at((3)),(-4));
  51934. $ctx1.sendIdx["at:put:"]=4;
  51935. $recv($2)._at_put_("new","N");
  51936. $3=$recv($2)._yourself();
  51937. $1=$3;
  51938. return $1;
  51939. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  51940. },
  51941. args: [],
  51942. 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",
  51943. referencedClasses: ["Dictionary"],
  51944. messageSends: ["at:put:", "new", "@", "yourself"]
  51945. }),
  51946. $globals.DictionaryTest);
  51947. $core.addMethod(
  51948. $core.method({
  51949. selector: "sampleNewValueAsCollection",
  51950. protocol: 'fixture',
  51951. fn: function (){
  51952. var self=this;
  51953. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51954. return $core.withContext(function($ctx1) {
  51955. var $2,$3,$1;
  51956. $2=$recv($Dictionary())._new();
  51957. $recv($2)._at_put_("new","N");
  51958. $3=$recv($2)._yourself();
  51959. $1=$3;
  51960. return $1;
  51961. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  51962. },
  51963. args: [],
  51964. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  51965. referencedClasses: ["Dictionary"],
  51966. messageSends: ["at:put:", "new", "yourself"]
  51967. }),
  51968. $globals.DictionaryTest);
  51969. $core.addMethod(
  51970. $core.method({
  51971. selector: "samplesDo:",
  51972. protocol: 'fixture',
  51973. fn: function (aBlock){
  51974. var self=this;
  51975. return $core.withContext(function($ctx1) {
  51976. (
  51977. $ctx1.supercall = true,
  51978. $globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51979. $ctx1.supercall = false;
  51980. $recv(aBlock)._value_value_(true,(3));
  51981. $ctx1.sendIdx["value:value:"]=1;
  51982. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  51983. return self;
  51984. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  51985. },
  51986. args: ["aBlock"],
  51987. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  51988. referencedClasses: [],
  51989. messageSends: ["samplesDo:", "value:value:", "@"]
  51990. }),
  51991. $globals.DictionaryTest);
  51992. $core.addMethod(
  51993. $core.method({
  51994. selector: "testAccessing",
  51995. protocol: 'tests',
  51996. fn: function (){
  51997. var self=this;
  51998. var d;
  51999. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52000. return $core.withContext(function($ctx1) {
  52001. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  52002. d=$recv($Dictionary())._new();
  52003. $recv(d)._at_put_("hello","world");
  52004. $ctx1.sendIdx["at:put:"]=1;
  52005. $1=$recv(d)._at_("hello");
  52006. $ctx1.sendIdx["at:"]=1;
  52007. self._assert_equals_($1,"world");
  52008. $ctx1.sendIdx["assert:equals:"]=1;
  52009. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  52010. return nil;
  52011. }));
  52012. $ctx1.sendIdx["at:ifAbsent:"]=1;
  52013. self._assert_equals_($2,"world");
  52014. $ctx1.sendIdx["assert:equals:"]=2;
  52015. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  52016. return nil;
  52017. }))).__eq("world"));
  52018. $ctx1.sendIdx["deny:"]=1;
  52019. $3=$recv(d)._includesKey_("hello");
  52020. $ctx1.sendIdx["includesKey:"]=1;
  52021. self._assert_($3);
  52022. $ctx1.sendIdx["assert:"]=1;
  52023. $4=$recv(d)._includesKey_("foo");
  52024. $ctx1.sendIdx["includesKey:"]=2;
  52025. self._deny_($4);
  52026. $ctx1.sendIdx["deny:"]=2;
  52027. $recv(d)._at_put_((1),(2));
  52028. $ctx1.sendIdx["at:put:"]=2;
  52029. $5=$recv(d)._at_((1));
  52030. $ctx1.sendIdx["at:"]=2;
  52031. self._assert_equals_($5,(2));
  52032. $ctx1.sendIdx["assert:equals:"]=3;
  52033. $6=d;
  52034. $7=(1).__at((3));
  52035. $ctx1.sendIdx["@"]=1;
  52036. $recv($6)._at_put_($7,(3));
  52037. $9=d;
  52038. $10=(1).__at((3));
  52039. $ctx1.sendIdx["@"]=2;
  52040. $8=$recv($9)._at_($10);
  52041. self._assert_equals_($8,(3));
  52042. $12=d;
  52043. $13=(1).__at((3));
  52044. $ctx1.sendIdx["@"]=3;
  52045. $11=$recv($12)._includesKey_($13);
  52046. $ctx1.sendIdx["includesKey:"]=3;
  52047. self._assert_($11);
  52048. self._deny_($recv(d)._includesKey_((3).__at((1))));
  52049. return self;
  52050. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  52051. },
  52052. args: [],
  52053. 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)",
  52054. referencedClasses: ["Dictionary"],
  52055. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  52056. }),
  52057. $globals.DictionaryTest);
  52058. $core.addMethod(
  52059. $core.method({
  52060. selector: "testDynamicDictionaries",
  52061. protocol: 'tests',
  52062. fn: function (){
  52063. var self=this;
  52064. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52065. return $core.withContext(function($ctx1) {
  52066. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($Dictionary())._with_("hello".__minus_gt((1))));
  52067. return self;
  52068. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  52069. },
  52070. args: [],
  52071. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  52072. referencedClasses: ["Dictionary"],
  52073. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  52074. }),
  52075. $globals.DictionaryTest);
  52076. $core.addMethod(
  52077. $core.method({
  52078. selector: "collectionClass",
  52079. protocol: 'fixture',
  52080. fn: function (){
  52081. var self=this;
  52082. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52083. return $Dictionary();
  52084. },
  52085. args: [],
  52086. source: "collectionClass\x0a\x09^ Dictionary",
  52087. referencedClasses: ["Dictionary"],
  52088. messageSends: []
  52089. }),
  52090. $globals.DictionaryTest.klass);
  52091. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  52092. $core.addMethod(
  52093. $core.method({
  52094. selector: "collection",
  52095. protocol: 'fixture',
  52096. fn: function (){
  52097. var self=this;
  52098. var $1;
  52099. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  52100. return $1;
  52101. },
  52102. args: [],
  52103. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  52104. referencedClasses: [],
  52105. messageSends: []
  52106. }),
  52107. $globals.HashedCollectionTest);
  52108. $core.addMethod(
  52109. $core.method({
  52110. selector: "collectionKeys",
  52111. protocol: 'fixture',
  52112. fn: function (){
  52113. var self=this;
  52114. var $1;
  52115. $1=["b","a","c","d"];
  52116. return $1;
  52117. },
  52118. args: [],
  52119. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  52120. referencedClasses: [],
  52121. messageSends: []
  52122. }),
  52123. $globals.HashedCollectionTest);
  52124. $core.addMethod(
  52125. $core.method({
  52126. selector: "collectionOfPrintStrings",
  52127. protocol: 'fixture',
  52128. fn: function (){
  52129. var self=this;
  52130. var $1;
  52131. $1=$globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  52132. return $1;
  52133. },
  52134. args: [],
  52135. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  52136. referencedClasses: [],
  52137. messageSends: []
  52138. }),
  52139. $globals.HashedCollectionTest);
  52140. $core.addMethod(
  52141. $core.method({
  52142. selector: "collectionSize",
  52143. protocol: 'fixture',
  52144. fn: function (){
  52145. var self=this;
  52146. return (4);
  52147. },
  52148. args: [],
  52149. source: "collectionSize\x0a\x09^ 4",
  52150. referencedClasses: [],
  52151. messageSends: []
  52152. }),
  52153. $globals.HashedCollectionTest);
  52154. $core.addMethod(
  52155. $core.method({
  52156. selector: "collectionValues",
  52157. protocol: 'fixture',
  52158. fn: function (){
  52159. var self=this;
  52160. var $1;
  52161. $1=[(1),(2),(3),(-4)];
  52162. return $1;
  52163. },
  52164. args: [],
  52165. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  52166. referencedClasses: [],
  52167. messageSends: []
  52168. }),
  52169. $globals.HashedCollectionTest);
  52170. $core.addMethod(
  52171. $core.method({
  52172. selector: "collectionWithDuplicates",
  52173. protocol: 'fixture',
  52174. fn: function (){
  52175. var self=this;
  52176. var $1;
  52177. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  52178. return $1;
  52179. },
  52180. args: [],
  52181. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  52182. referencedClasses: [],
  52183. messageSends: []
  52184. }),
  52185. $globals.HashedCollectionTest);
  52186. $core.addMethod(
  52187. $core.method({
  52188. selector: "collectionWithNewValue",
  52189. protocol: 'fixture',
  52190. fn: function (){
  52191. var self=this;
  52192. var $1;
  52193. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  52194. return $1;
  52195. },
  52196. args: [],
  52197. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  52198. referencedClasses: [],
  52199. messageSends: []
  52200. }),
  52201. $globals.HashedCollectionTest);
  52202. $core.addMethod(
  52203. $core.method({
  52204. selector: "sampleNewValueAsCollection",
  52205. protocol: 'fixture',
  52206. fn: function (){
  52207. var self=this;
  52208. var $1;
  52209. $1=$globals.HashedCollection._newFromPairs_(["new","N"]);
  52210. return $1;
  52211. },
  52212. args: [],
  52213. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  52214. referencedClasses: [],
  52215. messageSends: []
  52216. }),
  52217. $globals.HashedCollectionTest);
  52218. $core.addMethod(
  52219. $core.method({
  52220. selector: "testDynamicDictionaries",
  52221. protocol: 'tests',
  52222. fn: function (){
  52223. var self=this;
  52224. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  52225. return $core.withContext(function($ctx1) {
  52226. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($HashedCollection())._with_("hello".__minus_gt((1))));
  52227. return self;
  52228. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  52229. },
  52230. args: [],
  52231. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  52232. referencedClasses: ["HashedCollection"],
  52233. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  52234. }),
  52235. $globals.HashedCollectionTest);
  52236. $core.addMethod(
  52237. $core.method({
  52238. selector: "collectionClass",
  52239. protocol: 'fixture',
  52240. fn: function (){
  52241. var self=this;
  52242. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  52243. return $HashedCollection();
  52244. },
  52245. args: [],
  52246. source: "collectionClass\x0a\x09^ HashedCollection",
  52247. referencedClasses: ["HashedCollection"],
  52248. messageSends: []
  52249. }),
  52250. $globals.HashedCollectionTest.klass);
  52251. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  52252. $core.addMethod(
  52253. $core.method({
  52254. selector: "collectionFirst",
  52255. protocol: 'fixture',
  52256. fn: function (){
  52257. var self=this;
  52258. return $core.withContext(function($ctx1) {
  52259. self._subclassResponsibility();
  52260. return self;
  52261. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  52262. },
  52263. args: [],
  52264. source: "collectionFirst\x0a\x09self subclassResponsibility",
  52265. referencedClasses: [],
  52266. messageSends: ["subclassResponsibility"]
  52267. }),
  52268. $globals.SequenceableCollectionTest);
  52269. $core.addMethod(
  52270. $core.method({
  52271. selector: "collectionFirstTwo",
  52272. protocol: 'fixture',
  52273. fn: function (){
  52274. var self=this;
  52275. return $core.withContext(function($ctx1) {
  52276. self._subclassResponsibility();
  52277. return self;
  52278. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  52279. },
  52280. args: [],
  52281. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  52282. referencedClasses: [],
  52283. messageSends: ["subclassResponsibility"]
  52284. }),
  52285. $globals.SequenceableCollectionTest);
  52286. $core.addMethod(
  52287. $core.method({
  52288. selector: "collectionLast",
  52289. protocol: 'fixture',
  52290. fn: function (){
  52291. var self=this;
  52292. return $core.withContext(function($ctx1) {
  52293. self._subclassResponsibility();
  52294. return self;
  52295. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  52296. },
  52297. args: [],
  52298. source: "collectionLast\x0a\x09self subclassResponsibility",
  52299. referencedClasses: [],
  52300. messageSends: ["subclassResponsibility"]
  52301. }),
  52302. $globals.SequenceableCollectionTest);
  52303. $core.addMethod(
  52304. $core.method({
  52305. selector: "collectionLastTwo",
  52306. protocol: 'fixture',
  52307. fn: function (){
  52308. var self=this;
  52309. return $core.withContext(function($ctx1) {
  52310. self._subclassResponsibility();
  52311. return self;
  52312. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  52313. },
  52314. args: [],
  52315. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  52316. referencedClasses: [],
  52317. messageSends: ["subclassResponsibility"]
  52318. }),
  52319. $globals.SequenceableCollectionTest);
  52320. $core.addMethod(
  52321. $core.method({
  52322. selector: "nonIndexesDo:",
  52323. protocol: 'fixture',
  52324. fn: function (aBlock){
  52325. var self=this;
  52326. return $core.withContext(function($ctx1) {
  52327. $recv(aBlock)._value_((0));
  52328. $ctx1.sendIdx["value:"]=1;
  52329. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  52330. $ctx1.sendIdx["value:"]=2;
  52331. $recv(aBlock)._value_("z");
  52332. return self;
  52333. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  52334. },
  52335. args: ["aBlock"],
  52336. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  52337. referencedClasses: [],
  52338. messageSends: ["value:", "+", "collectionSize"]
  52339. }),
  52340. $globals.SequenceableCollectionTest);
  52341. $core.addMethod(
  52342. $core.method({
  52343. selector: "samplesDo:",
  52344. protocol: 'fixture',
  52345. fn: function (aBlock){
  52346. var self=this;
  52347. return $core.withContext(function($ctx1) {
  52348. $recv(aBlock)._value_value_((1),self._collectionFirst());
  52349. $ctx1.sendIdx["value:value:"]=1;
  52350. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  52351. return self;
  52352. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  52353. },
  52354. args: ["aBlock"],
  52355. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  52356. referencedClasses: [],
  52357. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  52358. }),
  52359. $globals.SequenceableCollectionTest);
  52360. $core.addMethod(
  52361. $core.method({
  52362. selector: "testBeginsWith",
  52363. protocol: 'tests',
  52364. fn: function (){
  52365. var self=this;
  52366. return $core.withContext(function($ctx1) {
  52367. var $2,$1,$4,$5,$3,$7,$6;
  52368. $2=self._collection();
  52369. $ctx1.sendIdx["collection"]=1;
  52370. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  52371. $ctx1.sendIdx["beginsWith:"]=1;
  52372. self._assert_($1);
  52373. $ctx1.sendIdx["assert:"]=1;
  52374. $4=self._collection();
  52375. $ctx1.sendIdx["collection"]=2;
  52376. $5=self._collection();
  52377. $ctx1.sendIdx["collection"]=3;
  52378. $3=$recv($4)._beginsWith_($5);
  52379. $ctx1.sendIdx["beginsWith:"]=2;
  52380. self._assert_($3);
  52381. $ctx1.sendIdx["assert:"]=2;
  52382. $7=self._collection();
  52383. $ctx1.sendIdx["collection"]=4;
  52384. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  52385. $ctx1.sendIdx["beginsWith:"]=3;
  52386. self._assert_($6);
  52387. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  52388. return self;
  52389. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  52390. },
  52391. args: [],
  52392. 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)",
  52393. referencedClasses: [],
  52394. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  52395. }),
  52396. $globals.SequenceableCollectionTest);
  52397. $core.addMethod(
  52398. $core.method({
  52399. selector: "testEndsWith",
  52400. protocol: 'tests',
  52401. fn: function (){
  52402. var self=this;
  52403. return $core.withContext(function($ctx1) {
  52404. var $2,$1,$4,$5,$3,$7,$6;
  52405. $2=self._collection();
  52406. $ctx1.sendIdx["collection"]=1;
  52407. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  52408. $ctx1.sendIdx["endsWith:"]=1;
  52409. self._assert_($1);
  52410. $ctx1.sendIdx["assert:"]=1;
  52411. $4=self._collection();
  52412. $ctx1.sendIdx["collection"]=2;
  52413. $5=self._collection();
  52414. $ctx1.sendIdx["collection"]=3;
  52415. $3=$recv($4)._endsWith_($5);
  52416. $ctx1.sendIdx["endsWith:"]=2;
  52417. self._assert_($3);
  52418. $ctx1.sendIdx["assert:"]=2;
  52419. $7=self._collection();
  52420. $ctx1.sendIdx["collection"]=4;
  52421. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  52422. $ctx1.sendIdx["endsWith:"]=3;
  52423. self._assert_($6);
  52424. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  52425. return self;
  52426. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  52427. },
  52428. args: [],
  52429. 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)",
  52430. referencedClasses: [],
  52431. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  52432. }),
  52433. $globals.SequenceableCollectionTest);
  52434. $core.addMethod(
  52435. $core.method({
  52436. selector: "testFirst",
  52437. protocol: 'tests',
  52438. fn: function (){
  52439. var self=this;
  52440. return $core.withContext(function($ctx1) {
  52441. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  52442. return self;
  52443. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  52444. },
  52445. args: [],
  52446. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  52447. referencedClasses: [],
  52448. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  52449. }),
  52450. $globals.SequenceableCollectionTest);
  52451. $core.addMethod(
  52452. $core.method({
  52453. selector: "testFirstN",
  52454. protocol: 'tests',
  52455. fn: function (){
  52456. var self=this;
  52457. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52458. return $core.withContext(function($ctx1) {
  52459. var $2,$1,$4,$3,$6,$5,$7;
  52460. $2=self._collection();
  52461. $ctx1.sendIdx["collection"]=1;
  52462. $1=$recv($2)._first_((2));
  52463. $ctx1.sendIdx["first:"]=1;
  52464. self._assert_equals_($1,self._collectionFirstTwo());
  52465. $ctx1.sendIdx["assert:equals:"]=1;
  52466. $4=self._collection();
  52467. $ctx1.sendIdx["collection"]=2;
  52468. $3=$recv($4)._first_((0));
  52469. $ctx1.sendIdx["first:"]=2;
  52470. self._assert_equals_($3,$recv(self._collectionClass())._new());
  52471. $ctx1.sendIdx["assert:equals:"]=2;
  52472. $6=self._collection();
  52473. $ctx1.sendIdx["collection"]=3;
  52474. $5=$recv($6)._first_(self._collectionSize());
  52475. $ctx1.sendIdx["first:"]=3;
  52476. $7=self._collection();
  52477. $ctx1.sendIdx["collection"]=4;
  52478. self._assert_equals_($5,$7);
  52479. self._should_raise_((function(){
  52480. return $core.withContext(function($ctx2) {
  52481. return $recv(self._collection())._first_((33));
  52482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52483. }),$Error());
  52484. return self;
  52485. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  52486. },
  52487. args: [],
  52488. 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",
  52489. referencedClasses: ["Error"],
  52490. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  52491. }),
  52492. $globals.SequenceableCollectionTest);
  52493. $core.addMethod(
  52494. $core.method({
  52495. selector: "testFourth",
  52496. protocol: 'tests',
  52497. fn: function (){
  52498. var self=this;
  52499. return $core.withContext(function($ctx1) {
  52500. var $2,$1;
  52501. $2=self._collection();
  52502. $ctx1.sendIdx["collection"]=1;
  52503. $1=$recv($2)._fourth();
  52504. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  52505. return self;
  52506. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  52507. },
  52508. args: [],
  52509. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  52510. referencedClasses: [],
  52511. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  52512. }),
  52513. $globals.SequenceableCollectionTest);
  52514. $core.addMethod(
  52515. $core.method({
  52516. selector: "testIndexOfStartingAt",
  52517. protocol: 'tests',
  52518. fn: function (){
  52519. var self=this;
  52520. var jsNull;
  52521. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  52522. return $core.withContext(function($ctx1) {
  52523. var $2,$1,$4,$3;
  52524. jsNull=$recv($JSON())._parse_("null");
  52525. self._samplesDo_((function(index,value){
  52526. return $core.withContext(function($ctx2) {
  52527. $2=self._collection();
  52528. $ctx2.sendIdx["collection"]=1;
  52529. $1=$recv($2)._indexOf_startingAt_(value,(1));
  52530. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  52531. self._assert_equals_($1,index);
  52532. $ctx2.sendIdx["assert:equals:"]=1;
  52533. $4=self._collection();
  52534. $ctx2.sendIdx["collection"]=2;
  52535. $3=$recv($4)._indexOf_startingAt_(value,index);
  52536. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  52537. self._assert_equals_($3,index);
  52538. $ctx2.sendIdx["assert:equals:"]=2;
  52539. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  52540. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52541. }));
  52542. return self;
  52543. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  52544. },
  52545. args: [],
  52546. 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 ]",
  52547. referencedClasses: ["JSON"],
  52548. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  52549. }),
  52550. $globals.SequenceableCollectionTest);
  52551. $core.addMethod(
  52552. $core.method({
  52553. selector: "testIndexOfStartingAtWithNull",
  52554. protocol: 'tests',
  52555. fn: function (){
  52556. var self=this;
  52557. var jsNull;
  52558. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  52559. return $core.withContext(function($ctx1) {
  52560. var $1,$2;
  52561. jsNull=$recv($JSON())._parse_("null");
  52562. self._samplesDo_((function(index,value){
  52563. var collection;
  52564. return $core.withContext(function($ctx2) {
  52565. collection=self._collection();
  52566. collection;
  52567. $recv(collection)._at_put_(index,jsNull);
  52568. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  52569. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  52570. self._assert_equals_($1,index);
  52571. $ctx2.sendIdx["assert:equals:"]=1;
  52572. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  52573. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  52574. self._assert_equals_($2,index);
  52575. $ctx2.sendIdx["assert:equals:"]=2;
  52576. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  52577. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  52578. }));
  52579. return self;
  52580. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  52581. },
  52582. args: [],
  52583. 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 ]",
  52584. referencedClasses: ["JSON"],
  52585. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  52586. }),
  52587. $globals.SequenceableCollectionTest);
  52588. $core.addMethod(
  52589. $core.method({
  52590. selector: "testLast",
  52591. protocol: 'tests',
  52592. fn: function (){
  52593. var self=this;
  52594. return $core.withContext(function($ctx1) {
  52595. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  52596. return self;
  52597. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  52598. },
  52599. args: [],
  52600. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  52601. referencedClasses: [],
  52602. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  52603. }),
  52604. $globals.SequenceableCollectionTest);
  52605. $core.addMethod(
  52606. $core.method({
  52607. selector: "testLastN",
  52608. protocol: 'tests',
  52609. fn: function (){
  52610. var self=this;
  52611. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52612. return $core.withContext(function($ctx1) {
  52613. var $2,$1,$4,$3,$6,$5,$7;
  52614. $2=self._collection();
  52615. $ctx1.sendIdx["collection"]=1;
  52616. $1=$recv($2)._last_((2));
  52617. $ctx1.sendIdx["last:"]=1;
  52618. self._assert_equals_($1,self._collectionLastTwo());
  52619. $ctx1.sendIdx["assert:equals:"]=1;
  52620. $4=self._collection();
  52621. $ctx1.sendIdx["collection"]=2;
  52622. $3=$recv($4)._last_((0));
  52623. $ctx1.sendIdx["last:"]=2;
  52624. self._assert_equals_($3,$recv(self._collectionClass())._new());
  52625. $ctx1.sendIdx["assert:equals:"]=2;
  52626. $6=self._collection();
  52627. $ctx1.sendIdx["collection"]=3;
  52628. $5=$recv($6)._last_(self._collectionSize());
  52629. $ctx1.sendIdx["last:"]=3;
  52630. $7=self._collection();
  52631. $ctx1.sendIdx["collection"]=4;
  52632. self._assert_equals_($5,$7);
  52633. self._should_raise_((function(){
  52634. return $core.withContext(function($ctx2) {
  52635. return $recv(self._collection())._last_((33));
  52636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52637. }),$Error());
  52638. return self;
  52639. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  52640. },
  52641. args: [],
  52642. 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",
  52643. referencedClasses: ["Error"],
  52644. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  52645. }),
  52646. $globals.SequenceableCollectionTest);
  52647. $core.addMethod(
  52648. $core.method({
  52649. selector: "testSecond",
  52650. protocol: 'tests',
  52651. fn: function (){
  52652. var self=this;
  52653. return $core.withContext(function($ctx1) {
  52654. var $2,$1;
  52655. $2=self._collection();
  52656. $ctx1.sendIdx["collection"]=1;
  52657. $1=$recv($2)._second();
  52658. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  52659. return self;
  52660. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  52661. },
  52662. args: [],
  52663. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  52664. referencedClasses: [],
  52665. messageSends: ["assert:equals:", "second", "collection", "at:"]
  52666. }),
  52667. $globals.SequenceableCollectionTest);
  52668. $core.addMethod(
  52669. $core.method({
  52670. selector: "testThird",
  52671. protocol: 'tests',
  52672. fn: function (){
  52673. var self=this;
  52674. return $core.withContext(function($ctx1) {
  52675. var $2,$1;
  52676. $2=self._collection();
  52677. $ctx1.sendIdx["collection"]=1;
  52678. $1=$recv($2)._third();
  52679. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  52680. return self;
  52681. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  52682. },
  52683. args: [],
  52684. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  52685. referencedClasses: [],
  52686. messageSends: ["assert:equals:", "third", "collection", "at:"]
  52687. }),
  52688. $globals.SequenceableCollectionTest);
  52689. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  52690. $core.addMethod(
  52691. $core.method({
  52692. selector: "collection",
  52693. protocol: 'fixture',
  52694. fn: function (){
  52695. var self=this;
  52696. var $1;
  52697. $1=[(1), (2), (3), (-4)];
  52698. return $1;
  52699. },
  52700. args: [],
  52701. source: "collection\x0a\x09^ #(1 2 3 -4)",
  52702. referencedClasses: [],
  52703. messageSends: []
  52704. }),
  52705. $globals.ArrayTest);
  52706. $core.addMethod(
  52707. $core.method({
  52708. selector: "collectionFirst",
  52709. protocol: 'fixture',
  52710. fn: function (){
  52711. var self=this;
  52712. return (1);
  52713. },
  52714. args: [],
  52715. source: "collectionFirst\x0a\x09^ 1",
  52716. referencedClasses: [],
  52717. messageSends: []
  52718. }),
  52719. $globals.ArrayTest);
  52720. $core.addMethod(
  52721. $core.method({
  52722. selector: "collectionFirstTwo",
  52723. protocol: 'fixture',
  52724. fn: function (){
  52725. var self=this;
  52726. var $1;
  52727. $1=[(1), (2)];
  52728. return $1;
  52729. },
  52730. args: [],
  52731. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  52732. referencedClasses: [],
  52733. messageSends: []
  52734. }),
  52735. $globals.ArrayTest);
  52736. $core.addMethod(
  52737. $core.method({
  52738. selector: "collectionLast",
  52739. protocol: 'fixture',
  52740. fn: function (){
  52741. var self=this;
  52742. return (-4);
  52743. },
  52744. args: [],
  52745. source: "collectionLast\x0a\x09^ -4",
  52746. referencedClasses: [],
  52747. messageSends: []
  52748. }),
  52749. $globals.ArrayTest);
  52750. $core.addMethod(
  52751. $core.method({
  52752. selector: "collectionLastTwo",
  52753. protocol: 'fixture',
  52754. fn: function (){
  52755. var self=this;
  52756. var $1;
  52757. $1=[(3), (-4)];
  52758. return $1;
  52759. },
  52760. args: [],
  52761. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  52762. referencedClasses: [],
  52763. messageSends: []
  52764. }),
  52765. $globals.ArrayTest);
  52766. $core.addMethod(
  52767. $core.method({
  52768. selector: "collectionOfPrintStrings",
  52769. protocol: 'fixture',
  52770. fn: function (){
  52771. var self=this;
  52772. var $1;
  52773. $1=["1", "2", "3", "-4"];
  52774. return $1;
  52775. },
  52776. args: [],
  52777. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  52778. referencedClasses: [],
  52779. messageSends: []
  52780. }),
  52781. $globals.ArrayTest);
  52782. $core.addMethod(
  52783. $core.method({
  52784. selector: "collectionSize",
  52785. protocol: 'fixture',
  52786. fn: function (){
  52787. var self=this;
  52788. return (4);
  52789. },
  52790. args: [],
  52791. source: "collectionSize\x0a\x09^ 4",
  52792. referencedClasses: [],
  52793. messageSends: []
  52794. }),
  52795. $globals.ArrayTest);
  52796. $core.addMethod(
  52797. $core.method({
  52798. selector: "collectionWithDuplicates",
  52799. protocol: 'fixture',
  52800. fn: function (){
  52801. var self=this;
  52802. var $1;
  52803. $1=["a", "b", "c", (1), (2), (1), "a"];
  52804. return $1;
  52805. },
  52806. args: [],
  52807. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  52808. referencedClasses: [],
  52809. messageSends: []
  52810. }),
  52811. $globals.ArrayTest);
  52812. $core.addMethod(
  52813. $core.method({
  52814. selector: "collectionWithNewValue",
  52815. protocol: 'fixture',
  52816. fn: function (){
  52817. var self=this;
  52818. var $1;
  52819. $1=[(1), (2), (3), (-4), "N"];
  52820. return $1;
  52821. },
  52822. args: [],
  52823. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  52824. referencedClasses: [],
  52825. messageSends: []
  52826. }),
  52827. $globals.ArrayTest);
  52828. $core.addMethod(
  52829. $core.method({
  52830. selector: "sampleNewIndex",
  52831. protocol: 'fixture',
  52832. fn: function (){
  52833. var self=this;
  52834. return (5);
  52835. },
  52836. args: [],
  52837. source: "sampleNewIndex\x0a\x09^ 5",
  52838. referencedClasses: [],
  52839. messageSends: []
  52840. }),
  52841. $globals.ArrayTest);
  52842. $core.addMethod(
  52843. $core.method({
  52844. selector: "samplesDo:",
  52845. protocol: 'fixture',
  52846. fn: function (aBlock){
  52847. var self=this;
  52848. return $core.withContext(function($ctx1) {
  52849. (
  52850. $ctx1.supercall = true,
  52851. $globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  52852. $ctx1.supercall = false;
  52853. $recv(aBlock)._value_value_((3),(3));
  52854. return self;
  52855. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  52856. },
  52857. args: ["aBlock"],
  52858. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  52859. referencedClasses: [],
  52860. messageSends: ["samplesDo:", "value:value:"]
  52861. }),
  52862. $globals.ArrayTest);
  52863. $core.addMethod(
  52864. $core.method({
  52865. selector: "testAdd",
  52866. protocol: 'tests',
  52867. fn: function (){
  52868. var self=this;
  52869. var array;
  52870. return $core.withContext(function($ctx1) {
  52871. array=self._collection();
  52872. $recv(array)._add_((6));
  52873. self._assert_equals_($recv(array)._last(),(6));
  52874. return self;
  52875. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  52876. },
  52877. args: [],
  52878. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  52879. referencedClasses: [],
  52880. messageSends: ["collection", "add:", "assert:equals:", "last"]
  52881. }),
  52882. $globals.ArrayTest);
  52883. $core.addMethod(
  52884. $core.method({
  52885. selector: "testAddFirst",
  52886. protocol: 'tests',
  52887. fn: function (){
  52888. var self=this;
  52889. return $core.withContext(function($ctx1) {
  52890. var $1,$2;
  52891. $1=self._collection();
  52892. $recv($1)._addFirst_((0));
  52893. $2=$recv($1)._yourself();
  52894. self._assert_equals_($recv($2)._first(),(0));
  52895. return self;
  52896. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  52897. },
  52898. args: [],
  52899. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  52900. referencedClasses: [],
  52901. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  52902. }),
  52903. $globals.ArrayTest);
  52904. $core.addMethod(
  52905. $core.method({
  52906. selector: "testPrintString",
  52907. protocol: 'tests',
  52908. fn: function (){
  52909. var self=this;
  52910. var array;
  52911. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  52912. return $core.withContext(function($ctx1) {
  52913. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  52914. array=$recv($Array())._new();
  52915. $1=$recv(array)._printString();
  52916. $ctx1.sendIdx["printString"]=1;
  52917. self._assert_equals_($1,"an Array ()");
  52918. $ctx1.sendIdx["assert:equals:"]=1;
  52919. $2=array;
  52920. $recv($2)._add_((1));
  52921. $ctx1.sendIdx["add:"]=1;
  52922. $3=$recv($2)._add_((3));
  52923. $ctx1.sendIdx["add:"]=2;
  52924. $4=$recv(array)._printString();
  52925. $ctx1.sendIdx["printString"]=2;
  52926. self._assert_equals_($4,"an Array (1 3)");
  52927. $ctx1.sendIdx["assert:equals:"]=2;
  52928. $recv(array)._add_("foo");
  52929. $5=$recv(array)._printString();
  52930. $ctx1.sendIdx["printString"]=3;
  52931. self._assert_equals_($5,"an Array (1 3 'foo')");
  52932. $ctx1.sendIdx["assert:equals:"]=3;
  52933. $6=array;
  52934. $recv($6)._remove_((1));
  52935. $ctx1.sendIdx["remove:"]=1;
  52936. $7=$recv($6)._remove_((3));
  52937. $8=$recv(array)._printString();
  52938. $ctx1.sendIdx["printString"]=4;
  52939. self._assert_equals_($8,"an Array ('foo')");
  52940. $ctx1.sendIdx["assert:equals:"]=4;
  52941. $recv(array)._addLast_((3));
  52942. $ctx1.sendIdx["addLast:"]=1;
  52943. $9=$recv(array)._printString();
  52944. $ctx1.sendIdx["printString"]=5;
  52945. self._assert_equals_($9,"an Array ('foo' 3)");
  52946. $ctx1.sendIdx["assert:equals:"]=5;
  52947. $recv(array)._addLast_((3));
  52948. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  52949. return self;
  52950. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  52951. },
  52952. args: [],
  52953. 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)'.",
  52954. referencedClasses: ["Array"],
  52955. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  52956. }),
  52957. $globals.ArrayTest);
  52958. $core.addMethod(
  52959. $core.method({
  52960. selector: "testRemove",
  52961. protocol: 'tests',
  52962. fn: function (){
  52963. var self=this;
  52964. var array;
  52965. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52966. return $core.withContext(function($ctx1) {
  52967. array=[(1), (2), (3), (4), (5)];
  52968. $recv(array)._remove_((3));
  52969. $ctx1.sendIdx["remove:"]=1;
  52970. self._assert_equals_(array,[(1), (2), (4), (5)]);
  52971. self._should_raise_((function(){
  52972. return $core.withContext(function($ctx2) {
  52973. return $recv(array)._remove_((3));
  52974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52975. }),$Error());
  52976. return self;
  52977. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  52978. },
  52979. args: [],
  52980. 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",
  52981. referencedClasses: ["Error"],
  52982. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  52983. }),
  52984. $globals.ArrayTest);
  52985. $core.addMethod(
  52986. $core.method({
  52987. selector: "testRemoveFromTo",
  52988. protocol: 'tests',
  52989. fn: function (){
  52990. var self=this;
  52991. return $core.withContext(function($ctx1) {
  52992. var $1,$2;
  52993. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  52994. $ctx1.sendIdx["removeFrom:to:"]=1;
  52995. self._assert_equals_($1,[(4)]);
  52996. $ctx1.sendIdx["assert:equals:"]=1;
  52997. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  52998. $ctx1.sendIdx["removeFrom:to:"]=2;
  52999. self._assert_equals_($2,[(1), (4)]);
  53000. $ctx1.sendIdx["assert:equals:"]=2;
  53001. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  53002. return self;
  53003. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  53004. },
  53005. args: [],
  53006. 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)",
  53007. referencedClasses: [],
  53008. messageSends: ["assert:equals:", "removeFrom:to:"]
  53009. }),
  53010. $globals.ArrayTest);
  53011. $core.addMethod(
  53012. $core.method({
  53013. selector: "testRemoveIndex",
  53014. protocol: 'tests',
  53015. fn: function (){
  53016. var self=this;
  53017. return $core.withContext(function($ctx1) {
  53018. var $1,$2;
  53019. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  53020. $ctx1.sendIdx["removeIndex:"]=1;
  53021. self._assert_equals_($1,[(1), (3), (4)]);
  53022. $ctx1.sendIdx["assert:equals:"]=1;
  53023. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  53024. $ctx1.sendIdx["removeIndex:"]=2;
  53025. self._assert_equals_($2,[(2), (3), (4)]);
  53026. $ctx1.sendIdx["assert:equals:"]=2;
  53027. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  53028. return self;
  53029. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  53030. },
  53031. args: [],
  53032. 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: #()",
  53033. referencedClasses: [],
  53034. messageSends: ["assert:equals:", "removeIndex:"]
  53035. }),
  53036. $globals.ArrayTest);
  53037. $core.addMethod(
  53038. $core.method({
  53039. selector: "testRemoveLast",
  53040. protocol: 'tests',
  53041. fn: function (){
  53042. var self=this;
  53043. var array;
  53044. return $core.withContext(function($ctx1) {
  53045. array=[(1), (2)];
  53046. $recv(array)._removeLast();
  53047. self._assert_equals_($recv(array)._last(),(1));
  53048. return self;
  53049. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  53050. },
  53051. args: [],
  53052. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  53053. referencedClasses: [],
  53054. messageSends: ["removeLast", "assert:equals:", "last"]
  53055. }),
  53056. $globals.ArrayTest);
  53057. $core.addMethod(
  53058. $core.method({
  53059. selector: "testReversed",
  53060. protocol: 'tests',
  53061. fn: function (){
  53062. var self=this;
  53063. var array;
  53064. return $core.withContext(function($ctx1) {
  53065. array=[(5), (4), (3), (2), (1)];
  53066. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  53067. return self;
  53068. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  53069. },
  53070. args: [],
  53071. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  53072. referencedClasses: [],
  53073. messageSends: ["assert:equals:", "reversed"]
  53074. }),
  53075. $globals.ArrayTest);
  53076. $core.addMethod(
  53077. $core.method({
  53078. selector: "testSort",
  53079. protocol: 'tests',
  53080. fn: function (){
  53081. var self=this;
  53082. var array;
  53083. return $core.withContext(function($ctx1) {
  53084. array=[(10), (1), (5)];
  53085. $recv(array)._sort();
  53086. self._assert_equals_(array,[(1), (5), (10)]);
  53087. return self;
  53088. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  53089. },
  53090. args: [],
  53091. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  53092. referencedClasses: [],
  53093. messageSends: ["sort", "assert:equals:"]
  53094. }),
  53095. $globals.ArrayTest);
  53096. $core.addMethod(
  53097. $core.method({
  53098. selector: "collectionClass",
  53099. protocol: 'fixture',
  53100. fn: function (){
  53101. var self=this;
  53102. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  53103. return $Array();
  53104. },
  53105. args: [],
  53106. source: "collectionClass\x0a\x09^ Array",
  53107. referencedClasses: ["Array"],
  53108. messageSends: []
  53109. }),
  53110. $globals.ArrayTest.klass);
  53111. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  53112. $core.addMethod(
  53113. $core.method({
  53114. selector: "collection",
  53115. protocol: 'fixture',
  53116. fn: function (){
  53117. var self=this;
  53118. return "helLo";
  53119. },
  53120. args: [],
  53121. source: "collection\x0a\x09^ 'helLo'",
  53122. referencedClasses: [],
  53123. messageSends: []
  53124. }),
  53125. $globals.StringTest);
  53126. $core.addMethod(
  53127. $core.method({
  53128. selector: "collectionFirst",
  53129. protocol: 'fixture',
  53130. fn: function (){
  53131. var self=this;
  53132. return "h";
  53133. },
  53134. args: [],
  53135. source: "collectionFirst\x0a\x09^ 'h'",
  53136. referencedClasses: [],
  53137. messageSends: []
  53138. }),
  53139. $globals.StringTest);
  53140. $core.addMethod(
  53141. $core.method({
  53142. selector: "collectionFirstTwo",
  53143. protocol: 'fixture',
  53144. fn: function (){
  53145. var self=this;
  53146. return "he";
  53147. },
  53148. args: [],
  53149. source: "collectionFirstTwo\x0a\x09^ 'he'",
  53150. referencedClasses: [],
  53151. messageSends: []
  53152. }),
  53153. $globals.StringTest);
  53154. $core.addMethod(
  53155. $core.method({
  53156. selector: "collectionLast",
  53157. protocol: 'fixture',
  53158. fn: function (){
  53159. var self=this;
  53160. return "o";
  53161. },
  53162. args: [],
  53163. source: "collectionLast\x0a\x09^ 'o'",
  53164. referencedClasses: [],
  53165. messageSends: []
  53166. }),
  53167. $globals.StringTest);
  53168. $core.addMethod(
  53169. $core.method({
  53170. selector: "collectionLastTwo",
  53171. protocol: 'fixture',
  53172. fn: function (){
  53173. var self=this;
  53174. return "Lo";
  53175. },
  53176. args: [],
  53177. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  53178. referencedClasses: [],
  53179. messageSends: []
  53180. }),
  53181. $globals.StringTest);
  53182. $core.addMethod(
  53183. $core.method({
  53184. selector: "collectionOfPrintStrings",
  53185. protocol: 'fixture',
  53186. fn: function (){
  53187. var self=this;
  53188. return "'h''e''l''L''o'";
  53189. },
  53190. args: [],
  53191. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  53192. referencedClasses: [],
  53193. messageSends: []
  53194. }),
  53195. $globals.StringTest);
  53196. $core.addMethod(
  53197. $core.method({
  53198. selector: "collectionSize",
  53199. protocol: 'fixture',
  53200. fn: function (){
  53201. var self=this;
  53202. return (5);
  53203. },
  53204. args: [],
  53205. source: "collectionSize\x0a\x09^ 5",
  53206. referencedClasses: [],
  53207. messageSends: []
  53208. }),
  53209. $globals.StringTest);
  53210. $core.addMethod(
  53211. $core.method({
  53212. selector: "collectionWithDuplicates",
  53213. protocol: 'fixture',
  53214. fn: function (){
  53215. var self=this;
  53216. return "abbaerte";
  53217. },
  53218. args: [],
  53219. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  53220. referencedClasses: [],
  53221. messageSends: []
  53222. }),
  53223. $globals.StringTest);
  53224. $core.addMethod(
  53225. $core.method({
  53226. selector: "collectionWithNewValue",
  53227. protocol: 'fixture',
  53228. fn: function (){
  53229. var self=this;
  53230. return "helLoN";
  53231. },
  53232. args: [],
  53233. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  53234. referencedClasses: [],
  53235. messageSends: []
  53236. }),
  53237. $globals.StringTest);
  53238. $core.addMethod(
  53239. $core.method({
  53240. selector: "sampleNewValueAsCollection",
  53241. protocol: 'fixture',
  53242. fn: function (){
  53243. var self=this;
  53244. return "N";
  53245. },
  53246. args: [],
  53247. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  53248. referencedClasses: [],
  53249. messageSends: []
  53250. }),
  53251. $globals.StringTest);
  53252. $core.addMethod(
  53253. $core.method({
  53254. selector: "samplesDo:",
  53255. protocol: 'fixture',
  53256. fn: function (aBlock){
  53257. var self=this;
  53258. return $core.withContext(function($ctx1) {
  53259. (
  53260. $ctx1.supercall = true,
  53261. $globals.StringTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  53262. $ctx1.supercall = false;
  53263. $recv(aBlock)._value_value_((3),"l");
  53264. return self;
  53265. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  53266. },
  53267. args: ["aBlock"],
  53268. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  53269. referencedClasses: [],
  53270. messageSends: ["samplesDo:", "value:value:"]
  53271. }),
  53272. $globals.StringTest);
  53273. $core.addMethod(
  53274. $core.method({
  53275. selector: "testAddAll",
  53276. protocol: 'tests',
  53277. fn: function (){
  53278. var self=this;
  53279. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53280. return $core.withContext(function($ctx1) {
  53281. var $1;
  53282. self._should_raise_((function(){
  53283. return $core.withContext(function($ctx2) {
  53284. $1=self._collection();
  53285. $ctx2.sendIdx["collection"]=1;
  53286. return $recv($1)._addAll_(self._collection());
  53287. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53288. }),$Error());
  53289. return self;
  53290. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  53291. },
  53292. args: [],
  53293. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  53294. referencedClasses: ["Error"],
  53295. messageSends: ["should:raise:", "addAll:", "collection"]
  53296. }),
  53297. $globals.StringTest);
  53298. $core.addMethod(
  53299. $core.method({
  53300. selector: "testAddRemove",
  53301. protocol: 'tests',
  53302. fn: function (){
  53303. var self=this;
  53304. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53305. return $core.withContext(function($ctx1) {
  53306. self._should_raise_((function(){
  53307. return $core.withContext(function($ctx2) {
  53308. return "hello"._add_("a");
  53309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53310. }),$Error());
  53311. $ctx1.sendIdx["should:raise:"]=1;
  53312. self._should_raise_((function(){
  53313. return $core.withContext(function($ctx2) {
  53314. return "hello"._remove_("h");
  53315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53316. }),$Error());
  53317. return self;
  53318. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  53319. },
  53320. args: [],
  53321. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  53322. referencedClasses: ["Error"],
  53323. messageSends: ["should:raise:", "add:", "remove:"]
  53324. }),
  53325. $globals.StringTest);
  53326. $core.addMethod(
  53327. $core.method({
  53328. selector: "testAsArray",
  53329. protocol: 'tests',
  53330. fn: function (){
  53331. var self=this;
  53332. return $core.withContext(function($ctx1) {
  53333. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  53334. return self;
  53335. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  53336. },
  53337. args: [],
  53338. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  53339. referencedClasses: [],
  53340. messageSends: ["assert:equals:", "asArray"]
  53341. }),
  53342. $globals.StringTest);
  53343. $core.addMethod(
  53344. $core.method({
  53345. selector: "testAsLowerCase",
  53346. protocol: 'tests',
  53347. fn: function (){
  53348. var self=this;
  53349. return $core.withContext(function($ctx1) {
  53350. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  53351. return self;
  53352. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  53353. },
  53354. args: [],
  53355. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  53356. referencedClasses: [],
  53357. messageSends: ["assert:equals:", "asLowercase"]
  53358. }),
  53359. $globals.StringTest);
  53360. $core.addMethod(
  53361. $core.method({
  53362. selector: "testAsNumber",
  53363. protocol: 'tests',
  53364. fn: function (){
  53365. var self=this;
  53366. return $core.withContext(function($ctx1) {
  53367. var $1,$2;
  53368. $1="3"._asNumber();
  53369. $ctx1.sendIdx["asNumber"]=1;
  53370. self._assert_equals_($1,(3));
  53371. $ctx1.sendIdx["assert:equals:"]=1;
  53372. $2="-3"._asNumber();
  53373. $ctx1.sendIdx["asNumber"]=2;
  53374. self._assert_equals_($2,(-3));
  53375. $ctx1.sendIdx["assert:equals:"]=2;
  53376. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  53377. return self;
  53378. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  53379. },
  53380. args: [],
  53381. 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.",
  53382. referencedClasses: [],
  53383. messageSends: ["assert:equals:", "asNumber"]
  53384. }),
  53385. $globals.StringTest);
  53386. $core.addMethod(
  53387. $core.method({
  53388. selector: "testAsUpperCase",
  53389. protocol: 'tests',
  53390. fn: function (){
  53391. var self=this;
  53392. return $core.withContext(function($ctx1) {
  53393. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  53394. return self;
  53395. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  53396. },
  53397. args: [],
  53398. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  53399. referencedClasses: [],
  53400. messageSends: ["assert:equals:", "asUppercase"]
  53401. }),
  53402. $globals.StringTest);
  53403. $core.addMethod(
  53404. $core.method({
  53405. selector: "testAsciiValue",
  53406. protocol: 'tests',
  53407. fn: function (){
  53408. var self=this;
  53409. var characterA,characterU;
  53410. return $core.withContext(function($ctx1) {
  53411. var $1;
  53412. characterA="A";
  53413. characterU="U";
  53414. $1=$recv(characterA)._asciiValue();
  53415. $ctx1.sendIdx["asciiValue"]=1;
  53416. self._assert_equals_($1,(65));
  53417. $ctx1.sendIdx["assert:equals:"]=1;
  53418. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  53419. return self;
  53420. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  53421. },
  53422. args: [],
  53423. 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",
  53424. referencedClasses: [],
  53425. messageSends: ["assert:equals:", "asciiValue"]
  53426. }),
  53427. $globals.StringTest);
  53428. $core.addMethod(
  53429. $core.method({
  53430. selector: "testAtIfAbsentPut",
  53431. protocol: 'tests',
  53432. fn: function (){
  53433. var self=this;
  53434. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53435. return $core.withContext(function($ctx1) {
  53436. self._should_raise_((function(){
  53437. return $core.withContext(function($ctx2) {
  53438. return "hello"._at_ifAbsentPut_((6),(function(){
  53439. return "a";
  53440. }));
  53441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53442. }),$Error());
  53443. return self;
  53444. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  53445. },
  53446. args: [],
  53447. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  53448. referencedClasses: ["Error"],
  53449. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  53450. }),
  53451. $globals.StringTest);
  53452. $core.addMethod(
  53453. $core.method({
  53454. selector: "testAtPut",
  53455. protocol: 'tests',
  53456. fn: function (){
  53457. var self=this;
  53458. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53459. return $core.withContext(function($ctx1) {
  53460. self._should_raise_((function(){
  53461. return $core.withContext(function($ctx2) {
  53462. return "hello"._at_put_((1),"a");
  53463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53464. }),$Error());
  53465. return self;
  53466. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  53467. },
  53468. args: [],
  53469. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  53470. referencedClasses: ["Error"],
  53471. messageSends: ["should:raise:", "at:put:"]
  53472. }),
  53473. $globals.StringTest);
  53474. $core.addMethod(
  53475. $core.method({
  53476. selector: "testCapitalized",
  53477. protocol: 'tests',
  53478. fn: function (){
  53479. var self=this;
  53480. return $core.withContext(function($ctx1) {
  53481. var $1,$2,$3;
  53482. $1="test"._capitalized();
  53483. $ctx1.sendIdx["capitalized"]=1;
  53484. self._assert_equals_($1,"Test");
  53485. $ctx1.sendIdx["assert:equals:"]=1;
  53486. $2="Test"._capitalized();
  53487. $ctx1.sendIdx["capitalized"]=2;
  53488. self._assert_equals_($2,"Test");
  53489. $ctx1.sendIdx["assert:equals:"]=2;
  53490. self._assert_equals_(""._capitalized(),"");
  53491. $ctx1.sendIdx["assert:equals:"]=3;
  53492. $3="Test"._isCapitalized();
  53493. $ctx1.sendIdx["isCapitalized"]=1;
  53494. self._assert_equals_($3,true);
  53495. $ctx1.sendIdx["assert:equals:"]=4;
  53496. self._assert_equals_("test"._isCapitalized(),false);
  53497. return self;
  53498. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  53499. },
  53500. args: [],
  53501. 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.",
  53502. referencedClasses: [],
  53503. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  53504. }),
  53505. $globals.StringTest);
  53506. $core.addMethod(
  53507. $core.method({
  53508. selector: "testCharCodeAt",
  53509. protocol: 'tests',
  53510. fn: function (){
  53511. var self=this;
  53512. return $core.withContext(function($ctx1) {
  53513. var $1,$2,$3,$4,$5;
  53514. $1="jackie"._charCodeAt_((1));
  53515. $ctx1.sendIdx["charCodeAt:"]=1;
  53516. self._assert_equals_($1,(106));
  53517. $ctx1.sendIdx["assert:equals:"]=1;
  53518. $2="jackie"._charCodeAt_((2));
  53519. $ctx1.sendIdx["charCodeAt:"]=2;
  53520. self._assert_equals_($2,(97));
  53521. $ctx1.sendIdx["assert:equals:"]=2;
  53522. $3="jackie"._charCodeAt_((3));
  53523. $ctx1.sendIdx["charCodeAt:"]=3;
  53524. self._assert_equals_($3,(99));
  53525. $ctx1.sendIdx["assert:equals:"]=3;
  53526. $4="jackie"._charCodeAt_((4));
  53527. $ctx1.sendIdx["charCodeAt:"]=4;
  53528. self._assert_equals_($4,(107));
  53529. $ctx1.sendIdx["assert:equals:"]=4;
  53530. $5="jackie"._charCodeAt_((5));
  53531. $ctx1.sendIdx["charCodeAt:"]=5;
  53532. self._assert_equals_($5,(105));
  53533. $ctx1.sendIdx["assert:equals:"]=5;
  53534. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  53535. return self;
  53536. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  53537. },
  53538. args: [],
  53539. 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",
  53540. referencedClasses: [],
  53541. messageSends: ["assert:equals:", "charCodeAt:"]
  53542. }),
  53543. $globals.StringTest);
  53544. $core.addMethod(
  53545. $core.method({
  53546. selector: "testCopyFromTo",
  53547. protocol: 'tests',
  53548. fn: function (){
  53549. var self=this;
  53550. return $core.withContext(function($ctx1) {
  53551. var $1;
  53552. $1="jackie"._copyFrom_to_((1),(3));
  53553. $ctx1.sendIdx["copyFrom:to:"]=1;
  53554. self._assert_equals_($1,"jac");
  53555. $ctx1.sendIdx["assert:equals:"]=1;
  53556. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  53557. return self;
  53558. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  53559. },
  53560. args: [],
  53561. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  53562. referencedClasses: [],
  53563. messageSends: ["assert:equals:", "copyFrom:to:"]
  53564. }),
  53565. $globals.StringTest);
  53566. $core.addMethod(
  53567. $core.method({
  53568. selector: "testCopyWithoutAll",
  53569. protocol: 'tests',
  53570. fn: function (){
  53571. var self=this;
  53572. return $core.withContext(function($ctx1) {
  53573. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  53574. return self;
  53575. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  53576. },
  53577. args: [],
  53578. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  53579. referencedClasses: [],
  53580. messageSends: ["assert:equals:", "copyWithoutAll:"]
  53581. }),
  53582. $globals.StringTest);
  53583. $core.addMethod(
  53584. $core.method({
  53585. selector: "testEquality",
  53586. protocol: 'tests',
  53587. fn: function (){
  53588. var self=this;
  53589. return $core.withContext(function($ctx1) {
  53590. var $1,$2,$3;
  53591. self._assert_equals_("hello","hello");
  53592. $ctx1.sendIdx["assert:equals:"]=1;
  53593. $1="hello".__eq("world");
  53594. $ctx1.sendIdx["="]=1;
  53595. self._deny_($1);
  53596. $ctx1.sendIdx["deny:"]=1;
  53597. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  53598. })));
  53599. $ctx1.sendIdx["="]=2;
  53600. self._deny_($2);
  53601. $ctx1.sendIdx["deny:"]=2;
  53602. $3="hello"._yourself();
  53603. $ctx1.sendIdx["yourself"]=1;
  53604. self._assert_equals_("hello",$3);
  53605. $ctx1.sendIdx["assert:equals:"]=2;
  53606. self._assert_equals_("hello"._yourself(),"hello");
  53607. self._deny_("".__eq((0)));
  53608. return self;
  53609. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  53610. },
  53611. args: [],
  53612. 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",
  53613. referencedClasses: [],
  53614. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  53615. }),
  53616. $globals.StringTest);
  53617. $core.addMethod(
  53618. $core.method({
  53619. selector: "testIdentity",
  53620. protocol: 'tests',
  53621. fn: function (){
  53622. var self=this;
  53623. return $core.withContext(function($ctx1) {
  53624. var $1,$2,$4,$3,$5;
  53625. $1="hello".__eq_eq("hello");
  53626. $ctx1.sendIdx["=="]=1;
  53627. self._assert_($1);
  53628. $ctx1.sendIdx["assert:"]=1;
  53629. $2="hello".__eq_eq("world");
  53630. $ctx1.sendIdx["=="]=2;
  53631. self._deny_($2);
  53632. $ctx1.sendIdx["deny:"]=1;
  53633. $4="hello"._yourself();
  53634. $ctx1.sendIdx["yourself"]=1;
  53635. $3="hello".__eq_eq($4);
  53636. $ctx1.sendIdx["=="]=3;
  53637. self._assert_($3);
  53638. $ctx1.sendIdx["assert:"]=2;
  53639. $5=$recv("hello"._yourself()).__eq_eq("hello");
  53640. $ctx1.sendIdx["=="]=4;
  53641. self._assert_($5);
  53642. self._deny_("".__eq_eq((0)));
  53643. return self;
  53644. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  53645. },
  53646. args: [],
  53647. 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",
  53648. referencedClasses: [],
  53649. messageSends: ["assert:", "==", "deny:", "yourself"]
  53650. }),
  53651. $globals.StringTest);
  53652. $core.addMethod(
  53653. $core.method({
  53654. selector: "testIncludesSubString",
  53655. protocol: 'tests',
  53656. fn: function (){
  53657. var self=this;
  53658. return $core.withContext(function($ctx1) {
  53659. var $1;
  53660. $1="amber"._includesSubString_("ber");
  53661. $ctx1.sendIdx["includesSubString:"]=1;
  53662. self._assert_($1);
  53663. self._deny_("amber"._includesSubString_("zork"));
  53664. return self;
  53665. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  53666. },
  53667. args: [],
  53668. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  53669. referencedClasses: [],
  53670. messageSends: ["assert:", "includesSubString:", "deny:"]
  53671. }),
  53672. $globals.StringTest);
  53673. $core.addMethod(
  53674. $core.method({
  53675. selector: "testIndexOfStartingAtWithNull",
  53676. protocol: 'tests',
  53677. fn: function (){
  53678. var self=this;
  53679. return self;
  53680. },
  53681. args: [],
  53682. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  53683. referencedClasses: [],
  53684. messageSends: []
  53685. }),
  53686. $globals.StringTest);
  53687. $core.addMethod(
  53688. $core.method({
  53689. selector: "testIndexOfWithNull",
  53690. protocol: 'tests',
  53691. fn: function (){
  53692. var self=this;
  53693. return self;
  53694. },
  53695. args: [],
  53696. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  53697. referencedClasses: [],
  53698. messageSends: []
  53699. }),
  53700. $globals.StringTest);
  53701. $core.addMethod(
  53702. $core.method({
  53703. selector: "testIsVowel",
  53704. protocol: 'tests',
  53705. fn: function (){
  53706. var self=this;
  53707. var vowel,consonant;
  53708. return $core.withContext(function($ctx1) {
  53709. var $1;
  53710. vowel="u";
  53711. consonant="z";
  53712. $1=$recv(vowel)._isVowel();
  53713. $ctx1.sendIdx["isVowel"]=1;
  53714. self._assert_equals_($1,true);
  53715. $ctx1.sendIdx["assert:equals:"]=1;
  53716. self._assert_equals_($recv(consonant)._isVowel(),false);
  53717. return self;
  53718. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  53719. },
  53720. args: [],
  53721. 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",
  53722. referencedClasses: [],
  53723. messageSends: ["assert:equals:", "isVowel"]
  53724. }),
  53725. $globals.StringTest);
  53726. $core.addMethod(
  53727. $core.method({
  53728. selector: "testJoin",
  53729. protocol: 'tests',
  53730. fn: function (){
  53731. var self=this;
  53732. return $core.withContext(function($ctx1) {
  53733. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  53734. return self;
  53735. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  53736. },
  53737. args: [],
  53738. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  53739. referencedClasses: [],
  53740. messageSends: ["assert:equals:", "join:"]
  53741. }),
  53742. $globals.StringTest);
  53743. $core.addMethod(
  53744. $core.method({
  53745. selector: "testRemoveAll",
  53746. protocol: 'tests',
  53747. fn: function (){
  53748. var self=this;
  53749. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53750. return $core.withContext(function($ctx1) {
  53751. self._should_raise_((function(){
  53752. return $core.withContext(function($ctx2) {
  53753. return $recv(self._collection())._removeAll();
  53754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53755. }),$Error());
  53756. return self;
  53757. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  53758. },
  53759. args: [],
  53760. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  53761. referencedClasses: ["Error"],
  53762. messageSends: ["should:raise:", "removeAll", "collection"]
  53763. }),
  53764. $globals.StringTest);
  53765. $core.addMethod(
  53766. $core.method({
  53767. selector: "testReversed",
  53768. protocol: 'tests',
  53769. fn: function (){
  53770. var self=this;
  53771. return $core.withContext(function($ctx1) {
  53772. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  53773. return self;
  53774. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  53775. },
  53776. args: [],
  53777. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  53778. referencedClasses: [],
  53779. messageSends: ["assert:equals:", "reversed"]
  53780. }),
  53781. $globals.StringTest);
  53782. $core.addMethod(
  53783. $core.method({
  53784. selector: "testStreamContents",
  53785. protocol: 'tests',
  53786. fn: function (){
  53787. var self=this;
  53788. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  53789. return $core.withContext(function($ctx1) {
  53790. var $1;
  53791. self._assert_equals_($recv($String())._streamContents_((function(aStream){
  53792. return $core.withContext(function($ctx2) {
  53793. $recv(aStream)._nextPutAll_("hello");
  53794. $ctx2.sendIdx["nextPutAll:"]=1;
  53795. $recv(aStream)._space();
  53796. $1=$recv(aStream)._nextPutAll_("world");
  53797. return $1;
  53798. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  53799. })),"hello world");
  53800. return self;
  53801. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  53802. },
  53803. args: [],
  53804. 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'",
  53805. referencedClasses: ["String"],
  53806. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  53807. }),
  53808. $globals.StringTest);
  53809. $core.addMethod(
  53810. $core.method({
  53811. selector: "testSubStrings",
  53812. protocol: 'tests',
  53813. fn: function (){
  53814. var self=this;
  53815. return $core.withContext(function($ctx1) {
  53816. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  53817. return self;
  53818. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  53819. },
  53820. args: [],
  53821. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  53822. referencedClasses: [],
  53823. messageSends: ["assert:equals:", "subStrings:"]
  53824. }),
  53825. $globals.StringTest);
  53826. $core.addMethod(
  53827. $core.method({
  53828. selector: "testTrim",
  53829. protocol: 'tests',
  53830. fn: function (){
  53831. var self=this;
  53832. return $core.withContext(function($ctx1) {
  53833. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  53834. $ctx1.sendIdx["assert:equals:"]=1;
  53835. self._assert_equals_("jackie "._trimRight(),"jackie");
  53836. return self;
  53837. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  53838. },
  53839. args: [],
  53840. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  53841. referencedClasses: [],
  53842. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  53843. }),
  53844. $globals.StringTest);
  53845. $core.addMethod(
  53846. $core.method({
  53847. selector: "testValue",
  53848. protocol: 'tests',
  53849. fn: function (){
  53850. var self=this;
  53851. return $core.withContext(function($ctx1) {
  53852. self._assert_equals_("asString"._value_((1)),"1");
  53853. $ctx1.sendIdx["assert:equals:"]=1;
  53854. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  53855. return self;
  53856. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  53857. },
  53858. args: [],
  53859. 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')",
  53860. referencedClasses: [],
  53861. messageSends: ["assert:equals:", "value:", "collect:"]
  53862. }),
  53863. $globals.StringTest);
  53864. $core.addMethod(
  53865. $core.method({
  53866. selector: "collectionClass",
  53867. protocol: 'fixture',
  53868. fn: function (){
  53869. var self=this;
  53870. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  53871. return $String();
  53872. },
  53873. args: [],
  53874. source: "collectionClass\x0a\x09^ String",
  53875. referencedClasses: ["String"],
  53876. messageSends: []
  53877. }),
  53878. $globals.StringTest.klass);
  53879. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  53880. $core.addMethod(
  53881. $core.method({
  53882. selector: "collection",
  53883. protocol: 'fixture',
  53884. fn: function (){
  53885. var self=this;
  53886. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53887. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  53888. return $core.withContext(function($ctx1) {
  53889. var $2,$3,$1;
  53890. $2=$recv($Set())._new();
  53891. $recv($2)._add_($Smalltalk());
  53892. $ctx1.sendIdx["add:"]=1;
  53893. $recv($2)._add_(nil);
  53894. $ctx1.sendIdx["add:"]=2;
  53895. $recv($2)._add_((3).__at((3)));
  53896. $ctx1.sendIdx["add:"]=3;
  53897. $recv($2)._add_(false);
  53898. $3=$recv($2)._yourself();
  53899. $1=$3;
  53900. return $1;
  53901. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  53902. },
  53903. args: [],
  53904. 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",
  53905. referencedClasses: ["Set", "Smalltalk"],
  53906. messageSends: ["add:", "new", "@", "yourself"]
  53907. }),
  53908. $globals.SetTest);
  53909. $core.addMethod(
  53910. $core.method({
  53911. selector: "collectionOfPrintStrings",
  53912. protocol: 'fixture',
  53913. fn: function (){
  53914. var self=this;
  53915. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53916. return $core.withContext(function($ctx1) {
  53917. var $2,$3,$1;
  53918. $2=$recv($Set())._new();
  53919. $recv($2)._add_("a SmalltalkImage");
  53920. $ctx1.sendIdx["add:"]=1;
  53921. $recv($2)._add_("nil");
  53922. $ctx1.sendIdx["add:"]=2;
  53923. $recv($2)._add_("3@3");
  53924. $ctx1.sendIdx["add:"]=3;
  53925. $recv($2)._add_("false");
  53926. $3=$recv($2)._yourself();
  53927. $1=$3;
  53928. return $1;
  53929. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  53930. },
  53931. args: [],
  53932. 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",
  53933. referencedClasses: ["Set"],
  53934. messageSends: ["add:", "new", "yourself"]
  53935. }),
  53936. $globals.SetTest);
  53937. $core.addMethod(
  53938. $core.method({
  53939. selector: "collectionSize",
  53940. protocol: 'fixture',
  53941. fn: function (){
  53942. var self=this;
  53943. return (4);
  53944. },
  53945. args: [],
  53946. source: "collectionSize\x0a\x09^ 4",
  53947. referencedClasses: [],
  53948. messageSends: []
  53949. }),
  53950. $globals.SetTest);
  53951. $core.addMethod(
  53952. $core.method({
  53953. selector: "collectionWithDuplicates",
  53954. protocol: 'fixture',
  53955. fn: function (){
  53956. var self=this;
  53957. return $core.withContext(function($ctx1) {
  53958. var $2,$3,$1;
  53959. $2=self._collection();
  53960. $recv($2)._add_((0));
  53961. $3=$recv($2)._yourself();
  53962. $1=$3;
  53963. return $1;
  53964. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  53965. },
  53966. args: [],
  53967. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  53968. referencedClasses: [],
  53969. messageSends: ["add:", "collection", "yourself"]
  53970. }),
  53971. $globals.SetTest);
  53972. $core.addMethod(
  53973. $core.method({
  53974. selector: "collectionWithNewValue",
  53975. protocol: 'fixture',
  53976. fn: function (){
  53977. var self=this;
  53978. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53979. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  53980. return $core.withContext(function($ctx1) {
  53981. var $2,$3,$1;
  53982. $2=$recv($Set())._new();
  53983. $recv($2)._add_($Smalltalk());
  53984. $ctx1.sendIdx["add:"]=1;
  53985. $recv($2)._add_(nil);
  53986. $ctx1.sendIdx["add:"]=2;
  53987. $recv($2)._add_((3).__at((3)));
  53988. $ctx1.sendIdx["add:"]=3;
  53989. $recv($2)._add_("N");
  53990. $ctx1.sendIdx["add:"]=4;
  53991. $recv($2)._add_(false);
  53992. $3=$recv($2)._yourself();
  53993. $1=$3;
  53994. return $1;
  53995. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  53996. },
  53997. args: [],
  53998. 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",
  53999. referencedClasses: ["Set", "Smalltalk"],
  54000. messageSends: ["add:", "new", "@", "yourself"]
  54001. }),
  54002. $globals.SetTest);
  54003. $core.addMethod(
  54004. $core.method({
  54005. selector: "testAddAll",
  54006. protocol: 'tests',
  54007. fn: function (){
  54008. var self=this;
  54009. return $core.withContext(function($ctx1) {
  54010. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  54011. (
  54012. $ctx1.supercall = true,
  54013. $globals.SetTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
  54014. $ctx1.supercall = false;
  54015. $2=self._collection();
  54016. $ctx1.sendIdx["collection"]=1;
  54017. $3=$2;
  54018. $4=self._collection();
  54019. $ctx1.sendIdx["collection"]=2;
  54020. $recv($3)._addAll_($4);
  54021. $ctx1.sendIdx["addAll:"]=1;
  54022. $5=$recv($2)._yourself();
  54023. $ctx1.sendIdx["yourself"]=1;
  54024. $1=$5;
  54025. $6=self._collection();
  54026. $ctx1.sendIdx["collection"]=3;
  54027. self._assert_equals_($1,$6);
  54028. $ctx1.sendIdx["assert:equals:"]=1;
  54029. $8=self._collection();
  54030. $ctx1.sendIdx["collection"]=4;
  54031. $9=$8;
  54032. $10=self._collectionWithNewValue();
  54033. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54034. $recv($9)._addAll_($10);
  54035. $ctx1.sendIdx["addAll:"]=2;
  54036. $11=$recv($8)._yourself();
  54037. $ctx1.sendIdx["yourself"]=2;
  54038. $7=$11;
  54039. $12=self._collectionWithNewValue();
  54040. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54041. self._assert_equals_($7,$12);
  54042. $ctx1.sendIdx["assert:equals:"]=2;
  54043. $14=self._collectionWithNewValue();
  54044. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54045. $recv($14)._addAll_(self._collection());
  54046. $15=$recv($14)._yourself();
  54047. $13=$15;
  54048. self._assert_equals_($13,self._collectionWithNewValue());
  54049. return self;
  54050. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  54051. },
  54052. args: [],
  54053. 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",
  54054. referencedClasses: [],
  54055. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54056. }),
  54057. $globals.SetTest);
  54058. $core.addMethod(
  54059. $core.method({
  54060. selector: "testAddRemove",
  54061. protocol: 'tests',
  54062. fn: function (){
  54063. var self=this;
  54064. var set;
  54065. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54066. return $core.withContext(function($ctx1) {
  54067. var $1,$2;
  54068. set=$recv($Set())._new();
  54069. self._assert_($recv(set)._isEmpty());
  54070. $ctx1.sendIdx["assert:"]=1;
  54071. $recv(set)._add_((3));
  54072. $ctx1.sendIdx["add:"]=1;
  54073. $1=$recv(set)._includes_((3));
  54074. $ctx1.sendIdx["includes:"]=1;
  54075. self._assert_($1);
  54076. $ctx1.sendIdx["assert:"]=2;
  54077. $recv(set)._add_((5));
  54078. $2=$recv(set)._includes_((5));
  54079. $ctx1.sendIdx["includes:"]=2;
  54080. self._assert_($2);
  54081. $recv(set)._remove_((3));
  54082. self._deny_($recv(set)._includes_((3)));
  54083. return self;
  54084. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  54085. },
  54086. args: [],
  54087. 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)",
  54088. referencedClasses: ["Set"],
  54089. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  54090. }),
  54091. $globals.SetTest);
  54092. $core.addMethod(
  54093. $core.method({
  54094. selector: "testAt",
  54095. protocol: 'tests',
  54096. fn: function (){
  54097. var self=this;
  54098. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54099. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54100. return $core.withContext(function($ctx1) {
  54101. self._should_raise_((function(){
  54102. return $core.withContext(function($ctx2) {
  54103. return $recv($recv($Set())._new())._at_put_((1),(2));
  54104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54105. }),$Error());
  54106. return self;
  54107. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  54108. },
  54109. args: [],
  54110. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  54111. referencedClasses: ["Set", "Error"],
  54112. messageSends: ["should:raise:", "at:put:", "new"]
  54113. }),
  54114. $globals.SetTest);
  54115. $core.addMethod(
  54116. $core.method({
  54117. selector: "testCollect",
  54118. protocol: 'tests',
  54119. fn: function (){
  54120. var self=this;
  54121. return $core.withContext(function($ctx1) {
  54122. var $2,$1;
  54123. (
  54124. $ctx1.supercall = true,
  54125. $globals.SetTest.superclass.fn.prototype._testCollect.apply($recv(self), []));
  54126. $ctx1.supercall = false;
  54127. $2=[(5), (6), (8)]._asSet();
  54128. $ctx1.sendIdx["asSet"]=1;
  54129. $1=$recv($2)._collect_((function(x){
  54130. return $core.withContext(function($ctx2) {
  54131. return $recv(x).__backslash_backslash((3));
  54132. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54133. }));
  54134. self._assert_equals_($1,[(0), (2)]._asSet());
  54135. return self;
  54136. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  54137. },
  54138. args: [],
  54139. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  54140. referencedClasses: [],
  54141. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  54142. }),
  54143. $globals.SetTest);
  54144. $core.addMethod(
  54145. $core.method({
  54146. selector: "testComma",
  54147. protocol: 'tests',
  54148. fn: function (){
  54149. var self=this;
  54150. return $core.withContext(function($ctx1) {
  54151. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54152. (
  54153. $ctx1.supercall = true,
  54154. $globals.SetTest.superclass.fn.prototype._testComma.apply($recv(self), []));
  54155. $ctx1.supercall = false;
  54156. $2=self._collection();
  54157. $ctx1.sendIdx["collection"]=1;
  54158. $3=self._collection();
  54159. $ctx1.sendIdx["collection"]=2;
  54160. $1=$recv($2).__comma($3);
  54161. $ctx1.sendIdx[","]=1;
  54162. $4=self._collection();
  54163. $ctx1.sendIdx["collection"]=3;
  54164. self._assert_equals_($1,$4);
  54165. $ctx1.sendIdx["assert:equals:"]=1;
  54166. $6=self._collection();
  54167. $ctx1.sendIdx["collection"]=4;
  54168. $7=self._collectionWithNewValue();
  54169. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54170. $5=$recv($6).__comma($7);
  54171. $ctx1.sendIdx[","]=2;
  54172. $8=self._collectionWithNewValue();
  54173. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54174. self._assert_equals_($5,$8);
  54175. $ctx1.sendIdx["assert:equals:"]=2;
  54176. $10=self._collectionWithNewValue();
  54177. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54178. $9=$recv($10).__comma(self._collection());
  54179. self._assert_equals_($9,self._collectionWithNewValue());
  54180. return self;
  54181. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  54182. },
  54183. args: [],
  54184. 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",
  54185. referencedClasses: [],
  54186. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54187. }),
  54188. $globals.SetTest);
  54189. $core.addMethod(
  54190. $core.method({
  54191. selector: "testComparing",
  54192. protocol: 'tests',
  54193. fn: function (){
  54194. var self=this;
  54195. return $core.withContext(function($ctx1) {
  54196. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  54197. $1=[(0), (2)]._asSet();
  54198. $ctx1.sendIdx["asSet"]=1;
  54199. $2=[(0), (2)]._asSet();
  54200. $ctx1.sendIdx["asSet"]=2;
  54201. self._assert_equals_($1,$2);
  54202. $ctx1.sendIdx["assert:equals:"]=1;
  54203. $3=[(2), (0)]._asSet();
  54204. $ctx1.sendIdx["asSet"]=3;
  54205. $4=[(0), (2)]._asSet();
  54206. $ctx1.sendIdx["asSet"]=4;
  54207. self._assert_equals_($3,$4);
  54208. $6=[(0), (2), (3)]._asSet();
  54209. $ctx1.sendIdx["asSet"]=5;
  54210. $7=[(0), (2)]._asSet();
  54211. $ctx1.sendIdx["asSet"]=6;
  54212. $5=$recv($6).__eq($7);
  54213. $ctx1.sendIdx["="]=1;
  54214. self._deny_($5);
  54215. $ctx1.sendIdx["deny:"]=1;
  54216. $9=[(1), (2)]._asSet();
  54217. $ctx1.sendIdx["asSet"]=7;
  54218. $8=$recv($9).__eq([(0), (2)]._asSet());
  54219. self._deny_($8);
  54220. return self;
  54221. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  54222. },
  54223. args: [],
  54224. 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",
  54225. referencedClasses: [],
  54226. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  54227. }),
  54228. $globals.SetTest);
  54229. $core.addMethod(
  54230. $core.method({
  54231. selector: "testPrintString",
  54232. protocol: 'tests',
  54233. fn: function (){
  54234. var self=this;
  54235. var set;
  54236. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54237. return $core.withContext(function($ctx1) {
  54238. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  54239. set=$recv($Set())._new();
  54240. $1=$recv(set)._printString();
  54241. $ctx1.sendIdx["printString"]=1;
  54242. self._assert_equals_($1,"a Set ()");
  54243. $ctx1.sendIdx["assert:equals:"]=1;
  54244. $2=set;
  54245. $recv($2)._add_((1));
  54246. $ctx1.sendIdx["add:"]=1;
  54247. $3=$recv($2)._add_((3));
  54248. $ctx1.sendIdx["add:"]=2;
  54249. $4=$recv(set)._printString();
  54250. $ctx1.sendIdx["printString"]=2;
  54251. self._assert_equals_($4,"a Set (1 3)");
  54252. $ctx1.sendIdx["assert:equals:"]=2;
  54253. $recv(set)._add_("foo");
  54254. $ctx1.sendIdx["add:"]=3;
  54255. $5=$recv(set)._printString();
  54256. $ctx1.sendIdx["printString"]=3;
  54257. self._assert_equals_($5,"a Set (1 3 'foo')");
  54258. $ctx1.sendIdx["assert:equals:"]=3;
  54259. $6=set;
  54260. $recv($6)._remove_((1));
  54261. $ctx1.sendIdx["remove:"]=1;
  54262. $7=$recv($6)._remove_((3));
  54263. $8=$recv(set)._printString();
  54264. $ctx1.sendIdx["printString"]=4;
  54265. self._assert_equals_($8,"a Set ('foo')");
  54266. $ctx1.sendIdx["assert:equals:"]=4;
  54267. $recv(set)._add_((3));
  54268. $ctx1.sendIdx["add:"]=4;
  54269. $9=$recv(set)._printString();
  54270. $ctx1.sendIdx["printString"]=5;
  54271. self._assert_equals_($9,"a Set (3 'foo')");
  54272. $ctx1.sendIdx["assert:equals:"]=5;
  54273. $recv(set)._add_((3));
  54274. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  54275. return self;
  54276. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  54277. },
  54278. args: [],
  54279. 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'')'",
  54280. referencedClasses: ["Set"],
  54281. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  54282. }),
  54283. $globals.SetTest);
  54284. $core.addMethod(
  54285. $core.method({
  54286. selector: "testUnboxedObjects",
  54287. protocol: 'tests',
  54288. fn: function (){
  54289. var self=this;
  54290. return $core.withContext(function($ctx1) {
  54291. var $4,$3,$2,$1;
  54292. $4="foo"._yourself();
  54293. $ctx1.sendIdx["yourself"]=1;
  54294. $3=[$4,"foo"._yourself()];
  54295. $2=$recv($3)._asSet();
  54296. $1=$recv($2)._asArray();
  54297. self._assert_equals_($1,["foo"]);
  54298. return self;
  54299. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  54300. },
  54301. args: [],
  54302. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  54303. referencedClasses: [],
  54304. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  54305. }),
  54306. $globals.SetTest);
  54307. $core.addMethod(
  54308. $core.method({
  54309. selector: "testUnicity",
  54310. protocol: 'tests',
  54311. fn: function (){
  54312. var self=this;
  54313. var set;
  54314. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54315. return $core.withContext(function($ctx1) {
  54316. var $1;
  54317. set=$recv($Set())._new();
  54318. $recv(set)._add_((21));
  54319. $ctx1.sendIdx["add:"]=1;
  54320. $recv(set)._add_("hello");
  54321. $ctx1.sendIdx["add:"]=2;
  54322. $recv(set)._add_((21));
  54323. $ctx1.sendIdx["add:"]=3;
  54324. $1=$recv(set)._size();
  54325. $ctx1.sendIdx["size"]=1;
  54326. self._assert_equals_($1,(2));
  54327. $ctx1.sendIdx["assert:equals:"]=1;
  54328. $recv(set)._add_("hello");
  54329. self._assert_equals_($recv(set)._size(),(2));
  54330. $ctx1.sendIdx["assert:equals:"]=2;
  54331. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  54332. return self;
  54333. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  54334. },
  54335. args: [],
  54336. 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')",
  54337. referencedClasses: ["Set"],
  54338. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  54339. }),
  54340. $globals.SetTest);
  54341. $core.addMethod(
  54342. $core.method({
  54343. selector: "collectionClass",
  54344. protocol: 'fixture',
  54345. fn: function (){
  54346. var self=this;
  54347. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54348. return $Set();
  54349. },
  54350. args: [],
  54351. source: "collectionClass\x0a\x09^ Set",
  54352. referencedClasses: ["Set"],
  54353. messageSends: []
  54354. }),
  54355. $globals.SetTest.klass);
  54356. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  54357. $core.addMethod(
  54358. $core.method({
  54359. selector: "testShow",
  54360. protocol: 'tests',
  54361. fn: function (){
  54362. var self=this;
  54363. var originalTranscript;
  54364. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  54365. function $ConsoleTranscript(){return $globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  54366. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54367. return $core.withContext(function($ctx1) {
  54368. originalTranscript=$recv($Transcript())._current();
  54369. $recv($Transcript())._register_($recv($ConsoleTranscript())._new());
  54370. $ctx1.sendIdx["register:"]=1;
  54371. self._shouldnt_raise_((function(){
  54372. return $core.withContext(function($ctx2) {
  54373. return $recv($Transcript())._show_("Hello console!");
  54374. $ctx2.sendIdx["show:"]=1;
  54375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54376. }),$Error());
  54377. $ctx1.sendIdx["shouldnt:raise:"]=1;
  54378. self._shouldnt_raise_((function(){
  54379. return $core.withContext(function($ctx2) {
  54380. return $recv($Transcript())._show_(console);
  54381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54382. }),$Error());
  54383. $recv($Transcript())._register_(originalTranscript);
  54384. return self;
  54385. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  54386. },
  54387. args: [],
  54388. 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.",
  54389. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  54390. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  54391. }),
  54392. $globals.ConsoleTranscriptTest);
  54393. $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
  54394. $core.addMethod(
  54395. $core.method({
  54396. selector: "testEquality",
  54397. protocol: 'tests',
  54398. fn: function (){
  54399. var self=this;
  54400. var now;
  54401. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  54402. return $core.withContext(function($ctx1) {
  54403. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  54404. now=$recv($Date())._new();
  54405. $1=$recv(now).__eq(now);
  54406. $ctx1.sendIdx["="]=1;
  54407. self._assert_($1);
  54408. $ctx1.sendIdx["assert:"]=1;
  54409. $3=now;
  54410. $4=$recv($Date())._fromMilliseconds_((0));
  54411. $ctx1.sendIdx["fromMilliseconds:"]=1;
  54412. $2=$recv($3).__eq($4);
  54413. $ctx1.sendIdx["="]=2;
  54414. self._deny_($2);
  54415. $6=$recv($Date())._fromMilliseconds_((12345678));
  54416. $ctx1.sendIdx["fromMilliseconds:"]=2;
  54417. $7=$recv($Date())._fromMilliseconds_((12345678));
  54418. $ctx1.sendIdx["fromMilliseconds:"]=3;
  54419. $5=$recv($6).__eq($7);
  54420. $ctx1.sendIdx["="]=3;
  54421. self._assert_($5);
  54422. $ctx1.sendIdx["assert:"]=2;
  54423. $9=now;
  54424. $11=$recv(now)._asMilliseconds();
  54425. $ctx1.sendIdx["asMilliseconds"]=1;
  54426. $10=$recv($Date())._fromMilliseconds_($11);
  54427. $ctx1.sendIdx["fromMilliseconds:"]=4;
  54428. $8=$recv($9).__eq($10);
  54429. $ctx1.sendIdx["="]=4;
  54430. self._assert_($8);
  54431. $ctx1.sendIdx["assert:"]=3;
  54432. self._assert_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  54433. return self;
  54434. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  54435. },
  54436. args: [],
  54437. 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",
  54438. referencedClasses: ["Date"],
  54439. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  54440. }),
  54441. $globals.DateTest);
  54442. $core.addMethod(
  54443. $core.method({
  54444. selector: "testIdentity",
  54445. protocol: 'tests',
  54446. fn: function (){
  54447. var self=this;
  54448. var now;
  54449. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  54450. return $core.withContext(function($ctx1) {
  54451. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  54452. now=$recv($Date())._new();
  54453. $1=$recv(now).__eq_eq(now);
  54454. $ctx1.sendIdx["=="]=1;
  54455. self._assert_($1);
  54456. $3=now;
  54457. $4=$recv($Date())._fromMilliseconds_((0));
  54458. $ctx1.sendIdx["fromMilliseconds:"]=1;
  54459. $2=$recv($3).__eq_eq($4);
  54460. $ctx1.sendIdx["=="]=2;
  54461. self._deny_($2);
  54462. $ctx1.sendIdx["deny:"]=1;
  54463. $6=$recv($Date())._fromMilliseconds_((12345678));
  54464. $ctx1.sendIdx["fromMilliseconds:"]=2;
  54465. $7=$recv($Date())._fromMilliseconds_((12345678));
  54466. $ctx1.sendIdx["fromMilliseconds:"]=3;
  54467. $5=$recv($6).__eq_eq($7);
  54468. $ctx1.sendIdx["=="]=3;
  54469. self._deny_($5);
  54470. $ctx1.sendIdx["deny:"]=2;
  54471. $9=now;
  54472. $11=$recv(now)._asMilliseconds();
  54473. $ctx1.sendIdx["asMilliseconds"]=1;
  54474. $10=$recv($Date())._fromMilliseconds_($11);
  54475. $ctx1.sendIdx["fromMilliseconds:"]=4;
  54476. $8=$recv($9).__eq_eq($10);
  54477. $ctx1.sendIdx["=="]=4;
  54478. self._deny_($8);
  54479. $ctx1.sendIdx["deny:"]=3;
  54480. self._deny_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  54481. return self;
  54482. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  54483. },
  54484. args: [],
  54485. 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",
  54486. referencedClasses: ["Date"],
  54487. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  54488. }),
  54489. $globals.DateTest);
  54490. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  54491. $core.addMethod(
  54492. $core.method({
  54493. selector: "jsNull",
  54494. protocol: 'accessing',
  54495. fn: function (){
  54496. var self=this;
  54497. return $core.withContext(function($ctx1) {
  54498. return null;
  54499. return self;
  54500. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  54501. },
  54502. args: [],
  54503. source: "jsNull\x0a\x09<return null>",
  54504. referencedClasses: [],
  54505. messageSends: []
  54506. }),
  54507. $globals.JSObjectProxyTest);
  54508. $core.addMethod(
  54509. $core.method({
  54510. selector: "jsObject",
  54511. protocol: 'accessing',
  54512. fn: function (){
  54513. var self=this;
  54514. return $core.withContext(function($ctx1) {
  54515. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  54516. return self;
  54517. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  54518. },
  54519. args: [],
  54520. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  54521. referencedClasses: [],
  54522. messageSends: []
  54523. }),
  54524. $globals.JSObjectProxyTest);
  54525. $core.addMethod(
  54526. $core.method({
  54527. selector: "jsUndefined",
  54528. protocol: 'accessing',
  54529. fn: function (){
  54530. var self=this;
  54531. return $core.withContext(function($ctx1) {
  54532. return;
  54533. return self;
  54534. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  54535. },
  54536. args: [],
  54537. source: "jsUndefined\x0a\x09<return>",
  54538. referencedClasses: [],
  54539. messageSends: []
  54540. }),
  54541. $globals.JSObjectProxyTest);
  54542. $core.addMethod(
  54543. $core.method({
  54544. selector: "testAtIfAbsent",
  54545. protocol: 'tests',
  54546. fn: function (){
  54547. var self=this;
  54548. var testObject;
  54549. return $core.withContext(function($ctx1) {
  54550. var $1,$2,$3;
  54551. testObject=self._jsObject();
  54552. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  54553. return "Property does not exist";
  54554. }));
  54555. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54556. self._assert_equals_($1,"Property does not exist");
  54557. $ctx1.sendIdx["assert:equals:"]=1;
  54558. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  54559. return "Property does not exist";
  54560. }));
  54561. $ctx1.sendIdx["at:ifAbsent:"]=2;
  54562. self._assert_equals_($2,nil);
  54563. $ctx1.sendIdx["assert:equals:"]=2;
  54564. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  54565. return "Property does not exist";
  54566. }));
  54567. $ctx1.sendIdx["at:ifAbsent:"]=3;
  54568. self._assert_equals_($3,(1));
  54569. $ctx1.sendIdx["assert:equals:"]=3;
  54570. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  54571. return "Property does not exist";
  54572. })),nil);
  54573. return self;
  54574. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54575. },
  54576. args: [],
  54577. 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.",
  54578. referencedClasses: [],
  54579. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  54580. }),
  54581. $globals.JSObjectProxyTest);
  54582. $core.addMethod(
  54583. $core.method({
  54584. selector: "testAtIfPresent",
  54585. protocol: 'tests',
  54586. fn: function (){
  54587. var self=this;
  54588. var testObject;
  54589. return $core.withContext(function($ctx1) {
  54590. var $2,$1,$4,$3,$6,$5;
  54591. testObject=self._jsObject();
  54592. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  54593. return $core.withContext(function($ctx2) {
  54594. $2=$recv(x)._asString();
  54595. $ctx2.sendIdx["asString"]=1;
  54596. return "hello ".__comma($2);
  54597. $ctx2.sendIdx[","]=1;
  54598. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54599. }));
  54600. $ctx1.sendIdx["at:ifPresent:"]=1;
  54601. self._assert_equals_($1,nil);
  54602. $ctx1.sendIdx["assert:equals:"]=1;
  54603. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  54604. return $core.withContext(function($ctx2) {
  54605. $4=$recv(x)._asString();
  54606. $ctx2.sendIdx["asString"]=2;
  54607. return "hello ".__comma($4);
  54608. $ctx2.sendIdx[","]=2;
  54609. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  54610. }));
  54611. $ctx1.sendIdx["at:ifPresent:"]=2;
  54612. self._assert_equals_($3,"hello nil");
  54613. $ctx1.sendIdx["assert:equals:"]=2;
  54614. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  54615. return $core.withContext(function($ctx2) {
  54616. $6=$recv(x)._asString();
  54617. $ctx2.sendIdx["asString"]=3;
  54618. return "hello ".__comma($6);
  54619. $ctx2.sendIdx[","]=3;
  54620. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  54621. }));
  54622. $ctx1.sendIdx["at:ifPresent:"]=3;
  54623. self._assert_equals_($5,"hello 1");
  54624. $ctx1.sendIdx["assert:equals:"]=3;
  54625. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  54626. return $core.withContext(function($ctx2) {
  54627. return "hello ".__comma($recv(x)._asString());
  54628. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  54629. })),"hello nil");
  54630. return self;
  54631. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54632. },
  54633. args: [],
  54634. 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'.",
  54635. referencedClasses: [],
  54636. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  54637. }),
  54638. $globals.JSObjectProxyTest);
  54639. $core.addMethod(
  54640. $core.method({
  54641. selector: "testAtIfPresentIfAbsent",
  54642. protocol: 'tests',
  54643. fn: function (){
  54644. var self=this;
  54645. var testObject;
  54646. return $core.withContext(function($ctx1) {
  54647. var $2,$1,$4,$3,$6,$5;
  54648. testObject=self._jsObject();
  54649. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  54650. return $core.withContext(function($ctx2) {
  54651. $2=$recv(x)._asString();
  54652. $ctx2.sendIdx["asString"]=1;
  54653. return "hello ".__comma($2);
  54654. $ctx2.sendIdx[","]=1;
  54655. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54656. }),(function(){
  54657. return "not present";
  54658. }));
  54659. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  54660. self._assert_equals_($1,"not present");
  54661. $ctx1.sendIdx["assert:equals:"]=1;
  54662. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  54663. return $core.withContext(function($ctx2) {
  54664. $4=$recv(x)._asString();
  54665. $ctx2.sendIdx["asString"]=2;
  54666. return "hello ".__comma($4);
  54667. $ctx2.sendIdx[","]=2;
  54668. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  54669. }),(function(){
  54670. return "not present";
  54671. }));
  54672. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  54673. self._assert_equals_($3,"hello nil");
  54674. $ctx1.sendIdx["assert:equals:"]=2;
  54675. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  54676. return $core.withContext(function($ctx2) {
  54677. $6=$recv(x)._asString();
  54678. $ctx2.sendIdx["asString"]=3;
  54679. return "hello ".__comma($6);
  54680. $ctx2.sendIdx[","]=3;
  54681. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  54682. }),(function(){
  54683. return "not present";
  54684. }));
  54685. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  54686. self._assert_equals_($5,"hello 1");
  54687. $ctx1.sendIdx["assert:equals:"]=3;
  54688. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  54689. return $core.withContext(function($ctx2) {
  54690. return "hello ".__comma($recv(x)._asString());
  54691. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  54692. }),(function(){
  54693. return "not present";
  54694. })),"hello nil");
  54695. return self;
  54696. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54697. },
  54698. args: [],
  54699. 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'.",
  54700. referencedClasses: [],
  54701. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  54702. }),
  54703. $globals.JSObjectProxyTest);
  54704. $core.addMethod(
  54705. $core.method({
  54706. selector: "testAtPut",
  54707. protocol: 'tests',
  54708. fn: function (){
  54709. var self=this;
  54710. var testObject;
  54711. return $core.withContext(function($ctx1) {
  54712. var $2,$1;
  54713. testObject=self._jsObject();
  54714. $2=$recv(testObject)._at_("abc");
  54715. $ctx1.sendIdx["at:"]=1;
  54716. $1=$recv($2).__tild_eq("xyz");
  54717. self._assert_($1);
  54718. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  54719. $ctx1.sendIdx["assert:equals:"]=1;
  54720. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  54721. return self;
  54722. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  54723. },
  54724. args: [],
  54725. 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'",
  54726. referencedClasses: [],
  54727. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  54728. }),
  54729. $globals.JSObjectProxyTest);
  54730. $core.addMethod(
  54731. $core.method({
  54732. selector: "testComparison",
  54733. protocol: 'tests',
  54734. fn: function (){
  54735. var self=this;
  54736. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  54737. return $core.withContext(function($ctx1) {
  54738. var $1,$2;
  54739. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  54740. $1=$recv(console).__eq(console);
  54741. $ctx1.sendIdx["="]=1;
  54742. self._assert_($1);
  54743. $2=$recv(console).__eq($recv($Object())._new());
  54744. $ctx1.sendIdx["="]=2;
  54745. self._deny_($2);
  54746. $ctx1.sendIdx["deny:"]=1;
  54747. self._deny_($recv(console).__eq(self._jsObject()));
  54748. return self;
  54749. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  54750. },
  54751. args: [],
  54752. 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",
  54753. referencedClasses: ["Object"],
  54754. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  54755. }),
  54756. $globals.JSObjectProxyTest);
  54757. $core.addMethod(
  54758. $core.method({
  54759. selector: "testDNU",
  54760. protocol: 'tests',
  54761. fn: function (){
  54762. var self=this;
  54763. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54764. return $core.withContext(function($ctx1) {
  54765. self._should_raise_((function(){
  54766. return $core.withContext(function($ctx2) {
  54767. return $recv(self._jsObject())._foo();
  54768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54769. }),$MessageNotUnderstood());
  54770. return self;
  54771. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  54772. },
  54773. args: [],
  54774. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  54775. referencedClasses: ["MessageNotUnderstood"],
  54776. messageSends: ["should:raise:", "foo", "jsObject"]
  54777. }),
  54778. $globals.JSObjectProxyTest);
  54779. $core.addMethod(
  54780. $core.method({
  54781. selector: "testDNURegression1057",
  54782. protocol: 'tests',
  54783. fn: function (){
  54784. var self=this;
  54785. var jsObject;
  54786. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54787. return $core.withContext(function($ctx1) {
  54788. var $1;
  54789. jsObject=[];
  54790. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54791. $ctx1.sendIdx["basicAt:put:"]=1;
  54792. $recv(jsObject)._basicAt_put_("foo",(3));
  54793. self._shouldnt_raise_((function(){
  54794. return $core.withContext(function($ctx2) {
  54795. return $recv(jsObject)._foo();
  54796. $ctx2.sendIdx["foo"]=1;
  54797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54798. }),$Error());
  54799. $ctx1.sendIdx["shouldnt:raise:"]=1;
  54800. $1=$recv(jsObject)._foo();
  54801. $ctx1.sendIdx["foo"]=2;
  54802. self._assert_equals_($1,(3));
  54803. $ctx1.sendIdx["assert:equals:"]=1;
  54804. self._shouldnt_raise_((function(){
  54805. return $core.withContext(function($ctx2) {
  54806. return $recv(jsObject)._foo_((4));
  54807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54808. }),$Error());
  54809. self._assert_equals_($recv(jsObject)._foo(),(4));
  54810. return self;
  54811. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54812. },
  54813. args: [],
  54814. 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",
  54815. referencedClasses: ["Error"],
  54816. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  54817. }),
  54818. $globals.JSObjectProxyTest);
  54819. $core.addMethod(
  54820. $core.method({
  54821. selector: "testDNURegression1059",
  54822. protocol: 'tests',
  54823. fn: function (){
  54824. var self=this;
  54825. var jsObject;
  54826. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54827. return $core.withContext(function($ctx1) {
  54828. jsObject=[];
  54829. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54830. $ctx1.sendIdx["basicAt:put:"]=1;
  54831. $recv(jsObject)._basicAt_put_("x",(3));
  54832. $ctx1.sendIdx["basicAt:put:"]=2;
  54833. $recv(jsObject)._basicAt_put_("x:",(function(){
  54834. return $core.withContext(function($ctx2) {
  54835. return self._error();
  54836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54837. }));
  54838. self._shouldnt_raise_((function(){
  54839. return $core.withContext(function($ctx2) {
  54840. return $recv(jsObject)._x_((4));
  54841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54842. }),$Error());
  54843. self._assert_equals_($recv(jsObject)._x(),(4));
  54844. return self;
  54845. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54846. },
  54847. args: [],
  54848. 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",
  54849. referencedClasses: ["Error"],
  54850. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  54851. }),
  54852. $globals.JSObjectProxyTest);
  54853. $core.addMethod(
  54854. $core.method({
  54855. selector: "testDNURegression1062",
  54856. protocol: 'tests',
  54857. fn: function (){
  54858. var self=this;
  54859. var jsObject,stored;
  54860. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54861. return $core.withContext(function($ctx1) {
  54862. jsObject=[];
  54863. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54864. $ctx1.sendIdx["basicAt:put:"]=1;
  54865. $recv(jsObject)._basicAt_put_("x",(function(v){
  54866. stored=v;
  54867. return stored;
  54868. }));
  54869. self._shouldnt_raise_((function(){
  54870. return $core.withContext(function($ctx2) {
  54871. return $recv(jsObject)._x_((4));
  54872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54873. }),$Error());
  54874. self._assert_equals_(stored,(4));
  54875. return self;
  54876. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  54877. },
  54878. args: [],
  54879. 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",
  54880. referencedClasses: ["Error"],
  54881. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  54882. }),
  54883. $globals.JSObjectProxyTest);
  54884. $core.addMethod(
  54885. $core.method({
  54886. selector: "testDNUWithAllowJavaScriptCalls",
  54887. protocol: 'tests',
  54888. fn: function (){
  54889. var self=this;
  54890. var jsObject;
  54891. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54892. return $core.withContext(function($ctx1) {
  54893. jsObject=[];
  54894. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54895. self._should_raise_((function(){
  54896. return $core.withContext(function($ctx2) {
  54897. return $recv(jsObject)._foo();
  54898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54899. }),$MessageNotUnderstood());
  54900. return self;
  54901. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54902. },
  54903. args: [],
  54904. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  54905. referencedClasses: ["MessageNotUnderstood"],
  54906. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  54907. }),
  54908. $globals.JSObjectProxyTest);
  54909. $core.addMethod(
  54910. $core.method({
  54911. selector: "testMessageSend",
  54912. protocol: 'tests',
  54913. fn: function (){
  54914. var self=this;
  54915. return $core.withContext(function($ctx1) {
  54916. var $2,$1,$4,$3;
  54917. $2=self._jsObject();
  54918. $ctx1.sendIdx["jsObject"]=1;
  54919. $1=$recv($2)._a();
  54920. self._assert_equals_($1,(1));
  54921. $ctx1.sendIdx["assert:equals:"]=1;
  54922. $4=self._jsObject();
  54923. $ctx1.sendIdx["jsObject"]=2;
  54924. $3=$recv($4)._b();
  54925. self._assert_equals_($3,(2));
  54926. $ctx1.sendIdx["assert:equals:"]=2;
  54927. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  54928. return self;
  54929. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  54930. },
  54931. args: [],
  54932. 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",
  54933. referencedClasses: [],
  54934. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  54935. }),
  54936. $globals.JSObjectProxyTest);
  54937. $core.addMethod(
  54938. $core.method({
  54939. selector: "testMethodWithArguments",
  54940. protocol: 'tests',
  54941. fn: function (){
  54942. var self=this;
  54943. return $core.withContext(function($ctx1) {
  54944. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  54945. return self;
  54946. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  54947. },
  54948. args: [],
  54949. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  54950. referencedClasses: [],
  54951. messageSends: ["assert:equals:", "c:", "jsObject"]
  54952. }),
  54953. $globals.JSObjectProxyTest);
  54954. $core.addMethod(
  54955. $core.method({
  54956. selector: "testPrinting",
  54957. protocol: 'tests',
  54958. fn: function (){
  54959. var self=this;
  54960. return $core.withContext(function($ctx1) {
  54961. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  54962. return self;
  54963. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  54964. },
  54965. args: [],
  54966. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  54967. referencedClasses: [],
  54968. messageSends: ["assert:equals:", "printString", "jsObject"]
  54969. }),
  54970. $globals.JSObjectProxyTest);
  54971. $core.addMethod(
  54972. $core.method({
  54973. selector: "testPropertyThatReturnsEmptyString",
  54974. protocol: 'tests',
  54975. fn: function (){
  54976. var self=this;
  54977. var object;
  54978. return $core.withContext(function($ctx1) {
  54979. var $1;
  54980. object=self._jsObject();
  54981. $1=$recv(object)._d();
  54982. $ctx1.sendIdx["d"]=1;
  54983. self._assert_equals_($1,"");
  54984. $ctx1.sendIdx["assert:equals:"]=1;
  54985. $recv(object)._d_("hello");
  54986. self._assert_equals_($recv(object)._d(),"hello");
  54987. return self;
  54988. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  54989. },
  54990. args: [],
  54991. 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'",
  54992. referencedClasses: [],
  54993. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  54994. }),
  54995. $globals.JSObjectProxyTest);
  54996. $core.addMethod(
  54997. $core.method({
  54998. selector: "testPropertyThatReturnsUndefined",
  54999. protocol: 'tests',
  55000. fn: function (){
  55001. var self=this;
  55002. var object;
  55003. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55004. return $core.withContext(function($ctx1) {
  55005. object=self._jsObject();
  55006. self._shouldnt_raise_((function(){
  55007. return $core.withContext(function($ctx2) {
  55008. return $recv(object)._e();
  55009. $ctx2.sendIdx["e"]=1;
  55010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55011. }),$MessageNotUnderstood());
  55012. self._assert_($recv($recv(object)._e())._isNil());
  55013. return self;
  55014. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  55015. },
  55016. args: [],
  55017. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  55018. referencedClasses: ["MessageNotUnderstood"],
  55019. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  55020. }),
  55021. $globals.JSObjectProxyTest);
  55022. $core.addMethod(
  55023. $core.method({
  55024. selector: "testSetPropertyWithFalsyValue",
  55025. protocol: 'tests',
  55026. fn: function (){
  55027. var self=this;
  55028. var jsObject;
  55029. return $core.withContext(function($ctx1) {
  55030. var $1,$2,$3,$4,$5;
  55031. jsObject=self._jsObject();
  55032. $1=$recv(jsObject)._a();
  55033. $ctx1.sendIdx["a"]=1;
  55034. self._assert_equals_($1,(1));
  55035. $ctx1.sendIdx["assert:equals:"]=1;
  55036. $recv(jsObject)._a_(self._jsNull());
  55037. $ctx1.sendIdx["a:"]=1;
  55038. $2=$recv(jsObject)._a();
  55039. $ctx1.sendIdx["a"]=2;
  55040. self._assert_equals_($2,nil);
  55041. $ctx1.sendIdx["assert:equals:"]=2;
  55042. $recv(jsObject)._a_((0));
  55043. $ctx1.sendIdx["a:"]=2;
  55044. $3=$recv(jsObject)._a();
  55045. $ctx1.sendIdx["a"]=3;
  55046. self._assert_equals_($3,(0));
  55047. $ctx1.sendIdx["assert:equals:"]=3;
  55048. $recv(jsObject)._a_(self._jsUndefined());
  55049. $ctx1.sendIdx["a:"]=3;
  55050. $4=$recv(jsObject)._a();
  55051. $ctx1.sendIdx["a"]=4;
  55052. self._assert_equals_($4,nil);
  55053. $ctx1.sendIdx["assert:equals:"]=4;
  55054. $recv(jsObject)._a_("");
  55055. $ctx1.sendIdx["a:"]=4;
  55056. $5=$recv(jsObject)._a();
  55057. $ctx1.sendIdx["a"]=5;
  55058. self._assert_equals_($5,"");
  55059. $ctx1.sendIdx["assert:equals:"]=5;
  55060. $recv(jsObject)._a_(false);
  55061. self._assert_equals_($recv(jsObject)._a(),false);
  55062. return self;
  55063. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55064. },
  55065. args: [],
  55066. 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",
  55067. referencedClasses: [],
  55068. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  55069. }),
  55070. $globals.JSObjectProxyTest);
  55071. $core.addMethod(
  55072. $core.method({
  55073. selector: "testValue",
  55074. protocol: 'tests',
  55075. fn: function (){
  55076. var self=this;
  55077. var testObject;
  55078. return $core.withContext(function($ctx1) {
  55079. testObject=self._jsObject();
  55080. $recv(testObject)._at_put_("value","aValue");
  55081. self._assert_equals_($recv(testObject)._value(),"aValue");
  55082. return self;
  55083. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  55084. },
  55085. args: [],
  55086. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  55087. referencedClasses: [],
  55088. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  55089. }),
  55090. $globals.JSObjectProxyTest);
  55091. $core.addMethod(
  55092. $core.method({
  55093. selector: "testYourself",
  55094. protocol: 'tests',
  55095. fn: function (){
  55096. var self=this;
  55097. var object;
  55098. return $core.withContext(function($ctx1) {
  55099. var $1,$2;
  55100. $1=self._jsObject();
  55101. $recv($1)._d_("test");
  55102. $2=$recv($1)._yourself();
  55103. object=$2;
  55104. self._assert_equals_($recv(object)._d(),"test");
  55105. return self;
  55106. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  55107. },
  55108. args: [],
  55109. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  55110. referencedClasses: [],
  55111. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  55112. }),
  55113. $globals.JSObjectProxyTest);
  55114. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  55115. $core.addMethod(
  55116. $core.method({
  55117. selector: "testCatchingException",
  55118. protocol: 'tests',
  55119. fn: function (){
  55120. var self=this;
  55121. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55122. return $core.withContext(function($ctx1) {
  55123. $recv((function(){
  55124. return $core.withContext(function($ctx2) {
  55125. return self._throwException();
  55126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55127. }))._on_do_($Error(),(function(error){
  55128. return $core.withContext(function($ctx2) {
  55129. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  55130. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  55131. }));
  55132. return self;
  55133. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  55134. },
  55135. args: [],
  55136. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  55137. referencedClasses: ["Error"],
  55138. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  55139. }),
  55140. $globals.JavaScriptExceptionTest);
  55141. $core.addMethod(
  55142. $core.method({
  55143. selector: "testRaisingException",
  55144. protocol: 'tests',
  55145. fn: function (){
  55146. var self=this;
  55147. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  55148. return $core.withContext(function($ctx1) {
  55149. self._should_raise_((function(){
  55150. return $core.withContext(function($ctx2) {
  55151. return self._throwException();
  55152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55153. }),$JavaScriptException());
  55154. return self;
  55155. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  55156. },
  55157. args: [],
  55158. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  55159. referencedClasses: ["JavaScriptException"],
  55160. messageSends: ["should:raise:", "throwException"]
  55161. }),
  55162. $globals.JavaScriptExceptionTest);
  55163. $core.addMethod(
  55164. $core.method({
  55165. selector: "throwException",
  55166. protocol: 'helpers',
  55167. fn: function (){
  55168. var self=this;
  55169. return $core.withContext(function($ctx1) {
  55170. throw 'test';
  55171. return self;
  55172. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  55173. },
  55174. args: [],
  55175. source: "throwException\x0a\x09<throw 'test'>",
  55176. referencedClasses: [],
  55177. messageSends: []
  55178. }),
  55179. $globals.JavaScriptExceptionTest);
  55180. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  55181. $core.addMethod(
  55182. $core.method({
  55183. selector: "testValue",
  55184. protocol: 'tests',
  55185. fn: function (){
  55186. var self=this;
  55187. var messageSend;
  55188. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  55189. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55190. return $core.withContext(function($ctx1) {
  55191. var $1,$2;
  55192. $1=$recv($MessageSend())._new();
  55193. $ctx1.sendIdx["new"]=1;
  55194. $recv($1)._receiver_($recv($Object())._new());
  55195. $recv($1)._selector_("asString");
  55196. $2=$recv($1)._yourself();
  55197. messageSend=$2;
  55198. self._assert_equals_($recv(messageSend)._value(),"an Object");
  55199. return self;
  55200. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  55201. },
  55202. args: [],
  55203. 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'",
  55204. referencedClasses: ["MessageSend", "Object"],
  55205. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  55206. }),
  55207. $globals.MessageSendTest);
  55208. $core.addMethod(
  55209. $core.method({
  55210. selector: "testValueWithArguments",
  55211. protocol: 'tests',
  55212. fn: function (){
  55213. var self=this;
  55214. var messageSend;
  55215. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  55216. return $core.withContext(function($ctx1) {
  55217. var $1,$2;
  55218. $1=$recv($MessageSend())._new();
  55219. $recv($1)._receiver_((2));
  55220. $recv($1)._selector_("+");
  55221. $2=$recv($1)._yourself();
  55222. messageSend=$2;
  55223. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  55224. $ctx1.sendIdx["assert:equals:"]=1;
  55225. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  55226. return self;
  55227. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  55228. },
  55229. args: [],
  55230. 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",
  55231. referencedClasses: ["MessageSend"],
  55232. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  55233. }),
  55234. $globals.MessageSendTest);
  55235. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  55236. $core.addMethod(
  55237. $core.method({
  55238. selector: "codeGeneratorClass",
  55239. protocol: 'accessing',
  55240. fn: function (){
  55241. var self=this;
  55242. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  55243. return $CodeGenerator();
  55244. },
  55245. args: [],
  55246. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  55247. referencedClasses: ["CodeGenerator"],
  55248. messageSends: []
  55249. }),
  55250. $globals.MethodInheritanceTest);
  55251. $core.addMethod(
  55252. $core.method({
  55253. selector: "compiler",
  55254. protocol: 'factory',
  55255. fn: function (){
  55256. var self=this;
  55257. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  55258. return $core.withContext(function($ctx1) {
  55259. var $2,$3,$1;
  55260. $2=$recv($Compiler())._new();
  55261. $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
  55262. $3=$recv($2)._yourself();
  55263. $1=$3;
  55264. return $1;
  55265. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  55266. },
  55267. args: [],
  55268. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  55269. referencedClasses: ["Compiler"],
  55270. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  55271. }),
  55272. $globals.MethodInheritanceTest);
  55273. $core.addMethod(
  55274. $core.method({
  55275. selector: "deinstallBottom",
  55276. protocol: 'testing',
  55277. fn: function (){
  55278. var self=this;
  55279. return $core.withContext(function($ctx1) {
  55280. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  55281. return self;
  55282. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  55283. },
  55284. args: [],
  55285. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  55286. referencedClasses: [],
  55287. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  55288. }),
  55289. $globals.MethodInheritanceTest);
  55290. $core.addMethod(
  55291. $core.method({
  55292. selector: "deinstallMiddle",
  55293. protocol: 'testing',
  55294. fn: function (){
  55295. var self=this;
  55296. return $core.withContext(function($ctx1) {
  55297. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  55298. return self;
  55299. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  55300. },
  55301. args: [],
  55302. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  55303. referencedClasses: [],
  55304. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  55305. }),
  55306. $globals.MethodInheritanceTest);
  55307. $core.addMethod(
  55308. $core.method({
  55309. selector: "deinstallTop",
  55310. protocol: 'testing',
  55311. fn: function (){
  55312. var self=this;
  55313. return $core.withContext(function($ctx1) {
  55314. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  55315. return self;
  55316. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  55317. },
  55318. args: [],
  55319. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  55320. referencedClasses: [],
  55321. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  55322. }),
  55323. $globals.MethodInheritanceTest);
  55324. $core.addMethod(
  55325. $core.method({
  55326. selector: "installBottom:",
  55327. protocol: 'testing',
  55328. fn: function (aString){
  55329. var self=this;
  55330. return $core.withContext(function($ctx1) {
  55331. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  55332. return self;
  55333. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  55334. },
  55335. args: ["aString"],
  55336. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  55337. referencedClasses: [],
  55338. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  55339. }),
  55340. $globals.MethodInheritanceTest);
  55341. $core.addMethod(
  55342. $core.method({
  55343. selector: "installMiddle:",
  55344. protocol: 'testing',
  55345. fn: function (aString){
  55346. var self=this;
  55347. return $core.withContext(function($ctx1) {
  55348. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  55349. return self;
  55350. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  55351. },
  55352. args: ["aString"],
  55353. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  55354. referencedClasses: [],
  55355. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  55356. }),
  55357. $globals.MethodInheritanceTest);
  55358. $core.addMethod(
  55359. $core.method({
  55360. selector: "installTop:",
  55361. protocol: 'testing',
  55362. fn: function (aString){
  55363. var self=this;
  55364. return $core.withContext(function($ctx1) {
  55365. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  55366. return self;
  55367. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  55368. },
  55369. args: ["aString"],
  55370. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  55371. referencedClasses: [],
  55372. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  55373. }),
  55374. $globals.MethodInheritanceTest);
  55375. $core.addMethod(
  55376. $core.method({
  55377. selector: "setUp",
  55378. protocol: 'initialization',
  55379. fn: function (){
  55380. var self=this;
  55381. return $core.withContext(function($ctx1) {
  55382. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  55383. $ctx1.sendIdx["new"]=1;
  55384. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  55385. $ctx1.sendIdx["new"]=2;
  55386. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  55387. self["@method"]=nil;
  55388. self["@performBlock"]=(function(){
  55389. return $core.withContext(function($ctx2) {
  55390. return self._error_("performBlock not initialized");
  55391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55392. });
  55393. return self;
  55394. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  55395. },
  55396. args: [],
  55397. 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' ]",
  55398. referencedClasses: [],
  55399. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  55400. }),
  55401. $globals.MethodInheritanceTest);
  55402. $core.addMethod(
  55403. $core.method({
  55404. selector: "shouldMNU",
  55405. protocol: 'testing',
  55406. fn: function (){
  55407. var self=this;
  55408. return $core.withContext(function($ctx1) {
  55409. self._shouldMNUTop();
  55410. self._shouldMNUMiddle();
  55411. self._shouldMNUBottom();
  55412. return self;
  55413. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  55414. },
  55415. args: [],
  55416. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  55417. referencedClasses: [],
  55418. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  55419. }),
  55420. $globals.MethodInheritanceTest);
  55421. $core.addMethod(
  55422. $core.method({
  55423. selector: "shouldMNUBottom",
  55424. protocol: 'testing',
  55425. fn: function (){
  55426. var self=this;
  55427. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55428. return $core.withContext(function($ctx1) {
  55429. self._should_raise_((function(){
  55430. return $core.withContext(function($ctx2) {
  55431. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55433. }),$MessageNotUnderstood());
  55434. return self;
  55435. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  55436. },
  55437. args: [],
  55438. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  55439. referencedClasses: ["MessageNotUnderstood"],
  55440. messageSends: ["should:raise:", "value:"]
  55441. }),
  55442. $globals.MethodInheritanceTest);
  55443. $core.addMethod(
  55444. $core.method({
  55445. selector: "shouldMNUMiddle",
  55446. protocol: 'testing',
  55447. fn: function (){
  55448. var self=this;
  55449. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55450. return $core.withContext(function($ctx1) {
  55451. self._should_raise_((function(){
  55452. return $core.withContext(function($ctx2) {
  55453. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55455. }),$MessageNotUnderstood());
  55456. return self;
  55457. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  55458. },
  55459. args: [],
  55460. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  55461. referencedClasses: ["MessageNotUnderstood"],
  55462. messageSends: ["should:raise:", "value:"]
  55463. }),
  55464. $globals.MethodInheritanceTest);
  55465. $core.addMethod(
  55466. $core.method({
  55467. selector: "shouldMNUTop",
  55468. protocol: 'testing',
  55469. fn: function (){
  55470. var self=this;
  55471. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55472. return $core.withContext(function($ctx1) {
  55473. self._should_raise_((function(){
  55474. return $core.withContext(function($ctx2) {
  55475. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55477. }),$MessageNotUnderstood());
  55478. return self;
  55479. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  55480. },
  55481. args: [],
  55482. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  55483. referencedClasses: ["MessageNotUnderstood"],
  55484. messageSends: ["should:raise:", "value:"]
  55485. }),
  55486. $globals.MethodInheritanceTest);
  55487. $core.addMethod(
  55488. $core.method({
  55489. selector: "shouldReturn:",
  55490. protocol: 'testing',
  55491. fn: function (anObject){
  55492. var self=this;
  55493. var result;
  55494. return $core.withContext(function($ctx1) {
  55495. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55496. $ctx1.sendIdx["value:"]=1;
  55497. self._assert_equals_(["top",anObject],["top",result]);
  55498. $ctx1.sendIdx["assert:equals:"]=1;
  55499. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55500. $ctx1.sendIdx["value:"]=2;
  55501. self._assert_equals_(["middle",anObject],["middle",result]);
  55502. $ctx1.sendIdx["assert:equals:"]=2;
  55503. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55504. self._assert_equals_(["bottom",anObject],["bottom",result]);
  55505. return self;
  55506. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  55507. },
  55508. args: ["anObject"],
  55509. 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 }",
  55510. referencedClasses: [],
  55511. messageSends: ["value:", "assert:equals:"]
  55512. }),
  55513. $globals.MethodInheritanceTest);
  55514. $core.addMethod(
  55515. $core.method({
  55516. selector: "shouldReturn:and:and:",
  55517. protocol: 'testing',
  55518. fn: function (anObject,anObject2,anObject3){
  55519. var self=this;
  55520. var result;
  55521. return $core.withContext(function($ctx1) {
  55522. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55523. $ctx1.sendIdx["value:"]=1;
  55524. self._assert_equals_(["top",anObject],["top",result]);
  55525. $ctx1.sendIdx["assert:equals:"]=1;
  55526. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55527. $ctx1.sendIdx["value:"]=2;
  55528. self._assert_equals_(["middle",anObject2],["middle",result]);
  55529. $ctx1.sendIdx["assert:equals:"]=2;
  55530. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55531. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  55532. return self;
  55533. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  55534. },
  55535. args: ["anObject", "anObject2", "anObject3"],
  55536. 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 }",
  55537. referencedClasses: [],
  55538. messageSends: ["value:", "assert:equals:"]
  55539. }),
  55540. $globals.MethodInheritanceTest);
  55541. $core.addMethod(
  55542. $core.method({
  55543. selector: "targetClassBottom",
  55544. protocol: 'accessing',
  55545. fn: function (){
  55546. var self=this;
  55547. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  55548. return $JavaScriptException();
  55549. },
  55550. args: [],
  55551. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  55552. referencedClasses: ["JavaScriptException"],
  55553. messageSends: []
  55554. }),
  55555. $globals.MethodInheritanceTest);
  55556. $core.addMethod(
  55557. $core.method({
  55558. selector: "targetClassMiddle",
  55559. protocol: 'accessing',
  55560. fn: function (){
  55561. var self=this;
  55562. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55563. return $Error();
  55564. },
  55565. args: [],
  55566. source: "targetClassMiddle\x0a\x09^ Error",
  55567. referencedClasses: ["Error"],
  55568. messageSends: []
  55569. }),
  55570. $globals.MethodInheritanceTest);
  55571. $core.addMethod(
  55572. $core.method({
  55573. selector: "targetClassTop",
  55574. protocol: 'accessing',
  55575. fn: function (){
  55576. var self=this;
  55577. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55578. return $Object();
  55579. },
  55580. args: [],
  55581. source: "targetClassTop\x0a\x09^ Object",
  55582. referencedClasses: ["Object"],
  55583. messageSends: []
  55584. }),
  55585. $globals.MethodInheritanceTest);
  55586. $core.addMethod(
  55587. $core.method({
  55588. selector: "tearDown",
  55589. protocol: 'initialization',
  55590. fn: function (){
  55591. var self=this;
  55592. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55593. return $core.withContext(function($ctx1) {
  55594. $recv((function(){
  55595. return $core.withContext(function($ctx2) {
  55596. return self._deinstallTop();
  55597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55598. }))._on_do_($Error(),(function(){
  55599. }));
  55600. $ctx1.sendIdx["on:do:"]=1;
  55601. $recv((function(){
  55602. return $core.withContext(function($ctx2) {
  55603. return self._deinstallMiddle();
  55604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55605. }))._on_do_($Error(),(function(){
  55606. }));
  55607. $ctx1.sendIdx["on:do:"]=2;
  55608. $recv((function(){
  55609. return $core.withContext(function($ctx2) {
  55610. return self._deinstallBottom();
  55611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  55612. }))._on_do_($Error(),(function(){
  55613. }));
  55614. return self;
  55615. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  55616. },
  55617. args: [],
  55618. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  55619. referencedClasses: ["Error"],
  55620. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  55621. }),
  55622. $globals.MethodInheritanceTest);
  55623. $core.addMethod(
  55624. $core.method({
  55625. selector: "testMNU11",
  55626. protocol: 'tests',
  55627. fn: function (){
  55628. var self=this;
  55629. return $core.withContext(function($ctx1) {
  55630. self["@performBlock"]=(function(x){
  55631. return $core.withContext(function($ctx2) {
  55632. return $recv(x)._foo();
  55633. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55634. });
  55635. self._shouldMNU();
  55636. $ctx1.sendIdx["shouldMNU"]=1;
  55637. self._installTop_("foo ^ false");
  55638. $ctx1.sendIdx["installTop:"]=1;
  55639. self._installTop_("foo ^ true");
  55640. self._deinstallTop();
  55641. self._shouldMNU();
  55642. return self;
  55643. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  55644. },
  55645. args: [],
  55646. 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",
  55647. referencedClasses: [],
  55648. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  55649. }),
  55650. $globals.MethodInheritanceTest);
  55651. $core.addMethod(
  55652. $core.method({
  55653. selector: "testMNU22",
  55654. protocol: 'tests',
  55655. fn: function (){
  55656. var self=this;
  55657. return $core.withContext(function($ctx1) {
  55658. self["@performBlock"]=(function(x){
  55659. return $core.withContext(function($ctx2) {
  55660. return $recv(x)._foo();
  55661. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55662. });
  55663. self._shouldMNU();
  55664. $ctx1.sendIdx["shouldMNU"]=1;
  55665. self._installMiddle_("foo ^ false");
  55666. $ctx1.sendIdx["installMiddle:"]=1;
  55667. self._installMiddle_("foo ^ true");
  55668. self._deinstallMiddle();
  55669. self._shouldMNU();
  55670. return self;
  55671. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  55672. },
  55673. args: [],
  55674. 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",
  55675. referencedClasses: [],
  55676. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  55677. }),
  55678. $globals.MethodInheritanceTest);
  55679. $core.addMethod(
  55680. $core.method({
  55681. selector: "testReturns1",
  55682. protocol: 'tests',
  55683. fn: function (){
  55684. var self=this;
  55685. return $core.withContext(function($ctx1) {
  55686. self["@performBlock"]=(function(x){
  55687. return $core.withContext(function($ctx2) {
  55688. return $recv(x)._foo();
  55689. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55690. });
  55691. self._installTop_("foo ^ false");
  55692. $ctx1.sendIdx["installTop:"]=1;
  55693. self._shouldReturn_(false);
  55694. $ctx1.sendIdx["shouldReturn:"]=1;
  55695. self._installTop_("foo ^ true");
  55696. self._shouldReturn_(true);
  55697. return self;
  55698. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  55699. },
  55700. args: [],
  55701. 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",
  55702. referencedClasses: [],
  55703. messageSends: ["foo", "installTop:", "shouldReturn:"]
  55704. }),
  55705. $globals.MethodInheritanceTest);
  55706. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  55707. $core.addMethod(
  55708. $core.method({
  55709. selector: "testAbs",
  55710. protocol: 'tests',
  55711. fn: function (){
  55712. var self=this;
  55713. return $core.withContext(function($ctx1) {
  55714. var $1;
  55715. $1=(4)._abs();
  55716. $ctx1.sendIdx["abs"]=1;
  55717. self._assert_equals_($1,(4));
  55718. $ctx1.sendIdx["assert:equals:"]=1;
  55719. self._assert_equals_((-4)._abs(),(4));
  55720. return self;
  55721. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  55722. },
  55723. args: [],
  55724. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  55725. referencedClasses: [],
  55726. messageSends: ["assert:equals:", "abs"]
  55727. }),
  55728. $globals.NumberTest);
  55729. $core.addMethod(
  55730. $core.method({
  55731. selector: "testArithmetic",
  55732. protocol: 'tests',
  55733. fn: function (){
  55734. var self=this;
  55735. return $core.withContext(function($ctx1) {
  55736. var $1,$2,$3,$5,$4;
  55737. $1=(1.5).__plus((1));
  55738. $ctx1.sendIdx["+"]=1;
  55739. self._assert_equals_($1,(2.5));
  55740. $ctx1.sendIdx["assert:equals:"]=1;
  55741. $2=(2).__minus((1));
  55742. $ctx1.sendIdx["-"]=1;
  55743. self._assert_equals_($2,(1));
  55744. $ctx1.sendIdx["assert:equals:"]=2;
  55745. self._assert_equals_((-2).__minus((1)),(-3));
  55746. $ctx1.sendIdx["assert:equals:"]=3;
  55747. self._assert_equals_((12).__slash((2)),(6));
  55748. $ctx1.sendIdx["assert:equals:"]=4;
  55749. $3=(3).__star((4));
  55750. $ctx1.sendIdx["*"]=1;
  55751. self._assert_equals_($3,(12));
  55752. $ctx1.sendIdx["assert:equals:"]=5;
  55753. self._assert_equals_((7).__slash_slash((2)),(3));
  55754. $ctx1.sendIdx["assert:equals:"]=6;
  55755. self._assert_equals_((7).__backslash_backslash((2)),(1));
  55756. $ctx1.sendIdx["assert:equals:"]=7;
  55757. $5=(1).__plus((2));
  55758. $ctx1.sendIdx["+"]=2;
  55759. $4=$recv($5).__star((3));
  55760. $ctx1.sendIdx["*"]=2;
  55761. self._assert_equals_($4,(9));
  55762. $ctx1.sendIdx["assert:equals:"]=8;
  55763. self._assert_equals_((1).__plus((2).__star((3))),(7));
  55764. return self;
  55765. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  55766. },
  55767. args: [],
  55768. 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",
  55769. referencedClasses: [],
  55770. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  55771. }),
  55772. $globals.NumberTest);
  55773. $core.addMethod(
  55774. $core.method({
  55775. selector: "testAsNumber",
  55776. protocol: 'tests',
  55777. fn: function (){
  55778. var self=this;
  55779. return $core.withContext(function($ctx1) {
  55780. self._assert_equals_((3)._asNumber(),(3));
  55781. return self;
  55782. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  55783. },
  55784. args: [],
  55785. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  55786. referencedClasses: [],
  55787. messageSends: ["assert:equals:", "asNumber"]
  55788. }),
  55789. $globals.NumberTest);
  55790. $core.addMethod(
  55791. $core.method({
  55792. selector: "testCeiling",
  55793. protocol: 'tests',
  55794. fn: function (){
  55795. var self=this;
  55796. return $core.withContext(function($ctx1) {
  55797. var $1,$2;
  55798. $1=(1.2)._ceiling();
  55799. $ctx1.sendIdx["ceiling"]=1;
  55800. self._assert_equals_($1,(2));
  55801. $ctx1.sendIdx["assert:equals:"]=1;
  55802. $2=(-1.2)._ceiling();
  55803. $ctx1.sendIdx["ceiling"]=2;
  55804. self._assert_equals_($2,(-1));
  55805. $ctx1.sendIdx["assert:equals:"]=2;
  55806. self._assert_equals_((1)._ceiling(),(1));
  55807. return self;
  55808. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  55809. },
  55810. args: [],
  55811. 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.",
  55812. referencedClasses: [],
  55813. messageSends: ["assert:equals:", "ceiling"]
  55814. }),
  55815. $globals.NumberTest);
  55816. $core.addMethod(
  55817. $core.method({
  55818. selector: "testComparison",
  55819. protocol: 'tests',
  55820. fn: function (){
  55821. var self=this;
  55822. return $core.withContext(function($ctx1) {
  55823. var $1,$2,$3,$4;
  55824. $1=(3).__gt((2));
  55825. $ctx1.sendIdx[">"]=1;
  55826. self._assert_($1);
  55827. $ctx1.sendIdx["assert:"]=1;
  55828. $2=(2).__lt((3));
  55829. $ctx1.sendIdx["<"]=1;
  55830. self._assert_($2);
  55831. $ctx1.sendIdx["assert:"]=2;
  55832. self._deny_((3).__lt((2)));
  55833. $ctx1.sendIdx["deny:"]=1;
  55834. self._deny_((2).__gt((3)));
  55835. $3=(3).__gt_eq((3));
  55836. $ctx1.sendIdx[">="]=1;
  55837. self._assert_($3);
  55838. $ctx1.sendIdx["assert:"]=3;
  55839. self._assert_((3.1).__gt_eq((3)));
  55840. $ctx1.sendIdx["assert:"]=4;
  55841. $4=(3).__lt_eq((3));
  55842. $ctx1.sendIdx["<="]=1;
  55843. self._assert_($4);
  55844. $ctx1.sendIdx["assert:"]=5;
  55845. self._assert_((3).__lt_eq((3.1)));
  55846. return self;
  55847. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  55848. },
  55849. args: [],
  55850. 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",
  55851. referencedClasses: [],
  55852. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  55853. }),
  55854. $globals.NumberTest);
  55855. $core.addMethod(
  55856. $core.method({
  55857. selector: "testCopying",
  55858. protocol: 'tests',
  55859. fn: function (){
  55860. var self=this;
  55861. return $core.withContext(function($ctx1) {
  55862. var $1;
  55863. $1=$recv((1)._copy()).__eq_eq((1));
  55864. $ctx1.sendIdx["=="]=1;
  55865. self._assert_($1);
  55866. $ctx1.sendIdx["assert:"]=1;
  55867. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  55868. return self;
  55869. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  55870. },
  55871. args: [],
  55872. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  55873. referencedClasses: [],
  55874. messageSends: ["assert:", "==", "copy", "deepCopy"]
  55875. }),
  55876. $globals.NumberTest);
  55877. $core.addMethod(
  55878. $core.method({
  55879. selector: "testEquality",
  55880. protocol: 'tests',
  55881. fn: function (){
  55882. var self=this;
  55883. return $core.withContext(function($ctx1) {
  55884. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  55885. $1=(1).__eq((1));
  55886. $ctx1.sendIdx["="]=1;
  55887. self._assert_($1);
  55888. $ctx1.sendIdx["assert:"]=1;
  55889. $2=(0).__eq((0));
  55890. $ctx1.sendIdx["="]=2;
  55891. self._assert_($2);
  55892. $ctx1.sendIdx["assert:"]=2;
  55893. $3=(1).__eq((0));
  55894. $ctx1.sendIdx["="]=3;
  55895. self._deny_($3);
  55896. $ctx1.sendIdx["deny:"]=1;
  55897. $5=(1)._yourself();
  55898. $ctx1.sendIdx["yourself"]=1;
  55899. $4=$recv($5).__eq((1));
  55900. $ctx1.sendIdx["="]=4;
  55901. self._assert_($4);
  55902. $ctx1.sendIdx["assert:"]=3;
  55903. $7=(1)._yourself();
  55904. $ctx1.sendIdx["yourself"]=2;
  55905. $6=(1).__eq($7);
  55906. $ctx1.sendIdx["="]=5;
  55907. self._assert_($6);
  55908. $ctx1.sendIdx["assert:"]=4;
  55909. $9=(1)._yourself();
  55910. $ctx1.sendIdx["yourself"]=3;
  55911. $8=$recv($9).__eq((1)._yourself());
  55912. $ctx1.sendIdx["="]=6;
  55913. self._assert_($8);
  55914. $10=(0).__eq(false);
  55915. $ctx1.sendIdx["="]=7;
  55916. self._deny_($10);
  55917. $ctx1.sendIdx["deny:"]=2;
  55918. $11=false.__eq((0));
  55919. $ctx1.sendIdx["="]=8;
  55920. self._deny_($11);
  55921. $ctx1.sendIdx["deny:"]=3;
  55922. $12="".__eq((0));
  55923. $ctx1.sendIdx["="]=9;
  55924. self._deny_($12);
  55925. $ctx1.sendIdx["deny:"]=4;
  55926. self._deny_((0).__eq(""));
  55927. return self;
  55928. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  55929. },
  55930. args: [],
  55931. 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 = ''",
  55932. referencedClasses: [],
  55933. messageSends: ["assert:", "=", "deny:", "yourself"]
  55934. }),
  55935. $globals.NumberTest);
  55936. $core.addMethod(
  55937. $core.method({
  55938. selector: "testFloor",
  55939. protocol: 'tests',
  55940. fn: function (){
  55941. var self=this;
  55942. return $core.withContext(function($ctx1) {
  55943. var $1,$2;
  55944. $1=(1.2)._floor();
  55945. $ctx1.sendIdx["floor"]=1;
  55946. self._assert_equals_($1,(1));
  55947. $ctx1.sendIdx["assert:equals:"]=1;
  55948. $2=(-1.2)._floor();
  55949. $ctx1.sendIdx["floor"]=2;
  55950. self._assert_equals_($2,(-2));
  55951. $ctx1.sendIdx["assert:equals:"]=2;
  55952. self._assert_equals_((1)._floor(),(1));
  55953. return self;
  55954. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  55955. },
  55956. args: [],
  55957. 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.",
  55958. referencedClasses: [],
  55959. messageSends: ["assert:equals:", "floor"]
  55960. }),
  55961. $globals.NumberTest);
  55962. $core.addMethod(
  55963. $core.method({
  55964. selector: "testHexNumbers",
  55965. protocol: 'tests',
  55966. fn: function (){
  55967. var self=this;
  55968. return $core.withContext(function($ctx1) {
  55969. var $1,$2,$3,$4,$5;
  55970. self._assert_equals_((9),(9));
  55971. $ctx1.sendIdx["assert:equals:"]=1;
  55972. $1=(10)._truncated();
  55973. $ctx1.sendIdx["truncated"]=1;
  55974. self._assert_equals_($1,(10));
  55975. $ctx1.sendIdx["assert:equals:"]=2;
  55976. $2=(11)._truncated();
  55977. $ctx1.sendIdx["truncated"]=2;
  55978. self._assert_equals_($2,(11));
  55979. $ctx1.sendIdx["assert:equals:"]=3;
  55980. $3=(12)._truncated();
  55981. $ctx1.sendIdx["truncated"]=3;
  55982. self._assert_equals_($3,(12));
  55983. $ctx1.sendIdx["assert:equals:"]=4;
  55984. $4=(13)._truncated();
  55985. $ctx1.sendIdx["truncated"]=4;
  55986. self._assert_equals_($4,(13));
  55987. $ctx1.sendIdx["assert:equals:"]=5;
  55988. $5=(14)._truncated();
  55989. $ctx1.sendIdx["truncated"]=5;
  55990. self._assert_equals_($5,(14));
  55991. $ctx1.sendIdx["assert:equals:"]=6;
  55992. self._assert_equals_((15)._truncated(),(15));
  55993. return self;
  55994. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  55995. },
  55996. args: [],
  55997. 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",
  55998. referencedClasses: [],
  55999. messageSends: ["assert:equals:", "truncated"]
  56000. }),
  56001. $globals.NumberTest);
  56002. $core.addMethod(
  56003. $core.method({
  56004. selector: "testIdentity",
  56005. protocol: 'tests',
  56006. fn: function (){
  56007. var self=this;
  56008. return $core.withContext(function($ctx1) {
  56009. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  56010. $1=(1).__eq_eq((1));
  56011. $ctx1.sendIdx["=="]=1;
  56012. self._assert_($1);
  56013. $ctx1.sendIdx["assert:"]=1;
  56014. $2=(0).__eq_eq((0));
  56015. $ctx1.sendIdx["=="]=2;
  56016. self._assert_($2);
  56017. $ctx1.sendIdx["assert:"]=2;
  56018. $3=(1).__eq_eq((0));
  56019. $ctx1.sendIdx["=="]=3;
  56020. self._deny_($3);
  56021. $ctx1.sendIdx["deny:"]=1;
  56022. $5=(1)._yourself();
  56023. $ctx1.sendIdx["yourself"]=1;
  56024. $4=$recv($5).__eq_eq((1));
  56025. $ctx1.sendIdx["=="]=4;
  56026. self._assert_($4);
  56027. $ctx1.sendIdx["assert:"]=3;
  56028. $7=(1)._yourself();
  56029. $ctx1.sendIdx["yourself"]=2;
  56030. $6=(1).__eq_eq($7);
  56031. $ctx1.sendIdx["=="]=5;
  56032. self._assert_($6);
  56033. $ctx1.sendIdx["assert:"]=4;
  56034. $9=(1)._yourself();
  56035. $ctx1.sendIdx["yourself"]=3;
  56036. $8=$recv($9).__eq_eq((1)._yourself());
  56037. $ctx1.sendIdx["=="]=6;
  56038. self._assert_($8);
  56039. self._deny_((1).__eq_eq((2)));
  56040. return self;
  56041. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  56042. },
  56043. args: [],
  56044. 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",
  56045. referencedClasses: [],
  56046. messageSends: ["assert:", "==", "deny:", "yourself"]
  56047. }),
  56048. $globals.NumberTest);
  56049. $core.addMethod(
  56050. $core.method({
  56051. selector: "testInvalidHexNumbers",
  56052. protocol: 'tests',
  56053. fn: function (){
  56054. var self=this;
  56055. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  56056. return $core.withContext(function($ctx1) {
  56057. self._should_raise_((function(){
  56058. return $core.withContext(function($ctx2) {
  56059. return (16)._rG();
  56060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56061. }),$MessageNotUnderstood());
  56062. $ctx1.sendIdx["should:raise:"]=1;
  56063. self._should_raise_((function(){
  56064. return $core.withContext(function($ctx2) {
  56065. return (16)._rg();
  56066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56067. }),$MessageNotUnderstood());
  56068. $ctx1.sendIdx["should:raise:"]=2;
  56069. self._should_raise_((function(){
  56070. return $core.withContext(function($ctx2) {
  56071. return (16)._rH();
  56072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  56073. }),$MessageNotUnderstood());
  56074. $ctx1.sendIdx["should:raise:"]=3;
  56075. self._should_raise_((function(){
  56076. return $core.withContext(function($ctx2) {
  56077. return (16)._rh();
  56078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  56079. }),$MessageNotUnderstood());
  56080. $ctx1.sendIdx["should:raise:"]=4;
  56081. self._should_raise_((function(){
  56082. return $core.withContext(function($ctx2) {
  56083. return (16)._rI();
  56084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  56085. }),$MessageNotUnderstood());
  56086. $ctx1.sendIdx["should:raise:"]=5;
  56087. self._should_raise_((function(){
  56088. return $core.withContext(function($ctx2) {
  56089. return (16)._ri();
  56090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  56091. }),$MessageNotUnderstood());
  56092. $ctx1.sendIdx["should:raise:"]=6;
  56093. self._should_raise_((function(){
  56094. return $core.withContext(function($ctx2) {
  56095. return (16)._rJ();
  56096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  56097. }),$MessageNotUnderstood());
  56098. $ctx1.sendIdx["should:raise:"]=7;
  56099. self._should_raise_((function(){
  56100. return $core.withContext(function($ctx2) {
  56101. return (16)._rj();
  56102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  56103. }),$MessageNotUnderstood());
  56104. $ctx1.sendIdx["should:raise:"]=8;
  56105. self._should_raise_((function(){
  56106. return $core.withContext(function($ctx2) {
  56107. return (16)._rK();
  56108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  56109. }),$MessageNotUnderstood());
  56110. $ctx1.sendIdx["should:raise:"]=9;
  56111. self._should_raise_((function(){
  56112. return $core.withContext(function($ctx2) {
  56113. return (16)._rk();
  56114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  56115. }),$MessageNotUnderstood());
  56116. $ctx1.sendIdx["should:raise:"]=10;
  56117. self._should_raise_((function(){
  56118. return $core.withContext(function($ctx2) {
  56119. return (16)._rL();
  56120. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  56121. }),$MessageNotUnderstood());
  56122. $ctx1.sendIdx["should:raise:"]=11;
  56123. self._should_raise_((function(){
  56124. return $core.withContext(function($ctx2) {
  56125. return (16)._rl();
  56126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  56127. }),$MessageNotUnderstood());
  56128. $ctx1.sendIdx["should:raise:"]=12;
  56129. self._should_raise_((function(){
  56130. return $core.withContext(function($ctx2) {
  56131. return (16)._rM();
  56132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  56133. }),$MessageNotUnderstood());
  56134. $ctx1.sendIdx["should:raise:"]=13;
  56135. self._should_raise_((function(){
  56136. return $core.withContext(function($ctx2) {
  56137. return (16)._rm();
  56138. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  56139. }),$MessageNotUnderstood());
  56140. $ctx1.sendIdx["should:raise:"]=14;
  56141. self._should_raise_((function(){
  56142. return $core.withContext(function($ctx2) {
  56143. return (16)._rN();
  56144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  56145. }),$MessageNotUnderstood());
  56146. $ctx1.sendIdx["should:raise:"]=15;
  56147. self._should_raise_((function(){
  56148. return $core.withContext(function($ctx2) {
  56149. return (16)._rn();
  56150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  56151. }),$MessageNotUnderstood());
  56152. $ctx1.sendIdx["should:raise:"]=16;
  56153. self._should_raise_((function(){
  56154. return $core.withContext(function($ctx2) {
  56155. return (16)._rO();
  56156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  56157. }),$MessageNotUnderstood());
  56158. $ctx1.sendIdx["should:raise:"]=17;
  56159. self._should_raise_((function(){
  56160. return $core.withContext(function($ctx2) {
  56161. return (16)._ro();
  56162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  56163. }),$MessageNotUnderstood());
  56164. $ctx1.sendIdx["should:raise:"]=18;
  56165. self._should_raise_((function(){
  56166. return $core.withContext(function($ctx2) {
  56167. return (16)._rP();
  56168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  56169. }),$MessageNotUnderstood());
  56170. $ctx1.sendIdx["should:raise:"]=19;
  56171. self._should_raise_((function(){
  56172. return $core.withContext(function($ctx2) {
  56173. return (16)._rp();
  56174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  56175. }),$MessageNotUnderstood());
  56176. $ctx1.sendIdx["should:raise:"]=20;
  56177. self._should_raise_((function(){
  56178. return $core.withContext(function($ctx2) {
  56179. return (16)._rQ();
  56180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  56181. }),$MessageNotUnderstood());
  56182. $ctx1.sendIdx["should:raise:"]=21;
  56183. self._should_raise_((function(){
  56184. return $core.withContext(function($ctx2) {
  56185. return (16)._rq();
  56186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  56187. }),$MessageNotUnderstood());
  56188. $ctx1.sendIdx["should:raise:"]=22;
  56189. self._should_raise_((function(){
  56190. return $core.withContext(function($ctx2) {
  56191. return (16)._rR();
  56192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  56193. }),$MessageNotUnderstood());
  56194. $ctx1.sendIdx["should:raise:"]=23;
  56195. self._should_raise_((function(){
  56196. return $core.withContext(function($ctx2) {
  56197. return (16)._rr();
  56198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  56199. }),$MessageNotUnderstood());
  56200. $ctx1.sendIdx["should:raise:"]=24;
  56201. self._should_raise_((function(){
  56202. return $core.withContext(function($ctx2) {
  56203. return (16)._rS();
  56204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  56205. }),$MessageNotUnderstood());
  56206. $ctx1.sendIdx["should:raise:"]=25;
  56207. self._should_raise_((function(){
  56208. return $core.withContext(function($ctx2) {
  56209. return (16)._rs();
  56210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  56211. }),$MessageNotUnderstood());
  56212. $ctx1.sendIdx["should:raise:"]=26;
  56213. self._should_raise_((function(){
  56214. return $core.withContext(function($ctx2) {
  56215. return (16)._rT();
  56216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  56217. }),$MessageNotUnderstood());
  56218. $ctx1.sendIdx["should:raise:"]=27;
  56219. self._should_raise_((function(){
  56220. return $core.withContext(function($ctx2) {
  56221. return (16)._rt();
  56222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  56223. }),$MessageNotUnderstood());
  56224. $ctx1.sendIdx["should:raise:"]=28;
  56225. self._should_raise_((function(){
  56226. return $core.withContext(function($ctx2) {
  56227. return (16)._rU();
  56228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  56229. }),$MessageNotUnderstood());
  56230. $ctx1.sendIdx["should:raise:"]=29;
  56231. self._should_raise_((function(){
  56232. return $core.withContext(function($ctx2) {
  56233. return (16)._ru();
  56234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  56235. }),$MessageNotUnderstood());
  56236. $ctx1.sendIdx["should:raise:"]=30;
  56237. self._should_raise_((function(){
  56238. return $core.withContext(function($ctx2) {
  56239. return (16)._rV();
  56240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  56241. }),$MessageNotUnderstood());
  56242. $ctx1.sendIdx["should:raise:"]=31;
  56243. self._should_raise_((function(){
  56244. return $core.withContext(function($ctx2) {
  56245. return (16)._rv();
  56246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  56247. }),$MessageNotUnderstood());
  56248. $ctx1.sendIdx["should:raise:"]=32;
  56249. self._should_raise_((function(){
  56250. return $core.withContext(function($ctx2) {
  56251. return (16)._rW();
  56252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  56253. }),$MessageNotUnderstood());
  56254. $ctx1.sendIdx["should:raise:"]=33;
  56255. self._should_raise_((function(){
  56256. return $core.withContext(function($ctx2) {
  56257. return (16)._rw();
  56258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  56259. }),$MessageNotUnderstood());
  56260. $ctx1.sendIdx["should:raise:"]=34;
  56261. self._should_raise_((function(){
  56262. return $core.withContext(function($ctx2) {
  56263. return (16)._rX();
  56264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  56265. }),$MessageNotUnderstood());
  56266. $ctx1.sendIdx["should:raise:"]=35;
  56267. self._should_raise_((function(){
  56268. return $core.withContext(function($ctx2) {
  56269. return (16)._rx();
  56270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  56271. }),$MessageNotUnderstood());
  56272. $ctx1.sendIdx["should:raise:"]=36;
  56273. self._should_raise_((function(){
  56274. return $core.withContext(function($ctx2) {
  56275. return (16)._rY();
  56276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  56277. }),$MessageNotUnderstood());
  56278. $ctx1.sendIdx["should:raise:"]=37;
  56279. self._should_raise_((function(){
  56280. return $core.withContext(function($ctx2) {
  56281. return (16)._ry();
  56282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  56283. }),$MessageNotUnderstood());
  56284. $ctx1.sendIdx["should:raise:"]=38;
  56285. self._should_raise_((function(){
  56286. return $core.withContext(function($ctx2) {
  56287. return (16)._rZ();
  56288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  56289. }),$MessageNotUnderstood());
  56290. $ctx1.sendIdx["should:raise:"]=39;
  56291. self._should_raise_((function(){
  56292. return $core.withContext(function($ctx2) {
  56293. return (16)._rz();
  56294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  56295. }),$MessageNotUnderstood());
  56296. $ctx1.sendIdx["should:raise:"]=40;
  56297. self._should_raise_((function(){
  56298. return $core.withContext(function($ctx2) {
  56299. return (11259375)._Z();
  56300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  56301. }),$MessageNotUnderstood());
  56302. return self;
  56303. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  56304. },
  56305. args: [],
  56306. 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.",
  56307. referencedClasses: ["MessageNotUnderstood"],
  56308. 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"]
  56309. }),
  56310. $globals.NumberTest);
  56311. $core.addMethod(
  56312. $core.method({
  56313. selector: "testLog",
  56314. protocol: 'tests',
  56315. fn: function (){
  56316. var self=this;
  56317. function $Number(){return $globals.Number||(typeof Number=="undefined"?nil:Number)}
  56318. return $core.withContext(function($ctx1) {
  56319. self._assert_equals_((10000)._log(),(4));
  56320. $ctx1.sendIdx["assert:equals:"]=1;
  56321. self._assert_equals_((512)._log_((2)),(9));
  56322. $ctx1.sendIdx["assert:equals:"]=2;
  56323. self._assert_equals_($recv($recv($Number())._e())._ln(),(1));
  56324. return self;
  56325. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  56326. },
  56327. args: [],
  56328. 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.",
  56329. referencedClasses: ["Number"],
  56330. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  56331. }),
  56332. $globals.NumberTest);
  56333. $core.addMethod(
  56334. $core.method({
  56335. selector: "testMinMax",
  56336. protocol: 'tests',
  56337. fn: function (){
  56338. var self=this;
  56339. return $core.withContext(function($ctx1) {
  56340. self._assert_equals_((2)._max_((5)),(5));
  56341. $ctx1.sendIdx["assert:equals:"]=1;
  56342. self._assert_equals_((2)._min_((5)),(2));
  56343. return self;
  56344. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  56345. },
  56346. args: [],
  56347. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  56348. referencedClasses: [],
  56349. messageSends: ["assert:equals:", "max:", "min:"]
  56350. }),
  56351. $globals.NumberTest);
  56352. $core.addMethod(
  56353. $core.method({
  56354. selector: "testNegated",
  56355. protocol: 'tests',
  56356. fn: function (){
  56357. var self=this;
  56358. return $core.withContext(function($ctx1) {
  56359. var $1;
  56360. $1=(3)._negated();
  56361. $ctx1.sendIdx["negated"]=1;
  56362. self._assert_equals_($1,(-3));
  56363. $ctx1.sendIdx["assert:equals:"]=1;
  56364. self._assert_equals_((-3)._negated(),(3));
  56365. return self;
  56366. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  56367. },
  56368. args: [],
  56369. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  56370. referencedClasses: [],
  56371. messageSends: ["assert:equals:", "negated"]
  56372. }),
  56373. $globals.NumberTest);
  56374. $core.addMethod(
  56375. $core.method({
  56376. selector: "testPrintShowingDecimalPlaces",
  56377. protocol: 'tests',
  56378. fn: function (){
  56379. var self=this;
  56380. return $core.withContext(function($ctx1) {
  56381. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  56382. $1=(23)._printShowingDecimalPlaces_((2));
  56383. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  56384. self._assert_equals_($1,"23.00");
  56385. $ctx1.sendIdx["assert:equals:"]=1;
  56386. $2=(23.5698)._printShowingDecimalPlaces_((2));
  56387. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  56388. self._assert_equals_($2,"23.57");
  56389. $ctx1.sendIdx["assert:equals:"]=2;
  56390. $4=(234.567)._negated();
  56391. $ctx1.sendIdx["negated"]=1;
  56392. $3=$recv($4)._printShowingDecimalPlaces_((5));
  56393. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  56394. self._assert_equals_($3,"-234.56700");
  56395. $ctx1.sendIdx["assert:equals:"]=3;
  56396. $5=(23.4567)._printShowingDecimalPlaces_((0));
  56397. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  56398. self._assert_equals_($5,"23");
  56399. $ctx1.sendIdx["assert:equals:"]=4;
  56400. $6=(23.5567)._printShowingDecimalPlaces_((0));
  56401. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  56402. self._assert_equals_($6,"24");
  56403. $ctx1.sendIdx["assert:equals:"]=5;
  56404. $8=(23.4567)._negated();
  56405. $ctx1.sendIdx["negated"]=2;
  56406. $7=$recv($8)._printShowingDecimalPlaces_((0));
  56407. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  56408. self._assert_equals_($7,"-23");
  56409. $ctx1.sendIdx["assert:equals:"]=6;
  56410. $10=(23.5567)._negated();
  56411. $ctx1.sendIdx["negated"]=3;
  56412. $9=$recv($10)._printShowingDecimalPlaces_((0));
  56413. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  56414. self._assert_equals_($9,"-24");
  56415. $ctx1.sendIdx["assert:equals:"]=7;
  56416. $11=(100000000)._printShowingDecimalPlaces_((1));
  56417. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  56418. self._assert_equals_($11,"100000000.0");
  56419. $ctx1.sendIdx["assert:equals:"]=8;
  56420. $12=(0.98)._printShowingDecimalPlaces_((5));
  56421. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  56422. self._assert_equals_($12,"0.98000");
  56423. $ctx1.sendIdx["assert:equals:"]=9;
  56424. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  56425. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  56426. self._assert_equals_($13,"-0.98");
  56427. $ctx1.sendIdx["assert:equals:"]=10;
  56428. $14=(2.567)._printShowingDecimalPlaces_((2));
  56429. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  56430. self._assert_equals_($14,"2.57");
  56431. $ctx1.sendIdx["assert:equals:"]=11;
  56432. $15=(-2.567)._printShowingDecimalPlaces_((2));
  56433. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  56434. self._assert_equals_($15,"-2.57");
  56435. $ctx1.sendIdx["assert:equals:"]=12;
  56436. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  56437. return self;
  56438. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  56439. },
  56440. args: [],
  56441. 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'.",
  56442. referencedClasses: [],
  56443. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  56444. }),
  56445. $globals.NumberTest);
  56446. $core.addMethod(
  56447. $core.method({
  56448. selector: "testRaisedTo",
  56449. protocol: 'tests',
  56450. fn: function (){
  56451. var self=this;
  56452. return $core.withContext(function($ctx1) {
  56453. var $1,$2,$3;
  56454. $1=(2)._raisedTo_((4));
  56455. $ctx1.sendIdx["raisedTo:"]=1;
  56456. self._assert_equals_($1,(16));
  56457. $ctx1.sendIdx["assert:equals:"]=1;
  56458. $2=(2)._raisedTo_((0));
  56459. $ctx1.sendIdx["raisedTo:"]=2;
  56460. self._assert_equals_($2,(1));
  56461. $ctx1.sendIdx["assert:equals:"]=2;
  56462. $3=(2)._raisedTo_((-3));
  56463. $ctx1.sendIdx["raisedTo:"]=3;
  56464. self._assert_equals_($3,(0.125));
  56465. $ctx1.sendIdx["assert:equals:"]=3;
  56466. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  56467. $ctx1.sendIdx["assert:equals:"]=4;
  56468. self._assert_equals_((2).__star_star((4)),(16));
  56469. return self;
  56470. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  56471. },
  56472. args: [],
  56473. 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.",
  56474. referencedClasses: [],
  56475. messageSends: ["assert:equals:", "raisedTo:", "**"]
  56476. }),
  56477. $globals.NumberTest);
  56478. $core.addMethod(
  56479. $core.method({
  56480. selector: "testRounded",
  56481. protocol: 'tests',
  56482. fn: function (){
  56483. var self=this;
  56484. return $core.withContext(function($ctx1) {
  56485. var $1,$2;
  56486. $1=(3)._rounded();
  56487. $ctx1.sendIdx["rounded"]=1;
  56488. self._assert_equals_($1,(3));
  56489. $ctx1.sendIdx["assert:equals:"]=1;
  56490. $2=(3.212)._rounded();
  56491. $ctx1.sendIdx["rounded"]=2;
  56492. self._assert_equals_($2,(3));
  56493. $ctx1.sendIdx["assert:equals:"]=2;
  56494. self._assert_equals_((3.51)._rounded(),(4));
  56495. return self;
  56496. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  56497. },
  56498. args: [],
  56499. 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",
  56500. referencedClasses: [],
  56501. messageSends: ["assert:equals:", "rounded"]
  56502. }),
  56503. $globals.NumberTest);
  56504. $core.addMethod(
  56505. $core.method({
  56506. selector: "testSign",
  56507. protocol: 'tests',
  56508. fn: function (){
  56509. var self=this;
  56510. return $core.withContext(function($ctx1) {
  56511. var $1,$2;
  56512. $1=(5)._sign();
  56513. $ctx1.sendIdx["sign"]=1;
  56514. self._assert_equals_($1,(1));
  56515. $ctx1.sendIdx["assert:equals:"]=1;
  56516. $2=(0)._sign();
  56517. $ctx1.sendIdx["sign"]=2;
  56518. self._assert_equals_($2,(0));
  56519. $ctx1.sendIdx["assert:equals:"]=2;
  56520. self._assert_equals_((-1.4)._sign(),(-1));
  56521. return self;
  56522. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  56523. },
  56524. args: [],
  56525. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  56526. referencedClasses: [],
  56527. messageSends: ["assert:equals:", "sign"]
  56528. }),
  56529. $globals.NumberTest);
  56530. $core.addMethod(
  56531. $core.method({
  56532. selector: "testSqrt",
  56533. protocol: 'tests',
  56534. fn: function (){
  56535. var self=this;
  56536. return $core.withContext(function($ctx1) {
  56537. var $1;
  56538. $1=(4)._sqrt();
  56539. $ctx1.sendIdx["sqrt"]=1;
  56540. self._assert_equals_($1,(2));
  56541. $ctx1.sendIdx["assert:equals:"]=1;
  56542. self._assert_equals_((16)._sqrt(),(4));
  56543. return self;
  56544. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  56545. },
  56546. args: [],
  56547. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  56548. referencedClasses: [],
  56549. messageSends: ["assert:equals:", "sqrt"]
  56550. }),
  56551. $globals.NumberTest);
  56552. $core.addMethod(
  56553. $core.method({
  56554. selector: "testSquared",
  56555. protocol: 'tests',
  56556. fn: function (){
  56557. var self=this;
  56558. return $core.withContext(function($ctx1) {
  56559. self._assert_equals_((4)._squared(),(16));
  56560. return self;
  56561. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  56562. },
  56563. args: [],
  56564. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  56565. referencedClasses: [],
  56566. messageSends: ["assert:equals:", "squared"]
  56567. }),
  56568. $globals.NumberTest);
  56569. $core.addMethod(
  56570. $core.method({
  56571. selector: "testTimesRepeat",
  56572. protocol: 'tests',
  56573. fn: function (){
  56574. var self=this;
  56575. var i;
  56576. return $core.withContext(function($ctx1) {
  56577. i=(0);
  56578. (0)._timesRepeat_((function(){
  56579. return $core.withContext(function($ctx2) {
  56580. i=$recv(i).__plus((1));
  56581. $ctx2.sendIdx["+"]=1;
  56582. return i;
  56583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56584. }));
  56585. $ctx1.sendIdx["timesRepeat:"]=1;
  56586. self._assert_equals_(i,(0));
  56587. $ctx1.sendIdx["assert:equals:"]=1;
  56588. (5)._timesRepeat_((function(){
  56589. return $core.withContext(function($ctx2) {
  56590. i=$recv(i).__plus((1));
  56591. return i;
  56592. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56593. }));
  56594. self._assert_equals_(i,(5));
  56595. return self;
  56596. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  56597. },
  56598. args: [],
  56599. 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",
  56600. referencedClasses: [],
  56601. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  56602. }),
  56603. $globals.NumberTest);
  56604. $core.addMethod(
  56605. $core.method({
  56606. selector: "testTo",
  56607. protocol: 'tests',
  56608. fn: function (){
  56609. var self=this;
  56610. return $core.withContext(function($ctx1) {
  56611. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  56612. return self;
  56613. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  56614. },
  56615. args: [],
  56616. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  56617. referencedClasses: [],
  56618. messageSends: ["assert:equals:", "to:"]
  56619. }),
  56620. $globals.NumberTest);
  56621. $core.addMethod(
  56622. $core.method({
  56623. selector: "testToBy",
  56624. protocol: 'tests',
  56625. fn: function (){
  56626. var self=this;
  56627. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56628. return $core.withContext(function($ctx1) {
  56629. var $1;
  56630. $1=(0)._to_by_((6),(2));
  56631. $ctx1.sendIdx["to:by:"]=1;
  56632. self._assert_equals_($1,[(0), (2), (4), (6)]);
  56633. self._should_raise_((function(){
  56634. return $core.withContext(function($ctx2) {
  56635. return (1)._to_by_((4),(0));
  56636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56637. }),$Error());
  56638. return self;
  56639. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  56640. },
  56641. args: [],
  56642. 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",
  56643. referencedClasses: ["Error"],
  56644. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  56645. }),
  56646. $globals.NumberTest);
  56647. $core.addMethod(
  56648. $core.method({
  56649. selector: "testTrigonometry",
  56650. protocol: 'tests',
  56651. fn: function (){
  56652. var self=this;
  56653. return $core.withContext(function($ctx1) {
  56654. self._assert_equals_((0)._cos(),(1));
  56655. $ctx1.sendIdx["assert:equals:"]=1;
  56656. self._assert_equals_((0)._sin(),(0));
  56657. $ctx1.sendIdx["assert:equals:"]=2;
  56658. self._assert_equals_((0)._tan(),(0));
  56659. $ctx1.sendIdx["assert:equals:"]=3;
  56660. self._assert_equals_((1)._arcCos(),(0));
  56661. $ctx1.sendIdx["assert:equals:"]=4;
  56662. self._assert_equals_((0)._arcSin(),(0));
  56663. $ctx1.sendIdx["assert:equals:"]=5;
  56664. self._assert_equals_((0)._arcTan(),(0));
  56665. return self;
  56666. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  56667. },
  56668. args: [],
  56669. 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.",
  56670. referencedClasses: [],
  56671. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  56672. }),
  56673. $globals.NumberTest);
  56674. $core.addMethod(
  56675. $core.method({
  56676. selector: "testTruncated",
  56677. protocol: 'tests',
  56678. fn: function (){
  56679. var self=this;
  56680. return $core.withContext(function($ctx1) {
  56681. var $1,$2;
  56682. $1=(3)._truncated();
  56683. $ctx1.sendIdx["truncated"]=1;
  56684. self._assert_equals_($1,(3));
  56685. $ctx1.sendIdx["assert:equals:"]=1;
  56686. $2=(3.212)._truncated();
  56687. $ctx1.sendIdx["truncated"]=2;
  56688. self._assert_equals_($2,(3));
  56689. $ctx1.sendIdx["assert:equals:"]=2;
  56690. self._assert_equals_((3.51)._truncated(),(3));
  56691. return self;
  56692. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  56693. },
  56694. args: [],
  56695. 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",
  56696. referencedClasses: [],
  56697. messageSends: ["assert:equals:", "truncated"]
  56698. }),
  56699. $globals.NumberTest);
  56700. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  56701. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  56702. $core.addMethod(
  56703. $core.method({
  56704. selector: "foo",
  56705. protocol: 'not yet classified',
  56706. fn: function (){
  56707. var self=this;
  56708. var $1;
  56709. $1=self["@foo"];
  56710. return $1;
  56711. },
  56712. args: [],
  56713. source: "foo\x0a\x09^ foo",
  56714. referencedClasses: [],
  56715. messageSends: []
  56716. }),
  56717. $globals.ObjectMock);
  56718. $core.addMethod(
  56719. $core.method({
  56720. selector: "foo:",
  56721. protocol: 'not yet classified',
  56722. fn: function (anObject){
  56723. var self=this;
  56724. self["@foo"]=anObject;
  56725. return self;
  56726. },
  56727. args: ["anObject"],
  56728. source: "foo: anObject\x0a\x09foo := anObject",
  56729. referencedClasses: [],
  56730. messageSends: []
  56731. }),
  56732. $globals.ObjectMock);
  56733. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  56734. $core.addMethod(
  56735. $core.method({
  56736. selector: "notDefined",
  56737. protocol: 'tests',
  56738. fn: function (){
  56739. var self=this;
  56740. return $core.withContext(function($ctx1) {
  56741. return void 0;;
  56742. return self;
  56743. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  56744. },
  56745. args: [],
  56746. source: "notDefined\x0a\x09<return void 0;>",
  56747. referencedClasses: [],
  56748. messageSends: []
  56749. }),
  56750. $globals.ObjectTest);
  56751. $core.addMethod(
  56752. $core.method({
  56753. selector: "testBasicAccess",
  56754. protocol: 'tests',
  56755. fn: function (){
  56756. var self=this;
  56757. var o;
  56758. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56759. return $core.withContext(function($ctx1) {
  56760. var $1;
  56761. o=$recv($Object())._new();
  56762. $recv(o)._basicAt_put_("a",(1));
  56763. $1=$recv(o)._basicAt_("a");
  56764. $ctx1.sendIdx["basicAt:"]=1;
  56765. self._assert_equals_($1,(1));
  56766. $ctx1.sendIdx["assert:equals:"]=1;
  56767. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  56768. return self;
  56769. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  56770. },
  56771. args: [],
  56772. 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",
  56773. referencedClasses: ["Object"],
  56774. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  56775. }),
  56776. $globals.ObjectTest);
  56777. $core.addMethod(
  56778. $core.method({
  56779. selector: "testBasicPerform",
  56780. protocol: 'tests',
  56781. fn: function (){
  56782. var self=this;
  56783. var o;
  56784. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56785. return $core.withContext(function($ctx1) {
  56786. o=$recv($Object())._new();
  56787. $recv(o)._basicAt_put_("func",(function(){
  56788. return "hello";
  56789. }));
  56790. $ctx1.sendIdx["basicAt:put:"]=1;
  56791. $recv(o)._basicAt_put_("func2",(function(a){
  56792. return $core.withContext(function($ctx2) {
  56793. return $recv(a).__plus((1));
  56794. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  56795. }));
  56796. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  56797. $ctx1.sendIdx["assert:equals:"]=1;
  56798. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  56799. return self;
  56800. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  56801. },
  56802. args: [],
  56803. 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",
  56804. referencedClasses: ["Object"],
  56805. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  56806. }),
  56807. $globals.ObjectTest);
  56808. $core.addMethod(
  56809. $core.method({
  56810. selector: "testDNU",
  56811. protocol: 'tests',
  56812. fn: function (){
  56813. var self=this;
  56814. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56815. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  56816. return $core.withContext(function($ctx1) {
  56817. self._should_raise_((function(){
  56818. return $core.withContext(function($ctx2) {
  56819. return $recv($recv($Object())._new())._foo();
  56820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56821. }),$MessageNotUnderstood());
  56822. return self;
  56823. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  56824. },
  56825. args: [],
  56826. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  56827. referencedClasses: ["Object", "MessageNotUnderstood"],
  56828. messageSends: ["should:raise:", "foo", "new"]
  56829. }),
  56830. $globals.ObjectTest);
  56831. $core.addMethod(
  56832. $core.method({
  56833. selector: "testEquality",
  56834. protocol: 'tests',
  56835. fn: function (){
  56836. var self=this;
  56837. var o;
  56838. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56839. return $core.withContext(function($ctx1) {
  56840. var $1,$2,$4,$3;
  56841. o=$recv($Object())._new();
  56842. $ctx1.sendIdx["new"]=1;
  56843. $1=$recv(o).__eq($recv($Object())._new());
  56844. $ctx1.sendIdx["="]=1;
  56845. self._deny_($1);
  56846. $2=$recv(o).__eq(o);
  56847. $ctx1.sendIdx["="]=2;
  56848. self._assert_($2);
  56849. $ctx1.sendIdx["assert:"]=1;
  56850. $4=$recv(o)._yourself();
  56851. $ctx1.sendIdx["yourself"]=1;
  56852. $3=$recv($4).__eq(o);
  56853. $ctx1.sendIdx["="]=3;
  56854. self._assert_($3);
  56855. $ctx1.sendIdx["assert:"]=2;
  56856. self._assert_($recv(o).__eq($recv(o)._yourself()));
  56857. return self;
  56858. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  56859. },
  56860. args: [],
  56861. 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)",
  56862. referencedClasses: ["Object"],
  56863. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  56864. }),
  56865. $globals.ObjectTest);
  56866. $core.addMethod(
  56867. $core.method({
  56868. selector: "testHalt",
  56869. protocol: 'tests',
  56870. fn: function (){
  56871. var self=this;
  56872. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56873. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56874. return $core.withContext(function($ctx1) {
  56875. self._should_raise_((function(){
  56876. return $core.withContext(function($ctx2) {
  56877. return $recv($recv($Object())._new())._halt();
  56878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56879. }),$Error());
  56880. return self;
  56881. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  56882. },
  56883. args: [],
  56884. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  56885. referencedClasses: ["Object", "Error"],
  56886. messageSends: ["should:raise:", "halt", "new"]
  56887. }),
  56888. $globals.ObjectTest);
  56889. $core.addMethod(
  56890. $core.method({
  56891. selector: "testIdentity",
  56892. protocol: 'tests',
  56893. fn: function (){
  56894. var self=this;
  56895. var o;
  56896. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56897. return $core.withContext(function($ctx1) {
  56898. var $1,$2,$4,$3;
  56899. o=$recv($Object())._new();
  56900. $ctx1.sendIdx["new"]=1;
  56901. $1=$recv(o).__eq_eq($recv($Object())._new());
  56902. $ctx1.sendIdx["=="]=1;
  56903. self._deny_($1);
  56904. $2=$recv(o).__eq_eq(o);
  56905. $ctx1.sendIdx["=="]=2;
  56906. self._assert_($2);
  56907. $ctx1.sendIdx["assert:"]=1;
  56908. $4=$recv(o)._yourself();
  56909. $ctx1.sendIdx["yourself"]=1;
  56910. $3=$recv($4).__eq_eq(o);
  56911. $ctx1.sendIdx["=="]=3;
  56912. self._assert_($3);
  56913. $ctx1.sendIdx["assert:"]=2;
  56914. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  56915. return self;
  56916. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  56917. },
  56918. args: [],
  56919. 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",
  56920. referencedClasses: ["Object"],
  56921. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  56922. }),
  56923. $globals.ObjectTest);
  56924. $core.addMethod(
  56925. $core.method({
  56926. selector: "testIfNil",
  56927. protocol: 'tests',
  56928. fn: function (){
  56929. var self=this;
  56930. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56931. return $core.withContext(function($ctx1) {
  56932. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  56933. $2=$recv($Object())._new();
  56934. $ctx1.sendIdx["new"]=1;
  56935. $1=$recv($2)._isNil();
  56936. self._deny_($1);
  56937. $ctx1.sendIdx["deny:"]=1;
  56938. $5=$recv($Object())._new();
  56939. $ctx1.sendIdx["new"]=2;
  56940. if(($receiver = $5) == null || $receiver.isNil){
  56941. $4=true;
  56942. } else {
  56943. $4=$5;
  56944. };
  56945. $3=$recv($4).__eq(true);
  56946. self._deny_($3);
  56947. $7=$recv($Object())._new();
  56948. $ctx1.sendIdx["new"]=3;
  56949. if(($receiver = $7) == null || $receiver.isNil){
  56950. $6=$7;
  56951. } else {
  56952. $6=true;
  56953. };
  56954. self._assert_equals_($6,true);
  56955. $ctx1.sendIdx["assert:equals:"]=1;
  56956. $9=$recv($Object())._new();
  56957. $ctx1.sendIdx["new"]=4;
  56958. if(($receiver = $9) == null || $receiver.isNil){
  56959. $8=false;
  56960. } else {
  56961. $8=true;
  56962. };
  56963. self._assert_equals_($8,true);
  56964. $ctx1.sendIdx["assert:equals:"]=2;
  56965. $11=$recv($Object())._new();
  56966. if(($receiver = $11) == null || $receiver.isNil){
  56967. $10=false;
  56968. } else {
  56969. $10=true;
  56970. };
  56971. self._assert_equals_($10,true);
  56972. return self;
  56973. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  56974. },
  56975. args: [],
  56976. 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",
  56977. referencedClasses: ["Object"],
  56978. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  56979. }),
  56980. $globals.ObjectTest);
  56981. $core.addMethod(
  56982. $core.method({
  56983. selector: "testInstVars",
  56984. protocol: 'tests',
  56985. fn: function (){
  56986. var self=this;
  56987. var o;
  56988. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  56989. return $core.withContext(function($ctx1) {
  56990. var $1,$2;
  56991. o=$recv($ObjectMock())._new();
  56992. $1=$recv(o)._instVarAt_("foo");
  56993. $ctx1.sendIdx["instVarAt:"]=1;
  56994. self._assert_equals_($1,nil);
  56995. $ctx1.sendIdx["assert:equals:"]=1;
  56996. $recv(o)._instVarAt_put_("foo",(1));
  56997. $2=$recv(o)._instVarAt_("foo");
  56998. $ctx1.sendIdx["instVarAt:"]=2;
  56999. self._assert_equals_($2,(1));
  57000. $ctx1.sendIdx["assert:equals:"]=2;
  57001. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  57002. return self;
  57003. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  57004. },
  57005. args: [],
  57006. 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",
  57007. referencedClasses: ["ObjectMock"],
  57008. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  57009. }),
  57010. $globals.ObjectTest);
  57011. $core.addMethod(
  57012. $core.method({
  57013. selector: "testNilUndefined",
  57014. protocol: 'tests',
  57015. fn: function (){
  57016. var self=this;
  57017. return $core.withContext(function($ctx1) {
  57018. self._assert_equals_(self._notDefined(),nil);
  57019. return self;
  57020. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  57021. },
  57022. args: [],
  57023. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  57024. referencedClasses: [],
  57025. messageSends: ["assert:equals:", "notDefined"]
  57026. }),
  57027. $globals.ObjectTest);
  57028. $core.addMethod(
  57029. $core.method({
  57030. selector: "testYourself",
  57031. protocol: 'tests',
  57032. fn: function (){
  57033. var self=this;
  57034. var o;
  57035. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  57036. return $core.withContext(function($ctx1) {
  57037. o=$recv($ObjectMock())._new();
  57038. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  57039. return self;
  57040. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  57041. },
  57042. args: [],
  57043. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  57044. referencedClasses: ["ObjectMock"],
  57045. messageSends: ["new", "assert:", "==", "yourself"]
  57046. }),
  57047. $globals.ObjectTest);
  57048. $core.addMethod(
  57049. $core.method({
  57050. selector: "testidentityHash",
  57051. protocol: 'tests',
  57052. fn: function (){
  57053. var self=this;
  57054. var o1,o2;
  57055. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  57056. return $core.withContext(function($ctx1) {
  57057. var $2,$3,$1,$5,$4;
  57058. o1=$recv($Object())._new();
  57059. $ctx1.sendIdx["new"]=1;
  57060. o2=$recv($Object())._new();
  57061. $2=$recv(o1)._identityHash();
  57062. $ctx1.sendIdx["identityHash"]=1;
  57063. $3=$recv(o1)._identityHash();
  57064. $ctx1.sendIdx["identityHash"]=2;
  57065. $1=$recv($2).__eq_eq($3);
  57066. $ctx1.sendIdx["=="]=1;
  57067. self._assert_($1);
  57068. $5=$recv(o1)._identityHash();
  57069. $ctx1.sendIdx["identityHash"]=3;
  57070. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  57071. self._deny_($4);
  57072. return self;
  57073. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  57074. },
  57075. args: [],
  57076. 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",
  57077. referencedClasses: ["Object"],
  57078. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  57079. }),
  57080. $globals.ObjectTest);
  57081. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  57082. $core.addMethod(
  57083. $core.method({
  57084. selector: "testAccessing",
  57085. protocol: 'tests',
  57086. fn: function (){
  57087. var self=this;
  57088. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57089. return $core.withContext(function($ctx1) {
  57090. var $2,$1,$3,$6,$5,$4;
  57091. $2=$recv($Point())._x_y_((3),(4));
  57092. $ctx1.sendIdx["x:y:"]=1;
  57093. $1=$recv($2)._x();
  57094. $ctx1.sendIdx["x"]=1;
  57095. self._assert_equals_($1,(3));
  57096. $ctx1.sendIdx["assert:equals:"]=1;
  57097. $3=$recv($recv($Point())._x_y_((3),(4)))._y();
  57098. $ctx1.sendIdx["y"]=1;
  57099. self._assert_equals_($3,(4));
  57100. $ctx1.sendIdx["assert:equals:"]=2;
  57101. $6=$recv($Point())._new();
  57102. $ctx1.sendIdx["new"]=1;
  57103. $5=$recv($6)._x_((3));
  57104. $4=$recv($5)._x();
  57105. self._assert_equals_($4,(3));
  57106. $ctx1.sendIdx["assert:equals:"]=3;
  57107. self._assert_equals_($recv($recv($recv($Point())._new())._y_((4)))._y(),(4));
  57108. return self;
  57109. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  57110. },
  57111. args: [],
  57112. 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",
  57113. referencedClasses: ["Point"],
  57114. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  57115. }),
  57116. $globals.PointTest);
  57117. $core.addMethod(
  57118. $core.method({
  57119. selector: "testArithmetic",
  57120. protocol: 'tests',
  57121. fn: function (){
  57122. var self=this;
  57123. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57124. return $core.withContext(function($ctx1) {
  57125. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  57126. $2=(3).__at((4));
  57127. $ctx1.sendIdx["@"]=1;
  57128. $3=(3).__at((4));
  57129. $ctx1.sendIdx["@"]=2;
  57130. $1=$recv($2).__star($3);
  57131. $4=$recv($Point())._x_y_((9),(16));
  57132. $ctx1.sendIdx["x:y:"]=1;
  57133. self._assert_equals_($1,$4);
  57134. $ctx1.sendIdx["assert:equals:"]=1;
  57135. $6=(3).__at((4));
  57136. $ctx1.sendIdx["@"]=3;
  57137. $7=(3).__at((4));
  57138. $ctx1.sendIdx["@"]=4;
  57139. $5=$recv($6).__plus($7);
  57140. $8=$recv($Point())._x_y_((6),(8));
  57141. $ctx1.sendIdx["x:y:"]=2;
  57142. self._assert_equals_($5,$8);
  57143. $ctx1.sendIdx["assert:equals:"]=2;
  57144. $10=(3).__at((4));
  57145. $ctx1.sendIdx["@"]=5;
  57146. $11=(3).__at((4));
  57147. $ctx1.sendIdx["@"]=6;
  57148. $9=$recv($10).__minus($11);
  57149. $12=$recv($Point())._x_y_((0),(0));
  57150. $ctx1.sendIdx["x:y:"]=3;
  57151. self._assert_equals_($9,$12);
  57152. $ctx1.sendIdx["assert:equals:"]=3;
  57153. $14=(6).__at((8));
  57154. $ctx1.sendIdx["@"]=7;
  57155. $13=$recv($14).__slash((3).__at((4)));
  57156. self._assert_equals_($13,$recv($Point())._x_y_((2),(2)));
  57157. return self;
  57158. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  57159. },
  57160. args: [],
  57161. 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)",
  57162. referencedClasses: ["Point"],
  57163. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  57164. }),
  57165. $globals.PointTest);
  57166. $core.addMethod(
  57167. $core.method({
  57168. selector: "testAt",
  57169. protocol: 'tests',
  57170. fn: function (){
  57171. var self=this;
  57172. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57173. return $core.withContext(function($ctx1) {
  57174. self._assert_equals_((3).__at((4)),$recv($Point())._x_y_((3),(4)));
  57175. return self;
  57176. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  57177. },
  57178. args: [],
  57179. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  57180. referencedClasses: ["Point"],
  57181. messageSends: ["assert:equals:", "@", "x:y:"]
  57182. }),
  57183. $globals.PointTest);
  57184. $core.addMethod(
  57185. $core.method({
  57186. selector: "testComparison",
  57187. protocol: 'tests',
  57188. fn: function (){
  57189. var self=this;
  57190. return $core.withContext(function($ctx1) {
  57191. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  57192. $2=(3).__at((4));
  57193. $ctx1.sendIdx["@"]=1;
  57194. $3=(4).__at((5));
  57195. $ctx1.sendIdx["@"]=2;
  57196. $1=$recv($2).__lt($3);
  57197. $ctx1.sendIdx["<"]=1;
  57198. self._assert_($1);
  57199. $ctx1.sendIdx["assert:"]=1;
  57200. $5=(3).__at((4));
  57201. $ctx1.sendIdx["@"]=3;
  57202. $6=(4).__at((4));
  57203. $ctx1.sendIdx["@"]=4;
  57204. $4=$recv($5).__lt($6);
  57205. self._deny_($4);
  57206. $ctx1.sendIdx["deny:"]=1;
  57207. $8=(4).__at((5));
  57208. $ctx1.sendIdx["@"]=5;
  57209. $9=(4).__at((5));
  57210. $ctx1.sendIdx["@"]=6;
  57211. $7=$recv($8).__lt_eq($9);
  57212. $ctx1.sendIdx["<="]=1;
  57213. self._assert_($7);
  57214. $ctx1.sendIdx["assert:"]=2;
  57215. $11=(4).__at((5));
  57216. $ctx1.sendIdx["@"]=7;
  57217. $12=(3).__at((5));
  57218. $ctx1.sendIdx["@"]=8;
  57219. $10=$recv($11).__lt_eq($12);
  57220. self._deny_($10);
  57221. $ctx1.sendIdx["deny:"]=2;
  57222. $14=(5).__at((6));
  57223. $ctx1.sendIdx["@"]=9;
  57224. $15=(4).__at((5));
  57225. $ctx1.sendIdx["@"]=10;
  57226. $13=$recv($14).__gt($15);
  57227. $ctx1.sendIdx[">"]=1;
  57228. self._assert_($13);
  57229. $ctx1.sendIdx["assert:"]=3;
  57230. $17=(5).__at((6));
  57231. $ctx1.sendIdx["@"]=11;
  57232. $18=(6).__at((6));
  57233. $ctx1.sendIdx["@"]=12;
  57234. $16=$recv($17).__gt($18);
  57235. self._deny_($16);
  57236. $ctx1.sendIdx["deny:"]=3;
  57237. $20=(4).__at((5));
  57238. $ctx1.sendIdx["@"]=13;
  57239. $21=(4).__at((5));
  57240. $ctx1.sendIdx["@"]=14;
  57241. $19=$recv($20).__gt_eq($21);
  57242. $ctx1.sendIdx[">="]=1;
  57243. self._assert_($19);
  57244. $23=(4).__at((5));
  57245. $ctx1.sendIdx["@"]=15;
  57246. $22=$recv($23).__gt_eq((5).__at((5)));
  57247. self._deny_($22);
  57248. return self;
  57249. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  57250. },
  57251. args: [],
  57252. 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)",
  57253. referencedClasses: [],
  57254. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  57255. }),
  57256. $globals.PointTest);
  57257. $core.addMethod(
  57258. $core.method({
  57259. selector: "testEgality",
  57260. protocol: 'tests',
  57261. fn: function (){
  57262. var self=this;
  57263. return $core.withContext(function($ctx1) {
  57264. var $2,$3,$1,$5,$4;
  57265. $2=(3).__at((4));
  57266. $ctx1.sendIdx["@"]=1;
  57267. $3=(3).__at((4));
  57268. $ctx1.sendIdx["@"]=2;
  57269. $1=$recv($2).__eq($3);
  57270. $ctx1.sendIdx["="]=1;
  57271. self._assert_($1);
  57272. $5=(3).__at((5));
  57273. $ctx1.sendIdx["@"]=3;
  57274. $4=$recv($5).__eq((3).__at((6)));
  57275. self._deny_($4);
  57276. return self;
  57277. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  57278. },
  57279. args: [],
  57280. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  57281. referencedClasses: [],
  57282. messageSends: ["assert:", "=", "@", "deny:"]
  57283. }),
  57284. $globals.PointTest);
  57285. $core.addMethod(
  57286. $core.method({
  57287. selector: "testNew",
  57288. protocol: 'tests',
  57289. fn: function (){
  57290. var self=this;
  57291. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57292. return $core.withContext(function($ctx1) {
  57293. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  57294. $3=$recv($Point())._new();
  57295. $ctx1.sendIdx["new"]=1;
  57296. $2=$recv($3)._x_((3));
  57297. $ctx1.sendIdx["x:"]=1;
  57298. $1=$recv($2)._y();
  57299. $ctx1.sendIdx["y"]=1;
  57300. self._assert_equals_($1,nil);
  57301. $ctx1.sendIdx["assert:equals:"]=1;
  57302. $7=$recv($Point())._new();
  57303. $ctx1.sendIdx["new"]=2;
  57304. $6=$recv($7)._x_((3));
  57305. $5=$recv($6)._x();
  57306. $ctx1.sendIdx["x"]=1;
  57307. $4=$recv($5).__eq((0));
  57308. $ctx1.sendIdx["="]=1;
  57309. self._deny_($4);
  57310. $ctx1.sendIdx["deny:"]=1;
  57311. $10=$recv($Point())._new();
  57312. $ctx1.sendIdx["new"]=3;
  57313. $9=$recv($10)._y_((4));
  57314. $ctx1.sendIdx["y:"]=1;
  57315. $8=$recv($9)._x();
  57316. self._assert_equals_($8,nil);
  57317. self._deny_($recv($recv($recv($recv($Point())._new())._y_((4)))._y()).__eq((0)));
  57318. return self;
  57319. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  57320. },
  57321. args: [],
  57322. 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",
  57323. referencedClasses: ["Point"],
  57324. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  57325. }),
  57326. $globals.PointTest);
  57327. $core.addMethod(
  57328. $core.method({
  57329. selector: "testTranslateBy",
  57330. protocol: 'tests',
  57331. fn: function (){
  57332. var self=this;
  57333. return $core.withContext(function($ctx1) {
  57334. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  57335. $2=(3).__at((3));
  57336. $ctx1.sendIdx["@"]=1;
  57337. $3=(0).__at((1));
  57338. $ctx1.sendIdx["@"]=2;
  57339. $1=$recv($2)._translateBy_($3);
  57340. $ctx1.sendIdx["translateBy:"]=1;
  57341. $4=(3).__at((4));
  57342. $ctx1.sendIdx["@"]=3;
  57343. self._assert_equals_($1,$4);
  57344. $ctx1.sendIdx["assert:equals:"]=1;
  57345. $6=(3).__at((3));
  57346. $ctx1.sendIdx["@"]=4;
  57347. $8=(1)._negated();
  57348. $ctx1.sendIdx["negated"]=1;
  57349. $7=(0).__at($8);
  57350. $ctx1.sendIdx["@"]=5;
  57351. $5=$recv($6)._translateBy_($7);
  57352. $ctx1.sendIdx["translateBy:"]=2;
  57353. $9=(3).__at((2));
  57354. $ctx1.sendIdx["@"]=6;
  57355. self._assert_equals_($5,$9);
  57356. $ctx1.sendIdx["assert:equals:"]=2;
  57357. $11=(3).__at((3));
  57358. $ctx1.sendIdx["@"]=7;
  57359. $12=(2).__at((3));
  57360. $ctx1.sendIdx["@"]=8;
  57361. $10=$recv($11)._translateBy_($12);
  57362. $ctx1.sendIdx["translateBy:"]=3;
  57363. $13=(5).__at((6));
  57364. $ctx1.sendIdx["@"]=9;
  57365. self._assert_equals_($10,$13);
  57366. $ctx1.sendIdx["assert:equals:"]=3;
  57367. $15=(3).__at((3));
  57368. $ctx1.sendIdx["@"]=10;
  57369. $16=$recv((3)._negated()).__at((0));
  57370. $ctx1.sendIdx["@"]=11;
  57371. $14=$recv($15)._translateBy_($16);
  57372. self._assert_equals_($14,(0).__at((3)));
  57373. return self;
  57374. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  57375. },
  57376. args: [],
  57377. 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.",
  57378. referencedClasses: [],
  57379. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  57380. }),
  57381. $globals.PointTest);
  57382. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  57383. $core.addMethod(
  57384. $core.method({
  57385. selector: "testNextIfAbsent",
  57386. protocol: 'tests',
  57387. fn: function (){
  57388. var self=this;
  57389. var queue;
  57390. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  57391. return $core.withContext(function($ctx1) {
  57392. var $2,$1;
  57393. queue=$recv($Queue())._new();
  57394. $recv(queue)._nextPut_("index1");
  57395. $2=$recv(queue)._nextIfAbsent_("empty");
  57396. $ctx1.sendIdx["nextIfAbsent:"]=1;
  57397. $1=$recv($2).__eq("index1");
  57398. $ctx1.sendIdx["="]=1;
  57399. self._assert_($1);
  57400. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  57401. return self;
  57402. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  57403. },
  57404. args: [],
  57405. 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'",
  57406. referencedClasses: ["Queue"],
  57407. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  57408. }),
  57409. $globals.QueueTest);
  57410. $core.addMethod(
  57411. $core.method({
  57412. selector: "testQueueNext",
  57413. protocol: 'tests',
  57414. fn: function (){
  57415. var self=this;
  57416. var queue;
  57417. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  57418. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  57419. return $core.withContext(function($ctx1) {
  57420. var $1,$2,$4,$3,$6,$5;
  57421. queue=$recv($Queue())._new();
  57422. $1=queue;
  57423. $recv($1)._nextPut_("index1");
  57424. $ctx1.sendIdx["nextPut:"]=1;
  57425. $2=$recv($1)._nextPut_("index2");
  57426. $4=$recv(queue)._next();
  57427. $ctx1.sendIdx["next"]=1;
  57428. $3=$recv($4).__eq("index1");
  57429. $ctx1.sendIdx["="]=1;
  57430. self._assert_($3);
  57431. $6=$recv(queue)._next();
  57432. $ctx1.sendIdx["next"]=2;
  57433. $5=$recv($6).__eq("index");
  57434. self._deny_($5);
  57435. self._should_raise_((function(){
  57436. return $core.withContext(function($ctx2) {
  57437. return $recv(queue)._next();
  57438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57439. }),$Error());
  57440. return self;
  57441. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  57442. },
  57443. args: [],
  57444. 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",
  57445. referencedClasses: ["Queue", "Error"],
  57446. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  57447. }),
  57448. $globals.QueueTest);
  57449. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  57450. $core.addMethod(
  57451. $core.method({
  57452. selector: "testAtRandomNumber",
  57453. protocol: 'tests',
  57454. fn: function (){
  57455. var self=this;
  57456. var val;
  57457. return $core.withContext(function($ctx1) {
  57458. (100)._timesRepeat_((function(){
  57459. return $core.withContext(function($ctx2) {
  57460. val=(10)._atRandom();
  57461. val;
  57462. self._assert_($recv(val).__gt((0)));
  57463. $ctx2.sendIdx["assert:"]=1;
  57464. return self._assert_($recv(val).__lt((11)));
  57465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57466. }));
  57467. return self;
  57468. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  57469. },
  57470. args: [],
  57471. 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]",
  57472. referencedClasses: [],
  57473. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  57474. }),
  57475. $globals.RandomTest);
  57476. $core.addMethod(
  57477. $core.method({
  57478. selector: "testAtRandomSequenceableCollection",
  57479. protocol: 'tests',
  57480. fn: function (){
  57481. var self=this;
  57482. var val;
  57483. return $core.withContext(function($ctx1) {
  57484. var $3,$4,$2,$1;
  57485. (100)._timesRepeat_((function(){
  57486. return $core.withContext(function($ctx2) {
  57487. val="abc"._atRandom();
  57488. val;
  57489. $3=$recv(val).__eq("a");
  57490. $ctx2.sendIdx["="]=1;
  57491. $4=$recv(val).__eq("b");
  57492. $ctx2.sendIdx["="]=2;
  57493. $2=$recv($3).__or($4);
  57494. $1=$recv($2).__or($recv(val).__eq("c"));
  57495. $ctx2.sendIdx["|"]=1;
  57496. return self._assert_($1);
  57497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57498. }));
  57499. return self;
  57500. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  57501. },
  57502. args: [],
  57503. 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].",
  57504. referencedClasses: [],
  57505. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  57506. }),
  57507. $globals.RandomTest);
  57508. $core.addMethod(
  57509. $core.method({
  57510. selector: "textNext",
  57511. protocol: 'tests',
  57512. fn: function (){
  57513. var self=this;
  57514. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  57515. return $core.withContext(function($ctx1) {
  57516. var $1;
  57517. (10000)._timesRepeat_((function(){
  57518. var current,next;
  57519. return $core.withContext(function($ctx2) {
  57520. next=$recv($recv($Random())._new())._next();
  57521. next;
  57522. self._assert_($recv(next).__gt_eq((0)));
  57523. $ctx2.sendIdx["assert:"]=1;
  57524. self._assert_($recv(next).__lt((1)));
  57525. $1=$recv(current).__eq(next);
  57526. $ctx2.sendIdx["="]=1;
  57527. self._deny_($1);
  57528. return $recv(next).__eq(current);
  57529. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  57530. }));
  57531. return self;
  57532. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  57533. },
  57534. args: [],
  57535. 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 ]",
  57536. referencedClasses: ["Random"],
  57537. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  57538. }),
  57539. $globals.RandomTest);
  57540. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  57541. $core.addMethod(
  57542. $core.method({
  57543. selector: "collectionClass",
  57544. protocol: 'accessing',
  57545. fn: function (){
  57546. var self=this;
  57547. return $core.withContext(function($ctx1) {
  57548. var $1;
  57549. $1=$recv(self._class())._collectionClass();
  57550. return $1;
  57551. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  57552. },
  57553. args: [],
  57554. source: "collectionClass\x0a\x09^ self class collectionClass",
  57555. referencedClasses: [],
  57556. messageSends: ["collectionClass", "class"]
  57557. }),
  57558. $globals.StreamTest);
  57559. $core.addMethod(
  57560. $core.method({
  57561. selector: "newCollection",
  57562. protocol: 'accessing',
  57563. fn: function (){
  57564. var self=this;
  57565. return $core.withContext(function($ctx1) {
  57566. var $1;
  57567. $1=$recv(self._collectionClass())._new();
  57568. return $1;
  57569. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  57570. },
  57571. args: [],
  57572. source: "newCollection\x0a\x09^ self collectionClass new",
  57573. referencedClasses: [],
  57574. messageSends: ["new", "collectionClass"]
  57575. }),
  57576. $globals.StreamTest);
  57577. $core.addMethod(
  57578. $core.method({
  57579. selector: "newStream",
  57580. protocol: 'accessing',
  57581. fn: function (){
  57582. var self=this;
  57583. return $core.withContext(function($ctx1) {
  57584. var $1;
  57585. $1=$recv($recv(self._collectionClass())._new())._stream();
  57586. return $1;
  57587. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  57588. },
  57589. args: [],
  57590. source: "newStream\x0a\x09^ self collectionClass new stream",
  57591. referencedClasses: [],
  57592. messageSends: ["stream", "new", "collectionClass"]
  57593. }),
  57594. $globals.StreamTest);
  57595. $core.addMethod(
  57596. $core.method({
  57597. selector: "testAtStartAtEnd",
  57598. protocol: 'tests',
  57599. fn: function (){
  57600. var self=this;
  57601. var stream;
  57602. return $core.withContext(function($ctx1) {
  57603. var $1,$2,$3,$4;
  57604. stream=self._newStream();
  57605. $1=$recv(stream)._atStart();
  57606. $ctx1.sendIdx["atStart"]=1;
  57607. self._assert_($1);
  57608. $ctx1.sendIdx["assert:"]=1;
  57609. $2=$recv(stream)._atEnd();
  57610. $ctx1.sendIdx["atEnd"]=1;
  57611. self._assert_($2);
  57612. $ctx1.sendIdx["assert:"]=2;
  57613. $recv(stream)._nextPutAll_(self._newCollection());
  57614. $3=$recv(stream)._atEnd();
  57615. $ctx1.sendIdx["atEnd"]=2;
  57616. self._assert_($3);
  57617. $4=$recv(stream)._atStart();
  57618. $ctx1.sendIdx["atStart"]=2;
  57619. self._deny_($4);
  57620. $ctx1.sendIdx["deny:"]=1;
  57621. $recv(stream)._position_((1));
  57622. self._deny_($recv(stream)._atEnd());
  57623. $ctx1.sendIdx["deny:"]=2;
  57624. self._deny_($recv(stream)._atStart());
  57625. return self;
  57626. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  57627. },
  57628. args: [],
  57629. 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",
  57630. referencedClasses: [],
  57631. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  57632. }),
  57633. $globals.StreamTest);
  57634. $core.addMethod(
  57635. $core.method({
  57636. selector: "testContents",
  57637. protocol: 'tests',
  57638. fn: function (){
  57639. var self=this;
  57640. var stream;
  57641. return $core.withContext(function($ctx1) {
  57642. var $1,$2;
  57643. stream=self._newStream();
  57644. $1=stream;
  57645. $2=self._newCollection();
  57646. $ctx1.sendIdx["newCollection"]=1;
  57647. $recv($1)._nextPutAll_($2);
  57648. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  57649. return self;
  57650. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  57651. },
  57652. args: [],
  57653. 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",
  57654. referencedClasses: [],
  57655. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  57656. }),
  57657. $globals.StreamTest);
  57658. $core.addMethod(
  57659. $core.method({
  57660. selector: "testIsEmpty",
  57661. protocol: 'tests',
  57662. fn: function (){
  57663. var self=this;
  57664. var stream;
  57665. return $core.withContext(function($ctx1) {
  57666. var $1;
  57667. stream=self._newStream();
  57668. $1=$recv(stream)._isEmpty();
  57669. $ctx1.sendIdx["isEmpty"]=1;
  57670. self._assert_($1);
  57671. $recv(stream)._nextPutAll_(self._newCollection());
  57672. self._deny_($recv(stream)._isEmpty());
  57673. return self;
  57674. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  57675. },
  57676. args: [],
  57677. 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",
  57678. referencedClasses: [],
  57679. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  57680. }),
  57681. $globals.StreamTest);
  57682. $core.addMethod(
  57683. $core.method({
  57684. selector: "testPosition",
  57685. protocol: 'tests',
  57686. fn: function (){
  57687. var self=this;
  57688. var collection,stream;
  57689. return $core.withContext(function($ctx1) {
  57690. var $1,$2,$3;
  57691. collection=self._newCollection();
  57692. stream=self._newStream();
  57693. $recv(stream)._nextPutAll_(collection);
  57694. $1=$recv(stream)._position();
  57695. $ctx1.sendIdx["position"]=1;
  57696. self._assert_equals_($1,$recv(collection)._size());
  57697. $ctx1.sendIdx["assert:equals:"]=1;
  57698. $recv(stream)._position_((0));
  57699. $2=$recv(stream)._position();
  57700. $ctx1.sendIdx["position"]=2;
  57701. self._assert_equals_($2,(0));
  57702. $ctx1.sendIdx["assert:equals:"]=2;
  57703. $recv(stream)._next();
  57704. $ctx1.sendIdx["next"]=1;
  57705. $3=$recv(stream)._position();
  57706. $ctx1.sendIdx["position"]=3;
  57707. self._assert_equals_($3,(1));
  57708. $ctx1.sendIdx["assert:equals:"]=3;
  57709. $recv(stream)._next();
  57710. self._assert_equals_($recv(stream)._position(),(2));
  57711. return self;
  57712. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  57713. },
  57714. args: [],
  57715. 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",
  57716. referencedClasses: [],
  57717. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  57718. }),
  57719. $globals.StreamTest);
  57720. $core.addMethod(
  57721. $core.method({
  57722. selector: "testReading",
  57723. protocol: 'tests',
  57724. fn: function (){
  57725. var self=this;
  57726. var stream,collection;
  57727. return $core.withContext(function($ctx1) {
  57728. var $1,$2,$3;
  57729. collection=self._newCollection();
  57730. stream=self._newStream();
  57731. $1=stream;
  57732. $recv($1)._nextPutAll_(collection);
  57733. $2=$recv($1)._position_((0));
  57734. $recv(collection)._do_((function(each){
  57735. return $core.withContext(function($ctx2) {
  57736. $3=$recv(stream)._next();
  57737. $ctx2.sendIdx["next"]=1;
  57738. return self._assert_equals_($3,each);
  57739. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57740. }));
  57741. self._assert_($recv($recv(stream)._next())._isNil());
  57742. return self;
  57743. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  57744. },
  57745. args: [],
  57746. 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",
  57747. referencedClasses: [],
  57748. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  57749. }),
  57750. $globals.StreamTest);
  57751. $core.addMethod(
  57752. $core.method({
  57753. selector: "testStreamContents",
  57754. protocol: 'tests',
  57755. fn: function (){
  57756. var self=this;
  57757. return self;
  57758. },
  57759. args: [],
  57760. source: "testStreamContents",
  57761. referencedClasses: [],
  57762. messageSends: []
  57763. }),
  57764. $globals.StreamTest);
  57765. $core.addMethod(
  57766. $core.method({
  57767. selector: "testWrite",
  57768. protocol: 'tests',
  57769. fn: function (){
  57770. var self=this;
  57771. var stream,collection;
  57772. return $core.withContext(function($ctx1) {
  57773. collection=self._newCollection();
  57774. stream=self._newStream();
  57775. $recv(collection)._do_((function(each){
  57776. return $core.withContext(function($ctx2) {
  57777. return $recv(stream).__lt_lt(each);
  57778. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57779. }));
  57780. self._assert_equals_($recv(stream)._contents(),collection);
  57781. return self;
  57782. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  57783. },
  57784. args: [],
  57785. 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",
  57786. referencedClasses: [],
  57787. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  57788. }),
  57789. $globals.StreamTest);
  57790. $core.addMethod(
  57791. $core.method({
  57792. selector: "testWriting",
  57793. protocol: 'tests',
  57794. fn: function (){
  57795. var self=this;
  57796. var stream,collection;
  57797. return $core.withContext(function($ctx1) {
  57798. var $1;
  57799. collection=self._newCollection();
  57800. stream=self._newStream();
  57801. $ctx1.sendIdx["newStream"]=1;
  57802. $recv(collection)._do_((function(each){
  57803. return $core.withContext(function($ctx2) {
  57804. return $recv(stream)._nextPut_(each);
  57805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57806. }));
  57807. $1=$recv(stream)._contents();
  57808. $ctx1.sendIdx["contents"]=1;
  57809. self._assert_equals_($1,collection);
  57810. $ctx1.sendIdx["assert:equals:"]=1;
  57811. stream=self._newStream();
  57812. $recv(stream)._nextPutAll_(collection);
  57813. self._assert_equals_($recv(stream)._contents(),collection);
  57814. return self;
  57815. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  57816. },
  57817. args: [],
  57818. 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",
  57819. referencedClasses: [],
  57820. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  57821. }),
  57822. $globals.StreamTest);
  57823. $core.addMethod(
  57824. $core.method({
  57825. selector: "collectionClass",
  57826. protocol: 'accessing',
  57827. fn: function (){
  57828. var self=this;
  57829. return nil;
  57830. },
  57831. args: [],
  57832. source: "collectionClass\x0a\x09^ nil",
  57833. referencedClasses: [],
  57834. messageSends: []
  57835. }),
  57836. $globals.StreamTest.klass);
  57837. $core.addMethod(
  57838. $core.method({
  57839. selector: "isAbstract",
  57840. protocol: 'testing',
  57841. fn: function (){
  57842. var self=this;
  57843. return $core.withContext(function($ctx1) {
  57844. var $1;
  57845. $1=$recv(self._collectionClass())._isNil();
  57846. return $1;
  57847. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  57848. },
  57849. args: [],
  57850. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  57851. referencedClasses: [],
  57852. messageSends: ["isNil", "collectionClass"]
  57853. }),
  57854. $globals.StreamTest.klass);
  57855. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  57856. $core.addMethod(
  57857. $core.method({
  57858. selector: "newCollection",
  57859. protocol: 'accessing',
  57860. fn: function (){
  57861. var self=this;
  57862. return $core.withContext(function($ctx1) {
  57863. var $1;
  57864. $1=[true,(1),(3).__at((4)),"foo"];
  57865. return $1;
  57866. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  57867. },
  57868. args: [],
  57869. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  57870. referencedClasses: [],
  57871. messageSends: ["@"]
  57872. }),
  57873. $globals.ArrayStreamTest);
  57874. $core.addMethod(
  57875. $core.method({
  57876. selector: "collectionClass",
  57877. protocol: 'accessing',
  57878. fn: function (){
  57879. var self=this;
  57880. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  57881. return $Array();
  57882. },
  57883. args: [],
  57884. source: "collectionClass\x0a\x09^ Array",
  57885. referencedClasses: ["Array"],
  57886. messageSends: []
  57887. }),
  57888. $globals.ArrayStreamTest.klass);
  57889. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  57890. $core.addMethod(
  57891. $core.method({
  57892. selector: "newCollection",
  57893. protocol: 'accessing',
  57894. fn: function (){
  57895. var self=this;
  57896. return "hello world";
  57897. },
  57898. args: [],
  57899. source: "newCollection\x0a\x09^ 'hello world'",
  57900. referencedClasses: [],
  57901. messageSends: []
  57902. }),
  57903. $globals.StringStreamTest);
  57904. $core.addMethod(
  57905. $core.method({
  57906. selector: "collectionClass",
  57907. protocol: 'accessing',
  57908. fn: function (){
  57909. var self=this;
  57910. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  57911. return $String();
  57912. },
  57913. args: [],
  57914. source: "collectionClass\x0a\x09^ String",
  57915. referencedClasses: ["String"],
  57916. messageSends: []
  57917. }),
  57918. $globals.StringStreamTest.klass);
  57919. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  57920. $core.addMethod(
  57921. $core.method({
  57922. selector: "testCopying",
  57923. protocol: 'tests',
  57924. fn: function (){
  57925. var self=this;
  57926. return $core.withContext(function($ctx1) {
  57927. self._assert_equals_(nil._copy(),nil);
  57928. return self;
  57929. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  57930. },
  57931. args: [],
  57932. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  57933. referencedClasses: [],
  57934. messageSends: ["assert:equals:", "copy"]
  57935. }),
  57936. $globals.UndefinedTest);
  57937. $core.addMethod(
  57938. $core.method({
  57939. selector: "testDeepCopy",
  57940. protocol: 'tests',
  57941. fn: function (){
  57942. var self=this;
  57943. return $core.withContext(function($ctx1) {
  57944. self._assert_($recv(nil._deepCopy()).__eq(nil));
  57945. return self;
  57946. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  57947. },
  57948. args: [],
  57949. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  57950. referencedClasses: [],
  57951. messageSends: ["assert:", "=", "deepCopy"]
  57952. }),
  57953. $globals.UndefinedTest);
  57954. $core.addMethod(
  57955. $core.method({
  57956. selector: "testIfNil",
  57957. protocol: 'tests',
  57958. fn: function (){
  57959. var self=this;
  57960. return $core.withContext(function($ctx1) {
  57961. var $1,$3,$2,$4,$6,$5,$receiver;
  57962. if(($receiver = nil) == null || $receiver.isNil){
  57963. $1=true;
  57964. } else {
  57965. $1=nil;
  57966. };
  57967. self._assert_equals_($1,true);
  57968. $ctx1.sendIdx["assert:equals:"]=1;
  57969. if(($receiver = nil) == null || $receiver.isNil){
  57970. $3=nil;
  57971. } else {
  57972. $3=true;
  57973. };
  57974. $2=$recv($3).__eq(true);
  57975. $ctx1.sendIdx["="]=1;
  57976. self._deny_($2);
  57977. $ctx1.sendIdx["deny:"]=1;
  57978. if(($receiver = nil) == null || $receiver.isNil){
  57979. $4=true;
  57980. } else {
  57981. $4=false;
  57982. };
  57983. self._assert_equals_($4,true);
  57984. if(($receiver = nil) == null || $receiver.isNil){
  57985. $6=false;
  57986. } else {
  57987. $6=true;
  57988. };
  57989. $5=$recv($6).__eq(true);
  57990. self._deny_($5);
  57991. return self;
  57992. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  57993. },
  57994. args: [],
  57995. 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",
  57996. referencedClasses: [],
  57997. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  57998. }),
  57999. $globals.UndefinedTest);
  58000. $core.addMethod(
  58001. $core.method({
  58002. selector: "testIsNil",
  58003. protocol: 'tests',
  58004. fn: function (){
  58005. var self=this;
  58006. return $core.withContext(function($ctx1) {
  58007. self._assert_(nil._isNil());
  58008. self._deny_(nil._notNil());
  58009. return self;
  58010. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  58011. },
  58012. args: [],
  58013. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  58014. referencedClasses: [],
  58015. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  58016. }),
  58017. $globals.UndefinedTest);
  58018. });
  58019. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  58020. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  58021. $core.addPackage('SUnit-Tests');
  58022. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  58023. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  58024. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  58025. $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.";
  58026. $core.addMethod(
  58027. $core.method({
  58028. selector: "setUp",
  58029. protocol: 'running',
  58030. fn: function (){
  58031. var self=this;
  58032. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  58033. return $core.withContext(function($ctx1) {
  58034. self["@empty"]=$recv($Set())._new();
  58035. self["@full"]=$recv($Set())._with_with_((5),"abc");
  58036. return self;
  58037. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  58038. },
  58039. args: [],
  58040. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  58041. referencedClasses: ["Set"],
  58042. messageSends: ["new", "with:with:"]
  58043. }),
  58044. $globals.ExampleSetTest);
  58045. $core.addMethod(
  58046. $core.method({
  58047. selector: "testAdd",
  58048. protocol: 'tests',
  58049. fn: function (){
  58050. var self=this;
  58051. return $core.withContext(function($ctx1) {
  58052. $recv(self["@empty"])._add_((5));
  58053. self._assert_($recv(self["@empty"])._includes_((5)));
  58054. return self;
  58055. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  58056. },
  58057. args: [],
  58058. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  58059. referencedClasses: [],
  58060. messageSends: ["add:", "assert:", "includes:"]
  58061. }),
  58062. $globals.ExampleSetTest);
  58063. $core.addMethod(
  58064. $core.method({
  58065. selector: "testGrow",
  58066. protocol: 'tests',
  58067. fn: function (){
  58068. var self=this;
  58069. return $core.withContext(function($ctx1) {
  58070. $recv(self["@empty"])._addAll_((1)._to_((100)));
  58071. self._assert_equals_($recv(self["@empty"])._size(),(100));
  58072. return self;
  58073. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  58074. },
  58075. args: [],
  58076. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  58077. referencedClasses: [],
  58078. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  58079. }),
  58080. $globals.ExampleSetTest);
  58081. $core.addMethod(
  58082. $core.method({
  58083. selector: "testIllegal",
  58084. protocol: 'tests',
  58085. fn: function (){
  58086. var self=this;
  58087. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58088. return $core.withContext(function($ctx1) {
  58089. self._should_raise_((function(){
  58090. return $core.withContext(function($ctx2) {
  58091. return $recv(self["@empty"])._at_((5));
  58092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58093. }),$Error());
  58094. $ctx1.sendIdx["should:raise:"]=1;
  58095. self._should_raise_((function(){
  58096. return $core.withContext(function($ctx2) {
  58097. return $recv(self["@empty"])._at_put_((5),"abc");
  58098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58099. }),$Error());
  58100. return self;
  58101. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  58102. },
  58103. args: [],
  58104. 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",
  58105. referencedClasses: ["Error"],
  58106. messageSends: ["should:raise:", "at:", "at:put:"]
  58107. }),
  58108. $globals.ExampleSetTest);
  58109. $core.addMethod(
  58110. $core.method({
  58111. selector: "testIncludes",
  58112. protocol: 'tests',
  58113. fn: function (){
  58114. var self=this;
  58115. return $core.withContext(function($ctx1) {
  58116. var $1;
  58117. $1=$recv(self["@full"])._includes_((5));
  58118. $ctx1.sendIdx["includes:"]=1;
  58119. self._assert_($1);
  58120. $ctx1.sendIdx["assert:"]=1;
  58121. self._assert_($recv(self["@full"])._includes_("abc"));
  58122. return self;
  58123. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  58124. },
  58125. args: [],
  58126. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  58127. referencedClasses: [],
  58128. messageSends: ["assert:", "includes:"]
  58129. }),
  58130. $globals.ExampleSetTest);
  58131. $core.addMethod(
  58132. $core.method({
  58133. selector: "testOccurrences",
  58134. protocol: 'tests',
  58135. fn: function (){
  58136. var self=this;
  58137. return $core.withContext(function($ctx1) {
  58138. var $1,$2;
  58139. $1=$recv(self["@empty"])._occurrencesOf_((0));
  58140. $ctx1.sendIdx["occurrencesOf:"]=1;
  58141. self._assert_equals_($1,(0));
  58142. $ctx1.sendIdx["assert:equals:"]=1;
  58143. $2=$recv(self["@full"])._occurrencesOf_((5));
  58144. $ctx1.sendIdx["occurrencesOf:"]=2;
  58145. self._assert_equals_($2,(1));
  58146. $ctx1.sendIdx["assert:equals:"]=2;
  58147. $recv(self["@full"])._add_((5));
  58148. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  58149. return self;
  58150. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  58151. },
  58152. args: [],
  58153. 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",
  58154. referencedClasses: [],
  58155. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  58156. }),
  58157. $globals.ExampleSetTest);
  58158. $core.addMethod(
  58159. $core.method({
  58160. selector: "testRemove",
  58161. protocol: 'tests',
  58162. fn: function (){
  58163. var self=this;
  58164. return $core.withContext(function($ctx1) {
  58165. var $1;
  58166. $recv(self["@full"])._remove_((5));
  58167. $1=$recv(self["@full"])._includes_("abc");
  58168. $ctx1.sendIdx["includes:"]=1;
  58169. self._assert_($1);
  58170. self._deny_($recv(self["@full"])._includes_((5)));
  58171. return self;
  58172. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  58173. },
  58174. args: [],
  58175. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  58176. referencedClasses: [],
  58177. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  58178. }),
  58179. $globals.ExampleSetTest);
  58180. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  58181. $core.addMethod(
  58182. $core.method({
  58183. selector: "fakeError",
  58184. protocol: 'helpers',
  58185. fn: function (){
  58186. var self=this;
  58187. return $core.withContext(function($ctx1) {
  58188. self["@flag"]="bad";
  58189. self._timeout_((30));
  58190. self["@flag"]=$recv(self._async_((function(){
  58191. return $core.withContext(function($ctx2) {
  58192. self["@flag"]="ok";
  58193. self["@flag"];
  58194. return self._error_("Intentional");
  58195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58196. })))._valueWithTimeout_((20));
  58197. return self;
  58198. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  58199. },
  58200. args: [],
  58201. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  58202. referencedClasses: [],
  58203. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  58204. }),
  58205. $globals.SUnitAsyncTest);
  58206. $core.addMethod(
  58207. $core.method({
  58208. selector: "fakeErrorFailingInTearDown",
  58209. protocol: 'helpers',
  58210. fn: function (){
  58211. var self=this;
  58212. return $core.withContext(function($ctx1) {
  58213. self["@flag"]="bad";
  58214. self._timeout_((30));
  58215. self["@flag"]=$recv(self._async_((function(){
  58216. return $core.withContext(function($ctx2) {
  58217. return self._error_("Intentional");
  58218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58219. })))._valueWithTimeout_((20));
  58220. return self;
  58221. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  58222. },
  58223. args: [],
  58224. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  58225. referencedClasses: [],
  58226. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  58227. }),
  58228. $globals.SUnitAsyncTest);
  58229. $core.addMethod(
  58230. $core.method({
  58231. selector: "fakeFailure",
  58232. protocol: 'helpers',
  58233. fn: function (){
  58234. var self=this;
  58235. return $core.withContext(function($ctx1) {
  58236. self["@flag"]="bad";
  58237. self._timeout_((30));
  58238. self["@flag"]=$recv(self._async_((function(){
  58239. return $core.withContext(function($ctx2) {
  58240. self["@flag"]="ok";
  58241. self["@flag"];
  58242. return self._assert_(false);
  58243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58244. })))._valueWithTimeout_((20));
  58245. return self;
  58246. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  58247. },
  58248. args: [],
  58249. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  58250. referencedClasses: [],
  58251. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  58252. }),
  58253. $globals.SUnitAsyncTest);
  58254. $core.addMethod(
  58255. $core.method({
  58256. selector: "fakeMultipleTimeoutFailing",
  58257. protocol: 'helpers',
  58258. fn: function (){
  58259. var self=this;
  58260. return $core.withContext(function($ctx1) {
  58261. var $1;
  58262. self._timeout_((100));
  58263. $ctx1.sendIdx["timeout:"]=1;
  58264. $1=self._async_((function(){
  58265. return $core.withContext(function($ctx2) {
  58266. self._timeout_((20));
  58267. return $recv(self._async_((function(){
  58268. return $core.withContext(function($ctx3) {
  58269. return self._finished();
  58270. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58271. })))._valueWithTimeout_((30));
  58272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58273. }));
  58274. $ctx1.sendIdx["async:"]=1;
  58275. $recv($1)._valueWithTimeout_((20));
  58276. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58277. return self;
  58278. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  58279. },
  58280. args: [],
  58281. 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",
  58282. referencedClasses: [],
  58283. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58284. }),
  58285. $globals.SUnitAsyncTest);
  58286. $core.addMethod(
  58287. $core.method({
  58288. selector: "fakeMultipleTimeoutPassing",
  58289. protocol: 'helpers',
  58290. fn: function (){
  58291. var self=this;
  58292. return $core.withContext(function($ctx1) {
  58293. var $1;
  58294. self._timeout_((20));
  58295. $ctx1.sendIdx["timeout:"]=1;
  58296. $1=self._async_((function(){
  58297. return $core.withContext(function($ctx2) {
  58298. self._timeout_((40));
  58299. return $recv(self._async_((function(){
  58300. return $core.withContext(function($ctx3) {
  58301. return self._finished();
  58302. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58303. })))._valueWithTimeout_((20));
  58304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58305. }));
  58306. $ctx1.sendIdx["async:"]=1;
  58307. $recv($1)._valueWithTimeout_((10));
  58308. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58309. return self;
  58310. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  58311. },
  58312. args: [],
  58313. 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",
  58314. referencedClasses: [],
  58315. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58316. }),
  58317. $globals.SUnitAsyncTest);
  58318. $core.addMethod(
  58319. $core.method({
  58320. selector: "fakeTimeout",
  58321. protocol: 'helpers',
  58322. fn: function (){
  58323. var self=this;
  58324. return $core.withContext(function($ctx1) {
  58325. self._timeout_((10));
  58326. $recv(self._async_((function(){
  58327. return $core.withContext(function($ctx2) {
  58328. return self._finished();
  58329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58330. })))._valueWithTimeout_((20));
  58331. return self;
  58332. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  58333. },
  58334. args: [],
  58335. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  58336. referencedClasses: [],
  58337. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58338. }),
  58339. $globals.SUnitAsyncTest);
  58340. $core.addMethod(
  58341. $core.method({
  58342. selector: "selectorSetOf:",
  58343. protocol: 'private',
  58344. fn: function (aCollection){
  58345. var self=this;
  58346. return $core.withContext(function($ctx1) {
  58347. var $1;
  58348. $1=$recv($recv(aCollection)._collect_((function(each){
  58349. return $core.withContext(function($ctx2) {
  58350. return $recv(each)._selector();
  58351. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58352. })))._asSet();
  58353. return $1;
  58354. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  58355. },
  58356. args: ["aCollection"],
  58357. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  58358. referencedClasses: [],
  58359. messageSends: ["asSet", "collect:", "selector"]
  58360. }),
  58361. $globals.SUnitAsyncTest);
  58362. $core.addMethod(
  58363. $core.method({
  58364. selector: "setUp",
  58365. protocol: 'running',
  58366. fn: function (){
  58367. var self=this;
  58368. self["@flag"]="ok";
  58369. return self;
  58370. },
  58371. args: [],
  58372. source: "setUp\x0a\x09flag := 'ok'",
  58373. referencedClasses: [],
  58374. messageSends: []
  58375. }),
  58376. $globals.SUnitAsyncTest);
  58377. $core.addMethod(
  58378. $core.method({
  58379. selector: "tearDown",
  58380. protocol: 'running',
  58381. fn: function (){
  58382. var self=this;
  58383. return $core.withContext(function($ctx1) {
  58384. self._assert_equals_("ok",self["@flag"]);
  58385. return self;
  58386. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  58387. },
  58388. args: [],
  58389. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  58390. referencedClasses: [],
  58391. messageSends: ["assert:equals:"]
  58392. }),
  58393. $globals.SUnitAsyncTest);
  58394. $core.addMethod(
  58395. $core.method({
  58396. selector: "testAsyncErrorsAndFailures",
  58397. protocol: 'tests',
  58398. fn: function (){
  58399. var self=this;
  58400. var suite,runner,result,assertBlock;
  58401. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  58402. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  58403. return $core.withContext(function($ctx1) {
  58404. var $1,$2,$3,$4;
  58405. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  58406. return $core.withContext(function($ctx2) {
  58407. return $recv(self._class())._selector_(each);
  58408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58409. }));
  58410. runner=$recv($TestSuiteRunner())._on_(suite);
  58411. self._timeout_((200));
  58412. result=$recv(runner)._result();
  58413. $ctx1.sendIdx["result"]=1;
  58414. assertBlock=self._async_((function(){
  58415. return $core.withContext(function($ctx2) {
  58416. $1=self._selectorSetOf_($recv(result)._errors());
  58417. $ctx2.sendIdx["selectorSetOf:"]=1;
  58418. $2=["fakeError"]._asSet();
  58419. $ctx2.sendIdx["asSet"]=1;
  58420. self._assert_equals_($1,$2);
  58421. $ctx2.sendIdx["assert:equals:"]=1;
  58422. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  58423. return self._finished();
  58424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58425. }));
  58426. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  58427. return $core.withContext(function($ctx2) {
  58428. $3=$recv($recv(ann)._result()).__eq_eq(result);
  58429. if($core.assert($3)){
  58430. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  58431. return $recv($4)._ifTrue_(assertBlock);
  58432. };
  58433. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  58434. }));
  58435. $recv(runner)._run();
  58436. return self;
  58437. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  58438. },
  58439. args: [],
  58440. 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",
  58441. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  58442. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  58443. }),
  58444. $globals.SUnitAsyncTest);
  58445. $core.addMethod(
  58446. $core.method({
  58447. selector: "testAsyncNeedsTimeout",
  58448. protocol: 'tests',
  58449. fn: function (){
  58450. var self=this;
  58451. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58452. return $core.withContext(function($ctx1) {
  58453. self._should_raise_((function(){
  58454. return $core.withContext(function($ctx2) {
  58455. return self._async_((function(){
  58456. }));
  58457. $ctx2.sendIdx["async:"]=1;
  58458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58459. }),$Error());
  58460. self._timeout_((0));
  58461. self._shouldnt_raise_((function(){
  58462. return $core.withContext(function($ctx2) {
  58463. return self._async_((function(){
  58464. }));
  58465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58466. }),$Error());
  58467. self._finished();
  58468. return self;
  58469. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  58470. },
  58471. args: [],
  58472. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  58473. referencedClasses: ["Error"],
  58474. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  58475. }),
  58476. $globals.SUnitAsyncTest);
  58477. $core.addMethod(
  58478. $core.method({
  58479. selector: "testFinishedNeedsTimeout",
  58480. protocol: 'tests',
  58481. fn: function (){
  58482. var self=this;
  58483. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58484. return $core.withContext(function($ctx1) {
  58485. self._should_raise_((function(){
  58486. return $core.withContext(function($ctx2) {
  58487. return self._finished();
  58488. $ctx2.sendIdx["finished"]=1;
  58489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58490. }),$Error());
  58491. self._timeout_((0));
  58492. self._shouldnt_raise_((function(){
  58493. return $core.withContext(function($ctx2) {
  58494. return self._finished();
  58495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58496. }),$Error());
  58497. return self;
  58498. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  58499. },
  58500. args: [],
  58501. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  58502. referencedClasses: ["Error"],
  58503. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  58504. }),
  58505. $globals.SUnitAsyncTest);
  58506. $core.addMethod(
  58507. $core.method({
  58508. selector: "testIsAsyncReturnsCorrectValues",
  58509. protocol: 'tests',
  58510. fn: function (){
  58511. var self=this;
  58512. return $core.withContext(function($ctx1) {
  58513. var $1,$2;
  58514. $1=self._isAsync();
  58515. $ctx1.sendIdx["isAsync"]=1;
  58516. self._deny_($1);
  58517. $ctx1.sendIdx["deny:"]=1;
  58518. self._timeout_((0));
  58519. $2=self._isAsync();
  58520. $ctx1.sendIdx["isAsync"]=2;
  58521. self._assert_($2);
  58522. self._finished();
  58523. self._deny_(self._isAsync());
  58524. return self;
  58525. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  58526. },
  58527. args: [],
  58528. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  58529. referencedClasses: [],
  58530. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  58531. }),
  58532. $globals.SUnitAsyncTest);
  58533. $core.addMethod(
  58534. $core.method({
  58535. selector: "testPass",
  58536. protocol: 'tests',
  58537. fn: function (){
  58538. var self=this;
  58539. return $core.withContext(function($ctx1) {
  58540. self["@flag"]="bad";
  58541. self._timeout_((10));
  58542. self["@flag"]=$recv(self._async_((function(){
  58543. return $core.withContext(function($ctx2) {
  58544. self._assert_(true);
  58545. self._finished();
  58546. self["@flag"]="ok";
  58547. return self["@flag"];
  58548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58549. })))._valueWithTimeout_((5));
  58550. return self;
  58551. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  58552. },
  58553. args: [],
  58554. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  58555. referencedClasses: [],
  58556. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  58557. }),
  58558. $globals.SUnitAsyncTest);
  58559. $core.addMethod(
  58560. $core.method({
  58561. selector: "testTimeouts",
  58562. protocol: 'tests',
  58563. fn: function (){
  58564. var self=this;
  58565. var suite,runner,result,assertBlock;
  58566. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  58567. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  58568. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  58569. return $core.withContext(function($ctx1) {
  58570. var $1,$2,$3;
  58571. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  58572. return $core.withContext(function($ctx2) {
  58573. return $recv(self._class())._selector_(each);
  58574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58575. }));
  58576. runner=$recv($TestSuiteRunner())._on_(suite);
  58577. self._timeout_((200));
  58578. result=$recv(runner)._result();
  58579. $ctx1.sendIdx["result"]=1;
  58580. assertBlock=self._async_((function(){
  58581. return $core.withContext(function($ctx2) {
  58582. $1=self._selectorSetOf_($recv(result)._errors());
  58583. $ctx2.sendIdx["selectorSetOf:"]=1;
  58584. self._assert_equals_($1,$recv($Set())._new());
  58585. $ctx2.sendIdx["assert:equals:"]=1;
  58586. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  58587. return self._finished();
  58588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58589. }));
  58590. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  58591. return $core.withContext(function($ctx2) {
  58592. $2=$recv($recv(ann)._result()).__eq_eq(result);
  58593. if($core.assert($2)){
  58594. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  58595. return $recv($3)._ifTrue_(assertBlock);
  58596. };
  58597. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  58598. }));
  58599. $recv(runner)._run();
  58600. return self;
  58601. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  58602. },
  58603. args: [],
  58604. 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",
  58605. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  58606. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  58607. }),
  58608. $globals.SUnitAsyncTest);
  58609. $core.addMethod(
  58610. $core.method({
  58611. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  58612. protocol: 'tests',
  58613. fn: function (){
  58614. var self=this;
  58615. var x;
  58616. return $core.withContext(function($ctx1) {
  58617. var $1;
  58618. self["@flag"]="bad";
  58619. self._timeout_((10));
  58620. x=(0);
  58621. $1=self._async_((function(){
  58622. return $core.withContext(function($ctx2) {
  58623. self._finished();
  58624. $ctx2.sendIdx["finished"]=1;
  58625. self["@flag"]="ok";
  58626. self["@flag"];
  58627. x=$recv(x).__plus((1));
  58628. $ctx2.sendIdx["+"]=1;
  58629. x;
  58630. return self._assert_equals_(x,(1));
  58631. $ctx2.sendIdx["assert:equals:"]=1;
  58632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58633. }));
  58634. $ctx1.sendIdx["async:"]=1;
  58635. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  58636. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58637. self["@flag"]=$recv(self._async_((function(){
  58638. return $core.withContext(function($ctx2) {
  58639. self._finished();
  58640. self["@flag"]="ok";
  58641. self["@flag"];
  58642. x=$recv(x).__plus((1));
  58643. x;
  58644. return self._assert_equals_(x,(1));
  58645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58646. })))._valueWithTimeout_((0));
  58647. return self;
  58648. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  58649. },
  58650. args: [],
  58651. 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.",
  58652. referencedClasses: [],
  58653. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  58654. }),
  58655. $globals.SUnitAsyncTest);
  58656. });
  58657. define('amber/devel',[
  58658. './helpers', // pre-fetch, dep of ./deploy
  58659. './deploy', // pre-fetch, dep of ./lang
  58660. './lang',
  58661. // --- packages of the development only Amber begin here ---
  58662. 'amber_core/SUnit',
  58663. 'amber_core/Compiler-Tests',
  58664. 'amber_core/Kernel-Tests',
  58665. 'amber_core/SUnit-Tests'
  58666. // --- packages of the development only Amber end here ---
  58667. ], function (amber) { return amber; });
  58668. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  58669. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  58670. $core.addPackage('AmberCli');
  58671. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  58672. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  58673. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  58674. $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.";
  58675. $core.addMethod(
  58676. $core.method({
  58677. selector: "commandLineSwitches",
  58678. protocol: 'commandline',
  58679. fn: function (){
  58680. var self=this;
  58681. var switches;
  58682. return $core.withContext(function($ctx1) {
  58683. var $1;
  58684. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  58685. return $core.withContext(function($ctx2) {
  58686. return $recv(each)._selector();
  58687. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58688. }));
  58689. $ctx1.sendIdx["collect:"]=1;
  58690. switches=$recv(switches)._select_((function(each){
  58691. return $core.withContext(function($ctx2) {
  58692. return $recv(each)._match_("^[^:]*:$");
  58693. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58694. }));
  58695. switches=$recv(switches)._collect_((function(each){
  58696. return $core.withContext(function($ctx2) {
  58697. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  58698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  58699. }));
  58700. $1=switches;
  58701. return $1;
  58702. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  58703. },
  58704. args: [],
  58705. 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",
  58706. referencedClasses: [],
  58707. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  58708. }),
  58709. $globals.AmberCli.klass);
  58710. $core.addMethod(
  58711. $core.method({
  58712. selector: "config:",
  58713. protocol: 'commands',
  58714. fn: function (args){
  58715. var self=this;
  58716. function $Configurator(){return $globals.Configurator||(typeof Configurator=="undefined"?nil:Configurator)}
  58717. return $core.withContext(function($ctx1) {
  58718. $recv($recv($Configurator())._new())._start();
  58719. return self;
  58720. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  58721. },
  58722. args: ["args"],
  58723. source: "config: args\x0a\x09Configurator new start",
  58724. referencedClasses: ["Configurator"],
  58725. messageSends: ["start", "new"]
  58726. }),
  58727. $globals.AmberCli.klass);
  58728. $core.addMethod(
  58729. $core.method({
  58730. selector: "handleArguments:",
  58731. protocol: 'commandline',
  58732. fn: function (args){
  58733. var self=this;
  58734. var selector;
  58735. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  58736. return $core.withContext(function($ctx1) {
  58737. var $1;
  58738. $1=$recv(args)._first();
  58739. $ctx1.sendIdx["first"]=1;
  58740. selector=self._selectorForCommandLineSwitch_($1);
  58741. $recv(args)._remove_($recv(args)._first());
  58742. self._perform_withArguments_(selector,$recv($Array())._with_(args));
  58743. return self;
  58744. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  58745. },
  58746. args: ["args"],
  58747. 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)",
  58748. referencedClasses: ["Array"],
  58749. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  58750. }),
  58751. $globals.AmberCli.klass);
  58752. $core.addMethod(
  58753. $core.method({
  58754. selector: "help:",
  58755. protocol: 'commands',
  58756. fn: function (args){
  58757. var self=this;
  58758. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  58759. return $core.withContext(function($ctx1) {
  58760. $recv($Transcript())._show_("Available commands");
  58761. $recv(self._commandLineSwitches())._do_((function(each){
  58762. return $core.withContext(function($ctx2) {
  58763. return $recv(console)._log_(each);
  58764. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58765. }));
  58766. return self;
  58767. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  58768. },
  58769. args: ["args"],
  58770. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  58771. referencedClasses: ["Transcript"],
  58772. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  58773. }),
  58774. $globals.AmberCli.klass);
  58775. $core.addMethod(
  58776. $core.method({
  58777. selector: "init:",
  58778. protocol: 'commands',
  58779. fn: function (args){
  58780. var self=this;
  58781. function $Initer(){return $globals.Initer||(typeof Initer=="undefined"?nil:Initer)}
  58782. return $core.withContext(function($ctx1) {
  58783. $recv($recv($Initer())._new())._start();
  58784. return self;
  58785. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  58786. },
  58787. args: ["args"],
  58788. source: "init: args\x0a\x09Initer new start",
  58789. referencedClasses: ["Initer"],
  58790. messageSends: ["start", "new"]
  58791. }),
  58792. $globals.AmberCli.klass);
  58793. $core.addMethod(
  58794. $core.method({
  58795. selector: "main",
  58796. protocol: 'startup',
  58797. fn: function (){
  58798. var self=this;
  58799. var args;
  58800. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  58801. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  58802. return $core.withContext(function($ctx1) {
  58803. var $3,$2,$1,$4,$5;
  58804. $3=$recv("Welcome to Amber version ".__comma($recv($Smalltalk())._version())).__comma(" (NodeJS ");
  58805. $ctx1.sendIdx[","]=3;
  58806. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  58807. $ctx1.sendIdx[","]=2;
  58808. $1=$recv($2).__comma(").");
  58809. $ctx1.sendIdx[","]=1;
  58810. $recv($Transcript())._show_($1);
  58811. args=$recv(process)._argv();
  58812. $recv(args)._removeFrom_to_((1),(2));
  58813. $4=$recv(args)._isEmpty();
  58814. if($core.assert($4)){
  58815. self._help_(nil);
  58816. } else {
  58817. $5=self._handleArguments_(args);
  58818. return $5;
  58819. };
  58820. return self;
  58821. }, function($ctx1) {$ctx1.fill(self,"main",{args:args},$globals.AmberCli.klass)});
  58822. },
  58823. args: [],
  58824. 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]",
  58825. referencedClasses: ["Transcript", "Smalltalk"],
  58826. messageSends: ["show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
  58827. }),
  58828. $globals.AmberCli.klass);
  58829. $core.addMethod(
  58830. $core.method({
  58831. selector: "repl:",
  58832. protocol: 'commands',
  58833. fn: function (args){
  58834. var self=this;
  58835. function $Repl(){return $globals.Repl||(typeof Repl=="undefined"?nil:Repl)}
  58836. return $core.withContext(function($ctx1) {
  58837. var $1;
  58838. $1=$recv($recv($Repl())._new())._createInterface();
  58839. return $1;
  58840. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  58841. },
  58842. args: ["args"],
  58843. source: "repl: args\x0a\x09^ Repl new createInterface",
  58844. referencedClasses: ["Repl"],
  58845. messageSends: ["createInterface", "new"]
  58846. }),
  58847. $globals.AmberCli.klass);
  58848. $core.addMethod(
  58849. $core.method({
  58850. selector: "selectorForCommandLineSwitch:",
  58851. protocol: 'commandline',
  58852. fn: function (aSwitch){
  58853. var self=this;
  58854. var command,selector;
  58855. return $core.withContext(function($ctx1) {
  58856. var $1,$2;
  58857. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  58858. if($core.assert($1)){
  58859. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  58860. return $core.withContext(function($ctx2) {
  58861. return $recv($recv(each)._second())._asUppercase();
  58862. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58863. }))).__comma(":");
  58864. selector;
  58865. } else {
  58866. selector="help:";
  58867. selector;
  58868. };
  58869. $2=selector;
  58870. return $2;
  58871. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  58872. },
  58873. args: ["aSwitch"],
  58874. 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",
  58875. referencedClasses: [],
  58876. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  58877. }),
  58878. $globals.AmberCli.klass);
  58879. $core.addMethod(
  58880. $core.method({
  58881. selector: "serve:",
  58882. protocol: 'commands',
  58883. fn: function (args){
  58884. var self=this;
  58885. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  58886. return $core.withContext(function($ctx1) {
  58887. var $1;
  58888. $1=$recv($recv($FileServer())._createServerWithArguments_(args))._start();
  58889. return $1;
  58890. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  58891. },
  58892. args: ["args"],
  58893. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  58894. referencedClasses: ["FileServer"],
  58895. messageSends: ["start", "createServerWithArguments:"]
  58896. }),
  58897. $globals.AmberCli.klass);
  58898. $core.addMethod(
  58899. $core.method({
  58900. selector: "version:",
  58901. protocol: 'commands',
  58902. fn: function (arguments_){
  58903. var self=this;
  58904. return self;
  58905. },
  58906. args: ["arguments"],
  58907. source: "version: arguments",
  58908. referencedClasses: [],
  58909. messageSends: []
  58910. }),
  58911. $globals.AmberCli.klass);
  58912. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  58913. $core.addMethod(
  58914. $core.method({
  58915. selector: "dirname",
  58916. protocol: 'private',
  58917. fn: function (){
  58918. var self=this;
  58919. return $core.withContext(function($ctx1) {
  58920. return __dirname;
  58921. return self;
  58922. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  58923. },
  58924. args: [],
  58925. source: "dirname\x0a\x09<return __dirname>",
  58926. referencedClasses: [],
  58927. messageSends: []
  58928. }),
  58929. $globals.BaseFileManipulator);
  58930. $core.addMethod(
  58931. $core.method({
  58932. selector: "initialize",
  58933. protocol: 'initialization',
  58934. fn: function (){
  58935. var self=this;
  58936. return $core.withContext(function($ctx1) {
  58937. (
  58938. $ctx1.supercall = true,
  58939. $globals.BaseFileManipulator.superclass.fn.prototype._initialize.apply($recv(self), []));
  58940. $ctx1.supercall = false;
  58941. self["@path"]=$recv(require)._value_("path");
  58942. $ctx1.sendIdx["value:"]=1;
  58943. self["@fs"]=$recv(require)._value_("fs");
  58944. return self;
  58945. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  58946. },
  58947. args: [],
  58948. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  58949. referencedClasses: [],
  58950. messageSends: ["initialize", "value:"]
  58951. }),
  58952. $globals.BaseFileManipulator);
  58953. $core.addMethod(
  58954. $core.method({
  58955. selector: "rootDirname",
  58956. protocol: 'private',
  58957. fn: function (){
  58958. var self=this;
  58959. return $core.withContext(function($ctx1) {
  58960. var $1;
  58961. $1=$recv(self["@path"])._join_with_(self._dirname(),"..");
  58962. return $1;
  58963. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  58964. },
  58965. args: [],
  58966. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  58967. referencedClasses: [],
  58968. messageSends: ["join:with:", "dirname"]
  58969. }),
  58970. $globals.BaseFileManipulator);
  58971. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  58972. $core.addMethod(
  58973. $core.method({
  58974. selector: "initialize",
  58975. protocol: 'initialization',
  58976. fn: function (){
  58977. var self=this;
  58978. return $core.withContext(function($ctx1) {
  58979. (
  58980. $ctx1.supercall = true,
  58981. $globals.Configurator.superclass.fn.prototype._initialize.apply($recv(self), []));
  58982. $ctx1.supercall = false;
  58983. return self;
  58984. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  58985. },
  58986. args: [],
  58987. source: "initialize\x0a\x09super initialize",
  58988. referencedClasses: [],
  58989. messageSends: ["initialize"]
  58990. }),
  58991. $globals.Configurator);
  58992. $core.addMethod(
  58993. $core.method({
  58994. selector: "start",
  58995. protocol: 'action',
  58996. fn: function (){
  58997. var self=this;
  58998. return $core.withContext(function($ctx1) {
  58999. var $receiver;
  59000. self._writeConfigThenDo_((function(err){
  59001. return $core.withContext(function($ctx2) {
  59002. if(($receiver = err) == null || $receiver.isNil){
  59003. return $recv(process)._exit();
  59004. } else {
  59005. return $recv(process)._exit_((111));
  59006. };
  59007. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  59008. }));
  59009. return self;
  59010. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  59011. },
  59012. args: [],
  59013. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  59014. referencedClasses: [],
  59015. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  59016. }),
  59017. $globals.Configurator);
  59018. $core.addMethod(
  59019. $core.method({
  59020. selector: "writeConfigThenDo:",
  59021. protocol: 'action',
  59022. fn: function (aBlock){
  59023. var self=this;
  59024. return $core.withContext(function($ctx1) {
  59025. $recv($recv(require)._value_("amber-dev/lib/config"))._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  59026. return self;
  59027. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  59028. },
  59029. args: ["aBlock"],
  59030. 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",
  59031. referencedClasses: [],
  59032. messageSends: ["writeConfig:toFile:thenDo:", "value:", "cwd"]
  59033. }),
  59034. $globals.Configurator);
  59035. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  59036. $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.";
  59037. $core.addMethod(
  59038. $core.method({
  59039. selector: "base64Decode:",
  59040. protocol: 'private',
  59041. fn: function (aString){
  59042. var self=this;
  59043. return $core.withContext(function($ctx1) {
  59044. return (new Buffer(aString, 'base64').toString());
  59045. return self;
  59046. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  59047. },
  59048. args: ["aString"],
  59049. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  59050. referencedClasses: [],
  59051. messageSends: []
  59052. }),
  59053. $globals.FileServer);
  59054. $core.addMethod(
  59055. $core.method({
  59056. selector: "basePath",
  59057. protocol: 'accessing',
  59058. fn: function (){
  59059. var self=this;
  59060. return $core.withContext(function($ctx1) {
  59061. var $2,$1,$receiver;
  59062. $2=self["@basePath"];
  59063. if(($receiver = $2) == null || $receiver.isNil){
  59064. $1=$recv(self._class())._defaultBasePath();
  59065. } else {
  59066. $1=$2;
  59067. };
  59068. return $1;
  59069. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  59070. },
  59071. args: [],
  59072. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  59073. referencedClasses: [],
  59074. messageSends: ["ifNil:", "defaultBasePath", "class"]
  59075. }),
  59076. $globals.FileServer);
  59077. $core.addMethod(
  59078. $core.method({
  59079. selector: "basePath:",
  59080. protocol: 'accessing',
  59081. fn: function (aString){
  59082. var self=this;
  59083. return $core.withContext(function($ctx1) {
  59084. self["@basePath"]=aString;
  59085. self._validateBasePath();
  59086. return self;
  59087. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  59088. },
  59089. args: ["aString"],
  59090. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  59091. referencedClasses: [],
  59092. messageSends: ["validateBasePath"]
  59093. }),
  59094. $globals.FileServer);
  59095. $core.addMethod(
  59096. $core.method({
  59097. selector: "checkDirectoryLayout",
  59098. protocol: 'initialization',
  59099. fn: function (){
  59100. var self=this;
  59101. return $core.withContext(function($ctx1) {
  59102. var $1;
  59103. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  59104. if(!$core.assert($1)){
  59105. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  59106. $ctx1.sendIdx["warn:"]=1;
  59107. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  59108. $ctx1.sendIdx["warn:"]=2;
  59109. $recv(console)._warn_(" You can also specify a page to be served by default,");
  59110. $ctx1.sendIdx["warn:"]=3;
  59111. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  59112. };
  59113. return self;
  59114. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  59115. },
  59116. args: [],
  59117. 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.'].",
  59118. referencedClasses: [],
  59119. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  59120. }),
  59121. $globals.FileServer);
  59122. $core.addMethod(
  59123. $core.method({
  59124. selector: "fallbackPage",
  59125. protocol: 'accessing',
  59126. fn: function (){
  59127. var self=this;
  59128. var $1;
  59129. $1=self["@fallbackPage"];
  59130. return $1;
  59131. },
  59132. args: [],
  59133. source: "fallbackPage\x0a\x09^ fallbackPage",
  59134. referencedClasses: [],
  59135. messageSends: []
  59136. }),
  59137. $globals.FileServer);
  59138. $core.addMethod(
  59139. $core.method({
  59140. selector: "fallbackPage:",
  59141. protocol: 'accessing',
  59142. fn: function (aString){
  59143. var self=this;
  59144. self["@fallbackPage"]=aString;
  59145. return self;
  59146. },
  59147. args: ["aString"],
  59148. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  59149. referencedClasses: [],
  59150. messageSends: []
  59151. }),
  59152. $globals.FileServer);
  59153. $core.addMethod(
  59154. $core.method({
  59155. selector: "handleGETRequest:respondTo:",
  59156. protocol: 'request handling',
  59157. fn: function (aRequest,aResponse){
  59158. var self=this;
  59159. var uri,filename;
  59160. return $core.withContext(function($ctx1) {
  59161. var $1;
  59162. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  59163. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  59164. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  59165. return $core.withContext(function($ctx2) {
  59166. if($core.assert(aBoolean)){
  59167. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  59168. if($core.assert($1)){
  59169. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  59170. } else {
  59171. return self._respondFileNamed_to_(filename,aResponse);
  59172. };
  59173. } else {
  59174. return self._respondNotFoundTo_(aResponse);
  59175. };
  59176. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  59177. }));
  59178. return self;
  59179. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  59180. },
  59181. args: ["aRequest", "aResponse"],
  59182. 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]]]",
  59183. referencedClasses: [],
  59184. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  59185. }),
  59186. $globals.FileServer);
  59187. $core.addMethod(
  59188. $core.method({
  59189. selector: "handleOPTIONSRequest:respondTo:",
  59190. protocol: 'request handling',
  59191. fn: function (aRequest,aResponse){
  59192. var self=this;
  59193. return $core.withContext(function($ctx1) {
  59194. $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)]));
  59195. $recv(aResponse)._end();
  59196. return self;
  59197. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  59198. },
  59199. args: ["aRequest", "aResponse"],
  59200. 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",
  59201. referencedClasses: [],
  59202. messageSends: ["writeHead:options:", "end"]
  59203. }),
  59204. $globals.FileServer);
  59205. $core.addMethod(
  59206. $core.method({
  59207. selector: "handlePUTRequest:respondTo:",
  59208. protocol: 'request handling',
  59209. fn: function (aRequest,aResponse){
  59210. var self=this;
  59211. var file,stream;
  59212. return $core.withContext(function($ctx1) {
  59213. var $1,$2,$3,$4;
  59214. $1=self._isAuthenticated_(aRequest);
  59215. if(!$core.assert($1)){
  59216. self._respondAuthenticationRequiredTo_(aResponse);
  59217. return nil;
  59218. };
  59219. file=".".__comma($recv(aRequest)._url());
  59220. $ctx1.sendIdx[","]=1;
  59221. stream=$recv(self["@fs"])._createWriteStream_(file);
  59222. $recv(stream)._on_do_("error",(function(error){
  59223. return $core.withContext(function($ctx2) {
  59224. $2=console;
  59225. $3="Error creating WriteStream for file ".__comma(file);
  59226. $ctx2.sendIdx[","]=2;
  59227. $recv($2)._warn_($3);
  59228. $ctx2.sendIdx["warn:"]=1;
  59229. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  59230. $ctx2.sendIdx["warn:"]=2;
  59231. $recv(console)._warn_(" The exact error is: ".__comma(error));
  59232. return self._respondNotCreatedTo_(aResponse);
  59233. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  59234. }));
  59235. $ctx1.sendIdx["on:do:"]=1;
  59236. $recv(stream)._on_do_("close",(function(){
  59237. return $core.withContext(function($ctx2) {
  59238. return self._respondCreatedTo_(aResponse);
  59239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59240. }));
  59241. $ctx1.sendIdx["on:do:"]=2;
  59242. $recv(aRequest)._setEncoding_("utf8");
  59243. $recv(aRequest)._on_do_("data",(function(data){
  59244. return $core.withContext(function($ctx2) {
  59245. return $recv(stream)._write_(data);
  59246. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  59247. }));
  59248. $ctx1.sendIdx["on:do:"]=3;
  59249. $recv(aRequest)._on_do_("end",(function(){
  59250. return $core.withContext(function($ctx2) {
  59251. $4=$recv(stream)._writable();
  59252. if($core.assert($4)){
  59253. return $recv(stream)._end();
  59254. };
  59255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  59256. }));
  59257. return self;
  59258. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  59259. },
  59260. args: ["aRequest", "aResponse"],
  59261. 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]]",
  59262. referencedClasses: [],
  59263. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  59264. }),
  59265. $globals.FileServer);
  59266. $core.addMethod(
  59267. $core.method({
  59268. selector: "handleRequest:respondTo:",
  59269. protocol: 'request handling',
  59270. fn: function (aRequest,aResponse){
  59271. var self=this;
  59272. return $core.withContext(function($ctx1) {
  59273. var $2,$1,$4,$3,$5;
  59274. $2=$recv(aRequest)._method();
  59275. $ctx1.sendIdx["method"]=1;
  59276. $1=$recv($2).__eq("PUT");
  59277. $ctx1.sendIdx["="]=1;
  59278. if($core.assert($1)){
  59279. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  59280. };
  59281. $4=$recv(aRequest)._method();
  59282. $ctx1.sendIdx["method"]=2;
  59283. $3=$recv($4).__eq("GET");
  59284. $ctx1.sendIdx["="]=2;
  59285. if($core.assert($3)){
  59286. self._handleGETRequest_respondTo_(aRequest,aResponse);
  59287. };
  59288. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  59289. if($core.assert($5)){
  59290. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  59291. };
  59292. return self;
  59293. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  59294. },
  59295. args: ["aRequest", "aResponse"],
  59296. 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]",
  59297. referencedClasses: [],
  59298. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  59299. }),
  59300. $globals.FileServer);
  59301. $core.addMethod(
  59302. $core.method({
  59303. selector: "host",
  59304. protocol: 'accessing',
  59305. fn: function (){
  59306. var self=this;
  59307. var $1;
  59308. $1=self["@host"];
  59309. return $1;
  59310. },
  59311. args: [],
  59312. source: "host\x0a\x09^ host",
  59313. referencedClasses: [],
  59314. messageSends: []
  59315. }),
  59316. $globals.FileServer);
  59317. $core.addMethod(
  59318. $core.method({
  59319. selector: "host:",
  59320. protocol: 'accessing',
  59321. fn: function (hostname){
  59322. var self=this;
  59323. self["@host"]=hostname;
  59324. return self;
  59325. },
  59326. args: ["hostname"],
  59327. source: "host: hostname\x0a\x09host := hostname",
  59328. referencedClasses: [],
  59329. messageSends: []
  59330. }),
  59331. $globals.FileServer);
  59332. $core.addMethod(
  59333. $core.method({
  59334. selector: "initialize",
  59335. protocol: 'initialization',
  59336. fn: function (){
  59337. var self=this;
  59338. return $core.withContext(function($ctx1) {
  59339. var $1;
  59340. (
  59341. $ctx1.supercall = true,
  59342. $globals.FileServer.superclass.fn.prototype._initialize.apply($recv(self), []));
  59343. $ctx1.supercall = false;
  59344. self["@http"]=self._require_("http");
  59345. $ctx1.sendIdx["require:"]=1;
  59346. self["@util"]=self._require_("util");
  59347. $ctx1.sendIdx["require:"]=2;
  59348. self["@url"]=self._require_("url");
  59349. $1=self._class();
  59350. $ctx1.sendIdx["class"]=1;
  59351. self["@host"]=$recv($1)._defaultHost();
  59352. self["@port"]=$recv(self._class())._defaultPort();
  59353. self["@username"]=nil;
  59354. self["@password"]=nil;
  59355. self["@fallbackPage"]=nil;
  59356. return self;
  59357. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  59358. },
  59359. args: [],
  59360. 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.",
  59361. referencedClasses: [],
  59362. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  59363. }),
  59364. $globals.FileServer);
  59365. $core.addMethod(
  59366. $core.method({
  59367. selector: "isAuthenticated:",
  59368. protocol: 'private',
  59369. fn: function (aRequest){
  59370. var self=this;
  59371. var header,token,auth,parts;
  59372. return $core.withContext(function($ctx1) {
  59373. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  59374. $2=$recv(self["@username"])._isNil();
  59375. $ctx1.sendIdx["isNil"]=1;
  59376. $1=$recv($2)._and_((function(){
  59377. return $core.withContext(function($ctx2) {
  59378. return $recv(self["@password"])._isNil();
  59379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59380. }));
  59381. $ctx1.sendIdx["and:"]=1;
  59382. if($core.assert($1)){
  59383. return true;
  59384. };
  59385. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  59386. $ctx1.sendIdx["at:"]=1;
  59387. if(($receiver = $3) == null || $receiver.isNil){
  59388. header="";
  59389. } else {
  59390. header=$3;
  59391. };
  59392. $4=$recv(header)._isEmpty();
  59393. if($core.assert($4)){
  59394. return false;
  59395. } else {
  59396. $5=$recv(header)._tokenize_(" ");
  59397. $ctx1.sendIdx["tokenize:"]=1;
  59398. if(($receiver = $5) == null || $receiver.isNil){
  59399. token="";
  59400. } else {
  59401. token=$5;
  59402. };
  59403. token;
  59404. $6=$recv(token)._at_((2));
  59405. $ctx1.sendIdx["at:"]=2;
  59406. auth=self._base64Decode_($6);
  59407. auth;
  59408. parts=$recv(auth)._tokenize_(":");
  59409. parts;
  59410. $9=self["@username"];
  59411. $10=$recv(parts)._at_((1));
  59412. $ctx1.sendIdx["at:"]=3;
  59413. $8=$recv($9).__eq($10);
  59414. $ctx1.sendIdx["="]=1;
  59415. $7=$recv($8)._and_((function(){
  59416. return $core.withContext(function($ctx2) {
  59417. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  59418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  59419. }));
  59420. if($core.assert($7)){
  59421. return true;
  59422. } else {
  59423. return false;
  59424. };
  59425. };
  59426. return self;
  59427. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  59428. },
  59429. args: ["aRequest"],
  59430. 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].",
  59431. referencedClasses: [],
  59432. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
  59433. }),
  59434. $globals.FileServer);
  59435. $core.addMethod(
  59436. $core.method({
  59437. selector: "password:",
  59438. protocol: 'accessing',
  59439. fn: function (aPassword){
  59440. var self=this;
  59441. self["@password"]=aPassword;
  59442. return self;
  59443. },
  59444. args: ["aPassword"],
  59445. source: "password: aPassword\x0a\x09password := aPassword.",
  59446. referencedClasses: [],
  59447. messageSends: []
  59448. }),
  59449. $globals.FileServer);
  59450. $core.addMethod(
  59451. $core.method({
  59452. selector: "port",
  59453. protocol: 'accessing',
  59454. fn: function (){
  59455. var self=this;
  59456. var $1;
  59457. $1=self["@port"];
  59458. return $1;
  59459. },
  59460. args: [],
  59461. source: "port\x0a\x09^ port",
  59462. referencedClasses: [],
  59463. messageSends: []
  59464. }),
  59465. $globals.FileServer);
  59466. $core.addMethod(
  59467. $core.method({
  59468. selector: "port:",
  59469. protocol: 'accessing',
  59470. fn: function (aNumber){
  59471. var self=this;
  59472. self["@port"]=aNumber;
  59473. return self;
  59474. },
  59475. args: ["aNumber"],
  59476. source: "port: aNumber\x0a\x09port := aNumber",
  59477. referencedClasses: [],
  59478. messageSends: []
  59479. }),
  59480. $globals.FileServer);
  59481. $core.addMethod(
  59482. $core.method({
  59483. selector: "require:",
  59484. protocol: 'private',
  59485. fn: function (aModuleString){
  59486. var self=this;
  59487. return $core.withContext(function($ctx1) {
  59488. var $1;
  59489. $1=$recv(require)._value_(aModuleString);
  59490. return $1;
  59491. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  59492. },
  59493. args: ["aModuleString"],
  59494. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  59495. referencedClasses: [],
  59496. messageSends: ["value:"]
  59497. }),
  59498. $globals.FileServer);
  59499. $core.addMethod(
  59500. $core.method({
  59501. selector: "respondAuthenticationRequiredTo:",
  59502. protocol: 'request handling',
  59503. fn: function (aResponse){
  59504. var self=this;
  59505. return $core.withContext(function($ctx1) {
  59506. var $1;
  59507. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  59508. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  59509. $1=$recv(aResponse)._end();
  59510. return self;
  59511. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  59512. },
  59513. args: ["aResponse"],
  59514. 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.",
  59515. referencedClasses: [],
  59516. messageSends: ["writeHead:options:", "write:", "end"]
  59517. }),
  59518. $globals.FileServer);
  59519. $core.addMethod(
  59520. $core.method({
  59521. selector: "respondCreatedTo:",
  59522. protocol: 'request handling',
  59523. fn: function (aResponse){
  59524. var self=this;
  59525. return $core.withContext(function($ctx1) {
  59526. var $1;
  59527. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  59528. $1=$recv(aResponse)._end();
  59529. return self;
  59530. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  59531. },
  59532. args: ["aResponse"],
  59533. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  59534. referencedClasses: [],
  59535. messageSends: ["writeHead:options:", "end"]
  59536. }),
  59537. $globals.FileServer);
  59538. $core.addMethod(
  59539. $core.method({
  59540. selector: "respondDirectoryNamed:from:to:",
  59541. protocol: 'request handling',
  59542. fn: function (aDirname,aUrl,aResponse){
  59543. var self=this;
  59544. return $core.withContext(function($ctx1) {
  59545. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  59546. $2=$recv(aUrl)._pathname();
  59547. $ctx1.sendIdx["pathname"]=1;
  59548. $1=$recv($2)._endsWith_("/");
  59549. if($core.assert($1)){
  59550. $3=$recv(aDirname).__comma("index.html");
  59551. $ctx1.sendIdx[","]=1;
  59552. self._respondFileNamed_to_($3,aResponse);
  59553. } else {
  59554. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  59555. $7=$recv(aUrl)._search();
  59556. if(($receiver = $7) == null || $receiver.isNil){
  59557. $6="";
  59558. } else {
  59559. $6=$7;
  59560. };
  59561. $4=$recv($5).__comma($6);
  59562. $ctx1.sendIdx[","]=2;
  59563. self._respondRedirect_to_($4,aResponse);
  59564. };
  59565. return self;
  59566. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  59567. },
  59568. args: ["aDirname", "aUrl", "aResponse"],
  59569. 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]",
  59570. referencedClasses: [],
  59571. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  59572. }),
  59573. $globals.FileServer);
  59574. $core.addMethod(
  59575. $core.method({
  59576. selector: "respondFileNamed:to:",
  59577. protocol: 'request handling',
  59578. fn: function (aFilename,aResponse){
  59579. var self=this;
  59580. var type,filename;
  59581. return $core.withContext(function($ctx1) {
  59582. var $1,$2,$3,$4,$5;
  59583. filename=aFilename;
  59584. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  59585. return $core.withContext(function($ctx2) {
  59586. $1=$recv(ex)._notNil();
  59587. if($core.assert($1)){
  59588. $2=console;
  59589. $3=$recv(filename).__comma(" does not exist");
  59590. $ctx2.sendIdx[","]=1;
  59591. $recv($2)._log_($3);
  59592. return self._respondNotFoundTo_(aResponse);
  59593. } else {
  59594. type=$recv(self._class())._mimeTypeFor_(filename);
  59595. type;
  59596. $4=$recv(type).__eq("application/javascript");
  59597. if($core.assert($4)){
  59598. type=$recv(type).__comma(";charset=utf-8");
  59599. type;
  59600. };
  59601. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  59602. $recv(aResponse)._write_encoding_(file,"binary");
  59603. $5=$recv(aResponse)._end();
  59604. return $5;
  59605. };
  59606. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  59607. }));
  59608. return self;
  59609. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  59610. },
  59611. args: ["aFilename", "aResponse"],
  59612. 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]]",
  59613. referencedClasses: [],
  59614. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  59615. }),
  59616. $globals.FileServer);
  59617. $core.addMethod(
  59618. $core.method({
  59619. selector: "respondInternalErrorTo:",
  59620. protocol: 'request handling',
  59621. fn: function (aResponse){
  59622. var self=this;
  59623. return $core.withContext(function($ctx1) {
  59624. var $1;
  59625. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  59626. $recv(aResponse)._write_("500 Internal server error");
  59627. $1=$recv(aResponse)._end();
  59628. return self;
  59629. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  59630. },
  59631. args: ["aResponse"],
  59632. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  59633. referencedClasses: [],
  59634. messageSends: ["writeHead:options:", "write:", "end"]
  59635. }),
  59636. $globals.FileServer);
  59637. $core.addMethod(
  59638. $core.method({
  59639. selector: "respondNotCreatedTo:",
  59640. protocol: 'request handling',
  59641. fn: function (aResponse){
  59642. var self=this;
  59643. return $core.withContext(function($ctx1) {
  59644. var $1;
  59645. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  59646. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  59647. $1=$recv(aResponse)._end();
  59648. return self;
  59649. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  59650. },
  59651. args: ["aResponse"],
  59652. 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.",
  59653. referencedClasses: [],
  59654. messageSends: ["writeHead:options:", "write:", "end"]
  59655. }),
  59656. $globals.FileServer);
  59657. $core.addMethod(
  59658. $core.method({
  59659. selector: "respondNotFoundTo:",
  59660. protocol: 'request handling',
  59661. fn: function (aResponse){
  59662. var self=this;
  59663. return $core.withContext(function($ctx1) {
  59664. var $2,$1,$3,$4;
  59665. $2=self._fallbackPage();
  59666. $ctx1.sendIdx["fallbackPage"]=1;
  59667. $1=$recv($2)._isNil();
  59668. if(!$core.assert($1)){
  59669. $3=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  59670. return $3;
  59671. };
  59672. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  59673. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  59674. $ctx1.sendIdx["write:"]=1;
  59675. $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>");
  59676. $ctx1.sendIdx["write:"]=2;
  59677. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  59678. $ctx1.sendIdx["write:"]=3;
  59679. $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>");
  59680. $ctx1.sendIdx["write:"]=4;
  59681. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  59682. $ctx1.sendIdx["write:"]=5;
  59683. $recv(aResponse)._write_("</ul></p></body></html>");
  59684. $4=$recv(aResponse)._end();
  59685. return self;
  59686. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  59687. },
  59688. args: ["aResponse"],
  59689. 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",
  59690. referencedClasses: [],
  59691. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  59692. }),
  59693. $globals.FileServer);
  59694. $core.addMethod(
  59695. $core.method({
  59696. selector: "respondOKTo:",
  59697. protocol: 'request handling',
  59698. fn: function (aResponse){
  59699. var self=this;
  59700. return $core.withContext(function($ctx1) {
  59701. var $1;
  59702. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  59703. $1=$recv(aResponse)._end();
  59704. return self;
  59705. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  59706. },
  59707. args: ["aResponse"],
  59708. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  59709. referencedClasses: [],
  59710. messageSends: ["writeHead:options:", "end"]
  59711. }),
  59712. $globals.FileServer);
  59713. $core.addMethod(
  59714. $core.method({
  59715. selector: "respondRedirect:to:",
  59716. protocol: 'request handling',
  59717. fn: function (aString,aResponse){
  59718. var self=this;
  59719. return $core.withContext(function($ctx1) {
  59720. var $1;
  59721. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  59722. $1=$recv(aResponse)._end();
  59723. return self;
  59724. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  59725. },
  59726. args: ["aString", "aResponse"],
  59727. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  59728. referencedClasses: [],
  59729. messageSends: ["writeHead:options:", "end"]
  59730. }),
  59731. $globals.FileServer);
  59732. $core.addMethod(
  59733. $core.method({
  59734. selector: "start",
  59735. protocol: 'starting',
  59736. fn: function (){
  59737. var self=this;
  59738. return $core.withContext(function($ctx1) {
  59739. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$11;
  59740. self._checkDirectoryLayout();
  59741. $1=$recv(self["@http"])._createServer_((function(request,response){
  59742. return $core.withContext(function($ctx2) {
  59743. return self._handleRequest_respondTo_(request,response);
  59744. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  59745. }));
  59746. $recv($1)._on_do_("error",(function(error){
  59747. return $core.withContext(function($ctx2) {
  59748. $2=console;
  59749. $3="Error starting server: ".__comma(error);
  59750. $ctx2.sendIdx[","]=1;
  59751. return $recv($2)._log_($3);
  59752. $ctx2.sendIdx["log:"]=1;
  59753. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  59754. }));
  59755. $ctx1.sendIdx["on:do:"]=1;
  59756. $recv($1)._on_do_("listening",(function(){
  59757. return $core.withContext(function($ctx2) {
  59758. $4=console;
  59759. $8=self._host();
  59760. $ctx2.sendIdx["host"]=1;
  59761. $7="Starting file server on http://".__comma($8);
  59762. $6=$recv($7).__comma(":");
  59763. $ctx2.sendIdx[","]=3;
  59764. $10=self._port();
  59765. $ctx2.sendIdx["port"]=1;
  59766. $9=$recv($10)._asString();
  59767. $5=$recv($6).__comma($9);
  59768. $ctx2.sendIdx[","]=2;
  59769. return $recv($4)._log_($5);
  59770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59771. }));
  59772. $11=$recv($1)._listen_host_(self._port(),self._host());
  59773. return self;
  59774. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  59775. },
  59776. args: [],
  59777. 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.",
  59778. referencedClasses: [],
  59779. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  59780. }),
  59781. $globals.FileServer);
  59782. $core.addMethod(
  59783. $core.method({
  59784. selector: "startOn:",
  59785. protocol: 'starting',
  59786. fn: function (aPort){
  59787. var self=this;
  59788. return $core.withContext(function($ctx1) {
  59789. self._port_(aPort);
  59790. self._start();
  59791. return self;
  59792. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  59793. },
  59794. args: ["aPort"],
  59795. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  59796. referencedClasses: [],
  59797. messageSends: ["port:", "start"]
  59798. }),
  59799. $globals.FileServer);
  59800. $core.addMethod(
  59801. $core.method({
  59802. selector: "username:",
  59803. protocol: 'accessing',
  59804. fn: function (aUsername){
  59805. var self=this;
  59806. self["@username"]=aUsername;
  59807. return self;
  59808. },
  59809. args: ["aUsername"],
  59810. source: "username: aUsername\x0a\x09username := aUsername.",
  59811. referencedClasses: [],
  59812. messageSends: []
  59813. }),
  59814. $globals.FileServer);
  59815. $core.addMethod(
  59816. $core.method({
  59817. selector: "validateBasePath",
  59818. protocol: 'private',
  59819. fn: function (){
  59820. var self=this;
  59821. return $core.withContext(function($ctx1) {
  59822. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  59823. $1=self["@fs"];
  59824. $2=self._basePath();
  59825. $ctx1.sendIdx["basePath"]=1;
  59826. $recv($1)._stat_then_($2,(function(err,stat){
  59827. return $core.withContext(function($ctx2) {
  59828. if(($receiver = err) == null || $receiver.isNil){
  59829. $3=$recv(stat)._isDirectory();
  59830. if(!$core.assert($3)){
  59831. $4=console;
  59832. $7=self._basePath();
  59833. $ctx2.sendIdx["basePath"]=2;
  59834. $6="Warning: --base-path parameter ".__comma($7);
  59835. $ctx2.sendIdx[","]=2;
  59836. $5=$recv($6).__comma(" is not a directory.");
  59837. $ctx2.sendIdx[","]=1;
  59838. return $recv($4)._warn_($5);
  59839. $ctx2.sendIdx["warn:"]=1;
  59840. };
  59841. } else {
  59842. $8=console;
  59843. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  59844. $ctx2.sendIdx[","]=3;
  59845. return $recv($8)._warn_($9);
  59846. };
  59847. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  59848. }));
  59849. return self;
  59850. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  59851. },
  59852. args: [],
  59853. 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.' ]].",
  59854. referencedClasses: [],
  59855. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  59856. }),
  59857. $globals.FileServer);
  59858. $core.addMethod(
  59859. $core.method({
  59860. selector: "withBasePath:",
  59861. protocol: 'private',
  59862. fn: function (aBaseRelativePath){
  59863. var self=this;
  59864. return $core.withContext(function($ctx1) {
  59865. var $1;
  59866. $1=$recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  59867. return $1;
  59868. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  59869. },
  59870. args: ["aBaseRelativePath"],
  59871. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  59872. referencedClasses: [],
  59873. messageSends: ["join:with:", "basePath"]
  59874. }),
  59875. $globals.FileServer);
  59876. $core.addMethod(
  59877. $core.method({
  59878. selector: "writeData:toFileNamed:",
  59879. protocol: 'private',
  59880. fn: function (data,aFilename){
  59881. var self=this;
  59882. return $core.withContext(function($ctx1) {
  59883. $recv(console)._log_(aFilename);
  59884. return self;
  59885. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  59886. },
  59887. args: ["data", "aFilename"],
  59888. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  59889. referencedClasses: [],
  59890. messageSends: ["log:"]
  59891. }),
  59892. $globals.FileServer);
  59893. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  59894. $core.addMethod(
  59895. $core.method({
  59896. selector: "commandLineSwitches",
  59897. protocol: 'accessing',
  59898. fn: function (){
  59899. var self=this;
  59900. var switches;
  59901. return $core.withContext(function($ctx1) {
  59902. var $1;
  59903. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  59904. return $core.withContext(function($ctx2) {
  59905. return $recv(each)._selector();
  59906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59907. }));
  59908. $ctx1.sendIdx["collect:"]=1;
  59909. switches=$recv(switches)._select_((function(each){
  59910. return $core.withContext(function($ctx2) {
  59911. return $recv(each)._match_("^[^:]*:$");
  59912. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  59913. }));
  59914. switches=$recv(switches)._collect_((function(each){
  59915. return $core.withContext(function($ctx2) {
  59916. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  59917. $ctx2.sendIdx["replace:with:"]=1;
  59918. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  59919. }));
  59920. $1=switches;
  59921. return $1;
  59922. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  59923. },
  59924. args: [],
  59925. 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",
  59926. referencedClasses: [],
  59927. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  59928. }),
  59929. $globals.FileServer.klass);
  59930. $core.addMethod(
  59931. $core.method({
  59932. selector: "createServerWithArguments:",
  59933. protocol: 'initialization',
  59934. fn: function (options){
  59935. var self=this;
  59936. var server,popFront,front,optionName,optionValue,switches;
  59937. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  59938. return $core.withContext(function($ctx1) {
  59939. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11;
  59940. var $early={};
  59941. try {
  59942. switches=self._commandLineSwitches();
  59943. server=self._new();
  59944. $recv(options)._ifEmpty_((function(){
  59945. $1=server;
  59946. throw $early=[$1];
  59947. }));
  59948. $2=$recv($recv(options)._size())._even();
  59949. if(!$core.assert($2)){
  59950. $recv(console)._log_("Using default parameters.");
  59951. $ctx1.sendIdx["log:"]=1;
  59952. $3=console;
  59953. $4="Wrong commandline options or not enough arguments for: ".__comma(options);
  59954. $ctx1.sendIdx[","]=1;
  59955. $recv($3)._log_($4);
  59956. $ctx1.sendIdx["log:"]=2;
  59957. $5=console;
  59958. $6="Use any of the following ones: ".__comma(switches);
  59959. $ctx1.sendIdx[","]=2;
  59960. $recv($5)._log_($6);
  59961. $ctx1.sendIdx["log:"]=3;
  59962. $7=server;
  59963. return $7;
  59964. };
  59965. popFront=(function(args){
  59966. return $core.withContext(function($ctx2) {
  59967. front=$recv(args)._first();
  59968. front;
  59969. $recv(args)._remove_(front);
  59970. return front;
  59971. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  59972. });
  59973. $recv((function(){
  59974. return $core.withContext(function($ctx2) {
  59975. return $recv(options)._notEmpty();
  59976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  59977. }))._whileTrue_((function(){
  59978. return $core.withContext(function($ctx2) {
  59979. optionName=$recv(popFront)._value_(options);
  59980. $ctx2.sendIdx["value:"]=1;
  59981. optionName;
  59982. optionValue=$recv(popFront)._value_(options);
  59983. optionValue;
  59984. $8=$recv(switches)._includes_(optionName);
  59985. if($core.assert($8)){
  59986. optionName=self._selectorForCommandLineSwitch_(optionName);
  59987. optionName;
  59988. return $recv(server)._perform_withArguments_(optionName,$recv($Array())._with_(optionValue));
  59989. } else {
  59990. $9=console;
  59991. $10=$recv(optionName).__comma(" is not a valid commandline option");
  59992. $ctx2.sendIdx[","]=3;
  59993. $recv($9)._log_($10);
  59994. $ctx2.sendIdx["log:"]=4;
  59995. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  59996. };
  59997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  59998. }));
  59999. $11=server;
  60000. return $11;
  60001. }
  60002. catch(e) {if(e===$early)return e[0]; throw e}
  60003. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  60004. },
  60005. args: ["options"],
  60006. 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.",
  60007. referencedClasses: ["Array"],
  60008. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  60009. }),
  60010. $globals.FileServer.klass);
  60011. $core.addMethod(
  60012. $core.method({
  60013. selector: "defaultBasePath",
  60014. protocol: 'accessing',
  60015. fn: function (){
  60016. var self=this;
  60017. return "./";
  60018. },
  60019. args: [],
  60020. source: "defaultBasePath\x0a\x09^ './'",
  60021. referencedClasses: [],
  60022. messageSends: []
  60023. }),
  60024. $globals.FileServer.klass);
  60025. $core.addMethod(
  60026. $core.method({
  60027. selector: "defaultHost",
  60028. protocol: 'accessing',
  60029. fn: function (){
  60030. var self=this;
  60031. return "127.0.0.1";
  60032. },
  60033. args: [],
  60034. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  60035. referencedClasses: [],
  60036. messageSends: []
  60037. }),
  60038. $globals.FileServer.klass);
  60039. $core.addMethod(
  60040. $core.method({
  60041. selector: "defaultMimeTypes",
  60042. protocol: 'accessing',
  60043. fn: function (){
  60044. var self=this;
  60045. var $1;
  60046. $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"]);
  60047. return $1;
  60048. },
  60049. args: [],
  60050. 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}",
  60051. referencedClasses: [],
  60052. messageSends: []
  60053. }),
  60054. $globals.FileServer.klass);
  60055. $core.addMethod(
  60056. $core.method({
  60057. selector: "defaultPort",
  60058. protocol: 'accessing',
  60059. fn: function (){
  60060. var self=this;
  60061. return (4000);
  60062. },
  60063. args: [],
  60064. source: "defaultPort\x0a\x09^ 4000",
  60065. referencedClasses: [],
  60066. messageSends: []
  60067. }),
  60068. $globals.FileServer.klass);
  60069. $core.addMethod(
  60070. $core.method({
  60071. selector: "main",
  60072. protocol: 'initialization',
  60073. fn: function (){
  60074. var self=this;
  60075. var fileServer,args;
  60076. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  60077. return $core.withContext(function($ctx1) {
  60078. var $1,$2;
  60079. var $early={};
  60080. try {
  60081. args=$recv(process)._argv();
  60082. $recv(args)._removeFrom_to_((1),(3));
  60083. $recv(args)._detect_ifNone_((function(each){
  60084. return $core.withContext(function($ctx2) {
  60085. $1=$recv(each).__eq("--help");
  60086. if($core.assert($1)){
  60087. return $recv($FileServer())._printHelp();
  60088. };
  60089. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60090. }),(function(){
  60091. return $core.withContext(function($ctx2) {
  60092. fileServer=$recv($FileServer())._createServerWithArguments_(args);
  60093. fileServer;
  60094. $2=$recv(fileServer)._start();
  60095. throw $early=[$2];
  60096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  60097. }));
  60098. return self;
  60099. }
  60100. catch(e) {if(e===$early)return e[0]; throw e}
  60101. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  60102. },
  60103. args: [],
  60104. 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]",
  60105. referencedClasses: ["FileServer"],
  60106. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  60107. }),
  60108. $globals.FileServer.klass);
  60109. $core.addMethod(
  60110. $core.method({
  60111. selector: "mimeTypeFor:",
  60112. protocol: 'accessing',
  60113. fn: function (aString){
  60114. var self=this;
  60115. return $core.withContext(function($ctx1) {
  60116. var $1;
  60117. $1=$recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  60118. return "text/plain";
  60119. }));
  60120. return $1;
  60121. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  60122. },
  60123. args: ["aString"],
  60124. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  60125. referencedClasses: [],
  60126. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  60127. }),
  60128. $globals.FileServer.klass);
  60129. $core.addMethod(
  60130. $core.method({
  60131. selector: "mimeTypes",
  60132. protocol: 'accessing',
  60133. fn: function (){
  60134. var self=this;
  60135. return $core.withContext(function($ctx1) {
  60136. var $2,$1,$receiver;
  60137. $2=self["@mimeTypes"];
  60138. if(($receiver = $2) == null || $receiver.isNil){
  60139. self["@mimeTypes"]=self._defaultMimeTypes();
  60140. $1=self["@mimeTypes"];
  60141. } else {
  60142. $1=$2;
  60143. };
  60144. return $1;
  60145. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  60146. },
  60147. args: [],
  60148. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  60149. referencedClasses: [],
  60150. messageSends: ["ifNil:", "defaultMimeTypes"]
  60151. }),
  60152. $globals.FileServer.klass);
  60153. $core.addMethod(
  60154. $core.method({
  60155. selector: "printHelp",
  60156. protocol: 'accessing',
  60157. fn: function (){
  60158. var self=this;
  60159. return $core.withContext(function($ctx1) {
  60160. $recv(console)._log_("Available commandline options are:");
  60161. $ctx1.sendIdx["log:"]=1;
  60162. $recv(console)._log_("--help");
  60163. $ctx1.sendIdx["log:"]=2;
  60164. $recv(self._commandLineSwitches())._do_((function(each){
  60165. return $core.withContext(function($ctx2) {
  60166. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  60167. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60168. }));
  60169. return self;
  60170. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  60171. },
  60172. args: [],
  60173. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  60174. referencedClasses: [],
  60175. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  60176. }),
  60177. $globals.FileServer.klass);
  60178. $core.addMethod(
  60179. $core.method({
  60180. selector: "selectorForCommandLineSwitch:",
  60181. protocol: 'accessing',
  60182. fn: function (aSwitch){
  60183. var self=this;
  60184. return $core.withContext(function($ctx1) {
  60185. var $2,$1;
  60186. $2=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  60187. return $core.withContext(function($ctx2) {
  60188. return $recv($recv(each)._second())._asUppercase();
  60189. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60190. }));
  60191. $ctx1.sendIdx["replace:with:"]=1;
  60192. $1=$recv($2).__comma(":");
  60193. return $1;
  60194. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  60195. },
  60196. args: ["aSwitch"],
  60197. 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 ]), ':'",
  60198. referencedClasses: [],
  60199. messageSends: [",", "replace:with:", "asUppercase", "second"]
  60200. }),
  60201. $globals.FileServer.klass);
  60202. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  60203. $core.addMethod(
  60204. $core.method({
  60205. selector: "bowerInstallThenDo:",
  60206. protocol: 'action',
  60207. fn: function (aBlock){
  60208. var self=this;
  60209. var child;
  60210. return $core.withContext(function($ctx1) {
  60211. var $1,$4,$3,$2;
  60212. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  60213. $1=child;
  60214. $recv($1)._on_do_("error",aBlock);
  60215. $ctx1.sendIdx["on:do:"]=1;
  60216. $2=$recv($1)._on_do_("close",(function(code){
  60217. return $core.withContext(function($ctx2) {
  60218. $4=$recv(code).__eq((0));
  60219. if($core.assert($4)){
  60220. $3=nil;
  60221. } else {
  60222. $3=code;
  60223. };
  60224. return $recv(aBlock)._value_($3);
  60225. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60226. }));
  60227. return self;
  60228. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60229. },
  60230. args: ["aBlock"],
  60231. 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 ]) ]",
  60232. referencedClasses: [],
  60233. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60234. }),
  60235. $globals.Initer);
  60236. $core.addMethod(
  60237. $core.method({
  60238. selector: "finishMessage",
  60239. protocol: 'action',
  60240. fn: function (){
  60241. var self=this;
  60242. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  60243. return $core.withContext(function($ctx1) {
  60244. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($String())._lf()));
  60245. $recv((function(){
  60246. }))._valueWithTimeout_((600));
  60247. return self;
  60248. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  60249. },
  60250. args: [],
  60251. 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",
  60252. referencedClasses: ["String"],
  60253. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  60254. }),
  60255. $globals.Initer);
  60256. $core.addMethod(
  60257. $core.method({
  60258. selector: "gruntInitThenDo:",
  60259. protocol: 'action',
  60260. fn: function (aBlock){
  60261. var self=this;
  60262. var child,sanitizedTemplatePath;
  60263. return $core.withContext(function($ctx1) {
  60264. var $1,$4,$3,$2;
  60265. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  60266. $ctx1.sendIdx["replace:with:"]=1;
  60267. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  60268. $1=child;
  60269. $recv($1)._on_do_("error",aBlock);
  60270. $ctx1.sendIdx["on:do:"]=1;
  60271. $2=$recv($1)._on_do_("close",(function(code){
  60272. return $core.withContext(function($ctx2) {
  60273. $4=$recv(code).__eq((0));
  60274. if($core.assert($4)){
  60275. $3=nil;
  60276. } else {
  60277. $3=code;
  60278. };
  60279. return $recv(aBlock)._value_($3);
  60280. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60281. }));
  60282. return self;
  60283. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  60284. },
  60285. args: ["aBlock"],
  60286. 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 ]) ]",
  60287. referencedClasses: [],
  60288. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60289. }),
  60290. $globals.Initer);
  60291. $core.addMethod(
  60292. $core.method({
  60293. selector: "gruntThenDo:",
  60294. protocol: 'action',
  60295. fn: function (aBlock){
  60296. var self=this;
  60297. var child;
  60298. return $core.withContext(function($ctx1) {
  60299. var $1,$4,$3,$2;
  60300. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  60301. $1=child;
  60302. $recv($1)._on_do_("error",aBlock);
  60303. $ctx1.sendIdx["on:do:"]=1;
  60304. $2=$recv($1)._on_do_("close",(function(code){
  60305. return $core.withContext(function($ctx2) {
  60306. $4=$recv(code).__eq((0));
  60307. if($core.assert($4)){
  60308. $3=nil;
  60309. } else {
  60310. $3=code;
  60311. };
  60312. return $recv(aBlock)._value_($3);
  60313. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60314. }));
  60315. return self;
  60316. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60317. },
  60318. args: ["aBlock"],
  60319. 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 ]) ]",
  60320. referencedClasses: [],
  60321. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60322. }),
  60323. $globals.Initer);
  60324. $core.addMethod(
  60325. $core.method({
  60326. selector: "initialize",
  60327. protocol: 'initialization',
  60328. fn: function (){
  60329. var self=this;
  60330. return $core.withContext(function($ctx1) {
  60331. (
  60332. $ctx1.supercall = true,
  60333. $globals.Initer.superclass.fn.prototype._initialize.apply($recv(self), []));
  60334. $ctx1.supercall = false;
  60335. self["@childProcess"]=$recv(require)._value_("child_process");
  60336. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  60337. return self;
  60338. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  60339. },
  60340. args: [],
  60341. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  60342. referencedClasses: [],
  60343. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  60344. }),
  60345. $globals.Initer);
  60346. $core.addMethod(
  60347. $core.method({
  60348. selector: "npmInstallThenDo:",
  60349. protocol: 'action',
  60350. fn: function (aBlock){
  60351. var self=this;
  60352. var child;
  60353. return $core.withContext(function($ctx1) {
  60354. var $1;
  60355. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  60356. $1=$recv(child)._stdout();
  60357. $ctx1.sendIdx["stdout"]=1;
  60358. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  60359. return self;
  60360. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60361. },
  60362. args: ["aBlock"],
  60363. 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 }",
  60364. referencedClasses: [],
  60365. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  60366. }),
  60367. $globals.Initer);
  60368. $core.addMethod(
  60369. $core.method({
  60370. selector: "npmScriptForModule:named:",
  60371. protocol: 'npm',
  60372. fn: function (aString,anotherString){
  60373. var self=this;
  60374. var modulePath,packageJson,binSection,scriptPath;
  60375. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  60376. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60377. return $core.withContext(function($ctx1) {
  60378. var $1,$3,$4,$2,$5,$6;
  60379. $1=self["@path"];
  60380. $3=$recv($JSObjectProxy())._on_(require);
  60381. $4=$recv(aString).__comma("/package.json");
  60382. $ctx1.sendIdx[","]=1;
  60383. $2=$recv($3)._resolve_($4);
  60384. modulePath=$recv($1)._dirname_($2);
  60385. packageJson=$recv($Smalltalk())._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  60386. binSection=$recv(packageJson)._at_("bin");
  60387. $ctx1.sendIdx["at:"]=1;
  60388. $5=$recv(binSection)._isString();
  60389. if($core.assert($5)){
  60390. scriptPath=binSection;
  60391. } else {
  60392. scriptPath=$recv(binSection)._at_(anotherString);
  60393. };
  60394. $6=$recv(self["@path"])._join_with_(modulePath,scriptPath);
  60395. return $6;
  60396. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  60397. },
  60398. args: ["aString", "anotherString"],
  60399. 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",
  60400. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  60401. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  60402. }),
  60403. $globals.Initer);
  60404. $core.addMethod(
  60405. $core.method({
  60406. selector: "start",
  60407. protocol: 'action',
  60408. fn: function (){
  60409. var self=this;
  60410. return $core.withContext(function($ctx1) {
  60411. var $1,$2,$3,$4,$5,$6,$7,$8,$receiver;
  60412. self._gruntInitThenDo_((function(error){
  60413. return $core.withContext(function($ctx2) {
  60414. if(($receiver = error) == null || $receiver.isNil){
  60415. return self._bowerInstallThenDo_((function(error2){
  60416. return $core.withContext(function($ctx3) {
  60417. if(($receiver = error2) == null || $receiver.isNil){
  60418. return self._npmInstallThenDo_((function(error3){
  60419. return $core.withContext(function($ctx4) {
  60420. if(($receiver = error3) == null || $receiver.isNil){
  60421. return self._gruntThenDo_((function(error4){
  60422. return $core.withContext(function($ctx5) {
  60423. if(($receiver = error4) == null || $receiver.isNil){
  60424. self._finishMessage();
  60425. return $recv(process)._exit();
  60426. } else {
  60427. $7=console;
  60428. $recv($7)._log_("grunt exec error:");
  60429. $ctx5.sendIdx["log:"]=7;
  60430. $8=$recv($7)._log_(error4);
  60431. $8;
  60432. return $recv(process)._exit_((104));
  60433. };
  60434. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  60435. }));
  60436. } else {
  60437. $5=console;
  60438. $recv($5)._log_("npm install exec error:");
  60439. $ctx4.sendIdx["log:"]=5;
  60440. $6=$recv($5)._log_(error3);
  60441. $ctx4.sendIdx["log:"]=6;
  60442. $6;
  60443. return $recv(process)._exit_((103));
  60444. $ctx4.sendIdx["exit:"]=3;
  60445. };
  60446. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  60447. }));
  60448. } else {
  60449. $3=console;
  60450. $recv($3)._log_("bower install exec error:");
  60451. $ctx3.sendIdx["log:"]=3;
  60452. $4=$recv($3)._log_(error2);
  60453. $ctx3.sendIdx["log:"]=4;
  60454. $4;
  60455. return $recv(process)._exit_((102));
  60456. $ctx3.sendIdx["exit:"]=2;
  60457. };
  60458. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  60459. }));
  60460. } else {
  60461. $1=console;
  60462. $recv($1)._log_("grunt-init exec error:");
  60463. $ctx2.sendIdx["log:"]=1;
  60464. $2=$recv($1)._log_(error);
  60465. $ctx2.sendIdx["log:"]=2;
  60466. $2;
  60467. return $recv(process)._exit_((101));
  60468. $ctx2.sendIdx["exit:"]=1;
  60469. };
  60470. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  60471. }));
  60472. return self;
  60473. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  60474. },
  60475. args: [],
  60476. 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 ]]]]]]]]",
  60477. referencedClasses: [],
  60478. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  60479. }),
  60480. $globals.Initer);
  60481. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  60482. $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.";
  60483. $core.addMethod(
  60484. $core.method({
  60485. selector: "addVariableNamed:to:",
  60486. protocol: 'private',
  60487. fn: function (aString,anObject){
  60488. var self=this;
  60489. var newClass,newObject;
  60490. return $core.withContext(function($ctx1) {
  60491. var $1;
  60492. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  60493. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  60494. newObject=$recv(newClass)._new();
  60495. self._setPreviousVariablesFor_from_(newObject,anObject);
  60496. $1=newObject;
  60497. return $1;
  60498. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  60499. },
  60500. args: ["aString", "anObject"],
  60501. 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",
  60502. referencedClasses: [],
  60503. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  60504. }),
  60505. $globals.Repl);
  60506. $core.addMethod(
  60507. $core.method({
  60508. selector: "assignNewVariable:do:",
  60509. protocol: 'private',
  60510. fn: function (buffer,aBlock){
  60511. var self=this;
  60512. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  60513. function $ConsoleErrorHandler(){return $globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)}
  60514. return $core.withContext(function($ctx1) {
  60515. var $3,$4,$2,$1,$receiver;
  60516. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  60517. var varName,value;
  60518. return $core.withContext(function($ctx2) {
  60519. if(($receiver = name) == null || $receiver.isNil){
  60520. varName=self._nextResultName();
  60521. } else {
  60522. varName=name;
  60523. };
  60524. varName;
  60525. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  60526. self["@session"];
  60527. $recv((function(){
  60528. return $core.withContext(function($ctx3) {
  60529. $3=$recv(varName).__comma(" := ");
  60530. if(($receiver = expr) == null || $receiver.isNil){
  60531. $4=buffer;
  60532. } else {
  60533. $4=expr;
  60534. };
  60535. $2=$recv($3).__comma($4);
  60536. $ctx3.sendIdx[","]=1;
  60537. value=self._eval_on_($2,self["@session"]);
  60538. return value;
  60539. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  60540. }))._on_do_($Error(),(function(e){
  60541. return $core.withContext(function($ctx3) {
  60542. $recv($recv($ConsoleErrorHandler())._new())._logError_(e);
  60543. value=nil;
  60544. return value;
  60545. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  60546. }));
  60547. return $recv(aBlock)._value_value_(varName,value);
  60548. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  60549. }));
  60550. return $1;
  60551. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  60552. },
  60553. args: ["buffer", "aBlock"],
  60554. 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]",
  60555. referencedClasses: ["Error", "ConsoleErrorHandler"],
  60556. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  60557. }),
  60558. $globals.Repl);
  60559. $core.addMethod(
  60560. $core.method({
  60561. selector: "clearScreen",
  60562. protocol: 'actions',
  60563. fn: function (){
  60564. var self=this;
  60565. var esc,cls;
  60566. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  60567. return $core.withContext(function($ctx1) {
  60568. var $1;
  60569. esc=$recv($String())._fromCharCode_((27));
  60570. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  60571. $ctx1.sendIdx[","]=2;
  60572. cls=$recv($1).__comma("[0;0f");
  60573. $ctx1.sendIdx[","]=1;
  60574. $recv($recv(process)._stdout())._write_(cls);
  60575. $recv(self["@interface"])._prompt();
  60576. return self;
  60577. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  60578. },
  60579. args: [],
  60580. 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",
  60581. referencedClasses: ["String"],
  60582. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  60583. }),
  60584. $globals.Repl);
  60585. $core.addMethod(
  60586. $core.method({
  60587. selector: "close",
  60588. protocol: 'actions',
  60589. fn: function (){
  60590. var self=this;
  60591. return $core.withContext(function($ctx1) {
  60592. $recv($recv(process)._stdin())._destroy();
  60593. return self;
  60594. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  60595. },
  60596. args: [],
  60597. source: "close\x0a\x09process stdin destroy",
  60598. referencedClasses: [],
  60599. messageSends: ["destroy", "stdin"]
  60600. }),
  60601. $globals.Repl);
  60602. $core.addMethod(
  60603. $core.method({
  60604. selector: "commands",
  60605. protocol: 'accessing',
  60606. fn: function (){
  60607. var self=this;
  60608. var $1;
  60609. $1=self["@commands"];
  60610. return $1;
  60611. },
  60612. args: [],
  60613. source: "commands\x0a\x09^ commands",
  60614. referencedClasses: [],
  60615. messageSends: []
  60616. }),
  60617. $globals.Repl);
  60618. $core.addMethod(
  60619. $core.method({
  60620. selector: "createInterface",
  60621. protocol: 'actions',
  60622. fn: function (){
  60623. var self=this;
  60624. return $core.withContext(function($ctx1) {
  60625. var $1;
  60626. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  60627. $recv(self["@interface"])._on_do_("line",(function(buffer){
  60628. return $core.withContext(function($ctx2) {
  60629. return self._processLine_(buffer);
  60630. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  60631. }));
  60632. $ctx1.sendIdx["on:do:"]=1;
  60633. $recv(self["@interface"])._on_do_("close",(function(){
  60634. return $core.withContext(function($ctx2) {
  60635. return self._close();
  60636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60637. }));
  60638. self._printWelcome();
  60639. self._setupHotkeys();
  60640. $1=self._setPrompt();
  60641. $recv(self["@interface"])._prompt();
  60642. return self;
  60643. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  60644. },
  60645. args: [],
  60646. 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",
  60647. referencedClasses: [],
  60648. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  60649. }),
  60650. $globals.Repl);
  60651. $core.addMethod(
  60652. $core.method({
  60653. selector: "encapsulateVariable:withValue:in:",
  60654. protocol: 'private',
  60655. fn: function (aString,anObject,aClass){
  60656. var self=this;
  60657. var compiler;
  60658. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  60659. return $core.withContext(function($ctx1) {
  60660. var $1,$4,$3,$2,$5,$6;
  60661. compiler=$recv($Compiler())._new();
  60662. $1=compiler;
  60663. $4=$recv(aString).__comma(": anObject ^ ");
  60664. $ctx1.sendIdx[","]=3;
  60665. $3=$recv($4).__comma(aString);
  60666. $ctx1.sendIdx[","]=2;
  60667. $2=$recv($3).__comma(" := anObject");
  60668. $ctx1.sendIdx[","]=1;
  60669. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  60670. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  60671. $5=compiler;
  60672. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  60673. $ctx1.sendIdx[","]=4;
  60674. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  60675. return self;
  60676. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  60677. },
  60678. args: ["aString", "anObject", "aClass"],
  60679. 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'.",
  60680. referencedClasses: ["Compiler"],
  60681. messageSends: ["new", "install:forClass:protocol:", ","]
  60682. }),
  60683. $globals.Repl);
  60684. $core.addMethod(
  60685. $core.method({
  60686. selector: "eval:",
  60687. protocol: 'actions',
  60688. fn: function (buffer){
  60689. var self=this;
  60690. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  60691. return $core.withContext(function($ctx1) {
  60692. var $1;
  60693. $1=self._eval_on_(buffer,$recv($DoIt())._new());
  60694. return $1;
  60695. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  60696. },
  60697. args: ["buffer"],
  60698. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  60699. referencedClasses: ["DoIt"],
  60700. messageSends: ["eval:on:", "new"]
  60701. }),
  60702. $globals.Repl);
  60703. $core.addMethod(
  60704. $core.method({
  60705. selector: "eval:on:",
  60706. protocol: 'actions',
  60707. fn: function (buffer,anObject){
  60708. var self=this;
  60709. var result;
  60710. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  60711. return $core.withContext(function($ctx1) {
  60712. var $1,$2,$3;
  60713. $1=$recv(buffer)._isEmpty();
  60714. if(!$core.assert($1)){
  60715. $recv((function(){
  60716. return $core.withContext(function($ctx2) {
  60717. result=$recv($recv($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  60718. return result;
  60719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60720. }))._tryCatch_((function(e){
  60721. return $core.withContext(function($ctx2) {
  60722. $2=$recv(e)._isSmalltalkError();
  60723. if($core.assert($2)){
  60724. return $recv(e)._resignal();
  60725. } else {
  60726. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  60727. };
  60728. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
  60729. }));
  60730. };
  60731. $3=result;
  60732. return $3;
  60733. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  60734. },
  60735. args: ["buffer", "anObject"],
  60736. 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",
  60737. referencedClasses: ["Compiler"],
  60738. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  60739. }),
  60740. $globals.Repl);
  60741. $core.addMethod(
  60742. $core.method({
  60743. selector: "executeCommand:",
  60744. protocol: 'private',
  60745. fn: function (aString){
  60746. var self=this;
  60747. return $core.withContext(function($ctx1) {
  60748. var $1;
  60749. var $early={};
  60750. try {
  60751. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  60752. return $core.withContext(function($ctx2) {
  60753. $1=$recv(names)._includes_(aString);
  60754. if($core.assert($1)){
  60755. $recv(cmd)._value();
  60756. throw $early=[true];
  60757. };
  60758. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  60759. }));
  60760. return false;
  60761. }
  60762. catch(e) {if(e===$early)return e[0]; throw e}
  60763. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  60764. },
  60765. args: ["aString"],
  60766. 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",
  60767. referencedClasses: [],
  60768. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  60769. }),
  60770. $globals.Repl);
  60771. $core.addMethod(
  60772. $core.method({
  60773. selector: "initialize",
  60774. protocol: 'initialization',
  60775. fn: function (){
  60776. var self=this;
  60777. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  60778. return $core.withContext(function($ctx1) {
  60779. (
  60780. $ctx1.supercall = true,
  60781. $globals.Repl.superclass.fn.prototype._initialize.apply($recv(self), []));
  60782. $ctx1.supercall = false;
  60783. self["@session"]=$recv($DoIt())._new();
  60784. self["@readline"]=$recv(require)._value_("readline");
  60785. $ctx1.sendIdx["value:"]=1;
  60786. self["@util"]=$recv(require)._value_("util");
  60787. self._setupCommands();
  60788. return self;
  60789. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  60790. },
  60791. args: [],
  60792. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  60793. referencedClasses: ["DoIt"],
  60794. messageSends: ["initialize", "new", "value:", "setupCommands"]
  60795. }),
  60796. $globals.Repl);
  60797. $core.addMethod(
  60798. $core.method({
  60799. selector: "instanceVariableNamesFor:",
  60800. protocol: 'private',
  60801. fn: function (aClass){
  60802. var self=this;
  60803. return $core.withContext(function($ctx1) {
  60804. var $2,$3,$1,$receiver;
  60805. $2=$recv(aClass)._superclass();
  60806. $ctx1.sendIdx["superclass"]=1;
  60807. if(($receiver = $2) == null || $receiver.isNil){
  60808. $1=$recv(aClass)._instanceVariableNames();
  60809. } else {
  60810. $3=$recv(aClass)._instanceVariableNames();
  60811. $ctx1.sendIdx["instanceVariableNames"]=1;
  60812. $1=$recv($3)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  60813. };
  60814. return $1;
  60815. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  60816. },
  60817. args: ["aClass"],
  60818. 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]",
  60819. referencedClasses: [],
  60820. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  60821. }),
  60822. $globals.Repl);
  60823. $core.addMethod(
  60824. $core.method({
  60825. selector: "isIdentifier:",
  60826. protocol: 'private',
  60827. fn: function (aString){
  60828. var self=this;
  60829. return $core.withContext(function($ctx1) {
  60830. var $1;
  60831. $1=$recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  60832. return $1;
  60833. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  60834. },
  60835. args: ["aString"],
  60836. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  60837. referencedClasses: [],
  60838. messageSends: ["match:", "asRegexp"]
  60839. }),
  60840. $globals.Repl);
  60841. $core.addMethod(
  60842. $core.method({
  60843. selector: "isVariableDefined:",
  60844. protocol: 'private',
  60845. fn: function (aString){
  60846. var self=this;
  60847. return $core.withContext(function($ctx1) {
  60848. var $1;
  60849. $1=$recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  60850. return $1;
  60851. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  60852. },
  60853. args: ["aString"],
  60854. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  60855. referencedClasses: [],
  60856. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  60857. }),
  60858. $globals.Repl);
  60859. $core.addMethod(
  60860. $core.method({
  60861. selector: "nextResultName",
  60862. protocol: 'private',
  60863. fn: function (){
  60864. var self=this;
  60865. return $core.withContext(function($ctx1) {
  60866. var $1,$2,$receiver;
  60867. $1=self["@resultCount"];
  60868. if(($receiver = $1) == null || $receiver.isNil){
  60869. self["@resultCount"]=(1);
  60870. } else {
  60871. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  60872. };
  60873. $2="res".__comma($recv(self["@resultCount"])._asString());
  60874. return $2;
  60875. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  60876. },
  60877. args: [],
  60878. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  60879. referencedClasses: [],
  60880. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  60881. }),
  60882. $globals.Repl);
  60883. $core.addMethod(
  60884. $core.method({
  60885. selector: "onKeyPress:",
  60886. protocol: 'private',
  60887. fn: function (key){
  60888. var self=this;
  60889. return $core.withContext(function($ctx1) {
  60890. var $1;
  60891. $1=$recv($recv(key)._ctrl())._and_((function(){
  60892. return $core.withContext(function($ctx2) {
  60893. return $recv($recv(key)._name()).__eq("l");
  60894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60895. }));
  60896. if($core.assert($1)){
  60897. self._clearScreen();
  60898. };
  60899. return self;
  60900. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  60901. },
  60902. args: ["key"],
  60903. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  60904. referencedClasses: [],
  60905. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  60906. }),
  60907. $globals.Repl);
  60908. $core.addMethod(
  60909. $core.method({
  60910. selector: "parseAssignment:do:",
  60911. protocol: 'private',
  60912. fn: function (aString,aBlock){
  60913. var self=this;
  60914. var assignment;
  60915. return $core.withContext(function($ctx1) {
  60916. var $3,$2,$1;
  60917. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  60918. return $core.withContext(function($ctx2) {
  60919. return $recv(s)._trimBoth();
  60920. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  60921. }));
  60922. $2=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  60923. return $core.withContext(function($ctx2) {
  60924. $3=$recv(assignment)._first();
  60925. $ctx2.sendIdx["first"]=1;
  60926. return self._isIdentifier_($3);
  60927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60928. }));
  60929. if($core.assert($2)){
  60930. $1=$recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  60931. $ctx1.sendIdx["value:value:"]=1;
  60932. } else {
  60933. $1=$recv(aBlock)._value_value_(nil,nil);
  60934. };
  60935. return $1;
  60936. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  60937. },
  60938. args: ["aString", "aBlock"],
  60939. 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 ]",
  60940. referencedClasses: [],
  60941. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  60942. }),
  60943. $globals.Repl);
  60944. $core.addMethod(
  60945. $core.method({
  60946. selector: "presentResultNamed:withValue:",
  60947. protocol: 'private',
  60948. fn: function (varName,value){
  60949. var self=this;
  60950. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  60951. return $core.withContext(function($ctx1) {
  60952. var $3,$2,$1,$4;
  60953. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  60954. $ctx1.sendIdx[","]=3;
  60955. $2=$recv($3).__comma(" = ");
  60956. $ctx1.sendIdx[","]=2;
  60957. $1=$recv($2).__comma($recv(value)._asString());
  60958. $ctx1.sendIdx[","]=1;
  60959. $recv($Transcript())._show_($1);
  60960. $4=$recv($Transcript())._cr();
  60961. $recv(self["@interface"])._prompt();
  60962. return self;
  60963. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  60964. },
  60965. args: ["varName", "value"],
  60966. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  60967. referencedClasses: ["Transcript"],
  60968. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  60969. }),
  60970. $globals.Repl);
  60971. $core.addMethod(
  60972. $core.method({
  60973. selector: "printWelcome",
  60974. protocol: 'actions',
  60975. fn: function (){
  60976. var self=this;
  60977. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  60978. return $core.withContext(function($ctx1) {
  60979. var $1;
  60980. $recv($Transcript())._show_("Type :q to exit.");
  60981. $1=$recv($Transcript())._cr();
  60982. return self;
  60983. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  60984. },
  60985. args: [],
  60986. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  60987. referencedClasses: ["Transcript"],
  60988. messageSends: ["show:", "cr"]
  60989. }),
  60990. $globals.Repl);
  60991. $core.addMethod(
  60992. $core.method({
  60993. selector: "processLine:",
  60994. protocol: 'private',
  60995. fn: function (buffer){
  60996. var self=this;
  60997. var show;
  60998. return $core.withContext(function($ctx1) {
  60999. var $1,$2;
  61000. show=(function(varName,value){
  61001. return $core.withContext(function($ctx2) {
  61002. return self._presentResultNamed_withValue_(varName,value);
  61003. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  61004. });
  61005. $1=self._executeCommand_(buffer);
  61006. if(!$core.assert($1)){
  61007. $2=self._isVariableDefined_(buffer);
  61008. if($core.assert($2)){
  61009. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  61010. } else {
  61011. self._assignNewVariable_do_(buffer,show);
  61012. };
  61013. };
  61014. return self;
  61015. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  61016. },
  61017. args: ["buffer"],
  61018. 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]]",
  61019. referencedClasses: [],
  61020. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  61021. }),
  61022. $globals.Repl);
  61023. $core.addMethod(
  61024. $core.method({
  61025. selector: "prompt",
  61026. protocol: 'accessing',
  61027. fn: function (){
  61028. var self=this;
  61029. return "amber >> ";
  61030. },
  61031. args: [],
  61032. source: "prompt\x0a\x09^ 'amber >> '",
  61033. referencedClasses: [],
  61034. messageSends: []
  61035. }),
  61036. $globals.Repl);
  61037. $core.addMethod(
  61038. $core.method({
  61039. selector: "setPreviousVariablesFor:from:",
  61040. protocol: 'private',
  61041. fn: function (newObject,oldObject){
  61042. var self=this;
  61043. return $core.withContext(function($ctx1) {
  61044. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  61045. return $core.withContext(function($ctx2) {
  61046. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  61047. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61048. }));
  61049. return self;
  61050. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  61051. },
  61052. args: ["newObject", "oldObject"],
  61053. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  61054. referencedClasses: [],
  61055. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  61056. }),
  61057. $globals.Repl);
  61058. $core.addMethod(
  61059. $core.method({
  61060. selector: "setPrompt",
  61061. protocol: 'actions',
  61062. fn: function (){
  61063. var self=this;
  61064. return $core.withContext(function($ctx1) {
  61065. $recv(self["@interface"])._setPrompt_(self._prompt());
  61066. return self;
  61067. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  61068. },
  61069. args: [],
  61070. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  61071. referencedClasses: [],
  61072. messageSends: ["setPrompt:", "prompt"]
  61073. }),
  61074. $globals.Repl);
  61075. $core.addMethod(
  61076. $core.method({
  61077. selector: "setupCommands",
  61078. protocol: 'initialization',
  61079. fn: function (){
  61080. var self=this;
  61081. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  61082. return $core.withContext(function($ctx1) {
  61083. var $2,$1;
  61084. $2=$recv([":q"]).__minus_gt((function(){
  61085. return $core.withContext(function($ctx2) {
  61086. return $recv(process)._exit();
  61087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61088. }));
  61089. $ctx1.sendIdx["->"]=1;
  61090. $1=[$2,$recv([""]).__minus_gt((function(){
  61091. return $core.withContext(function($ctx2) {
  61092. return $recv(self["@interface"])._prompt();
  61093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61094. }))];
  61095. self["@commands"]=$recv($Dictionary())._from_($1);
  61096. return self;
  61097. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  61098. },
  61099. args: [],
  61100. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  61101. referencedClasses: ["Dictionary"],
  61102. messageSends: ["from:", "->", "exit", "prompt"]
  61103. }),
  61104. $globals.Repl);
  61105. $core.addMethod(
  61106. $core.method({
  61107. selector: "setupHotkeys",
  61108. protocol: 'initialization',
  61109. fn: function (){
  61110. var self=this;
  61111. return $core.withContext(function($ctx1) {
  61112. var $receiver;
  61113. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  61114. return $core.withContext(function($ctx2) {
  61115. if(($receiver = key) == null || $receiver.isNil){
  61116. return key;
  61117. } else {
  61118. return self._onKeyPress_(key);
  61119. };
  61120. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  61121. }));
  61122. return self;
  61123. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  61124. },
  61125. args: [],
  61126. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  61127. referencedClasses: [],
  61128. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  61129. }),
  61130. $globals.Repl);
  61131. $core.addMethod(
  61132. $core.method({
  61133. selector: "subclass:withVariable:",
  61134. protocol: 'private',
  61135. fn: function (aClass,varName){
  61136. var self=this;
  61137. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  61138. return $core.withContext(function($ctx1) {
  61139. var $1;
  61140. $1=$recv($recv($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  61141. return $1;
  61142. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  61143. },
  61144. args: ["aClass", "varName"],
  61145. 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'",
  61146. referencedClasses: ["ClassBuilder"],
  61147. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  61148. }),
  61149. $globals.Repl);
  61150. $core.addMethod(
  61151. $core.method({
  61152. selector: "subclassNameFor:",
  61153. protocol: 'private',
  61154. fn: function (aClass){
  61155. var self=this;
  61156. return $core.withContext(function($ctx1) {
  61157. var $3,$2,$7,$6,$5,$4,$8,$1,$receiver;
  61158. $3=$recv(aClass)._name();
  61159. $ctx1.sendIdx["name"]=1;
  61160. $2=$recv($3)._matchesOf_("\x5cd+$");
  61161. $ctx1.sendIdx["matchesOf:"]=1;
  61162. if(($receiver = $2) == null || $receiver.isNil){
  61163. $1=$recv($recv(aClass)._name()).__comma("2");
  61164. } else {
  61165. var counter;
  61166. $7=$recv(aClass)._name();
  61167. $ctx1.sendIdx["name"]=2;
  61168. $6=$recv($7)._matchesOf_("\x5cd+$");
  61169. $5=$recv($6)._first();
  61170. $4=$recv($5)._asNumber();
  61171. counter=$recv($4).__plus((1));
  61172. counter;
  61173. $8=$recv(aClass)._name();
  61174. $ctx1.sendIdx["name"]=3;
  61175. $1=$recv($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  61176. };
  61177. return $1;
  61178. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  61179. },
  61180. args: ["aClass"],
  61181. 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'].",
  61182. referencedClasses: [],
  61183. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  61184. }),
  61185. $globals.Repl);
  61186. $core.addMethod(
  61187. $core.method({
  61188. selector: "main",
  61189. protocol: 'initialization',
  61190. fn: function (){
  61191. var self=this;
  61192. return $core.withContext(function($ctx1) {
  61193. $recv(self._new())._createInterface();
  61194. return self;
  61195. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  61196. },
  61197. args: [],
  61198. source: "main\x0a\x09self new createInterface",
  61199. referencedClasses: [],
  61200. messageSends: ["createInterface", "new"]
  61201. }),
  61202. $globals.Repl.klass);
  61203. });
  61204. (function () {
  61205. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  61206. amber.initialize();
  61207. amber.globals.AmberCli._main();
  61208. });
  61209. }());
  61210. require(["app"]);
  61211. });
  61212. define.require('__wrap__');
  61213. }((function amdefine(module, requireFn) {
  61214. 'use strict';
  61215. var defineCache = {},
  61216. loaderCache = {},
  61217. alreadyCalled = false,
  61218. path = require('path'),
  61219. makeRequire, stringRequire;
  61220. /**
  61221. * Trims the . and .. from an array of path segments.
  61222. * It will keep a leading path segment if a .. will become
  61223. * the first path segment, to help with module name lookups,
  61224. * which act like paths, but can be remapped. But the end result,
  61225. * all paths that use this function should look normalized.
  61226. * NOTE: this method MODIFIES the input array.
  61227. * @param {Array} ary the array of path segments.
  61228. */
  61229. function trimDots(ary) {
  61230. var i, part;
  61231. for (i = 0; ary[i]; i+= 1) {
  61232. part = ary[i];
  61233. if (part === '.') {
  61234. ary.splice(i, 1);
  61235. i -= 1;
  61236. } else if (part === '..') {
  61237. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  61238. //End of the line. Keep at least one non-dot
  61239. //path segment at the front so it can be mapped
  61240. //correctly to disk. Otherwise, there is likely
  61241. //no path mapping for a path starting with '..'.
  61242. //This can still fail, but catches the most reasonable
  61243. //uses of ..
  61244. break;
  61245. } else if (i > 0) {
  61246. ary.splice(i - 1, 2);
  61247. i -= 2;
  61248. }
  61249. }
  61250. }
  61251. }
  61252. function normalize(name, baseName) {
  61253. var baseParts;
  61254. //Adjust any relative paths.
  61255. if (name && name.charAt(0) === '.') {
  61256. //If have a base name, try to normalize against it,
  61257. //otherwise, assume it is a top-level require that will
  61258. //be relative to baseUrl in the end.
  61259. if (baseName) {
  61260. baseParts = baseName.split('/');
  61261. baseParts = baseParts.slice(0, baseParts.length - 1);
  61262. baseParts = baseParts.concat(name.split('/'));
  61263. trimDots(baseParts);
  61264. name = baseParts.join('/');
  61265. }
  61266. }
  61267. return name;
  61268. }
  61269. /**
  61270. * Create the normalize() function passed to a loader plugin's
  61271. * normalize method.
  61272. */
  61273. function makeNormalize(relName) {
  61274. return function (name) {
  61275. return normalize(name, relName);
  61276. };
  61277. }
  61278. function makeLoad(id) {
  61279. function load(value) {
  61280. loaderCache[id] = value;
  61281. }
  61282. load.fromText = function (id, text) {
  61283. //This one is difficult because the text can/probably uses
  61284. //define, and any relative paths and requires should be relative
  61285. //to that id was it would be found on disk. But this would require
  61286. //bootstrapping a module/require fairly deeply from node core.
  61287. //Not sure how best to go about that yet.
  61288. throw new Error('amdefine does not implement load.fromText');
  61289. };
  61290. return load;
  61291. }
  61292. makeRequire = function (systemRequire, exports, module, relId) {
  61293. function amdRequire(deps, callback) {
  61294. if (typeof deps === 'string') {
  61295. //Synchronous, single module require('')
  61296. return stringRequire(systemRequire, exports, module, deps, relId);
  61297. } else {
  61298. //Array of dependencies with a callback.
  61299. //Convert the dependencies to modules.
  61300. deps = deps.map(function (depName) {
  61301. return stringRequire(systemRequire, exports, module, depName, relId);
  61302. });
  61303. //Wait for next tick to call back the require call.
  61304. if (callback) {
  61305. process.nextTick(function () {
  61306. callback.apply(null, deps);
  61307. });
  61308. }
  61309. }
  61310. }
  61311. amdRequire.toUrl = function (filePath) {
  61312. if (filePath.indexOf('.') === 0) {
  61313. return normalize(filePath, path.dirname(module.filename));
  61314. } else {
  61315. return filePath;
  61316. }
  61317. };
  61318. return amdRequire;
  61319. };
  61320. //Favor explicit value, passed in if the module wants to support Node 0.4.
  61321. requireFn = requireFn || function req() {
  61322. return module.require.apply(module, arguments);
  61323. };
  61324. function runFactory(id, deps, factory) {
  61325. var r, e, m, result;
  61326. if (id) {
  61327. e = loaderCache[id] = {};
  61328. m = {
  61329. id: id,
  61330. uri: __filename,
  61331. exports: e
  61332. };
  61333. r = makeRequire(requireFn, e, m, id);
  61334. } else {
  61335. //Only support one define call per file
  61336. if (alreadyCalled) {
  61337. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  61338. }
  61339. alreadyCalled = true;
  61340. //Use the real variables from node
  61341. //Use module.exports for exports, since
  61342. //the exports in here is amdefine exports.
  61343. e = module.exports;
  61344. m = module;
  61345. r = makeRequire(requireFn, e, m, module.id);
  61346. }
  61347. //If there are dependencies, they are strings, so need
  61348. //to convert them to dependency values.
  61349. if (deps) {
  61350. deps = deps.map(function (depName) {
  61351. return r(depName);
  61352. });
  61353. }
  61354. //Call the factory with the right dependencies.
  61355. if (typeof factory === 'function') {
  61356. result = factory.apply(m.exports, deps);
  61357. } else {
  61358. result = factory;
  61359. }
  61360. if (result !== undefined) {
  61361. m.exports = result;
  61362. if (id) {
  61363. loaderCache[id] = m.exports;
  61364. }
  61365. }
  61366. }
  61367. stringRequire = function (systemRequire, exports, module, id, relId) {
  61368. //Split the ID by a ! so that
  61369. var index = id.indexOf('!'),
  61370. originalId = id,
  61371. prefix, plugin;
  61372. if (index === -1) {
  61373. id = normalize(id, relId);
  61374. //Straight module lookup. If it is one of the special dependencies,
  61375. //deal with it, otherwise, delegate to node.
  61376. if (id === 'require') {
  61377. return makeRequire(systemRequire, exports, module, relId);
  61378. } else if (id === 'exports') {
  61379. return exports;
  61380. } else if (id === 'module') {
  61381. return module;
  61382. } else if (loaderCache.hasOwnProperty(id)) {
  61383. return loaderCache[id];
  61384. } else if (defineCache[id]) {
  61385. runFactory.apply(null, defineCache[id]);
  61386. return loaderCache[id];
  61387. } else {
  61388. if(systemRequire) {
  61389. return systemRequire(originalId);
  61390. } else {
  61391. throw new Error('No module with ID: ' + id);
  61392. }
  61393. }
  61394. } else {
  61395. //There is a plugin in play.
  61396. prefix = id.substring(0, index);
  61397. id = id.substring(index + 1, id.length);
  61398. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  61399. if (plugin.normalize) {
  61400. id = plugin.normalize(id, makeNormalize(relId));
  61401. } else {
  61402. //Normalize the ID normally.
  61403. id = normalize(id, relId);
  61404. }
  61405. if (loaderCache[id]) {
  61406. return loaderCache[id];
  61407. } else {
  61408. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  61409. return loaderCache[id];
  61410. }
  61411. }
  61412. };
  61413. //Create a define function specific to the module asking for amdefine.
  61414. function define(id, deps, factory) {
  61415. if (Array.isArray(id)) {
  61416. factory = deps;
  61417. deps = id;
  61418. id = undefined;
  61419. } else if (typeof id !== 'string') {
  61420. factory = id;
  61421. id = deps = undefined;
  61422. }
  61423. if (deps && !Array.isArray(deps)) {
  61424. factory = deps;
  61425. deps = undefined;
  61426. }
  61427. if (!deps) {
  61428. deps = ['require', 'exports', 'module'];
  61429. }
  61430. //Set up properties for this module. If an ID, then use
  61431. //internal cache. If no ID, then use the external variables
  61432. //for this node module.
  61433. if (id) {
  61434. //Put the module in deep freeze until there is a
  61435. //require call for it.
  61436. defineCache[id] = [id, deps, factory];
  61437. } else {
  61438. runFactory(id, deps, factory);
  61439. }
  61440. }
  61441. //define.require, which has access to all the values in the
  61442. //cache. Useful for AMD modules that all have IDs in the file,
  61443. //but need to finally export a value to node based on one of those
  61444. //IDs.
  61445. define.require = function (id) {
  61446. if (loaderCache[id]) {
  61447. return loaderCache[id];
  61448. }
  61449. if (defineCache[id]) {
  61450. runFactory.apply(null, defineCache[id]);
  61451. return loaderCache[id];
  61452. }
  61453. };
  61454. define.amd = {};
  61455. return define;
  61456. }(module)), require));